Skip to content

get_service async

get_service(
    id: Arn, *, config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None
) -> GetServiceResponse

Gets the settings for a specified service.

Parameters:

  • id (Arn) –

    The ID or Amazon Resource Name (ARN) of the service that you want to get settings for. For services created by consumers in a shared namespace, specify the service ARN. For more information about shared namespaces, see Cross-account Cloud Map namespace sharing in the Cloud Map Developer Guide.

Raises:

  • 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.

  • ServiceNotFound –

    No service exists with the specified ID.

  • UnknownServiceError –

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

Examples:

Get service using service ARN Gets service settings using a service ARN instead of service ID, useful when working with shared namespaces. Shows a service created by a sharee (111122223333) in a namespace owned by another account (123456789012).

>>> await client.get_service(id='arn:aws:servicediscovery:us-west-2:123456789012:service/srv-abcd1234xmpl5678')
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
async def get_service(
    self,
    id: "capo_servicediscovery.types.arn.Arn",
    *,
    config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
) -> "capo_servicediscovery.types.get_service_response.GetServiceResponse":
    """<p>Gets the settings for a specified service.</p>

    Args:
        id: <p>The ID or Amazon Resource Name (ARN) of the service that you want to get settings for. For services created by consumers in a shared namespace, specify the service ARN. For more information about shared namespaces, see <a href="https://docs.aws.amazon.com/cloud-map/latest/dg/sharing-namespaces.html">Cross-account Cloud Map namespace sharing</a> in the <i>Cloud Map Developer Guide</i>.</p>

    Raises:
        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.service_not_found.ServiceNotFound: <p>No service exists with the specified ID.</p>
        capo_servicediscovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Get service using service ARN
        Gets service settings using a service ARN instead of service ID, useful when working with shared namespaces. Shows a service created by a sharee (111122223333) in a namespace owned by another account (123456789012).

        >>> await client.get_service(id='arn:aws:servicediscovery:us-west-2:123456789012:service/srv-abcd1234xmpl5678')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_servicediscovery.types.get_service_request.GetServiceRequest]",
    ) -> AsyncOperationResponse[
        "capo_servicediscovery.types.get_service_response.GetServiceResponse"
    ]:
        import capo_servicediscovery._operations.route53_auto_naming_v20170314.get_service

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetService")
    )
    input_: capo_servicediscovery.types.get_service_request.GetServiceRequest = {
        "id": id
    }

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