Skip to content

modify_private_dns_name_options

modify_private_dns_name_options(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    instance_id: Optional[InstanceId] = None,
    private_dns_hostname_type: Optional[HostnameType] = None,
    enable_resource_name_dns_a_record: Optional[Boolean] = None,
    enable_resource_name_dns_aaaa_record: Optional[Boolean] = None,
) -> ModifyPrivateDnsNameOptionsResult

Modifies the options for instance hostnames for the specified instance.

Parameters:

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • instance_id (Optional[InstanceId], default: None ) –

    The ID of the instance.

  • private_dns_hostname_type (Optional[HostnameType], default: None ) –

    The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.

  • enable_resource_name_dns_a_record (Optional[Boolean], default: None ) –

    Indicates whether to respond to DNS queries for instance hostnames with DNS A records.

  • enable_resource_name_dns_aaaa_record (Optional[Boolean], default: None ) –

    Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def modify_private_dns_name_options(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    instance_id: Optional["capo_ec2.types.instance_id.InstanceId"] = None,
    private_dns_hostname_type: Optional[
        "capo_ec2.types.hostname_type.HostnameType"
    ] = None,
    enable_resource_name_dns_a_record: Optional[
        "capo_ec2.types.boolean.Boolean"
    ] = None,
    enable_resource_name_dns_aaaa_record: Optional[
        "capo_ec2.types.boolean.Boolean"
    ] = None,
) -> "capo_ec2.types.modify_private_dns_name_options_result.ModifyPrivateDnsNameOptionsResult":
    """<p>Modifies the options for instance hostnames for the specified instance.</p>

    Args:
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        instance_id: <p>The ID of the instance.</p>
        private_dns_hostname_type: <p>The type of hostname for EC2 instances. For IPv4 only subnets, an instance DNS name must be based on the instance IPv4 address. For IPv6 only subnets, an instance DNS name must be based on the instance ID. For dual-stack subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID.</p>
        enable_resource_name_dns_a_record: <p>Indicates whether to respond to DNS queries for instance hostnames with DNS A records.</p>
        enable_resource_name_dns_aaaa_record: <p>Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.modify_private_dns_name_options_request.ModifyPrivateDnsNameOptionsRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.modify_private_dns_name_options_result.ModifyPrivateDnsNameOptionsResult"
    ]:
        import capo_ec2._operations.amazon_ec2.modify_private_dns_name_options

        output, http_response = (
            capo_ec2._operations.amazon_ec2.modify_private_dns_name_options.modify_private_dns_name_options(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyPrivateDnsNameOptions")
    )
    input_: capo_ec2.types.modify_private_dns_name_options_request.ModifyPrivateDnsNameOptionsRequest = {}
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if private_dns_hostname_type is not None:
        input_["private_dns_hostname_type"] = private_dns_hostname_type
    if enable_resource_name_dns_a_record is not None:
        input_["enable_resource_name_dns_a_record"] = (
            enable_resource_name_dns_a_record
        )
    if enable_resource_name_dns_aaaa_record is not None:
        input_["enable_resource_name_dns_aaaa_record"] = (
            enable_resource_name_dns_aaaa_record
        )

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output