diff --git a/src/dns_data/README.md b/src/dns_data/README.md index c72cc13..fc8f114 100644 --- a/src/dns_data/README.md +++ b/src/dns_data/README.md @@ -50,16 +50,15 @@ configuration.portal_key = os.getenv("INFOBLOX_PORTAL_KEY") with dns_data.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dns_data.RecordApi(api_client) - body = dns_data.Record() # Record | - inherit = 'inherit_example' # str | This parameter is used for getting inheritance_sources. (optional) + body = dns_data.ConfigureRecordProtectionRequest() # ConfigureRecordProtectionRequest | try: - # Create the DNS resource record. - api_response = api_instance.create(body, inherit=inherit) - print("The response of RecordApi->create:\n") + # Configure record protection for multiple records in a zone. + api_response = api_instance.configure_record_protection(body) + print("The response of RecordApi->configure_record_protection:\n") pprint(api_response) except ApiException as e: - print("Exception when calling RecordApi->create: %s\n" % e) + print("Exception when calling RecordApi->configure_record_protection: %s\n" % e) ``` @@ -69,6 +68,7 @@ All URIs are relative to *http://csp.infoblox.com/api/ddi/v1* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*RecordApi* | [**configure_record_protection**](dns_data/docs/RecordApi.md#configure_record_protection) | **POST** /dns/configure_record_protection | Configure record protection for multiple records in a zone. *RecordApi* | [**create**](dns_data/docs/RecordApi.md#create) | **POST** /dns/record | Create the DNS resource record. *RecordApi* | [**delete**](dns_data/docs/RecordApi.md#delete) | **DELETE** /dns/record/{id} | Move the DNS resource record to recycle bin. *RecordApi* | [**list**](dns_data/docs/RecordApi.md#list) | **GET** /dns/record | Retrieve DNS resource records. @@ -79,9 +79,13 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [ConfigureRecordProtectionRequest](dns_data/docs/ConfigureRecordProtectionRequest.md) + - [ConfigureRecordProtectionResponse](dns_data/docs/ConfigureRecordProtectionResponse.md) - [CreateRecordResponse](dns_data/docs/CreateRecordResponse.md) - [Inheritance2InheritedUInt32](dns_data/docs/Inheritance2InheritedUInt32.md) - [ListRecordResponse](dns_data/docs/ListRecordResponse.md) + - [ProtectedRecordItem](dns_data/docs/ProtectedRecordItem.md) + - [Protection](dns_data/docs/Protection.md) - [ProtobufFieldMask](dns_data/docs/ProtobufFieldMask.md) - [ReadRecordResponse](dns_data/docs/ReadRecordResponse.md) - [Record](dns_data/docs/Record.md) diff --git a/src/dns_data/__init__.py b/src/dns_data/__init__.py index 9a7fbe4..fe19948 100644 --- a/src/dns_data/__init__.py +++ b/src/dns_data/__init__.py @@ -19,9 +19,13 @@ from dns_data.api.record_api import RecordApi # import models into sdk package +from dns_data.models.configure_record_protection_request import ConfigureRecordProtectionRequest +from dns_data.models.configure_record_protection_response import ConfigureRecordProtectionResponse from dns_data.models.create_record_response import CreateRecordResponse from dns_data.models.inheritance2_inherited_u_int32 import Inheritance2InheritedUInt32 from dns_data.models.list_record_response import ListRecordResponse +from dns_data.models.protected_record_item import ProtectedRecordItem +from dns_data.models.protection import Protection from dns_data.models.protobuf_field_mask import ProtobufFieldMask from dns_data.models.read_record_response import ReadRecordResponse from dns_data.models.record import Record diff --git a/src/dns_data/api/record_api.py b/src/dns_data/api/record_api.py index 738843e..82a5c19 100644 --- a/src/dns_data/api/record_api.py +++ b/src/dns_data/api/record_api.py @@ -19,6 +19,8 @@ from pydantic import Field, StrictInt, StrictStr from typing import Optional from typing_extensions import Annotated +from dns_data.models.configure_record_protection_request import ConfigureRecordProtectionRequest +from dns_data.models.configure_record_protection_response import ConfigureRecordProtectionResponse from dns_data.models.create_record_response import CreateRecordResponse from dns_data.models.list_record_response import ListRecordResponse from dns_data.models.read_record_response import ReadRecordResponse @@ -45,6 +47,247 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient.get_default() self.api_client = api_client + @validate_call + def configure_record_protection( + self, + body: ConfigureRecordProtectionRequest, + _request_timeout: Union[None, Annotated[StrictFloat, + Field(gt=0)], + Tuple[Annotated[StrictFloat, + Field(gt=0)], + Annotated[StrictFloat, + Field(gt=0)]]] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ConfigureRecordProtectionResponse: + """Configure record protection for multiple records in a zone. + + Use this method to configure protection levels for DNS records in a zone. This allows setting protection levels (e.g., Global Admin, DDI Admin, None) for multiple records with same rname. + + :param body: (required) + :type body: ConfigureRecordProtectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._configure_record_protection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigureRecordProtectionResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + models=models, + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def configure_record_protection_with_http_info( + self, + body: ConfigureRecordProtectionRequest, + _request_timeout: Union[None, Annotated[StrictFloat, + Field(gt=0)], + Tuple[Annotated[StrictFloat, + Field(gt=0)], + Annotated[StrictFloat, + Field(gt=0)]]] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ConfigureRecordProtectionResponse]: + """Configure record protection for multiple records in a zone. + + Use this method to configure protection levels for DNS records in a zone. This allows setting protection levels (e.g., Global Admin, DDI Admin, None) for multiple records with same rname. + + :param body: (required) + :type body: ConfigureRecordProtectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._configure_record_protection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigureRecordProtectionResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + models=models, + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def configure_record_protection_without_preload_content( + self, + body: ConfigureRecordProtectionRequest, + _request_timeout: Union[None, Annotated[StrictFloat, + Field(gt=0)], + Tuple[Annotated[StrictFloat, + Field(gt=0)], + Annotated[StrictFloat, + Field(gt=0)]]] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Configure record protection for multiple records in a zone. + + Use this method to configure protection levels for DNS records in a zone. This allows setting protection levels (e.g., Global Admin, DDI Admin, None) for multiple records with same rname. + + :param body: (required) + :type body: ConfigureRecordProtectionRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._configure_record_protection_serialize( + body=body, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConfigureRecordProtectionResponse", + } + response_data = self.api_client.call_api( + *_param, _request_timeout=_request_timeout) + return response_data.response + + def _configure_record_protection_serialize( + self, + body, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if body is not None: + _body_params = body + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + ['application/json'])) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ['ApiKeyAuth'] + + return self.api_client.param_serialize( + method='POST', + base_path='/api/ddi/v1', + resource_path='/dns/configure_record_protection', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth) + @validate_call def create( self, diff --git a/src/dns_data/docs/ConfigureRecordProtectionRequest.md b/src/dns_data/docs/ConfigureRecordProtectionRequest.md new file mode 100644 index 0000000..40ee16a --- /dev/null +++ b/src/dns_data/docs/ConfigureRecordProtectionRequest.md @@ -0,0 +1,31 @@ +# ConfigureRecordProtectionRequest + +The request format to configure record protection for multiple records in a zone. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**protected_records** | [**List[ProtectedRecordItem]**](ProtectedRecordItem.md) | List of records with their protection levels. | [optional] +**zone_id** | **str** | The resource identifier. | [optional] + +## Example + +```python +from dns_data.models.configure_record_protection_request import ConfigureRecordProtectionRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of ConfigureRecordProtectionRequest from a JSON string +configure_record_protection_request_instance = ConfigureRecordProtectionRequest.from_json(json) +# print the JSON string representation of the object +print(ConfigureRecordProtectionRequest.to_json()) + +# convert the object into a dict +configure_record_protection_request_dict = configure_record_protection_request_instance.to_dict() +# create an instance of ConfigureRecordProtectionRequest from a dict +configure_record_protection_request_from_dict = ConfigureRecordProtectionRequest.from_dict(configure_record_protection_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/dns_data/docs/ConfigureRecordProtectionResponse.md b/src/dns_data/docs/ConfigureRecordProtectionResponse.md new file mode 100644 index 0000000..cbdd278 --- /dev/null +++ b/src/dns_data/docs/ConfigureRecordProtectionResponse.md @@ -0,0 +1,31 @@ +# ConfigureRecordProtectionResponse + +The response format for configuring record protection. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**protected_records** | [**List[ProtectedRecordItem]**](ProtectedRecordItem.md) | List of records with their protection levels and protection status. | [optional] +**zone_id** | **str** | The resource identifier. | [optional] + +## Example + +```python +from dns_data.models.configure_record_protection_response import ConfigureRecordProtectionResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ConfigureRecordProtectionResponse from a JSON string +configure_record_protection_response_instance = ConfigureRecordProtectionResponse.from_json(json) +# print the JSON string representation of the object +print(ConfigureRecordProtectionResponse.to_json()) + +# convert the object into a dict +configure_record_protection_response_dict = configure_record_protection_response_instance.to_dict() +# create an instance of ConfigureRecordProtectionResponse from a dict +configure_record_protection_response_from_dict = ConfigureRecordProtectionResponse.from_dict(configure_record_protection_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/dns_data/docs/ProtectedRecordItem.md b/src/dns_data/docs/ProtectedRecordItem.md new file mode 100644 index 0000000..5011bd8 --- /dev/null +++ b/src/dns_data/docs/ProtectedRecordItem.md @@ -0,0 +1,32 @@ +# ProtectedRecordItem + +Represents a single record protection configuration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**level** | **str** | The protection level (e.g., \"Global Admin\", \"DDI Admin\", \"None\"). | [optional] +**rname** | **str** | The record name (relative to zone). | [optional] +**rtype** | **str** | The record type. | [optional] + +## Example + +```python +from dns_data.models.protected_record_item import ProtectedRecordItem + +# TODO update the JSON string below +json = "{}" +# create an instance of ProtectedRecordItem from a JSON string +protected_record_item_instance = ProtectedRecordItem.from_json(json) +# print the JSON string representation of the object +print(ProtectedRecordItem.to_json()) + +# convert the object into a dict +protected_record_item_dict = protected_record_item_instance.to_dict() +# create an instance of ProtectedRecordItem from a dict +protected_record_item_from_dict = ProtectedRecordItem.from_dict(protected_record_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/dns_data/docs/Protection.md b/src/dns_data/docs/Protection.md new file mode 100644 index 0000000..3ae32f8 --- /dev/null +++ b/src/dns_data/docs/Protection.md @@ -0,0 +1,30 @@ +# Protection + +Protection configuration indicates the record is protected & contains the user group with protected access. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**level** | **str** | | [optional] + +## Example + +```python +from dns_data.models.protection import Protection + +# TODO update the JSON string below +json = "{}" +# create an instance of Protection from a JSON string +protection_instance = Protection.from_json(json) +# print the JSON string representation of the object +print(Protection.to_json()) + +# convert the object into a dict +protection_dict = protection_instance.to_dict() +# create an instance of Protection from a dict +protection_from_dict = Protection.from_dict(protection_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/dns_data/docs/Record.md b/src/dns_data/docs/Record.md index 7011079..cb3bf3a 100644 --- a/src/dns_data/docs/Record.md +++ b/src/dns_data/docs/Record.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **absolute_name_spec** | **str** | Synthetic field, used to determine _zone_ and/or _name_in_zone_ field for records. | [optional] **absolute_zone_name** | **str** | The absolute domain name of the zone where this record belongs. | [optional] [readonly] **comment** | **str** | The description for the DNS resource record. May contain 0 to 1024 characters. Can include UTF-8. | [optional] +**compartment_id** | **str** | The compartment associated with the object. If no compartment is associated with the object, the value defaults to empty. | [optional] [readonly] **created_at** | **datetime** | The timestamp when the object has been created. | [optional] [readonly] **delegation** | **str** | The resource identifier. | [optional] [readonly] **disabled** | **bool** | Indicates if the DNS resource record is disabled. A disabled object is effectively non-existent when generating configuration. Defaults to _false_. | [optional] @@ -21,6 +22,7 @@ Name | Type | Description | Notes **ipam_host** | **str** | The resource identifier. | [optional] [readonly] **name_in_zone** | **str** | The relative owner name to the zone origin. Must be specified for creating the DNS resource record and is read only for other operations. | [optional] [default to ''] **options** | **object** | The DNS resource record type-specific non-protocol options. Valid value for _A_ (Address) and _AAAA_ (IPv6 Address) records: Option | Description -----------|----------------------------------------- create_ptr | A boolean flag which can be set to _true_ for POST operation to automatically create the corresponding PTR record. check_rmz | A boolean flag which can be set to _true_ for POST operation to check the existence of reverse zone for creating the corresponding PTR record. Only applicable if the _create_ptr_ option is set to _true_. Valid value for _PTR_ (Pointer) records: Option | Description -----------|---------------------------------------- address | For GET operation it contains the IPv4 or IPv6 address represented by the PTR record.<br><br>For POST and PATCH operations it can be used to create/update a PTR record based on the IP address it represents. In this case, in addition to the _address_ in the options field, need to specify the _view_ field. | | [optional] +**protection** | [**Protection**](Protection.md) | Protection configuration containing user group with protected access. | [optional] [readonly] **provider_metadata** | **object** | external DNS provider metadata. | [optional] [readonly] **rdata** | **object** | The DNS resource record data in JSON format. Certain DNS resource record-specific subfields are required for creating the DNS resource record. Subfields for _A_ (Address) record: Subfield | Description |Required ---------|---------------------------------------|-------- address | The IPv4 address of the host.<br><br> | Yes Subfields for _AAAA_ (IPv6 Address) record: Subfield | Description | Required ---------|---------------------------------------|--------- address | The IPv6 address of the host.<br><br> | Yes Subfields for _CAA_ (Certification Authority Authorization) record: Subfield | Description | Required ---------|---------------------------------------|--------- flags | An unsigned 8-bit integer which specifies the CAA record flags. RFC 6844 defines one (highest) bit in flag octet, remaining bits are deferred for future use. This bit is referenced as _Critical_. When the bit is set (flag value == 128), issuers must not issue certificates in case CAA records contain unknown property tags.<br><br>Defaults to 0.<br><br> | No tag | The CAA record property tag string which indicates the type of CAA record. The following property tags are defined by RFC 6844:<ul><li>_issue_: Used to explicitly authorize CA to issue certificates for the domain in which the property is published.</li><li>_issuewild_: Used to explicitly authorize a single CA to issue wildcard certificates for the domain in which the property is published.</li><li>_iodef_: Used to specify an email address or URL to report invalid certificate requests or issuers’ certificate policy violations.</li></ul>Note: _issuewild_ type takes precedence over _issue_.<br><br> | Yes value | A string which contains the CAA record property value.<br><br>Specifies the CA who is authorized to issue a certificate for the domain if the CAA record property tag is _issue_ or _issuewild_.<br><br> Specifies the URL/email address to report CAA policy violation for the domain if the CAA record property tag is _iodef_.<br><br> | Yes Subfields for _CNAME_ (Canonical Name) record: Subfield | Description | Required ---------|---------------------------------------|--------- cname | A domain name which specifies the canonical or primary name for the owner. The owner name is an alias. Can be empty.<br><br> | Yes Subfields for _DNAME_ (Delegation Name) record: Subfield | Description | Required ---------|---------------------------------------|--------- target | The target domain name to which the zone will be mapped. Can be empty.<br><br> | Yes Subfields for _DHCID_ (DHCP Identifier) record: Subfield | Description | Required ---------|---------------------------------------|--------- dhcid | The Base64 encoded string which contains DHCP client information.<br><br> | Yes Subfields for _MX_ (Mail Exchanger) record: Subfield | Description | Required -----------|-----------------------------------|--------- exchange | A domain name which specifies a host willing to act as a mail exchange for the owner name.<br><br> | Yes preference | An unsigned 16-bit integer which specifies the preference given to this RR among others at the same owner. Lower values are preferred. The range of the value is 0 to 65535. <br><br> | Yes Subfields for _NAPTR_ (Naming Authority Pointer) record: Subfield | Description | Required ------------|-------------------------------------|--------- flags | A character string containing flags to control aspects of the rewriting and interpretation of the fields in the DNS resource record. The flags that are currently used are: <ul><li> __U__: Indicates that the output maps to a URI (Uniform Record Identifier). </li><li> __S__: Indicates that the output is a domain name that has at least one SRV record. The DNS client must then send a query for the SRV record of the resulting domain name. </li><li> __A__: Indicates that the output is a domain name that has at least one A or AAAA record. The DNS client must then send a query for the A or AAAA record of the resulting domain name. </li><li> __P__: Indicates that the protocol specified in the _services_ field defines the next step or phase. </li></ul> | No order | A 16-bit unsigned integer specifying the order in which the NAPTR records must be processed. Low numbers are processed before high numbers, and once a NAPTR is found whose rule \"matches\" the target, the client must not consider any NAPTRs with a higher value for order (except as noted below for the \"flags\" field. The range of the value is 0 to 65535. <br><br> | Yes preference |A 16-bit unsigned integer that specifies the order in which NAPTR records with equal \"order\" values should be processed, low numbers being processed before high numbers. This is similar to the preference field in an MX record, and is used so domain administrators can direct clients towards more capable hosts or lighter weight protocols. A client may look at records with higher preference values if it has a good reason to do so such as not understanding the preferred protocol or service. The range of the value is 0 to 65535.<br><br> | Yes regexp | A string containing a substitution expression that is applied to the original string held by the client in order to construct the next domain name to lookup.<br><br>Defaults to none.<br><br> | No replacement | The next name to query for NAPTR, SRV, or address records depending on the value of the _flags_ field. This can be an absolute or relative domain name. Can be empty.<br><br> | Yes services | Specifies the service(s) available down this rewrite path. It may also specify the particular protocol that is used to talk with a service. A protocol must be specified if the flags field states that the NAPTR is terminal. If a protocol is specified, but the flags field does not state that the NAPTR is terminal, the next lookup must be for a NAPTR. The client may choose not to perform the next lookup if the protocol is unknown, but that behavior must not be relied upon.<br><br>The service field may take any of the values below (using the Augmented BNF of RFC 2234):<br><br>service_field = [ [protocol] *(\"+\" rs)]<br>protocol = ALPHA * 31 ALPHANUM<br>rs = ALPHA * 31 ALPHANUM<br><br>The protocol and rs fields are limited to 32 characters and must start with an alphabetic character.<br><br> For example, an optional protocol specification followed by 0 or more resolution services. Each resolution service is indicated by an initial '+' character.<br><br> Note that the empty string is also a valid service field. This will typically be seen at the beginning of a series of rules, when it is impossible to know what services and protocols will be offered by a particular service.<br><br> The actual format of the service request and response will be determined by the resolution protocol. Protocols need not offer all services. The labels for service requests shall be formed from the set of characters [A-Z0-9]. The case of the alphabetic characters is not significant.<br><br> | Yes Subfields for _NS_ (Name Server) record: Subfield | Description | Required ---------|-------------------------------------|--------- dname | A domain-name which specifies a host which should be authoritative for the specified class and domain. Can be absolute or relative domain name and include UTF-8. <br><br> | Yes Subfields for _PTR_ (Pointer) record: Subfield | Description | Required ---------|-------------------------------------|--------- dname | A domain name which points to some location in the domain name space. Can be absolute or relative domain name and include UTF-8. <br><br> | Yes Subfields for _SOA_ (Start of Authority) record: Subfield | Description | Required ------------ |-------------------------------------|--------- expire | The time interval in seconds after which zone data will expire and secondary server stops answering requests for the zone.<br><br> | No mname | The domain name for the master server for the zone. Can be absolute or relative domain name.<br><br> | Yes negative_ttl | The time interval in seconds for which name servers can cache negative responses for zone. <br><br>Defaults to 900 seconds (15 minutes).<br><br> | No refresh | The time interval in seconds that specifies how often secondary servers need to send a message to the primary server for a zone to check that their data is current, and retrieve fresh data if it is not.<br><br>Defaults to 10800 seconds (3 hours).<br><br> | No retry | The time interval in seconds for which the secondary server will wait before attempting to recontact the primary server after a connection failure occurs.<br><br>Defaults to 3600 seconds (1 hour).<br><br> | No rname | The domain name which specifies the mailbox of the person responsible for this zone. <br><br> | No serial | An unsigned 32-bit integer that specifies the serial number of the zone. Used to indicate that zone data was updated, so the secondary name server can initiate zone transfer. The range of the value is 0 to 4294967295. <br><br> | No Subfields for _SRV_ (Service) record: Subfield | Description | Required ---------|-------------------------------------|--------- port | An unsigned 16-bit integer which specifies the port on this target host of this service. The range of the value is 0 to 65535. This is often as specified in Assigned Numbers but need not be.<br><br> | Yes priority | An unsigned 16-bit integer which specifies the priority of this target host. The range of the value is 0 to 65535. A client must attempt to contact the target host with the lowest-numbered priority it can reach. Target hosts with the same priority should be tried in an order defined by the _weight_ field.<br><br>| Yes target | The domain name of the target host. There must be one or more address records for this name, the name must not be an alias (in the sense of RFC 1034 or RFC 2181).<br><br>A target of \".\" means that the service is decidedly not available at this domain. | Yes weight | An unsigned 16-bit integer which specifies a relative weight for entries with the same priority. The range of the value is 0 to 65535. Larger weights should be given a proportionately higher probability of being selected. Domain administrators should use weight 0 when there isn't any server selection to do, to make the RR easier to read for humans (less noisy). In the presence of records containing weights greater than 0, records with weight 0 should have a very small chance of being selected.<br><br>In the absence of a protocol whose specification calls for the use of other weighting information, a client arranges the SRV RRs of the same priority in the order in which target hosts, specified by the SRV RRs, will be contacted.<br><br>Defaults to 0.<br><br>| No Subfields for _TXT_ (Text) record: Subfield | Description | Required ---------|-------------------------------------|--------- text | The semantics of the text depends on the domain where it is found.<br><br> | No Generic record can be used to represent any DNS resource record not listed above. Subfields for a generic record consist of a list of struct subfields, each having the following sub-subfields: Sub-subfield | Description | Required -------------|------------------------------------|--------- type | Following types are supported:<ul><li>_8BIT_: Unsigned 8-bit integer. </li><li> _16BIT_: Unsigned 16-bit integer. </li><li> _32BIT_: Unsigned 32-bit integer. </li><li> _IPV6_: IPv6 address. For example, \"abcd:123::abcd\". </li><li> _IPV4_: IPv4 address. For example, \"1.1.1.1\". </li><li> _DomainName_: Domain name (absolute or relative). </li><li> _TEXT_: ASCII text. </li><li> _BASE64_: Base64 encoded binary data. </li><li> _HEX_: Hex encoded binary data. </li><li>_PRESENTATION_: Presentation is a standard textual form of record data, as shown in a standard master zone file. <br><br> For example, an IPSEC RDATA could be specified using the PRESENTATION type field whose value is \"10 1 2 192.0.2.38 AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ==\", instead of a sequence of the following subfields: <ul><li> 8BIT: value=10 </li><li> 8BIT: value=1 </li><li> 8BIT: value=2 </li><li> IPV4: value=\"192.0.2.38\" </li><li> BASE64 (without _length_kind_ sub-subfield): value=\"AQNRU3mG7TVTO2BkR47usntb102uFJtugbo6BSGvgqt4AQ==\" </li></ul></li></ul>If type is _PRESENTATION_, only one struct subfield can be specified. <br><br> | Yes length_kind | A string indicating the size in bits of a sub-subfield that is prepended to the value and encodes the length of the value. Valid values are:<ul><li>_8_: If _type_ is _ASCII_ or _BASE64_. </li><li>_16_: If _type_ is _HEX_.</li></ul>Defaults to none. <br><br>| Only required for some types. value | A string representing the value for the sub-subfield | Yes | **source** | **List[str]** | Source indicator | Description ------------------------------------|-------------------------------- _STATIC_ | Record was created manually by API call to _dns/record_. Valid for all record types except _SOA_. _SYSTEM_ | Record was created automatically based on name server assignment. Valid for _SOA_, _NS_, _A_, _AAAA_, and _PTR_ record types. _DYNAMIC_ | Record was created dynamically by performing dynamic update. Valid for all record types except _SOA_. _DELEGATED_ | Record was created automatically based on delegation servers assignment. Always extends the _SYSTEM_ bit. Valid for _NS_, _A_, _AAAA_, and _PTR_ record types. _DTC_ | Record was created automatically based on the DTC configuration. Always extends the _SYSTEM_ bit. Valid only for _IBMETA_ record type with _LBDN_ subtype. _STATIC_, _SYSTEM_ | Record was created manually by API call but it is obfuscated by record generated based on name server assignment. _DYNAMIC_, _SYSTEM_ | Record was created dynamically by DDNS but it is obfuscated by record generated based on name server assignment. _DELEGATED_, _SYSTEM_ | Record was created automatically based on delegation servers assignment. _SYSTEM_ will always accompany _DELEGATED_. _DTC_, _SYSTEM_ | Record was created automatically based on the DTC configuration. _SYSTEM_ will always accompany _DTC_. _STATIC_, _SYSTEM_, _DELEGATED_ | Record was created manually by API call but it is obfuscated by record generated based on name server assignment as a result of creating a delegation. _DYNAMIC_, _SYSTEM_, _DELEGATED_ | Record was created dynamically by DDNS but it is obfuscated by record generated based on name server assignment as a result of creating a delegation. | [optional] [readonly] diff --git a/src/dns_data/docs/RecordApi.md b/src/dns_data/docs/RecordApi.md index a35be48..b78f0ef 100644 --- a/src/dns_data/docs/RecordApi.md +++ b/src/dns_data/docs/RecordApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://csp.infoblox.com/api/ddi/v1* Method | HTTP request | Description ------------- | ------------- | ------------- +[**configure_record_protection**](RecordApi.md#configure_record_protection) | **POST** /dns/configure_record_protection | Configure record protection for multiple records in a zone. [**create**](RecordApi.md#create) | **POST** /dns/record | Create the DNS resource record. [**delete**](RecordApi.md#delete) | **DELETE** /dns/record/{id} | Move the DNS resource record to recycle bin. [**list**](RecordApi.md#list) | **GET** /dns/record | Retrieve DNS resource records. @@ -12,6 +13,82 @@ Method | HTTP request | Description [**update**](RecordApi.md#update) | **PATCH** /dns/record/{id} | Update the DNS resource record. +# **configure_record_protection** +> ConfigureRecordProtectionResponse configure_record_protection(body) + +Configure record protection for multiple records in a zone. + +Use this method to configure protection levels for DNS records in a zone. This allows setting protection levels (e.g., Global Admin, DDI Admin, None) for multiple records with same rname. + +### Example + +* Api Key Authentication (ApiKeyAuth): +```python +import os +from pprint import pprint + +import dns_data + +from universal_ddi_client.api_client import ApiClient +from universal_ddi_client.configuration import Configuration + +# Defining the Portal URL is optional and defaults to "https://csp.infoblox.com" +# See configuration.py for a list of all supported configuration parameters. +configuration = Configuration( + portal_url = os.getenv('INFOBLOX_PORTAL_URL'), +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. + +# Configure Portal key authorization: ApiKeyAuth +configuration.portal_key = os.getenv("INFOBLOX_PORTAL_KEY") + +# Enter a context with an instance of the API client +with ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = dns_data.RecordApi(api_client) + body = dns_data.ConfigureRecordProtectionRequest() # ConfigureRecordProtectionRequest | + + try: + # Configure record protection for multiple records in a zone. + api_response = api_instance.configure_record_protection(body) + pprint("The response of RecordApi->configure_record_protection:\n") + pprint(api_response) + except Exception as e: + pprint("Exception when calling RecordApi->configure_record_protection: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ConfigureRecordProtectionRequest**](ConfigureRecordProtectionRequest.md)| | + +### Return type + +[**ConfigureRecordProtectionResponse**](ConfigureRecordProtectionResponse.md) + +### Authorization + +[ApiKeyAuth](../README.md#ApiKeyAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | POST operation response | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **create** > CreateRecordResponse create(body, inherit=inherit) diff --git a/src/dns_data/models/__init__.py b/src/dns_data/models/__init__.py index bbd26fb..b694100 100644 --- a/src/dns_data/models/__init__.py +++ b/src/dns_data/models/__init__.py @@ -13,9 +13,13 @@ """ # noqa: E501 # import models into model package +from dns_data.models.configure_record_protection_request import ConfigureRecordProtectionRequest +from dns_data.models.configure_record_protection_response import ConfigureRecordProtectionResponse from dns_data.models.create_record_response import CreateRecordResponse from dns_data.models.inheritance2_inherited_u_int32 import Inheritance2InheritedUInt32 from dns_data.models.list_record_response import ListRecordResponse +from dns_data.models.protected_record_item import ProtectedRecordItem +from dns_data.models.protection import Protection from dns_data.models.protobuf_field_mask import ProtobufFieldMask from dns_data.models.read_record_response import ReadRecordResponse from dns_data.models.record import Record diff --git a/src/dns_data/models/configure_record_protection_request.py b/src/dns_data/models/configure_record_protection_request.py new file mode 100644 index 0000000..2df80f5 --- /dev/null +++ b/src/dns_data/models/configure_record_protection_request.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + DNS Data API + + The DNS Data is a Universal DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. + + The version of the OpenAPI document: v1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from dns_data.models.protected_record_item import ProtectedRecordItem +from typing import Optional, Set +from typing_extensions import Self + + +class ConfigureRecordProtectionRequest(BaseModel): + """ + The request format to configure record protection for multiple records in a zone. + """ # noqa: E501 + protected_records: Optional[List[ProtectedRecordItem]] = Field( + default=None, + description="List of records with their protection levels.") + zone_id: Optional[StrictStr] = Field( + default=None, description="The resource identifier.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["protected_records", "zone_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConfigureRecordProtectionRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in protected_records (list) + _items = [] + if self.protected_records: + for _item in self.protected_records: + if _item: + _items.append(_item.to_dict()) + _dict['protected_records'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConfigureRecordProtectionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "protected_records": [ + ProtectedRecordItem.from_dict(_item) + for _item in obj["protected_records"] + ] if obj.get("protected_records") is not None else None, + "zone_id": + obj.get("zone_id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/src/dns_data/models/configure_record_protection_response.py b/src/dns_data/models/configure_record_protection_response.py new file mode 100644 index 0000000..7bd23db --- /dev/null +++ b/src/dns_data/models/configure_record_protection_response.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + DNS Data API + + The DNS Data is a Universal DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. + + The version of the OpenAPI document: v1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from dns_data.models.protected_record_item import ProtectedRecordItem +from typing import Optional, Set +from typing_extensions import Self + + +class ConfigureRecordProtectionResponse(BaseModel): + """ + The response format for configuring record protection. + """ # noqa: E501 + protected_records: Optional[List[ProtectedRecordItem]] = Field( + default=None, + description= + "List of records with their protection levels and protection status.") + zone_id: Optional[StrictStr] = Field( + default=None, description="The resource identifier.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["protected_records", "zone_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConfigureRecordProtectionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in protected_records (list) + _items = [] + if self.protected_records: + for _item in self.protected_records: + if _item: + _items.append(_item.to_dict()) + _dict['protected_records'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConfigureRecordProtectionResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "protected_records": [ + ProtectedRecordItem.from_dict(_item) + for _item in obj["protected_records"] + ] if obj.get("protected_records") is not None else None, + "zone_id": + obj.get("zone_id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/src/dns_data/models/protected_record_item.py b/src/dns_data/models/protected_record_item.py new file mode 100644 index 0000000..597d50f --- /dev/null +++ b/src/dns_data/models/protected_record_item.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + DNS Data API + + The DNS Data is a Universal DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. + + The version of the OpenAPI document: v1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class ProtectedRecordItem(BaseModel): + """ + Represents a single record protection configuration. + """ # noqa: E501 + level: Optional[StrictStr] = Field( + default=None, + description= + "The protection level (e.g., \"Global Admin\", \"DDI Admin\", \"None\")." + ) + rname: Optional[StrictStr] = Field( + default=None, description="The record name (relative to zone).") + rtype: Optional[StrictStr] = Field(default=None, + description="The record type.") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["level", "rname", "rtype"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ProtectedRecordItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ProtectedRecordItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "level": obj.get("level"), + "rname": obj.get("rname"), + "rtype": obj.get("rtype") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/src/dns_data/models/protection.py b/src/dns_data/models/protection.py new file mode 100644 index 0000000..db342dc --- /dev/null +++ b/src/dns_data/models/protection.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + DNS Data API + + The DNS Data is a Universal DDI service providing primary authoritative zone support. DNS Data is authoritative for all DNS resource records and is acting as a primary DNS server. It is part of the full-featured, DDI cloud solution that enables customers to deploy large numbers of protocol servers to deliver DNS and DHCP throughout their enterprise network. + + The version of the OpenAPI document: v1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + + +class Protection(BaseModel): + """ + Protection configuration indicates the record is protected & contains the user group with protected access. + """ # noqa: E501 + level: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["level"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Protection from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Protection from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"level": obj.get("level")}) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj diff --git a/src/dns_data/models/record.py b/src/dns_data/models/record.py index a543225..fc4c946 100644 --- a/src/dns_data/models/record.py +++ b/src/dns_data/models/record.py @@ -19,6 +19,7 @@ from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from dns_data.models.protection import Protection from dns_data.models.record_inheritance import RecordInheritance from typing import Optional, Set from typing_extensions import Self @@ -42,6 +43,11 @@ class Record(BaseModel): description= "The description for the DNS resource record. May contain 0 to 1024 characters. Can include UTF-8." ) + compartment_id: Optional[StrictStr] = Field( + default=None, + description= + "The compartment associated with the object. If no compartment is associated with the object, the value defaults to empty." + ) created_at: Optional[datetime] = Field( default=None, description="The timestamp when the object has been created.") @@ -87,6 +93,11 @@ class Record(BaseModel): description= "The DNS resource record type-specific non-protocol options. Valid value for _A_ (Address) and _AAAA_ (IPv6 Address) records: Option | Description -----------|----------------------------------------- create_ptr | A boolean flag which can be set to _true_ for POST operation to automatically create the corresponding PTR record. check_rmz | A boolean flag which can be set to _true_ for POST operation to check the existence of reverse zone for creating the corresponding PTR record. Only applicable if the _create_ptr_ option is set to _true_. Valid value for _PTR_ (Pointer) records: Option | Description -----------|---------------------------------------- address | For GET operation it contains the IPv4 or IPv6 address represented by the PTR record.

For POST and PATCH operations it can be used to create/update a PTR record based on the IP address it represents. In this case, in addition to the _address_ in the options field, need to specify the _view_ field. |" ) + protection: Optional[Protection] = Field( + default=None, + description= + "Protection configuration containing user group with protected access." + ) provider_metadata: Optional[Dict[str, Any]] = Field( default=None, description="external DNS provider metadata.") rdata: Dict[str, Any] = Field( @@ -132,12 +143,13 @@ class Record(BaseModel): description="The resource identifier.") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = [ - "absolute_name_spec", "absolute_zone_name", "comment", "created_at", - "delegation", "disabled", "dns_absolute_name_spec", - "dns_absolute_zone_name", "dns_name_in_zone", "dns_rdata", "id", - "inheritance_sources", "ipam_host", "name_in_zone", "options", - "provider_metadata", "rdata", "source", "subtype", "tags", "ttl", - "type", "updated_at", "view", "view_name", "zone" + "absolute_name_spec", "absolute_zone_name", "comment", + "compartment_id", "created_at", "delegation", "disabled", + "dns_absolute_name_spec", "dns_absolute_zone_name", "dns_name_in_zone", + "dns_rdata", "id", "inheritance_sources", "ipam_host", "name_in_zone", + "options", "protection", "provider_metadata", "rdata", "source", + "subtype", "tags", "ttl", "type", "updated_at", "view", "view_name", + "zone" ] model_config = ConfigDict( @@ -183,10 +195,13 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. * Fields in `self.additional_properties` are added to the output dict. """ excluded_fields: Set[str] = set([ "absolute_zone_name", + "compartment_id", "created_at", "delegation", "dns_absolute_name_spec", @@ -195,6 +210,7 @@ def to_dict(self) -> Dict[str, Any]: "dns_rdata", "id", "ipam_host", + "protection", "provider_metadata", "source", "subtype", @@ -211,6 +227,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of inheritance_sources if self.inheritance_sources: _dict['inheritance_sources'] = self.inheritance_sources.to_dict() + # override the default output from pydantic by calling `to_dict()` of protection + if self.protection: + _dict['protection'] = self.protection.to_dict() # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -234,6 +253,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: obj.get("absolute_zone_name"), "comment": obj.get("comment"), + "compartment_id": + obj.get("compartment_id"), "created_at": obj.get("created_at"), "delegation": @@ -260,6 +281,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if obj.get("name_in_zone") is not None else '', "options": obj.get("options"), + "protection": + Protection.from_dict(obj["protection"]) + if obj.get("protection") is not None else None, "provider_metadata": obj.get("provider_metadata"), "rdata":