Creates a tag for an EFS resource. You can create tags for EFS file systems and access points using this API operation.
This operation requires permissions for the elasticfilesystem:TagResource action.
Parameters:
-
resource_id
(ResourceId)
–
The ID specifying the EFS resource that you want to create a tag for.
-
tags
(Tags)
–
An array of Tag objects to add. Each Tag object is a key-value pair.
Raises:
-
AccessPointNotFound
–
Returned if the specified AccessPointId value doesn't exist in the requester's Amazon Web Services account.
-
BadRequest
–
Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.
-
FileSystemNotFound
–
Returned if the specified FileSystemId value doesn't exist in the requester's Amazon Web Services account.
-
InternalServerError
–
Returned if an error occurred on the server side.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_efs/_services/async_efs.py
| async def tag_resource(
self,
resource_id: "capo_efs.types.resource_id.ResourceId",
tags: "capo_efs.types.tags.Tags",
*,
config_overrides: Optional[AsyncEFSClientConfig] = None,
) -> None:
"""<p>Creates a tag for an EFS resource. You can create tags for EFS file systems and access points using this API operation.</p> <p>This operation requires permissions for the <code>elasticfilesystem:TagResource</code> action.</p>
Args:
resource_id: <p>The ID specifying the EFS resource that you want to create a tag for.</p>
tags: <p>An array of <code>Tag</code> objects to add. Each <code>Tag</code> object is a key-value pair.</p>
Raises:
capo_efs.errors.access_point_not_found.AccessPointNotFound: <p>Returned if the specified <code>AccessPointId</code> value doesn't exist in the requester's Amazon Web Services account.</p>
capo_efs.errors.bad_request.BadRequest: <p>Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.</p>
capo_efs.errors.file_system_not_found.FileSystemNotFound: <p>Returned if the specified <code>FileSystemId</code> value doesn't exist in the requester's Amazon Web Services account.</p>
capo_efs.errors.internal_server_error.InternalServerError: <p>Returned if an error occurred on the server side.</p>
capo_efs.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_efs.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[None]:
import capo_efs._operations.magnolio_api_service_v20150201.tag_resource
(
output,
http_response,
) = await capo_efs._operations.magnolio_api_service_v20150201.tag_resource.async_tag_resource(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("TagResource")
)
input_: capo_efs.types.tag_resource_request.TagResourceRequest = {
"resource_id": resource_id,
"tags": tags,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|