ServiceDiscovery / Client / list_namespaces
list_namespaces#
- ServiceDiscovery.Client.list_namespaces(**kwargs)#
Lists summary information about the namespaces that were created by the current Amazon Web Services account.
See also: AWS API Documentation
Request Syntax
response = client.list_namespaces( NextToken='string', MaxResults=123, Filters=[ { 'Name': 'TYPE'|'NAME'|'HTTP_NAME', 'Values': [ 'string', ], 'Condition': 'EQ'|'IN'|'BETWEEN'|'BEGINS_WITH' }, ] )
- Parameters:
NextToken (string) –
For the first
ListNamespacesrequest, omit this value.If the response contains
NextToken, submit anotherListNamespacesrequest to get the next group of results. Specify the value ofNextTokenfrom the previous response in the next request.Note
Cloud Map gets
MaxResultsnamespaces and then filters them based on the specified criteria. It’s possible that no namespaces in the firstMaxResultsnamespaces matched the specified criteria but that subsequent groups ofMaxResultsnamespaces do contain namespaces that match the criteria.MaxResults (integer) – The maximum number of namespaces that you want Cloud Map to return in the response to a
ListNamespacesrequest. If you don’t specify a value forMaxResults, Cloud Map returns up to 100 namespaces.Filters (list) –
A complex type that contains specifications for the namespaces that you want to list.
If you specify more than one filter, a namespace must match all filters to be returned by
ListNamespaces.(dict) –
A complex type that identifies the namespaces that you want to list. You can choose to list public or private namespaces.
Name (string) – [REQUIRED]
Specify the namespaces that you want to get using one of the following.
TYPE: Gets the namespaces of the specified type.NAME: Gets the namespaces with the specified name.HTTP_NAME: Gets the namespaces with the specified HTTP name.
Values (list) – [REQUIRED]
Specify the values that are applicable to the value that you specify for
Name.TYPE: SpecifyHTTP,DNS_PUBLIC, orDNS_PRIVATE.NAME: Specify the name of the namespace, which is found inNamespace.Name.HTTP_NAME: Specify the HTTP name of the namespace, which is found inNamespace.Properties.HttpProperties.HttpName.
(string) –
Condition (string) –
Specify the operator that you want to use to determine whether a namespace matches the specified value. Valid values for
Conditionare one of the following.EQ: When you specifyEQforCondition, you can specify only one value.EQis supported forTYPE,NAME, andHTTP_NAME.EQis the default condition and can be omitted.BEGINS_WITH: When you specifyBEGINS_WITHforCondition, you can specify only one value.BEGINS_WITHis supported forTYPE,NAME, andHTTP_NAME.
- Return type:
dict
- Returns:
Response Syntax
{ 'Namespaces': [ { '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) }, ], 'NextToken': 'string' }
Response Structure
(dict) –
Namespaces (list) –
An array that contains one
NamespaceSummaryobject for each namespace that matches the specified filter criteria.(dict) –
A complex type that contains information about a namespace.
Id (string) –
The ID of the 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. When you create a namespace, Cloud Map automatically creates a Route 53 hosted zone that has the same name as the namespace.
Type (string) –
The type of the namespace, either public or private.
Description (string) –
A description for the namespace.
ServiceCount (integer) –
The number of services that were created using the namespace.
Properties (dict) –
The properties 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 and time that the namespace was created.
NextToken (string) –
If the response contains
NextToken, submit anotherListNamespacesrequest to get the next group of results. Specify the value ofNextTokenfrom the previous response in the next request.Note
Cloud Map gets
MaxResultsnamespaces and then filters them based on the specified criteria. It’s possible that no namespaces in the firstMaxResultsnamespaces matched the specified criteria but that subsequent groups ofMaxResultsnamespaces do contain namespaces that match the criteria.
Exceptions
ServiceDiscovery.Client.exceptions.InvalidInput
Examples
Example: List namespaces
response = client.list_namespaces( ) print(response)
Expected Output:
{ 'Namespaces': [ { 'Arn': 'arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-a3ccy2e7e3a7rile', 'CreateDate': 1585354387.357, 'Id': 'ns-a3ccy2e7e3a7rile', 'Name': 'local', 'Properties': { 'DnsProperties': { 'HostedZoneId': 'Z06752353VBUDTC32S84S', }, 'HttpProperties': { 'HttpName': 'local', }, }, 'Type': 'DNS_PRIVATE', }, { 'Arn': 'arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-pocfyjtrsmwtvcxx', 'CreateDate': 1586468974.698, 'Description': 'My second namespace', 'Id': 'ns-pocfyjtrsmwtvcxx', 'Name': 'My-second-namespace', 'Properties': { 'DnsProperties': { }, 'HttpProperties': { 'HttpName': 'My-second-namespace', }, }, 'Type': 'HTTP', }, { 'Arn': 'arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-ylexjili4cdxy3xm', 'CreateDate': 1587055896.798, 'Id': 'ns-ylexjili4cdxy3xm', 'Name': 'example.com', 'Properties': { 'DnsProperties': { 'HostedZoneId': 'Z09983722P0QME1B3KC8I', }, 'HttpProperties': { 'HttpName': 'example.com', }, }, 'Type': 'DNS_PRIVATE', }, ], 'ResponseMetadata': { '...': '...', }, }