tag_resource
async
¶
tag_resource(
resource_arn: AmazonResourceName,
tags: TagList,
*,
config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
) -> TagResourceResponse
Adds one or more tags to the specified resource.
Parameters:
-
resource_arn(AmazonResourceName) –The Amazon Resource Name (ARN) of the resource that you want to retrieve tags for.
-
tags(TagList) –The tags to add to the specified resource. Specifying the tag key is required. You can set the value of a tag to an empty string, but you can't set the value of a tag to null.
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.
-
ResourceNotFoundException–The operation can't be completed because the resource was not found.
-
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:
TagResource example This example adds "Department" and "Project" tags to a resource.
>>> await client.tag_resource(resource_arn='arn:aws:servicediscovery:us-east-1:123456789012:namespace/ns-ylexjili4cdxy3xm', tags=[{'Key': 'Department', 'Value': 'Engineering'}, {'Key': 'Project', 'Value': 'Zeta'}])
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 | |