Cloud Storage API - Class Google::Cloud::Storage::HmacKey (v1.38.0)

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() -> String

The ID of the HMAC Key.

Returns
  • (String)

#active!

def active!() -> Google::Cloud::Storage::HmacKey

Updates the state of the HMAC key to ACTIVE.

Returns
Example
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?() -> Boolean

Whether the state of the HMAC key is ACTIVE.

Returns
  • (Boolean)

#api_url

def api_url() -> String

A URL that can be used to access the HMAC key using the REST API.

Returns
  • (String)

#created_at

def created_at() -> String

Creation time of the HMAC key.

Returns
  • (String)

#delete

def delete() -> Google::Cloud::Storage::HmacKey
Alias Of: #delete!

Deletes 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.

Returns
Example
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::HmacKey
Aliases

Deletes 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.

Returns
Example
require "google/cloud/storage"

storage = Google::Cloud::Storage.new

hmac_key = storage.hmac_keys.first

hmac_key.inactive!.delete!

#deleted?

def deleted?() -> Boolean

Whether the state of the HMAC key is DELETED.

Returns
  • (Boolean)

#etag

def etag() -> String

HTTP 1.1 Entity tag for the HMAC key.

Returns
  • (String)

#id

def id() -> String

The ID of the HMAC key, including the Project ID and the Access ID.

Returns
  • (String)

#inactive!

def inactive!() -> Google::Cloud::Storage::HmacKey

Updates the state of the HMAC key to INACTIVE.

Returns
Example
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?() -> Boolean

Whether the state of the HMAC key is INACTIVE.

Returns
  • (Boolean)

#project_id

def project_id() -> String

Project ID owning the service account to which the key authenticates.

Returns
  • (String)

#refresh!

def refresh!()
Alias Of: #reload!

Reloads the HMAC key with current data from the Storage service.

#reload!

def reload!()
Aliases

Reloads the HMAC key with current data from the Storage service.

#secret

def secret() -> String, nil

HMAC secret key material, or nil if the key was not returned by the Project#create_hmac_key creation method.

Returns
  • (String, nil) — the current value of secret

#service_account_email

def service_account_email() -> String

The email address of the key's associated service account.

Returns
  • (String)

#state

def state() -> String

The state of the key. Can be one of ACTIVE, INACTIVE, or DELETED.

Returns
  • (String)

#updated_at

def updated_at() -> String

Last modification time of the HMAC key metadata.

Returns
  • (String)