pub struct HmacKey {
    pub kind: String,
    pub metadata: HmacMeta,
    pub secret: String,
}
Expand description

The HmacKey resource represents an HMAC key within Cloud Storage. The resource consists of a secret and HmacMeta. HMAC keys can be used as credentials for service accounts. For more information, see HMAC Keys.

Note that the HmacKey resource is only returned when you use HmacKey::create. Other methods, such as HmacKey::read, return the metadata portion of the HMAC key resource.

Fields

kind: String

The kind of item this is. For HMAC keys, this is always storage#hmacKey.

metadata: HmacMeta

HMAC key metadata.

secret: String

HMAC secret key material.

Implementations

Creates a new HMAC key for the specified service account.

The authenticated user must have storage.hmacKeys.create permission for the project in which the key will be created.

For general information about HMAC keys in Cloud Storage, see HMAC Keys.

Example
use cloud_storage::hmac_key::HmacKey;

let hmac_key = HmacKey::create().await?;

The synchronous equivalent of HmacKey::create.

Features

This function requires that the feature flag sync is enabled in Cargo.toml.

Retrieves a list of HMAC keys matching the criteria. Since the HmacKey is secret, this does not return a HmacKey, but a HmacMeta. This is a redacted version of a HmacKey, but with the secret data omitted.

The authenticated user must have storage.hmacKeys.list permission for the project in which the key exists.

For general information about HMAC keys in Cloud Storage, see HMAC Keys.

Example
use cloud_storage::hmac_key::HmacKey;

let all_hmac_keys = HmacKey::list().await?;

The synchronous equivalent of HmacKey::list.

Features

This function requires that the feature flag sync is enabled in Cargo.toml.

Retrieves an HMAC key’s metadata. Since the HmacKey is secret, this does not return a HmacKey, but a HmacMeta. This is a redacted version of a HmacKey, but with the secret data omitted.

The authenticated user must have storage.hmacKeys.get permission for the project in which the key exists.

For general information about HMAC keys in Cloud Storage, see HMAC Keys.

Example
use cloud_storage::hmac_key::HmacKey;

let key = HmacKey::read("some identifier").await?;

The synchronous equivalent of HmacKey::read.

Features

This function requires that the feature flag sync is enabled in Cargo.toml.

Updates the state of an HMAC key. See the HMAC Key resource descriptor for valid states. Since the HmacKey is secret, this does not return a HmacKey, but a HmacMeta. This is a redacted version of a HmacKey, but with the secret data omitted.

The authenticated user must have storage.hmacKeys.update permission for the project in which the key exists.

For general information about HMAC keys in Cloud Storage, see HMAC Keys.

Example
use cloud_storage::hmac_key::{HmacKey, HmacState};

let key = HmacKey::update("your key", HmacState::Active).await?;

The synchronous equivalent of HmacKey::update.

Features

This function requires that the feature flag sync is enabled in Cargo.toml.

Deletes an HMAC key. Note that a key must be set to Inactive first.

The authenticated user must have storage.hmacKeys.delete permission for the project in which the key exists.

For general information about HMAC keys in Cloud Storage, see HMAC Keys.

Example
use cloud_storage::hmac_key::{HmacKey, HmacState};

let key = HmacKey::update("your key", HmacState::Inactive).await?; // this is required.
HmacKey::delete(&key.access_id).await?;

The synchronous equivalent of HmacKey::delete.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more