Skip to content

update_private_dns_namespace

update_private_dns_namespace(
    id: Arn,
    namespace: PrivateDnsNamespaceChange,
    *,
    config_overrides: Optional[ServiceDiscoveryClientConfig] = None,
    updater_request_id: Optional[ResourceId] = None,
) -> UpdatePrivateDnsNamespaceResponse

Updates a private DNS namespace.

Parameters:

  • id (Arn) –

    The ID or Amazon Resource Name (ARN) of the namespace that you want to update.

  • updater_request_id (Optional[ResourceId], default: None ) –

    A unique string that identifies the request and that allows failed UpdatePrivateDnsNamespace requests to be retried without the risk of running the operation twice. UpdaterRequestId can be any unique string (for example, a date/timestamp).

  • namespace (PrivateDnsNamespaceChange) –

    Updated properties for the private DNS namespace.

Raises:

  • DuplicateRequest –

    The operation is already in progress.

  • InvalidInput –

    One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

  • NamespaceNotFound –

    No namespace exists with the specified ID.

  • ResourceInUse –

    The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To update a private DNS namespace The following example updates the description of a private DNS namespace.

>>> client.update_private_dns_namespace(id='ns-bk3aEXAMPLE', updater_request_id='', namespace={'Description': 'The updated namespace description.'})
Update private DNS namespace using namespace ARN for shared namespace
This example updates a private DNS namespace using a namespace ARN instead of namespace ID.
>>> client.update_private_dns_namespace(id='arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-bk3aexample', namespace={'Description': 'Updated description for shared private DNS namespace.'})
Source code in docs_src/capo_servicediscovery/_services/service_discovery.py
def update_private_dns_namespace(
    self,
    id: "capo_servicediscovery.types.arn.Arn",
    namespace: "capo_servicediscovery.types.private_dns_namespace_change.PrivateDnsNamespaceChange",
    *,
    config_overrides: Optional[ServiceDiscoveryClientConfig] = None,
    updater_request_id: Optional[
        "capo_servicediscovery.types.resource_id.ResourceId"
    ] = None,
) -> "capo_servicediscovery.types.update_private_dns_namespace_response.UpdatePrivateDnsNamespaceResponse":
    """<p>Updates a private DNS namespace.</p>

    Args:
        id: <p>The ID or Amazon Resource Name (ARN) of the namespace that you want to update.</p>
        updater_request_id: <p>A unique string that identifies the request and that allows failed <code>UpdatePrivateDnsNamespace</code> requests to be retried without the risk of running the operation twice. <code>UpdaterRequestId</code> can be any unique string (for example, a date/timestamp).</p>
        namespace: <p>Updated properties for the private DNS namespace.</p>

    Raises:
        capo_servicediscovery.errors.duplicate_request.DuplicateRequest: <p>The operation is already in progress.</p>
        capo_servicediscovery.errors.invalid_input.InvalidInput: <p>One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.</p>
        capo_servicediscovery.errors.namespace_not_found.NamespaceNotFound: <p>No namespace exists with the specified ID.</p>
        capo_servicediscovery.errors.resource_in_use.ResourceInUse: <p>The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.</p>
        capo_servicediscovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To update a private DNS namespace
        The following example updates the description of a private DNS namespace.

        >>> client.update_private_dns_namespace(id='ns-bk3aEXAMPLE', updater_request_id='', namespace={'Description': 'The updated namespace description.'})
        Update private DNS namespace using namespace ARN for shared namespace
        This example updates a private DNS namespace using a namespace ARN instead of namespace ID.

        >>> client.update_private_dns_namespace(id='arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-bk3aexample', namespace={'Description': 'Updated description for shared private DNS namespace.'})
    """

    def _handler(
        req: "OperationRequest[capo_servicediscovery.types.update_private_dns_namespace_request.UpdatePrivateDnsNamespaceRequest]",
    ) -> OperationResponse[
        "capo_servicediscovery.types.update_private_dns_namespace_response.UpdatePrivateDnsNamespaceResponse"
    ]:
        import capo_servicediscovery._operations.route53_auto_naming_v20170314.update_private_dns_namespace

        output, http_response = (
            capo_servicediscovery._operations.route53_auto_naming_v20170314.update_private_dns_namespace.update_private_dns_namespace(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePrivateDnsNamespace")
    )
    input_: capo_servicediscovery.types.update_private_dns_namespace_request.UpdatePrivateDnsNamespaceRequest = {
        "id": id,
        "namespace": namespace,
    }
    if updater_request_id is None:
        updater_request_id = str(uuid.uuid4())
    input_["updater_request_id"] = updater_request_id

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