-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for CAA record types in DNS update request and zone…
… record set - Added CAA record type support to DnsUpdateRecordSetRequest. - Updated DnsUpdateRecordSetRequestRecordSet enum to include CAA. - Extended schema definitions in Zone and ZoneRecordSet to accommodate CAA records. - Updated Contributor schema to make description optional and reflect changes in constructor and output. - Introduced new fields for notes and successor ID in the ExtensionDeprecation schema.
- Loading branch information
1 parent
80c5cf7
commit 002ea81
Showing
10 changed files
with
660 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mittwald\ApiClient\Generated\V2\Schemas\Dns; | ||
|
||
use InvalidArgumentException; | ||
use JsonSchema\Validator; | ||
|
||
/** | ||
* Auto-generated class for de.mittwald.v1.dns.RecordCAAComponent. | ||
* | ||
* DO NOT EDIT; this class was generated by the mittwald/api-client-builder package | ||
* (https://github.com/mittwald/api-client-php-builder). Please make any changes | ||
* there. | ||
* | ||
* @generated | ||
* @see https://github.com/mittwald/api-client-php-builder | ||
*/ | ||
class RecordCAAComponent | ||
{ | ||
/** | ||
* Schema used to validate input for creating instances of this class | ||
*/ | ||
private static array $schema = [ | ||
'additionalProperties' => false, | ||
'properties' => [ | ||
'records' => [ | ||
'items' => [ | ||
'$ref' => '#/components/schemas/de.mittwald.v1.dns.RecordCAARecord', | ||
], | ||
'minItems' => 1, | ||
'type' => 'array', | ||
], | ||
'settings' => [ | ||
'$ref' => '#/components/schemas/de.mittwald.v1.dns.RecordSettings', | ||
], | ||
], | ||
'required' => [ | ||
'records', | ||
'settings', | ||
], | ||
'type' => 'object', | ||
]; | ||
|
||
/** | ||
* @var RecordCAARecord[] | ||
*/ | ||
private array $records; | ||
|
||
private RecordSettings $settings; | ||
|
||
/** | ||
* @param RecordCAARecord[] $records | ||
*/ | ||
public function __construct(array $records, RecordSettings $settings) | ||
{ | ||
$this->records = $records; | ||
$this->settings = $settings; | ||
} | ||
|
||
/** | ||
* @return RecordCAARecord[] | ||
*/ | ||
public function getRecords(): array | ||
{ | ||
return $this->records; | ||
} | ||
|
||
public function getSettings(): RecordSettings | ||
{ | ||
return $this->settings; | ||
} | ||
|
||
/** | ||
* @param RecordCAARecord[] $records | ||
*/ | ||
public function withRecords(array $records): self | ||
{ | ||
$clone = clone $this; | ||
$clone->records = $records; | ||
|
||
return $clone; | ||
} | ||
|
||
public function withSettings(RecordSettings $settings): self | ||
{ | ||
$clone = clone $this; | ||
$clone->settings = $settings; | ||
|
||
return $clone; | ||
} | ||
|
||
/** | ||
* Builds a new instance from an input array | ||
* | ||
* @param array|object $input Input data | ||
* @param bool $validate Set this to false to skip validation; use at own risk | ||
* @return RecordCAAComponent Created instance | ||
* @throws InvalidArgumentException | ||
*/ | ||
public static function buildFromInput(array|object $input, bool $validate = true): RecordCAAComponent | ||
{ | ||
$input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; | ||
if ($validate) { | ||
static::validateInput($input); | ||
} | ||
|
||
$records = array_map(fn (array|object $i): RecordCAARecord => RecordCAARecord::buildFromInput($i, validate: $validate), $input->{'records'}); | ||
$settings = RecordSettings::buildFromInput($input->{'settings'}, validate: $validate); | ||
|
||
$obj = new self($records, $settings); | ||
|
||
return $obj; | ||
} | ||
|
||
/** | ||
* Converts this object back to a simple array that can be JSON-serialized | ||
* | ||
* @return array Converted array | ||
*/ | ||
public function toJson(): array | ||
{ | ||
$output = []; | ||
$output['records'] = array_map(fn (RecordCAARecord $i): array => $i->toJson(), $this->records); | ||
$output['settings'] = $this->settings->toJson(); | ||
|
||
return $output; | ||
} | ||
|
||
/** | ||
* Validates an input array | ||
* | ||
* @param array|object $input Input data | ||
* @param bool $return Return instead of throwing errors | ||
* @return bool Validation result | ||
* @throws InvalidArgumentException | ||
*/ | ||
public static function validateInput(array|object $input, bool $return = false): bool | ||
{ | ||
$validator = new \Mittwald\ApiClient\Validator\Validator(); | ||
$input = is_array($input) ? Validator::arrayToObjectRecursive($input) : $input; | ||
$validator->validate($input, self::$schema); | ||
|
||
if (!$validator->isValid() && !$return) { | ||
$errors = array_map(function (array $e): string { | ||
return $e["property"] . ": " . $e["message"]; | ||
}, $validator->getErrors()); | ||
throw new InvalidArgumentException(join(", ", $errors)); | ||
} | ||
|
||
return $validator->isValid(); | ||
} | ||
|
||
public function __clone() | ||
{ | ||
} | ||
} |
Oops, something went wrong.