Creates an HTTP namespace. Service instances registered using an HTTP namespace can be discovered using a DiscoverInstances request but can't be discovered using DNS.
For the current quota on the number of namespaces that you can create using the same Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.
Parameters:
-
name
(NamespaceNameHttp)
–
The name that you want to assign to this namespace.
-
creator_request_id
(Optional[ResourceId], default:
None
)
–
A unique string that identifies the request and that allows failed CreateHttpNamespace requests to be retried without the risk of running the operation twice. CreatorRequestId can be any unique string (for example, a date/time stamp).
-
description
(Optional[ResourceDescription], default:
None
)
–
A description for the namespace.
-
tags
(Optional[TagList], default:
None
)
–
The tags to add to the namespace. Each tag consists of a key and an optional value that you define. Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.
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.
-
NamespaceAlreadyExists
–
The namespace that you're trying to create already exists.
-
ResourceLimitExceeded
–
The resource can't be created because you've reached the quota on the number of resources.
-
TooManyTagsException
–
The list of tags on the resource is over the quota. The maximum number of tags that can be applied to a resource is 50.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
CreateHttpNamespace example
This example creates an HTTP namespace.
>>> client.create_http_namespace(creator_request_id='example-creator-request-id-0001', name='example-http.com', description='Example.com AWS Cloud Map HTTP Namespace')
Source code in docs_src/capo_servicediscovery/_services/service_discovery.py
| def create_http_namespace(
self,
name: "capo_servicediscovery.types.namespace_name_http.NamespaceNameHttp",
*,
config_overrides: Optional[ServiceDiscoveryClientConfig] = None,
creator_request_id: Optional[
"capo_servicediscovery.types.resource_id.ResourceId"
] = None,
description: Optional[
"capo_servicediscovery.types.resource_description.ResourceDescription"
] = None,
tags: Optional["capo_servicediscovery.types.tag_list.TagList"] = None,
) -> "capo_servicediscovery.types.create_http_namespace_response.CreateHttpNamespaceResponse":
"""<p>Creates an HTTP namespace. Service instances registered using an HTTP namespace can be discovered using a <code>DiscoverInstances</code> request but can't be discovered using DNS.</p> <p>For the current quota on the number of namespaces that you can create using the same Amazon Web Services account, see <a href="https://docs.aws.amazon.com/cloud-map/latest/dg/cloud-map-limits.html">Cloud Map quotas</a> in the <i>Cloud Map Developer Guide</i>.</p>
Args:
name: <p>The name that you want to assign to this namespace.</p>
creator_request_id: <p>A unique string that identifies the request and that allows failed <code>CreateHttpNamespace</code> requests to be retried without the risk of running the operation twice. <code>CreatorRequestId</code> can be any unique string (for example, a date/time stamp).</p>
description: <p>A description for the namespace.</p>
tags: <p>The tags to add to the namespace. Each tag consists of a key and an optional value that you define. Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.</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_already_exists.NamespaceAlreadyExists: <p>The namespace that you're trying to create already exists.</p>
capo_servicediscovery.errors.resource_limit_exceeded.ResourceLimitExceeded: <p>The resource can't be created because you've reached the quota on the number of resources.</p>
capo_servicediscovery.errors.too_many_tags_exception.TooManyTagsException: <p>The list of tags on the resource is over the quota. The maximum number of tags that can be applied to a resource is 50.</p>
capo_servicediscovery.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
CreateHttpNamespace example
This example creates an HTTP namespace.
>>> client.create_http_namespace(creator_request_id='example-creator-request-id-0001', name='example-http.com', description='Example.com AWS Cloud Map HTTP Namespace')
"""
def _handler(
req: "OperationRequest[capo_servicediscovery.types.create_http_namespace_request.CreateHttpNamespaceRequest]",
) -> OperationResponse[
"capo_servicediscovery.types.create_http_namespace_response.CreateHttpNamespaceResponse"
]:
import capo_servicediscovery._operations.route53_auto_naming_v20170314.create_http_namespace
output, http_response = (
capo_servicediscovery._operations.route53_auto_naming_v20170314.create_http_namespace.create_http_namespace(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateHttpNamespace")
)
input_: capo_servicediscovery.types.create_http_namespace_request.CreateHttpNamespaceRequest = {
"name": name
}
if creator_request_id is None:
creator_request_id = str(uuid.uuid4())
input_["creator_request_id"] = creator_request_id
if description is not None:
input_["description"] = description
if tags is not None:
input_["tags"] = tags
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|