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.
- (String)
#active!
def active!() -> Google::Cloud::Storage::HmacKey
Updates 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?() -> Boolean
Whether the state of the HMAC key is ACTIVE
.
- (Boolean)
#api_url
def api_url() -> String
A URL that can be used to access the HMAC key using the REST API.
- (String)
#created_at
def created_at() -> String
Creation time of the HMAC key.
- (String)
#delete
def delete() -> Google::Cloud::Storage::HmacKey
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.
- (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::HmacKey
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.
- (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?() -> Boolean
Whether the state of the HMAC key is DELETED
.
- (Boolean)
#etag
def etag() -> String
HTTP 1.1 Entity tag for the HMAC key.
- (String)
#id
def id() -> String
The ID of the HMAC key, including the Project ID and the Access ID.
- (String)
#inactive!
def inactive!() -> Google::Cloud::Storage::HmacKey
Updates 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?() -> Boolean
Whether the state of the HMAC key is INACTIVE
.
- (Boolean)
#project_id
def project_id() -> String
Project 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, nil
HMAC 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() -> String
The email address of the key's associated service account.
- (String)
#state
def state() -> String
The state of the key. Can be one of ACTIVE
, INACTIVE
, or
DELETED
.
- (String)
#updated_at
def updated_at() -> String
Last modification time of the HMAC key metadata.
- (String)