Skip to content

create_storage_lens_group async

create_storage_lens_group(
    account_id: AccountId,
    storage_lens_group: StorageLensGroup,
    *,
    config_overrides: Optional[AsyncS3ControlClientConfig] = None,
    tags: Optional[TagList] = None,
) -> None

Creates a new S3 Storage Lens group and associates it with the specified Amazon Web Services account ID. An S3 Storage Lens group is a custom grouping of objects based on prefix, suffix, object tags, object size, object age, or a combination of these filters. For each Storage Lens group that you’ve created, you can also optionally add Amazon Web Services resource tags. For more information about S3 Storage Lens groups, see Working with S3 Storage Lens groups.

To use this operation, you must have the permission to perform the s3:CreateStorageLensGroup action. If you’re trying to create a Storage Lens group with Amazon Web Services resource tags, you must also have permission to perform the s3:TagResource action. For more information about the required Storage Lens Groups permissions, see Setting account permissions to use S3 Storage Lens groups.

For information about Storage Lens groups errors, see List of Amazon S3 Storage Lens error codes.

Parameters:

  • account_id (AccountId) –

    The Amazon Web Services account ID that the Storage Lens group is created from and associated with.

  • storage_lens_group (StorageLensGroup) –

    The Storage Lens group configuration.

  • tags (Optional[TagList], default: None ) –

    The Amazon Web Services resource tags that you're adding to your Storage Lens group. This parameter is optional.

Raises:

Source code in docs_src/capo_s3_control/_services/async_s3_control.py
async def create_storage_lens_group(
    self,
    account_id: "capo_s3_control.types.account_id.AccountId",
    storage_lens_group: "capo_s3_control.types.storage_lens_group.StorageLensGroup",
    *,
    config_overrides: Optional[AsyncS3ControlClientConfig] = None,
    tags: Optional["capo_s3_control.types.tag_list.TagList"] = None,
) -> None:
    """<p> Creates a new S3 Storage Lens group and associates it with the specified Amazon Web Services account ID. An S3 Storage Lens group is a custom grouping of objects based on prefix, suffix, object tags, object size, object age, or a combination of these filters. For each Storage Lens group that you’ve created, you can also optionally add Amazon Web Services resource tags. For more information about S3 Storage Lens groups, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-lens-groups-overview.html">Working with S3 Storage Lens groups</a>.</p> <p>To use this operation, you must have the permission to perform the <code>s3:CreateStorageLensGroup</code> action. If you’re trying to create a Storage Lens group with Amazon Web Services resource tags, you must also have permission to perform the <code>s3:TagResource</code> action. For more information about the required Storage Lens Groups permissions, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage_lens_iam_permissions.html#storage_lens_groups_permissions">Setting account permissions to use S3 Storage Lens groups</a>.</p> <p>For information about Storage Lens groups errors, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#S3LensErrorCodeList">List of Amazon S3 Storage Lens error codes</a>.</p>

    Args:
        account_id: <p> The Amazon Web Services account ID that the Storage Lens group is created from and associated with. </p>
        storage_lens_group: <p> The Storage Lens group configuration. </p>
        tags: <p> The Amazon Web Services resource tags that you're adding to your Storage Lens group. This parameter is optional. </p>

    Raises:
        capo_s3_control.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_s3_control.types.create_storage_lens_group_request.CreateStorageLensGroupRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_s3_control._operations.awss3_control_service_v20180820.create_storage_lens_group

        (
            output,
            http_response,
        ) = await capo_s3_control._operations.awss3_control_service_v20180820.create_storage_lens_group.async_create_storage_lens_group(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateStorageLensGroup")
    )
    input_: capo_s3_control.types.create_storage_lens_group_request.CreateStorageLensGroupRequest = {
        "account_id": account_id,
        "storage_lens_group": storage_lens_group,
    }
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output