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
from mypy_boto3_s3.service_resource import S3ServiceResource
def get_s3_resource() -> S3ServiceResource:
return boto3.resource("s3")
Attributes
-
meta
: S3ResourceMeta -
buckets
: ServiceResourceBucketsCollection
Collections
ServiceResourceBucketsCollection
Provides access to Bucket resource.
Type annotations and code completion for boto3.resource("s3").buckets
collection.
boto3 documentation
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
kwargs: ServiceResourceBucketRequestTypeDef = { # (1)
"name": ...,
}
parent.Bucket(**kwargs)
S3ServiceResource.BucketAcl method
Creates a BucketAcl resource.
Type annotations and code completion for boto3.resource("s3").BucketAcl
method.
boto3 documentation
kwargs: ServiceResourceBucketAclRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketAcl(**kwargs)
S3ServiceResource.BucketCors method
Creates a BucketCors resource.
Type annotations and code completion for boto3.resource("s3").BucketCors
method.
boto3 documentation
kwargs: ServiceResourceBucketCorsRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketCors(**kwargs)
S3ServiceResource.BucketLifecycle method
Creates a BucketLifecycle resource.
Type annotations and code completion for boto3.resource("s3").BucketLifecycle
method.
boto3 documentation
kwargs: ServiceResourceBucketLifecycleRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketLifecycle(**kwargs)
S3ServiceResource.BucketLifecycleConfiguration method
Creates a BucketLifecycleConfiguration resource.
Type annotations and code completion for boto3.resource("s3").BucketLifecycleConfiguration
method.
boto3 documentation
def BucketLifecycleConfiguration(
self,
bucket_name: str,
) -> BucketLifecycleConfiguration:
...
kwargs: ServiceResourceBucketLifecycleConfigurationRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketLifecycleConfiguration(**kwargs)
S3ServiceResource.BucketLogging method
Creates a BucketLogging resource.
Type annotations and code completion for boto3.resource("s3").BucketLogging
method.
boto3 documentation
kwargs: ServiceResourceBucketLoggingRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketLogging(**kwargs)
S3ServiceResource.BucketNotification method
Creates a BucketNotification resource.
Type annotations and code completion for boto3.resource("s3").BucketNotification
method.
boto3 documentation
kwargs: ServiceResourceBucketNotificationRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketNotification(**kwargs)
S3ServiceResource.BucketPolicy method
Creates a BucketPolicy resource.
Type annotations and code completion for boto3.resource("s3").BucketPolicy
method.
boto3 documentation
kwargs: ServiceResourceBucketPolicyRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketPolicy(**kwargs)
S3ServiceResource.BucketRequestPayment method
Creates a BucketRequestPayment resource.
Type annotations and code completion for boto3.resource("s3").BucketRequestPayment
method.
boto3 documentation
kwargs: ServiceResourceBucketRequestPaymentRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketRequestPayment(**kwargs)
S3ServiceResource.BucketTagging method
Creates a BucketTagging resource.
Type annotations and code completion for boto3.resource("s3").BucketTagging
method.
boto3 documentation
kwargs: ServiceResourceBucketTaggingRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketTagging(**kwargs)
S3ServiceResource.BucketVersioning method
Creates a BucketVersioning resource.
Type annotations and code completion for boto3.resource("s3").BucketVersioning
method.
boto3 documentation
kwargs: ServiceResourceBucketVersioningRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketVersioning(**kwargs)
S3ServiceResource.BucketWebsite method
Creates a BucketWebsite resource.
Type annotations and code completion for boto3.resource("s3").BucketWebsite
method.
boto3 documentation
kwargs: ServiceResourceBucketWebsiteRequestTypeDef = { # (1)
"bucket_name": ...,
}
parent.BucketWebsite(**kwargs)
S3ServiceResource.MultipartUpload method
Creates a MultipartUpload resource.
Type annotations and code completion for boto3.resource("s3").MultipartUpload
method.
boto3 documentation
def MultipartUpload(
self,
bucket_name: str,
object_key: str,
id: str,
) -> MultipartUpload:
...
kwargs: ServiceResourceMultipartUploadRequestTypeDef = { # (1)
"bucket_name": ...,
"object_key": ...,
"id": ...,
}
parent.MultipartUpload(**kwargs)
S3ServiceResource.MultipartUploadPart method
Creates a MultipartUploadPart resource.
Type annotations and code completion for boto3.resource("s3").MultipartUploadPart
method.
boto3 documentation
def MultipartUploadPart(
self,
bucket_name: str,
object_key: str,
multipart_upload_id: str,
part_number: str,
) -> MultipartUploadPart:
...
kwargs: ServiceResourceMultipartUploadPartRequestTypeDef = { # (1)
"bucket_name": ...,
"object_key": ...,
"multipart_upload_id": ...,
"part_number": ...,
}
parent.MultipartUploadPart(**kwargs)
S3ServiceResource.Object method
Creates a Object resource.
Type annotations and code completion for boto3.resource("s3").Object
method.
boto3 documentation
kwargs: ServiceResourceObjectRequestTypeDef = { # (1)
"bucket_name": ...,
"key": ...,
}
parent.Object(**kwargs)
S3ServiceResource.ObjectAcl method
Creates a ObjectAcl resource.
Type annotations and code completion for boto3.resource("s3").ObjectAcl
method.
boto3 documentation
kwargs: ServiceResourceObjectAclRequestTypeDef = { # (1)
"bucket_name": ...,
"object_key": ...,
}
parent.ObjectAcl(**kwargs)
S3ServiceResource.ObjectSummary method
Creates a ObjectSummary resource.
Type annotations and code completion for boto3.resource("s3").ObjectSummary
method.
boto3 documentation
kwargs: ServiceResourceObjectSummaryRequestTypeDef = { # (1)
"bucket_name": ...,
"key": ...,
}
parent.ObjectSummary(**kwargs)
S3ServiceResource.ObjectVersion method
Creates a ObjectVersion resource.
Type annotations and code completion for boto3.resource("s3").ObjectVersion
method.
boto3 documentation
def ObjectVersion(
self,
bucket_name: str,
object_key: str,
id: str,
) -> ObjectVersion:
...
kwargs: ServiceResourceObjectVersionRequestTypeDef = { # (1)
"bucket_name": ...,
"object_key": ...,
"id": ...,
}
parent.ObjectVersion(**kwargs)
S3ServiceResource.create_bucket method
Creates a new S3 bucket.
Type annotations and code completion for boto3.resource("s3").create_bucket
method.
boto3 documentation
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:
...
kwargs: CreateBucketRequestServiceResourceCreateBucketTypeDef = { # (1)
"Bucket": ...,
}
parent.create_bucket(**kwargs)
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
Bucket
Type annotations and code completion for boto3.resource("s3").Bucket
class.
boto3 documentation
from mypy_boto3_s3.service_resource import Bucket
def get_resource() -> Bucket:
return boto3.resource("s3").Bucket(...)
Bucket attributes
creation_date
:datetime
name
:str
multipart_uploads
: BucketMultipartUploadsCollectionobject_versions
: BucketObjectVersionsCollectionobjects
: BucketObjectsCollection
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
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
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
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
Bucket.Cors method
Creates a BucketCors resource.
Type annotations and code completion for boto3.resource("s3").Cors
method.
boto3 documentation
Bucket.Lifecycle method
Creates a BucketLifecycle resource.
Type annotations and code completion for boto3.resource("s3").Lifecycle
method.
boto3 documentation
Bucket.LifecycleConfiguration method
Creates a BucketLifecycleConfiguration resource.
Type annotations and code completion for boto3.resource("s3").LifecycleConfiguration
method.
boto3 documentation
Bucket.Logging method
Creates a BucketLogging resource.
Type annotations and code completion for boto3.resource("s3").Logging
method.
boto3 documentation
Bucket.Notification method
Creates a BucketNotification resource.
Type annotations and code completion for boto3.resource("s3").Notification
method.
boto3 documentation
Bucket.Object method
Creates a Object resource.
Type annotations and code completion for boto3.resource("s3").Object
method.
boto3 documentation
kwargs: BucketObjectRequestTypeDef = { # (1)
"key": ...,
}
parent.Object(**kwargs)
Bucket.Policy method
Creates a BucketPolicy resource.
Type annotations and code completion for boto3.resource("s3").Policy
method.
boto3 documentation
Bucket.RequestPayment method
Creates a BucketRequestPayment resource.
Type annotations and code completion for boto3.resource("s3").RequestPayment
method.
boto3 documentation
Bucket.Tagging method
Creates a BucketTagging resource.
Type annotations and code completion for boto3.resource("s3").Tagging
method.
boto3 documentation
Bucket.Versioning method
Creates a BucketVersioning resource.
Type annotations and code completion for boto3.resource("s3").Versioning
method.
boto3 documentation
Bucket.Website method
Creates a BucketWebsite resource.
Type annotations and code completion for boto3.resource("s3").Website
method.
boto3 documentation
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
def copy(
self,
CopySource: CopySourceTypeDef, # (1)
Key: str,
ExtraArgs: Dict[str, Any] = ...,
Callback: Callable[..., Any] = ...,
SourceClient: BaseClient = ...,
Config: TransferConfig = ...,
) -> None:
...
kwargs: BucketCopyRequestTypeDef = { # (1)
"CopySource": ...,
"Key": ...,
}
parent.copy(**kwargs)
Bucket.create method
Creates a new S3 bucket.
Type annotations and code completion for boto3.resource("s3").create
method.
boto3 documentation
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)
...
- See BucketCannedACLType
- See CreateBucketConfigurationTypeDef
- See ObjectOwnershipType
- See CreateBucketOutputTypeDef
kwargs: CreateBucketRequestBucketCreateTypeDef = { # (1)
"ACL": ...,
}
parent.create(**kwargs)
Bucket.delete method
Deletes the S3 bucket.
Type annotations and code completion for boto3.resource("s3").delete
method.
boto3 documentation
kwargs: DeleteBucketRequestBucketDeleteTypeDef = { # (1)
"ExpectedBucketOwner": ...,
}
parent.delete(**kwargs)
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
def delete_objects(
self,
*,
Delete: DeleteTypeDef, # (1)
MFA: str = ...,
RequestPayer: RequestPayerType = ..., # (2)
BypassGovernanceRetention: bool = ...,
ExpectedBucketOwner: str = ...,
ChecksumAlgorithm: ChecksumAlgorithmType = ..., # (3)
) -> DeleteObjectsOutputTypeDef: # (4)
...
- See DeleteTypeDef
- See RequestPayerType
- See ChecksumAlgorithmType
- See DeleteObjectsOutputTypeDef
kwargs: DeleteObjectsRequestBucketDeleteObjectsTypeDef = { # (1)
"Delete": ...,
}
parent.delete_objects(**kwargs)
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
def download_file(
self,
Key: str,
Filename: str,
ExtraArgs: Dict[str, Any] = ...,
Callback: Callable[..., Any] = ...,
Config: TransferConfig = ...,
) -> None:
...
kwargs: BucketDownloadFileRequestTypeDef = { # (1)
"Key": ...,
"Filename": ...,
}
parent.download_file(**kwargs)
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
def download_fileobj(
self,
Key: str,
Fileobj: Union[IO[Any], StreamingBody],
ExtraArgs: Dict[str, Any] = ...,
Callback: Callable[..., Any] = ...,
Config: TransferConfig = ...,
) -> None:
...
kwargs: BucketDownloadFileobjRequestTypeDef = { # (1)
"Key": ...,
"Fileobj": ...,
}
parent.download_fileobj(**kwargs)
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
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
Bucket.put_object method
Adds an object to a bucket.
Type annotations and code completion for boto3.resource("s3").put_object
method.
boto3 documentation
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:
...