class Google::Cloud::Storage::HmacKey
hmac_key.delete
hmac_key.inactive!
hmac_key.secret # nil
hmac_key = storage.hmac_key hmac_key.access_id
hmac_key.secret # …
hmac_key = storage.create_hmac_key service_account_email
service_account_email = “my_account@developer.gserviceaccount.com”
storage = Google::Cloud::Storage.new
require “google/cloud/storage”
@example
method.
the key was not returned by the {Project#create_hmac_key} creation
@attr_reader [String, nil] secret HMAC secret key material, or ‘nil` if
Migrating from Amazon S3 to Cloud Storage - Simple migration
@see cloud.google.com/storage/docs/migrating#migration-simple<br><br>secret if returned by the {Project#create_hmac_key} creation method.
Represents the metadata for an HMAC key, and also includes the key’s
# HmacKey
#
def self.from_gapi gapi, service, user_project: nil
-
gapi
(Google::Apis::StorageV1::HmacKey
) --
Other tags:
- Private: - New HmacKey from a Google::Apis::StorageV1::HmacKey object.
def self.from_gapi gapi, service, user_project: nil hmac_key = from_gapi_metadata gapi.metadata, service, user_project: user_project hmac_key.tap do |f| f.instance_variable_set :@secret, gapi.secret end end
def self.from_gapi_metadata gapi, service, user_project: nil
-
gapi
(Google::Apis::StorageV1::HmacKeyMetadata
) --
Other tags:
- Private: - New HmacKey from a Google::Apis::StorageV1::HmacKeyMetadata
def self.from_gapi_metadata gapi, service, user_project: nil new.tap do |f| f.gapi = gapi f.service = service f.user_project = user_project end end
def access_id
-
(String)
-
def access_id @gapi.access_id end
def active!
-
(Google::Cloud::Storage::HmacKey)
- Returns the HMAC key for
def active! put_gapi! "ACTIVE" self end
def active?
-
(Boolean)
-
def active? state == "ACTIVE" end
def api_url
-
(String)
-
def api_url @gapi.self_link end
def created_at
-
(String)
-
def created_at @gapi.time_created end
def delete!
-
(Google::Cloud::Storage::HmacKey)
- Returns the HMAC key for
def delete! ensure_service! @service.delete_hmac_key access_id, project_id: project_id, user_project: @user_project @gapi = @service.get_hmac_key access_id, project_id: project_id, user_project: @user_project self end
def deleted?
-
(Boolean)
-
def deleted? state == "DELETED" end
def ensure_service!
#
def ensure_service! raise "Must have active connection" unless service end
def etag
-
(String)
-
def etag @gapi.etag end
def id
-
(String)
-
def id @gapi.id end
def inactive!
-
(Google::Cloud::Storage::HmacKey)
- Returns the HMAC key for
def inactive! put_gapi! "INACTIVE" self end
def inactive?
-
(Boolean)
-
def inactive? state == "INACTIVE" end
def initialize
- Private: - Creates an HmacKey object.
def initialize @bucket = nil @service = nil @gapi = nil @user_project = nil end
def project_id
-
(String)
-
def project_id @gapi.project_id end
def put_gapi! new_state
def put_gapi! new_state ensure_service! put_gapi = @gapi.dup put_gapi.state = new_state @gapi = service.update_hmac_key access_id, put_gapi, project_id: project_id, user_project: @user_project self end
def reload!
Reloads the HMAC key with current data from the Storage service.
#
def reload! ensure_service! @gapi = service.get_hmac_key access_id, project_id: project_id, user_project: user_project self end
def service_account_email
-
(String)
-
def service_account_email @gapi.service_account_email end
def state
-
(String)
-
def state @gapi.state end
def updated_at
-
(String)
-
def updated_at @gapi.updated end