[−][src]Struct cloud_storage::object::Object
A resource representing a file in Google Cloud Storage.
Fields
kind: StringThe kind of item this is. For objects, this is always storage#object.
id: StringThe ID of the object, including the bucket name, object name, and generation number.
self_link: StringThe link to this object.
name: StringThe name of the object. Required if not specified by URL parameter.
bucket: StringThe name of the bucket containing this object.
generation: i64The content generation of this object. Used for object versioning.
metageneration: i64The version of the metadata for this object at this generation. Used for preconditions and for detecting changes in metadata. A metageneration number is only meaningful in the context of a particular generation of a particular object.
content_type: Option<String>Content-Type of the object data. If an object is stored without a Content-Type, it is served as application/octet-stream.
time_created: DateTime<Utc>The creation time of the object in RFC 3339 format.
updated: DateTime<Utc>The modification time of the object metadata in RFC 3339 format.
time_deleted: Option<DateTime<Utc>>The deletion time of the object in RFC 3339 format. Returned if and only if this version of the object is no longer a live version, but remains in the bucket as a noncurrent version.
temporary_hold: Option<bool>Whether or not the object is subject to a temporary hold.
event_based_hold: Option<bool>Whether or not the object is subject to an event-based hold.
retention_expiration_time: Option<DateTime<Utc>>The earliest time that the object can be deleted, based on a bucket's retention policy, in RFC 3339 format.
storage_class: StringStorage class of the object.
time_storage_class_updated: DateTime<Utc>The time at which the object's storage class was last changed. When the object is initially created, it will be set to timeCreated.
size: u64Content-Length of the data in bytes.
md5_hash: Option<String>MD5 hash of the data; encoded using base64. For more information about using the MD5 hash, see Hashes and ETags: Best Practices.
media_link: StringMedia download link.
content_encoding: Option<String>Content-Encoding of the object data.
content_disposition: Option<String>Content-Disposition of the object data.
content_language: Option<String>Content-Language of the object data.
cache_control: Option<String>Cache-Control directive for the object data. If omitted, and the object is accessible to all anonymous users, the default will be public, max-age=3600.
metadata: Option<HashMap<String, String>>User-provided metadata, in key/value pairs.
acl: Option<Vec<ObjectAccessControl>>Access controls on the object, containing one or more objectAccessControls Resources. If iamConfiguration.uniformBucketLevelAccess.enabled is set to true, this field is omitted in responses, and requests that specify this field fail.
owner: Option<Owner>The owner of the object. This will always be the uploader of the object. If
iamConfiguration.uniformBucketLevelAccess.enabled is set to true, this field does not
apply, and is omitted in responses.
crc32c: StringCRC32c checksum, as described in RFC 4960, Appendix B; encoded using base64 in big-endian byte order. For more information about using the CRC32c checksum, see Hashes and ETags: Best Practices.
component_count: Option<i32>Number of underlying components that make up a composite object. Components are accumulated by compose operations, counting 1 for each non-composite source object and componentCount for each composite source object. Note: componentCount is included in the metadata for composite objects only.
etag: StringHTTP 1.1 Entity tag for the object.
customer_encryption: Option<CustomerEncrypton>Metadata of customer-supplied encryption key, if the object is encrypted by such a key.
kms_key_name: Option<String>Cloud KMS Key used to encrypt this object, if the object is encrypted by such a key.
Methods
impl Object[src]
pub fn create(
bucket: &str,
file: &[u8],
filename: &str,
mime_type: &str
) -> Result<Self, Error>[src]
bucket: &str,
file: &[u8],
filename: &str,
mime_type: &str
) -> Result<Self, Error>
Create a new object. Upload a file as that is loaded in memory to google cloud storage, where it will be interpreted according to the mime type you specified.
Example
use cloud_storage::Object; let file: Vec<u8> = read_cute_cat("cat.png"); Object::create("cat-photos", &file, "recently read cat.png", "image/png") .expect("cat not uploaded");
pub fn list(bucket: &str) -> Result<Vec<Self>, Error>[src]
Obtain a list of objects within this Bucket.
Example
use cloud_storage::Object; let all_objects = Object::list("my_bucket").unwrap();
pub fn read(bucket: &str, file_name: &str) -> Result<Self, Error>[src]
Read a single object.
pub fn update(&self) -> Result<Self, Error>[src]
Modify this object
pub fn delete(self) -> Result<(), Error>[src]
Delete this object
pub fn compose(
bucket: &str,
req: &ComposeRequest,
destination_object: &str
) -> Result<Self, Error>[src]
bucket: &str,
req: &ComposeRequest,
destination_object: &str
) -> Result<Self, Error>
Allows composing up to 32 objects into a single one.
pub fn copy(&self, destination_bucket: &str, path: &str) -> Result<Self, Error>[src]
Copy this object to the target bucket and path
pub fn rewrite(
&self,
destination_bucket: &str,
path: &str
) -> Result<Self, Error>[src]
&self,
destination_bucket: &str,
path: &str
) -> Result<Self, Error>
Moves a file from the current location to the target bucket and path.
Limitations
This function does not yet support rewriting objects to another
- Geographical Location,
- Encryption,
- Storage class. These limitations mean that for now, the rewrite and the copy methods do the same thing.
pub fn download_url(&self, duration: u32) -> String[src]
Creates a Signed Url
which is valid for duration seconds, and lets the posessor download the file contents
without any authentication.
pub fn upload_url(&self, duration: u32) -> String[src]
Creates a Signed Url
which is valid for duration seconds, and lets the posessor upload new file contents.
without any authentication.
Trait Implementations
impl Debug for Object[src]
impl<'de> Deserialize<'de> for Object[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl PartialEq<Object> for Object[src]
impl Serialize for Object[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructuralPartialEq for Object[src]
Auto Trait Implementations
impl RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl UnwindSafe for Object
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,