Skip to content

tag_resource

tag_resource(
    resource_id: ResourceId,
    tags: Tags,
    *,
    config_overrides: Optional[EFSClientConfig] = None,
) -> None

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/efs.py
def tag_resource(
    self,
    resource_id: "capo_efs.types.resource_id.ResourceId",
    tags: "capo_efs.types.tags.Tags",
    *,
    config_overrides: Optional[EFSClientConfig] = 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.
    """

    def _handler(
        req: "OperationRequest[capo_efs.types.tag_resource_request.TagResourceRequest]",
    ) -> OperationResponse[None]:
        import capo_efs._operations.magnolio_api_service_v20150201.tag_resource

        output, http_response = (
            capo_efs._operations.magnolio_api_service_v20150201.tag_resource.tag_resource(
                req.options, req.input
            )
        )
        return OperationResponse(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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output