get_namespace

get_namespace(**kwargs)

Gets information about a namespace.

See also: AWS API Documentation

Request Syntax

response = client.get_namespace(
    Id='string'
)
Parameters
Id (string) --

[REQUIRED]

The ID of the namespace that you want to get information about.

Return type
dict
Returns
Response Syntax
{
    'Namespace': {
        'Id': 'string',
        'Arn': 'string',
        'Name': 'string',
        'Type': 'DNS_PUBLIC'|'DNS_PRIVATE'|'HTTP',
        'Description': 'string',
        'ServiceCount': 123,
        'Properties': {
            'DnsProperties': {
                'HostedZoneId': 'string',
                'SOA': {
                    'TTL': 123
                }
            },
            'HttpProperties': {
                'HttpName': 'string'
            }
        },
        'CreateDate': datetime(2015, 1, 1),
        'CreatorRequestId': 'string'
    }
}

Response Structure

  • (dict) --
    • Namespace (dict) --

      A complex type that contains information about the specified namespace.

      • Id (string) --

        The ID of a namespace.

      • Arn (string) --

        The Amazon Resource Name (ARN) that Cloud Map assigns to the namespace when you create it.

      • Name (string) --

        The name of the namespace, such as example.com .

      • Type (string) --

        The type of the namespace. The methods for discovering instances depends on the value that you specify:

        HTTP

        Instances can be discovered only programmatically, using the Cloud Map DiscoverInstances API.

        DNS_PUBLIC

        Instances can be discovered using public DNS queries and using the DiscoverInstances API.

        DNS_PRIVATE

        Instances can be discovered using DNS queries in VPCs and using the DiscoverInstances API.

      • Description (string) --

        The description that you specify for the namespace when you create it.

      • ServiceCount (integer) --

        The number of services that are associated with the namespace.

      • Properties (dict) --

        A complex type that contains information that's specific to the type of the namespace.

        • DnsProperties (dict) --

          A complex type that contains the ID for the Route 53 hosted zone that Cloud Map creates when you create a namespace.

          • HostedZoneId (string) --

            The ID for the Route 53 hosted zone that Cloud Map creates when you create a namespace.

          • SOA (dict) --

            Start of Authority (SOA) record for the hosted zone.

            • TTL (integer) --

              The time to live (TTL) for purposes of negative caching.

        • HttpProperties (dict) --

          A complex type that contains the name of an HTTP namespace.

          • HttpName (string) --

            The name of an HTTP namespace.

      • CreateDate (datetime) --

        The date that the namespace was created, in Unix date/time format and Coordinated Universal Time (UTC). The value of CreateDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM.

      • CreatorRequestId (string) --

        A unique string that identifies the request and that allows failed requests to be retried without the risk of running an operation twice.

Exceptions

  • ServiceDiscovery.Client.exceptions.InvalidInput
  • ServiceDiscovery.Client.exceptions.NamespaceNotFound

Examples

This example gets information about a specified namespace.

response = client.get_namespace(
    Id='ns-e4anhexample0004',
)

print(response)

Expected Output:

{
    'Namespace': {
        'Arn': 'arn:aws:servicediscovery:us-west-2: 123456789120:namespace/ns-e1tpmexample0001',
        'CreateDate': datetime(2018, 11, 18, 21, 17, 12, 6, 322, 0),
        'CreatorRequestId': 'example-creator-request-id-0001',
        'Description': 'Example.com AWS Cloud Map HTTP Namespace',
        'Id': 'ns-e1tpmexample0001',
        'Name': 'example-http.com',
        'Properties': {
            'DnsProperties': {
            },
            'HttpProperties': {
                'HttpName': 'example-http.com',
            },
        },
        'Type': 'HTTP',
    },
    'ResponseMetadata': {
        '...': '...',
    },
}