Skip to content

S3ServiceResource#

Index > S3 > S3ServiceResource

Auto-generated documentation for S3 type annotations stubs module mypy-boto3-s3.

S3ServiceResource#

Type annotations and code completion for boto3.resource("s3"), included resources and collections. boto3 documentation

# S3ServiceResource usage example

from mypy_boto3_s3.service_resource import S3ServiceResource

def get_s3_resource() -> S3ServiceResource:
    return boto3.resource("s3")

Attributes#

Collections#

ServiceResourceBucketsCollection#

Provides access to Bucket resource.

Type annotations and code completion for boto3.resource("s3").buckets collection. boto3 documentation

# ServiceResourceBucketsCollection usage example

from mypy_boto3_s3.service_resource import ServiceResourceBucketsCollection

def get_collection() -> ServiceResourceBucketsCollection:
    return boto3.resource("s3").buckets

Methods#

S3ServiceResource.Bucket method#

Creates a Bucket resource.

Type annotations and code completion for boto3.resource("s3").Bucket method. boto3 documentation

# Bucket method definition

def Bucket(
    self,
    name: str,
) -> Bucket:
    ...

S3ServiceResource.BucketAcl method#

Creates a BucketAcl resource.

Type annotations and code completion for boto3.resource("s3").BucketAcl method. boto3 documentation

# BucketAcl method definition

def BucketAcl(
    self,
    bucket_name: str,
) -> BucketAcl:
    ...

S3ServiceResource.BucketCors method#

Creates a BucketCors resource.

Type annotations and code completion for boto3.resource("s3").BucketCors method. boto3 documentation

# BucketCors method definition

def BucketCors(
    self,
    bucket_name: str,
) -> BucketCors:
    ...

S3ServiceResource.BucketLifecycle method#

Creates a BucketLifecycle resource.

Type annotations and code completion for boto3.resource("s3").BucketLifecycle method. boto3 documentation

# BucketLifecycle method definition

def BucketLifecycle(
    self,
    bucket_name: str,
) -> BucketLifecycle:
    ...

S3ServiceResource.BucketLifecycleConfiguration method#

Creates a BucketLifecycleConfiguration resource.

Type annotations and code completion for boto3.resource("s3").BucketLifecycleConfiguration method. boto3 documentation

# BucketLifecycleConfiguration method definition

def BucketLifecycleConfiguration(
    self,
    bucket_name: str,
) -> BucketLifecycleConfiguration:
    ...

S3ServiceResource.BucketLogging method#

Creates a BucketLogging resource.

Type annotations and code completion for boto3.resource("s3").BucketLogging method. boto3 documentation

# BucketLogging method definition

def BucketLogging(
    self,
    bucket_name: str,
) -> BucketLogging:
    ...

S3ServiceResource.BucketNotification method#

Creates a BucketNotification resource.

Type annotations and code completion for boto3.resource("s3").BucketNotification method. boto3 documentation

# BucketNotification method definition

def BucketNotification(
    self,
    bucket_name: str,
) -> BucketNotification:
    ...

S3ServiceResource.BucketPolicy method#

Creates a BucketPolicy resource.

Type annotations and code completion for boto3.resource("s3").BucketPolicy method. boto3 documentation

# BucketPolicy method definition

def BucketPolicy(
    self,
    bucket_name: str,
) -> BucketPolicy:
    ...

S3ServiceResource.BucketRequestPayment method#

Creates a BucketRequestPayment resource.

Type annotations and code completion for boto3.resource("s3").BucketRequestPayment method. boto3 documentation

# BucketRequestPayment method definition

def BucketRequestPayment(
    self,
    bucket_name: str,
) -> BucketRequestPayment:
    ...

S3ServiceResource.BucketTagging method#

Creates a BucketTagging resource.

Type annotations and code completion for boto3.resource("s3").BucketTagging method. boto3 documentation

# BucketTagging method definition

def BucketTagging(
    self,
    bucket_name: str,
) -> BucketTagging:
    ...

S3ServiceResource.BucketVersioning method#

Creates a BucketVersioning resource.

Type annotations and code completion for boto3.resource("s3").BucketVersioning method. boto3 documentation

# BucketVersioning method definition

def BucketVersioning(
    self,
    bucket_name: str,
) -> BucketVersioning:
    ...

S3ServiceResource.BucketWebsite method#

Creates a BucketWebsite resource.

Type annotations and code completion for boto3.resource("s3").BucketWebsite method. boto3 documentation

# BucketWebsite method definition

def BucketWebsite(
    self,
    bucket_name: str,
) -> BucketWebsite:
    ...

S3ServiceResource.MultipartUpload method#

Creates a MultipartUpload resource.

Type annotations and code completion for boto3.resource("s3").MultipartUpload method. boto3 documentation

# MultipartUpload method definition

def MultipartUpload(
    self,
    bucket_name: str,
    object_key: str,
    id: str,
) -> MultipartUpload:
    ...

S3ServiceResource.MultipartUploadPart method#

Creates a MultipartUploadPart resource.

Type annotations and code completion for boto3.resource("s3").MultipartUploadPart method. boto3 documentation

# MultipartUploadPart method definition

def MultipartUploadPart(
    self,
    bucket_name: str,
    object_key: str,
    multipart_upload_id: str,
    part_number: str,
) -> MultipartUploadPart:
    ...

S3ServiceResource.Object method#

Creates a Object resource.

Type annotations and code completion for boto3.resource("s3").Object method. boto3 documentation

# Object method definition

def Object(
    self,
    bucket_name: str,
    key: str,
) -> Object:
    ...

S3ServiceResource.ObjectAcl method#

Creates a ObjectAcl resource.

Type annotations and code completion for boto3.resource("s3").ObjectAcl method. boto3 documentation

# ObjectAcl method definition

def ObjectAcl(
    self,
    bucket_name: str,
    object_key: str,
) -> ObjectAcl:
    ...

S3ServiceResource.ObjectSummary method#

Creates a ObjectSummary resource.

Type annotations and code completion for boto3.resource("s3").ObjectSummary method. boto3 documentation

# ObjectSummary method definition

def ObjectSummary(
    self,
    bucket_name: str,
    key: str,
) -> ObjectSummary:
    ...

S3ServiceResource.ObjectVersion method#

Creates a ObjectVersion resource.

Type annotations and code completion for boto3.resource("s3").ObjectVersion method. boto3 documentation

# ObjectVersion method definition

def ObjectVersion(
    self,
    bucket_name: str,
    object_key: str,
    id: str,
) -> ObjectVersion:
    ...

S3ServiceResource.create_bucket method#

Creates a new S3 bucket.

Type annotations and code completion for boto3.resource("s3").create_bucket method. boto3 documentation

# create_bucket method definition

def create_bucket(
    self,
    *,
    Bucket: str,
    ACL: BucketCannedACLType = ...,  # (1)
    CreateBucketConfiguration: CreateBucketConfigurationTypeDef = ...,  # (2)
    GrantFullControl: str = ...,
    GrantRead: str = ...,
    GrantReadACP: str = ...,
    GrantWrite: str = ...,
    GrantWriteACP: str = ...,
    ObjectLockEnabledForBucket: bool = ...,
    ObjectOwnership: ObjectOwnershipType = ...,  # (3)
) -> Bucket:
    ...
  1. See BucketCannedACLType
  2. See CreateBucketConfigurationTypeDef
  3. See ObjectOwnershipType
# create_bucket method usage example with argument unpacking

kwargs: CreateBucketRequestServiceResourceCreateBucketTypeDef = {  # (1)
    "Bucket": ...,
}

parent.create_bucket(**kwargs)
  1. See CreateBucketRequestServiceResourceCreateBucketTypeDef

S3ServiceResource.get_available_subresources method#

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for boto3.resource("s3").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Bucket#

Type annotations and code completion for boto3.resource("s3").Bucket class. boto3 documentation

# Bucket usage example

from mypy_boto3_s3.service_resource import Bucket

def get_resource() -> Bucket:
    return boto3.resource("s3").Bucket(...)

Bucket attributes#

Bucket collections#

Bucket.multipart_uploads#

Provides access to MultipartUpload resource.

Type annotations and code completion for boto3.resource("s3").Bucket(...).multipart_uploads collection. boto3 documentation

# BucketMultipartUploadsCollection usage example

from mypy_boto3_s3.service_resource import BucketMultipartUploadsCollection

def get_collection() -> BucketMultipartUploadsCollection:
    resource = boto3.resource("s3").Bucket(...)
    return resource.multipart_uploads

Bucket.object_versions#

Provides access to ObjectVersion resource.

Type annotations and code completion for boto3.resource("s3").Bucket(...).object_versions collection. boto3 documentation

# BucketObjectVersionsCollection usage example

from mypy_boto3_s3.service_resource import BucketObjectVersionsCollection

def get_collection() -> BucketObjectVersionsCollection:
    resource = boto3.resource("s3").Bucket(...)
    return resource.object_versions

Bucket.objects#

Provides access to ObjectSummary resource.

Type annotations and code completion for boto3.resource("s3").Bucket(...).objects collection. boto3 documentation

# BucketObjectsCollection usage example

from mypy_boto3_s3.service_resource import BucketObjectsCollection

def get_collection() -> BucketObjectsCollection:
    resource = boto3.resource("s3").Bucket(...)
    return resource.objects

Bucket methods#

Bucket.Acl method#

Creates a BucketAcl resource.

Type annotations and code completion for boto3.resource("s3").Acl method. boto3 documentation

# Acl method definition

def Acl(
    self,
) -> BucketAcl:
    ...

Bucket.Cors method#

Creates a BucketCors resource.

Type annotations and code completion for boto3.resource("s3").Cors method. boto3 documentation

# Cors method definition

def Cors(
    self,
) -> BucketCors:
    ...

Bucket.Lifecycle method#

Creates a BucketLifecycle resource.

Type annotations and code completion for boto3.resource("s3").Lifecycle method. boto3 documentation

# Lifecycle method definition

def Lifecycle(
    self,
) -> BucketLifecycle:
    ...

Bucket.LifecycleConfiguration method#

Creates a BucketLifecycleConfiguration resource.

Type annotations and code completion for boto3.resource("s3").LifecycleConfiguration method. boto3 documentation

# LifecycleConfiguration method definition

def LifecycleConfiguration(
    self,
) -> BucketLifecycleConfiguration:
    ...

Bucket.Logging method#

Creates a BucketLogging resource.

Type annotations and code completion for boto3.resource("s3").Logging method. boto3 documentation

# Logging method definition

def Logging(
    self,
) -> BucketLogging:
    ...

Bucket.Notification method#

Creates a BucketNotification resource.

Type annotations and code completion for boto3.resource("s3").Notification method. boto3 documentation

# Notification method definition

def Notification(
    self,
) -> BucketNotification:
    ...

Bucket.Object method#

Creates a Object resource.

Type annotations and code completion for boto3.resource("s3").Object method. boto3 documentation

# Object method definition

def Object(
    self,
    key: str,
) -> Object:
    ...

Bucket.Policy method#

Creates a BucketPolicy resource.

Type annotations and code completion for boto3.resource("s3").Policy method. boto3 documentation

# Policy method definition

def Policy(
    self,
) -> BucketPolicy:
    ...

Bucket.RequestPayment method#

Creates a BucketRequestPayment resource.

Type annotations and code completion for boto3.resource("s3").RequestPayment method. boto3 documentation

# RequestPayment method definition

def RequestPayment(
    self,
) -> BucketRequestPayment:
    ...

Bucket.Tagging method#

Creates a BucketTagging resource.

Type annotations and code completion for boto3.resource("s3").Tagging method. boto3 documentation

# Tagging method definition

def Tagging(
    self,
) -> BucketTagging:
    ...

Bucket.Versioning method#

Creates a BucketVersioning resource.

Type annotations and code completion for boto3.resource("s3").Versioning method. boto3 documentation

# Versioning method definition

def Versioning(
    self,
) -> BucketVersioning:
    ...

Bucket.Website method#

Creates a BucketWebsite resource.

Type annotations and code completion for boto3.resource("s3").Website method. boto3 documentation

# Website method definition

def Website(
    self,
) -> BucketWebsite:
    ...

Bucket.copy method#

Copy an object from one S3 location to an object in this bucket.

Type annotations and code completion for boto3.resource("s3").copy method. boto3 documentation

# copy method definition

def copy(
    self,
    CopySource: CopySourceTypeDef,  # (1)
    Key: str,
    ExtraArgs: Dict[str, Any] = ...,
    Callback: Callable[..., Any] = ...,
    SourceClient: BaseClient = ...,
    Config: TransferConfig = ...,
) -> None:
    ...
  1. See CopySourceTypeDef
# copy method usage example with argument unpacking

kwargs: BucketCopyRequestTypeDef = {  # (1)
    "CopySource": ...,
    "Key": ...,
}

parent.copy(**kwargs)
  1. See BucketCopyRequestTypeDef

Bucket.create method#

Creates a new S3 bucket.

Type annotations and code completion for boto3.resource("s3").create method. boto3 documentation

# create method definition

def create(
    self,
    *,
    ACL: BucketCannedACLType = ...,  # (1)
    CreateBucketConfiguration: CreateBucketConfigurationTypeDef = ...,  # (2)
    GrantFullControl: str = ...,
    GrantRead: str = ...,
    GrantReadACP: str = ...,
    GrantWrite: str = ...,
    GrantWriteACP: str = ...,
    ObjectLockEnabledForBucket: bool = ...,
    ObjectOwnership: ObjectOwnershipType = ...,  # (3)
) -> CreateBucketOutputTypeDef:  # (4)
    ...
  1. See BucketCannedACLType
  2. See CreateBucketConfigurationTypeDef
  3. See ObjectOwnershipType
  4. See CreateBucketOutputTypeDef
# create method usage example with argument unpacking

kwargs: CreateBucketRequestBucketCreateTypeDef = {  # (1)
    "ACL": ...,
}

parent.create(**kwargs)
  1. See CreateBucketRequestBucketCreateTypeDef

Bucket.delete method#

Deletes the S3 bucket.

Type annotations and code completion for boto3.resource("s3").delete method. boto3 documentation

# delete method definition

def delete(
    self,
    *,
    ExpectedBucketOwner: str = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

kwargs: DeleteBucketRequestBucketDeleteTypeDef = {  # (1)
    "ExpectedBucketOwner": ...,
}

parent.delete(**kwargs)
  1. See DeleteBucketRequestBucketDeleteTypeDef

Bucket.delete_objects method#

This action enables you to delete multiple objects from a bucket using a single HTTP request.

Type annotations and code completion for boto3.resource("s3").delete_objects method. boto3 documentation

# delete_objects method definition

def delete_objects(
    self,
    *,
    Delete: DeleteTypeDef,  # (1)
    MFA: str = ...,
    RequestPayer: RequestPayerType = ...,  # (2)
    BypassGovernanceRetention: bool = ...,
    ExpectedBucketOwner: str = ...,
    ChecksumAlgorithm: ChecksumAlgorithmType = ...,  # (3)
) -> DeleteObjectsOutputTypeDef:  # (4)
    ...
  1. See DeleteTypeDef
  2. See RequestPayerType
  3. See ChecksumAlgorithmType
  4. See DeleteObjectsOutputTypeDef
# delete_objects method usage example with argument unpacking

kwargs: DeleteObjectsRequestBucketDeleteObjectsTypeDef = {  # (1)
    "Delete": ...,
}

parent.delete_objects(**kwargs)
  1. See DeleteObjectsRequestBucketDeleteObjectsTypeDef

Bucket.download_file method#

Download an S3 object to a file.

Type annotations and code completion for boto3.resource("s3").download_file method. boto3 documentation

# download_file method definition

def download_file(
    self,
    Key: str,
    Filename: str,
    ExtraArgs: Dict[str, Any] = ...,
    Callback: Callable[..., Any] = ...,
    Config: TransferConfig = ...,
) -> None:
    ...
# download_file method usage example with argument unpacking

kwargs: BucketDownloadFileRequestTypeDef = {  # (1)
    "Key": ...,
    "Filename": ...,
}

parent.download_file(**kwargs)
  1. See BucketDownloadFileRequestTypeDef

Bucket.download_fileobj method#

Download an object from this bucket to a file-like-object.

Type annotations and code completion for boto3.resource("s3").download_fileobj method. boto3 documentation

# download_fileobj method definition

def download_fileobj(
    self,
    Key: str,
    Fileobj: Union[IO[Any], StreamingBody],
    ExtraArgs: Dict[str, Any] = ...,
    Callback: Callable[..., Any] = ...,
    Config: TransferConfig = ...,
) -> None:
    ...
# download_fileobj method usage example with argument unpacking

kwargs: BucketDownloadFileobjRequestTypeDef = {  # (1)
    "Key": ...,
    "Fileobj": ...,
}

parent.download_fileobj(**kwargs)
  1. See BucketDownloadFileobjRequestTypeDef

Bucket.get_available_subresources method#

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for boto3.resource("s3").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

Bucket.load method#

Calls s3.Client.list_buckets() to update the attributes of the Bucket resource.

Type annotations and code completion for boto3.resource("s3").load method. boto3 documentation

# load method definition

def load(
    self,
) -> None:
    ...

Bucket.put_object method#

Adds an object to a bucket.

Type annotations and code completion for boto3.resource("s3").put_object method. boto3 documentation

# put_object method definition

def put_object(
    self,
    *,
    Key: str,
    ACL: ObjectCannedACLType = ...,  # (1)
    Body: Union[str, bytes, IO[Any], StreamingBody] = ...,
    CacheControl: str = ...,
    ContentDisposition: str = ...,
    ContentEncoding: str = ...,
    ContentLanguage: str = ...,
    ContentLength: int = ...,
    ContentMD5: str = ...,
    ContentType: str = ...,
    ChecksumAlgorithm: ChecksumAlgorithmType = ...,  # (2)
    ChecksumCRC32: str = ...,
    ChecksumCRC32C: str = ...,
    ChecksumSHA1: str = ...,
    ChecksumSHA256: str = ...,
    Expires: Union[datetime, str] = ...,
    GrantFullControl: str = ...,
    GrantRead: str = ...,
    GrantReadACP: str = ...,
    GrantWriteACP: str = ...,
    Metadata: Mapping[str, str] = ...,
    ServerSideEncryption: ServerSideEncryptionType = ...,  # (3)
    StorageClass: StorageClassType = ...,  # (4)
    WebsiteRedirectLocation: str = ...,
    SSECustomerAlgorithm: str = ...,
    SSECustomerKey: str = ...,
    SSECustomerKeyMD5: str = ...,
    SSEKMSKeyId: str = ...,
    SSEKMSEncryptionContext: str = ...,
    BucketKeyEnabled: bool = ...,
    RequestPayer: RequestPayerType = ...,  # (5)
    Tagging: str = ...,
    ObjectLockMode: ObjectLockModeType = ...,  # (6)
    ObjectLockRetainUntilDate: Union[datetime, str] = ...,
    ObjectLockLegalHoldStatus: ObjectLockLegalHoldStatusType = ...,  # (7)
    ExpectedBucketOwner: str = ...,
) -> Object:
    ...
  1. See ObjectCannedACLType
  2. See ChecksumAlgorithmType
  3. See ServerSideEncryptionType
  4. See StorageClassType
  5. See RequestPayerType
  6. See ObjectLockModeType
  7. See ObjectLockLegalHoldStatusType
# put_object method usage example with argument unpacking

kwargs: PutObjectRequestBucketPutObjectTypeDef = {  # (1)
    "Key": ...,
}

parent.put_object(**kwargs)
  1. See PutObjectRequestBucketPutObjectTypeDef

Bucket.upload_file method#

Upload a file to an S3 object.

Type annotations and code completion for boto3.resource("s3").upload_file method. boto3 documentation

# upload_file method definition

def upload_file(
    self,
    Filename: str,
    Key: str,
    ExtraArgs: Dict[str, Any] = ...,
    Callback: Callable[..., Any] = ...,
    Config: TransferConfig = ...,
) -> None:
    ...
# upload_file method usage example with argument unpacking

kwargs: BucketUploadFileRequestTypeDef = {  # (1)
    "Filename": ...,
    "Key": ...,
}

parent.upload_file(**kwargs)
  1. See BucketUploadFileRequestTypeDef

Bucket.upload_fileobj method#

Upload a file-like object to this bucket.

Type annotations and code completion for boto3.resource("s3").upload_fileobj method. boto3 documentation

# upload_fileobj method definition

def upload_fileobj(
    self,
    Fileobj: Union[IO[Any], StreamingBody],
    Key: str,
    ExtraArgs: Dict[str, Any] = ...,
    Callback: Callable[..., Any] = ...,
    Config: TransferConfig = ...,
) -> None:
    ...
# upload_fileobj method usage example with argument unpacking

kwargs: BucketUploadFileobjRequestTypeDef = {  # (1)
    "Fileobj": ...,
    "Key": ...,
}

parent.upload_fileobj(**kwargs)
  1. See BucketUploadFileobjRequestTypeDef

Bucket.wait_until_exists method#

Waits until this Bucket is exists.

Type annotations and code completion for boto3.resource("s3").wait_until_exists method. boto3 documentation

# wait_until_exists method definition

def wait_until_exists(
    self,
) -> None:
    ...

Bucket.wait_until_not_exists method#

Waits until this Bucket is not exists.

Type annotations and code completion for boto3.resource("s3").wait_until_not_exists method. boto3 documentation

# wait_until_not_exists method definition

def wait_until_not_exists(
    self,
) -> None:
    ...

BucketAcl#

Type annotations and code completion for boto3.resource("s3").BucketAcl class. boto3 documentation

# BucketAcl usage example

from mypy_boto3_s3.service_resource import BucketAcl

def get_resource() -> BucketAcl:
    return boto3.resource("s3").BucketAcl(...)

BucketAcl attributes#

BucketAcl methods#

BucketAcl.Bucket method#

Creates a Bucket resource.

Type annotations and code completion for boto3.resource("s3").Bucket method. boto3 documentation

# Bucket method definition

def Bucket(
    self,
) -> Bucket:
    ...

BucketAcl.get_available_subresources method#

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for boto3.resource("s3").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

BucketAcl.load method#

Calls 🇵🇾meth:S3.Client.get_bucket_acl to update the attributes of the BucketAcl resource.

Type annotations and code completion for boto3.resource("s3").load method. boto3 documentation

# load method definition

def load(
    self,
) -> None:
    ...

BucketAcl.put method#

Sets the permissions on an existing bucket using access control lists (ACL).

Type annotations and code completion for boto3.resource("s3").put method. boto3 documentation

# put method definition

def put(
    self,
    *,
    ACL: BucketCannedACLType = ...,  # (1)
    AccessControlPolicy: AccessControlPolicyTypeDef = ...,  # (2)
    ChecksumAlgorithm: ChecksumAlgorithmType = ...,  # (3)
    GrantFullControl: str = ...,
    GrantRead: str = ...,
    GrantReadACP: str = ...,
    GrantWrite: str = ...,
    GrantWriteACP: str = ...,
    ExpectedBucketOwner: str = ...,
) -> None:
    ...
  1. See BucketCannedACLType
  2. See AccessControlPolicyTypeDef
  3. See ChecksumAlgorithmType
# put method usage example with argument unpacking

kwargs: PutBucketAclRequestBucketAclPutTypeDef = {  # (1)
    "ACL": ...,
}

parent.put(**kwargs)
  1. See PutBucketAclRequestBucketAclPutTypeDef

BucketAcl.reload method#

Calls 🇵🇾meth:S3.Client.get_bucket_acl to update the attributes of the BucketAcl resource.

Type annotations and code completion for boto3.resource("s3").reload method. boto3 documentation

# reload method definition

def reload(
    self,
) -> None:
    ...

BucketCors#

Type annotations and code completion for boto3.resource("s3").BucketCors class. boto3 documentation

# BucketCors usage example

from mypy_boto3_s3.service_resource import BucketCors

def get_resource() -> BucketCors:
    return boto3.resource("s3").BucketCors(...)

BucketCors attributes#

BucketCors methods#

BucketCors.Bucket method#

Creates a Bucket resource.

Type annotations and code completion for boto3.resource("s3").Bucket method. boto3 documentation

# Bucket method definition

def Bucket(
    self,
) -> Bucket:
    ...

BucketCors.delete method#

Deletes the cors configuration information set for the bucket.

Type annotations and code completion for boto3.resource("s3").delete method. boto3 documentation

# delete method definition

def delete(
    self,
    *,
    ExpectedBucketOwner: str = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

kwargs: DeleteBucketCorsRequestBucketCorsDeleteTypeDef = {  # (1)
    "ExpectedBucketOwner": ...,
}

parent.delete(**kwargs)
  1. See DeleteBucketCorsRequestBucketCorsDeleteTypeDef

BucketCors.get_available_subresources method#

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for boto3.resource("s3").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

BucketCors.load method#

Calls 🇵🇾meth:S3.Client.get_bucket_cors to update the attributes of the BucketCors resource.

Type annotations and code completion for boto3.resource("s3").load method. boto3 documentation

# load method definition

def load(
    self,
) -> None:
    ...

BucketCors.put method#

Sets the cors configuration for your bucket.

Type annotations and code completion for boto3.resource("s3").put method. boto3 documentation

# put method definition

def put(
    self,
    *,
    CORSConfiguration: CORSConfigurationTypeDef,  # (1)
    ChecksumAlgorithm: ChecksumAlgorithmType = ...,  # (2)
    ExpectedBucketOwner: str = ...,
) -> None:
    ...
  1. See CORSConfigurationTypeDef
  2. See ChecksumAlgorithmType
# put method usage example with argument unpacking

kwargs: PutBucketCorsRequestBucketCorsPutTypeDef = {  # (1)
    "CORSConfiguration": ...,
}

parent.put(**kwargs)
  1. See PutBucketCorsRequestBucketCorsPutTypeDef

BucketCors.reload method#

Calls 🇵🇾meth:S3.Client.get_bucket_cors to update the attributes of the BucketCors resource.

Type annotations and code completion for boto3.resource("s3").reload method. boto3 documentation

# reload method definition

def reload(
    self,
) -> None:
    ...

BucketLifecycle#

Type annotations and code completion for boto3.resource("s3").BucketLifecycle class. boto3 documentation

# BucketLifecycle usage example

from mypy_boto3_s3.service_resource import BucketLifecycle

def get_resource() -> BucketLifecycle:
    return boto3.resource("s3").BucketLifecycle(...)

BucketLifecycle attributes#

BucketLifecycle methods#

BucketLifecycle.Bucket method#

Creates a Bucket resource.

Type annotations and code completion for boto3.resource("s3").Bucket method. boto3 documentation

# Bucket method definition

def Bucket(
    self,
) -> Bucket:
    ...

BucketLifecycle.delete method#

Deletes the lifecycle configuration from the specified bucket.

Type annotations and code completion for boto3.resource("s3").delete method. boto3 documentation

# delete method definition

def delete(
    self,
    *,
    ExpectedBucketOwner: str = ...,
) -> None:
    ...
# delete method usage example with argument unpacking

kwargs: DeleteBucketLifecycleRequestBucketLifecycleDeleteTypeDef = {  # (1)
    "ExpectedBucketOwner": ...,
}

parent.delete(**kwargs)
  1. See DeleteBucketLifecycleRequestBucketLifecycleDeleteTypeDef

BucketLifecycle.get_available_subresources method#

Returns a list of all the available sub-resources for this Resource.

Type annotations and code completion for boto3.resource("s3").get_available_subresources method. boto3 documentation

# get_available_subresources method definition

def get_available_subresources(
    self,
) -> Sequence[str]:
    ...

BucketLifecycle.load method#

Calls 🇵🇾meth:S3.Client.get_bucket_lifecycle to update the attributes of the BucketLifecycle resource.

Type annotations and code completion for boto3.resource("s3").load method. boto3 documentation

# load method definition

def load(
    self,
) -> None:
    ...

BucketLifecycle.put method#

.

Type annotations and code completion for boto3.resource("s3").put method.