put_attributes
async
¶
put_attributes(
attributes: Attributes,
*,
config_overrides: Optional[AsyncECSClientConfig] = None,
cluster: Optional[String] = None,
) -> PutAttributesResponse
Create or update an attribute on an Amazon ECS resource. If the attribute doesn't exist, it's created. If the attribute exists, its value is replaced with the specified value. To delete an attribute, use DeleteAttributes. For more information, see Attributes in the Amazon Elastic Container Service Developer Guide.
Parameters:
-
cluster(Optional[String], default:None) –The short name or full Amazon Resource Name (ARN) of the cluster that contains the resource to apply attributes. If you do not specify a cluster, the default cluster is assumed.
-
attributes(Attributes) –The attributes to apply to your resource. You can specify up to 10 custom attributes for each resource. You can specify up to 10 attributes in a single call.
Raises:
-
AccessDeniedException–You don't have authorization to perform the requested action.
-
AttributeLimitExceededException–You can apply up to 10 custom attributes for each resource. You can view the attributes of a resource with ListAttributes. You can remove existing attributes on a resource with DeleteAttributes.
-
ClientException–These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.
-
ClusterNotFoundException–The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.
-
InvalidParameterException–The specified parameter isn't valid. Review the available parameters for the API request.
For more information about service event errors, see Amazon ECS service event messages.
-
ServerException–These errors are usually caused by a server issue.
-
TargetNotFoundException–The specified target wasn't found. You can view your available container instances with ListContainerInstances. Amazon ECS container instances are cluster-specific and Region-specific.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create or update an attribute on a resource This example adds an attribute "stack" with the value "production" to a container instance.
>>> await client.put_attributes(cluster='MyCluster', attributes=[{'targetId': 'arn:aws:ecs:us-west-2:123456789012:container-instance/1c3be8ed-df30-47b4-8f1e-6e68ebd01f34', 'name': 'stack', 'value': 'production'}])
Source code in docs_src/capo_ecs/_services/async_ecs.py
2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 | |