Skip to content

update_public_dns_namespace async

update_public_dns_namespace(
    id: Arn,
    namespace: PublicDnsNamespaceChange,
    *,
    config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
    updater_request_id: Optional[ResourceId] = None,
) -> UpdatePublicDnsNamespaceResponse

Updates a public DNS namespace.

Parameters:

  • id (Arn) –

    The ID or Amazon Resource Name (ARN) of the namespace being updated.

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

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

  • namespace (PublicDnsNamespaceChange) –

    Updated properties for the public 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 public DNS namespace The following example updates the description of a public DNS namespace.

>>> await client.update_public_dns_namespace(id='ns-bk3aEXAMPLE', updater_request_id='', namespace={'Description': 'The updated namespace description.'})
Update public DNS namespace using namespace ARN for shared namespace
This example updates a public DNS namespace using a namespace ARN instead of namespace ID.
>>> await client.update_public_dns_namespace(id='arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-bk3aexample', namespace={'Description': 'Updated description for shared public DNS namespace.'})
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
async def update_public_dns_namespace(
    self,
    id: "capo_servicediscovery.types.arn.Arn",
    namespace: "capo_servicediscovery.types.public_dns_namespace_change.PublicDnsNamespaceChange",
    *,
    config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
    updater_request_id: Optional[
        "capo_servicediscovery.types.resource_id.ResourceId"
    ] = None,
) -> "capo_servicediscovery.types.update_public_dns_namespace_response.UpdatePublicDnsNamespaceResponse":
    """<p>Updates a public DNS namespace.</p>

    Args:
        id: <p>The ID or Amazon Resource Name (ARN) of the namespace being updated.</p>
        updater_request_id: <p>A unique string that identifies the request and that allows failed <code>UpdatePublicDnsNamespace</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 public 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 public DNS namespace
        The following example updates the description of a public DNS namespace.

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

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

    async def _handler(
        req: "AsyncOperationRequest[capo_servicediscovery.types.update_public_dns_namespace_request.UpdatePublicDnsNamespaceRequest]",
    ) -> AsyncOperationResponse[
        "capo_servicediscovery.types.update_public_dns_namespace_response.UpdatePublicDnsNamespaceResponse"
    ]:
        import capo_servicediscovery._operations.route53_auto_naming_v20170314.update_public_dns_namespace

        (
            output,
            http_response,
        ) = await capo_servicediscovery._operations.route53_auto_naming_v20170314.update_public_dns_namespace.async_update_public_dns_namespace(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

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

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output