Submits a request to update a specified service to add service-level attributes.
Parameters:
-
service_id
(Arn)
–
The ID or Amazon Resource Name (ARN) of the service that you want to update. For services created in a namespace shared with your Amazon Web Services account, specify the service ARN.
-
attributes
(ServiceAttributesMap)
–
A string map that contains attribute key-value pairs.
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.
-
ServiceAttributesLimitExceededException
–
The attribute can't be added to the service because you've exceeded the quota for the number of attributes you can add to a service.
-
ServiceNotFound
–
No service exists with the specified ID.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
Update service attributes using service ARN
Updates service attributes using a service ARN instead of service ID, useful when working with shared namespaces.
>>> await client.update_service_attributes(service_id='arn:aws:servicediscovery:us-west-2:123456789012:service/srv-abcd1234xmpl5678', attributes={'Port': '8080', 'Protocol': 'HTTP'})
UpdateServiceAttributes Example
This example submits a request to update the specified service to add a port attribute with the value 80.
>>> await client.update_service_attributes(service_id='srv-e4anhexample0004', attributes={'port': '80'})
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
| async def update_service_attributes(
self,
service_id: "capo_servicediscovery.types.arn.Arn",
attributes: "capo_servicediscovery.types.service_attributes_map.ServiceAttributesMap",
*,
config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
) -> "capo_servicediscovery.types.update_service_attributes_response.UpdateServiceAttributesResponse":
"""<p>Submits a request to update a specified service to add service-level attributes.</p>
Args:
service_id: <p>The ID or Amazon Resource Name (ARN) of the service that you want to update. For services created in a namespace shared with your Amazon Web Services account, specify the service ARN.</p>
attributes: <p>A string map that contains attribute key-value pairs.</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_attributes_limit_exceeded_exception.ServiceAttributesLimitExceededException: <p>The attribute can't be added to the service because you've exceeded the quota for the number of attributes you can add to a service.</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:
Update service attributes using service ARN
Updates service attributes using a service ARN instead of service ID, useful when working with shared namespaces.
>>> await client.update_service_attributes(service_id='arn:aws:servicediscovery:us-west-2:123456789012:service/srv-abcd1234xmpl5678', attributes={'Port': '8080', 'Protocol': 'HTTP'})
UpdateServiceAttributes Example
This example submits a request to update the specified service to add a port attribute with the value 80.
>>> await client.update_service_attributes(service_id='srv-e4anhexample0004', attributes={'port': '80'})
"""
async def _handler(
req: "AsyncOperationRequest[capo_servicediscovery.types.update_service_attributes_request.UpdateServiceAttributesRequest]",
) -> AsyncOperationResponse[
"capo_servicediscovery.types.update_service_attributes_response.UpdateServiceAttributesResponse"
]:
import capo_servicediscovery._operations.route53_auto_naming_v20170314.update_service_attributes
(
output,
http_response,
) = await capo_servicediscovery._operations.route53_auto_naming_v20170314.update_service_attributes.async_update_service_attributes(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateServiceAttributes")
)
input_: capo_servicediscovery.types.update_service_attributes_request.UpdateServiceAttributesRequest = {
"service_id": service_id,
"attributes": attributes,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|