[−][src]Struct cloud_storage::hmac_key::HmacKey
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.
Methods
impl HmacKey
[src]
pub fn create() -> Result<Self, Error>
[src]
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()?;
pub fn list() -> Result<Vec<HmacMeta>, Error>
[src]
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()?;
pub fn read(access_id: &str) -> Result<HmacMeta, Error>
[src]
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")?;
pub fn update(access_id: &str, state: HmacState) -> Result<HmacMeta, Error>
[src]
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)?;
pub fn delete(access_id: &str) -> Result<(), Error>
[src]
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)?; // this is required. HmacKey::delete(&key.access_id)?;
Trait Implementations
impl Debug for HmacKey
[src]
impl<'de> Deserialize<'de> for HmacKey
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<HmacKey> for HmacKey
[src]
impl Serialize for HmacKey
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for HmacKey
[src]
Auto Trait Implementations
impl RefUnwindSafe for HmacKey
impl Send for HmacKey
impl Sync for HmacKey
impl Unpin for HmacKey
impl UnwindSafe for HmacKey
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: for<'de> Deserialize<'de>,
[src]
T: for<'de> 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>,