Reference documentation and code samples for the Cloud Storage API class Google::Cloud::Storage::HmacKey.
HmacKey
Represents the metadata for an HMAC key, and also includes the key's secret if returned by the Project#create_hmac_key creation method.
Inherits
- Object
Example
require "google/cloud/storage" storage = Google::Cloud::Storage.new service_account_email = "my_account@developer.gserviceaccount.com" hmac_key = storage.create_hmac_key service_account_email hmac_key.secret # ... hmac_key = storage.hmac_key hmac_key.access_id hmac_key.secret # nil hmac_key.inactive! hmac_key.delete
Methods
#access_id
def access_id() -> StringThe ID of the HMAC Key.
- (String)
#active!
def active!() -> Google::Cloud::Storage::HmacKeyUpdates the state of the HMAC key to ACTIVE.
- (Google::Cloud::Storage::HmacKey) — Returns the HMAC key for method chaining.
require "google/cloud/storage" storage = Google::Cloud::Storage.new hmac_key = storage.hmac_keys.first hmac_key.active! hmac_key.state # "ACTIVE"
#active?
def active?() -> BooleanWhether the state of the HMAC key is ACTIVE.
- (Boolean)
#api_url
def api_url() -> StringA URL that can be used to access the HMAC key using the REST API.
- (String)
#created_at
def created_at() -> StringCreation time of the HMAC key.
- (String)
#delete
def delete() -> Google::Cloud::Storage::HmacKeyDeletes the HMAC key, and loads the new state of the HMAC key,
which will be DELETED.
The API call to delete the HMAC key may be retried under certain conditions. See Google::Cloud#storage to control this behavior.
- (Google::Cloud::Storage::HmacKey) — Returns the HMAC key for method chaining.
require "google/cloud/storage" storage = Google::Cloud::Storage.new hmac_key = storage.hmac_keys.first hmac_key.inactive!.delete!
#delete!
def delete!() -> Google::Cloud::Storage::HmacKeyDeletes the HMAC key, and loads the new state of the HMAC key,
which will be DELETED.
The API call to delete the HMAC key may be retried under certain conditions. See Google::Cloud#storage to control this behavior.
- (Google::Cloud::Storage::HmacKey) — Returns the HMAC key for method chaining.
require "google/cloud/storage" storage = Google::Cloud::Storage.new hmac_key = storage.hmac_keys.first hmac_key.inactive!.delete!
#deleted?
def deleted?() -> BooleanWhether the state of the HMAC key is DELETED.
- (Boolean)
#etag
def etag() -> StringHTTP 1.1 Entity tag for the HMAC key.
- (String)
#id
def id() -> StringThe ID of the HMAC key, including the Project ID and the Access ID.
- (String)
#inactive!
def inactive!() -> Google::Cloud::Storage::HmacKeyUpdates the state of the HMAC key to INACTIVE.
- (Google::Cloud::Storage::HmacKey) — Returns the HMAC key for method chaining.
require "google/cloud/storage" storage = Google::Cloud::Storage.new hmac_key = storage.hmac_keys.first hmac_key.inactive! hmac_key.state # "INACTIVE"
#inactive?
def inactive?() -> BooleanWhether the state of the HMAC key is INACTIVE.
- (Boolean)
#project_id
def project_id() -> StringProject ID owning the service account to which the key authenticates.
- (String)
#refresh!
def refresh!()Reloads the HMAC key with current data from the Storage service.
#reload!
def reload!()Reloads the HMAC key with current data from the Storage service.
#secret
def secret() -> String, nilHMAC secret key material, or nil if
the key was not returned by the Project#create_hmac_key creation
method.
- (String, nil) — the current value of secret
#service_account_email
def service_account_email() -> StringThe email address of the key's associated service account.
- (String)
#state
def state() -> StringThe state of the key. Can be one of ACTIVE, INACTIVE, or
DELETED.
- (String)
#updated_at
def updated_at() -> StringLast modification time of the HMAC key metadata.
- (String)