pub struct Object { /* private fields */ }
Expand description
Helper struct used to collate all of the operations available for Objects Additionally, it can also be used to specify a custom authority.
Implementations§
source§impl Object
impl Object
sourcepub fn delete<'a, OID>(
&self,
id: &OID,
optional: Option<DeleteObjectOptional<'_>>
) -> Result<Request<Empty>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
pub fn delete<'a, OID>(
&self,
id: &OID,
optional: Option<DeleteObjectOptional<'_>>
) -> Result<Request<Empty>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.
Required IAM Permissions: storage.objects.delete
source§impl Object
impl Object
source§impl Object
impl Object
source§impl Object
impl Object
sourcepub fn insert_multipart<B>(
&self,
bucket: &BucketName<'_>,
content: B,
length: u64,
metadata: &Metadata,
optional: Option<InsertObjectOptional<'_>>
) -> Result<Request<Multipart<B>>, Error>
pub fn insert_multipart<B>( &self, bucket: &BucketName<'_>, content: B, length: u64, metadata: &Metadata, optional: Option<InsertObjectOptional<'_>> ) -> Result<Request<Multipart<B>>, Error>
Stores a new object and metadata.
- Maximum file size:
5TB
- Accepted Media MIME types:
*/*
This method differs from insert_simple
in that it performs a
multipart upload
which allows you specify both the object data and its metadata in a single
request, instead of having to do an additional request to set the metadata.
NOTE: You must specify the name
field in the metadata provided to this function
with a valid object name. Only the content_type
specified in metadata
will be used,
the content_type
in optional
will be ignored.
Required IAM Permissions: storage.objects.create
, storage.objects.delete
Note: storage.objects.delete
is only needed if an object with the same
name already exists.
source§impl Object
impl Object
sourcepub fn resumable_insert_init<'a, OID>(
&self,
id: &OID,
content_type: Option<&str>
) -> Result<Request<()>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
pub fn resumable_insert_init<'a, OID>(
&self,
id: &OID,
content_type: Option<&str>
) -> Result<Request<()>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
Initiates a resumable upload session.
- Accepted Media MIME types:
*/*
Note: A resumable upload must be completed within a week of being initiated.
CAUTION: Be careful when sharing the resumable session URI, because it can be used by anyone to upload data to the target bucket without any further authentication.
Required IAM Permissions: storage.objects.create
, storage.objects.delete
Note: storage.objects.delete
is only needed if an object with the same
name already exists.
sourcepub fn resumable_cancel(session: ResumableSession) -> Result<Request<()>, Error>
pub fn resumable_cancel(session: ResumableSession) -> Result<Request<()>, Error>
Cancels an incomplete resumable upload and prevent any further action for
session_uri
, which should have been obtained using [Object::init_resumable_insert
]
sourcepub fn resumable_append<B>(
session: ResumableSession,
content: B,
length: u64
) -> Result<Request<B>, Error>
pub fn resumable_append<B>( session: ResumableSession, content: B, length: u64 ) -> Result<Request<B>, Error>
Performs resumable upload to the specified session_uri
, which should
have been obtained using [Object::init_resumable_insert
]
- Maximum total object size:
5TB
There are two ways to upload the object’s data:
- For single chunk upload, set
length
to the total size of the object. - For multiple chunks upload, set
length
to the size of current chunk that is being uploaded andContent-Range
header asbytes CHUNK_FIRST_BYTE-CHUNK_LAST_BYTE/TOTAL_OBJECT_SIZE
where:CHUNK_FIRST_BYTE
is the starting byte in the overall object that the chunk you’re uploading contains.CHUNK_LAST_BYTE
is the ending byte in the overall object that the chunk you’re uploading contains.TOTAL_OBJECT_SIZE
is the total size of the object you are uploading.
NOTE: length
should be a multiple of 256KiB, unless it’s the last
chunk. If not, the server will not accept all bytes sent in the request.
Also, it is recommended to use at least 8MiB.
source§impl Object
impl Object
sourcepub fn insert_simple<'a, OID, B>(
&self,
id: &OID,
content: B,
length: u64,
optional: Option<InsertObjectOptional<'_>>
) -> Result<Request<B>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
pub fn insert_simple<'a, OID, B>(
&self,
id: &OID,
content: B,
length: u64,
optional: Option<InsertObjectOptional<'_>>
) -> Result<Request<B>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
Stores a new object and metadata.
- Maximum file size:
5TB
- Accepted Media MIME types:
*/*
Required IAM Permissions: storage.objects.create
, storage.objects.delete
Note: storage.objects.delete
is only needed if an object with the same
name already exists.
source§impl Object
impl Object
sourcepub fn list(
&self,
bucket: &BucketName<'_>,
optional: Option<ListOptional<'_>>
) -> Result<Request<Empty>, Error>
pub fn list( &self, bucket: &BucketName<'_>, optional: Option<ListOptional<'_>> ) -> Result<Request<Empty>, Error>
Retrieves a list of objects matching the criteria.
Required IAM Permissions: storage.objects.list
, storage.objects.getIamPolicy
*
source§impl Object
impl Object
sourcepub fn patch<'a, OID>(
&self,
id: &OID,
metadata: &Metadata,
optional: Option<PatchObjectOptional<'_>>
) -> Result<Request<Cursor<Vec<u8>>>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
pub fn patch<'a, OID>(
&self,
id: &OID,
metadata: &Metadata,
optional: Option<PatchObjectOptional<'_>>
) -> Result<Request<Cursor<Vec<u8>>>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
Updates a data blob’s associated metadata.
Required IAM Permissions: storage.objects.get
, storage.objects.update
source§impl Object
impl Object
sourcepub fn rewrite<'a, OID>(
&self,
source: &OID,
destination: &OID,
rewrite_token: Option<String>,
metadata: Option<&Metadata>,
optional: Option<RewriteObjectOptional<'_>>
) -> Result<Request<Cursor<Vec<u8>>>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
pub fn rewrite<'a, OID>(
&self,
source: &OID,
destination: &OID,
rewrite_token: Option<String>,
metadata: Option<&Metadata>,
optional: Option<RewriteObjectOptional<'_>>
) -> Result<Request<Cursor<Vec<u8>>>, Error>where
OID: ObjectIdentifier<'a> + ?Sized,
Rewrites a source object to a destination object. Optionally overrides metadata.
Required IAM Permissions:
storage.objects.create
(for the destination bucket)storage.objects.delete
(for the destination bucket)storage.objects.get
(for the source bucket)