Class: Google::Cloud::Storage::HmacKey
- Inherits:
-
Object
- Object
- Google::Cloud::Storage::HmacKey
- Defined in:
- lib/google/cloud/storage/hmac_key.rb,
lib/google/cloud/storage/hmac_key/list.rb
Overview
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.
Defined Under Namespace
Classes: List
Instance Attribute Summary collapse
-
#secret ⇒ String?
readonly
HMAC secret key material, or
nil
if the key was not returned by the Project#create_hmac_key creation method.
Instance Method Summary collapse
-
#access_id ⇒ String
The ID of the HMAC Key.
-
#active! ⇒ Google::Cloud::Storage::HmacKey
Updates the state of the HMAC key to
ACTIVE
. -
#active? ⇒ Boolean
Whether the state of the HMAC key is
ACTIVE
. -
#api_url ⇒ String
A URL that can be used to access the HMAC key using the REST API.
-
#created_at ⇒ String
Creation time of the HMAC key.
-
#delete! ⇒ Google::Cloud::Storage::HmacKey
(also: #delete)
Deletes the HMAC key, and loads the new state of the HMAC key, which will be
DELETED
. -
#deleted? ⇒ Boolean
Whether the state of the HMAC key is
DELETED
. -
#etag ⇒ String
HTTP 1.1 Entity tag for the HMAC key.
-
#id ⇒ String
The ID of the HMAC key, including the Project ID and the Access ID.
-
#inactive! ⇒ Google::Cloud::Storage::HmacKey
Updates the state of the HMAC key to
INACTIVE
. -
#inactive? ⇒ Boolean
Whether the state of the HMAC key is
INACTIVE
. -
#project_id ⇒ String
Project ID owning the service account to which the key authenticates.
-
#reload! ⇒ Object
(also: #refresh!)
Reloads the HMAC key with current data from the Storage service.
-
#service_account_email ⇒ String
The email address of the key's associated service account.
-
#state ⇒ String
The state of the key.
-
#updated_at ⇒ String
Last modification time of the HMAC key metadata.
Instance Attribute Details
#secret ⇒ String? (readonly)
HMAC secret key material, or nil
if
the key was not returned by the Project#create_hmac_key creation
method.
49 50 51 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 49 def secret @secret end |
Instance Method Details
#access_id ⇒ String
The ID of the HMAC Key.
79 80 81 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 79 def access_id @gapi.access_id end |
#active! ⇒ Google::Cloud::Storage::HmacKey
Updates the state of the HMAC key to ACTIVE
.
181 182 183 184 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 181 def active! put_gapi! "ACTIVE" self end |
#active? ⇒ Boolean
Whether the state of the HMAC key is ACTIVE
.
161 162 163 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 161 def active? state == "ACTIVE" end |
#api_url ⇒ String
A URL that can be used to access the HMAC key using the REST API.
88 89 90 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 88 def api_url @gapi.self_link end |
#created_at ⇒ String
Creation time of the HMAC key.
97 98 99 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 97 def created_at @gapi.time_created end |
#delete! ⇒ Google::Cloud::Storage::HmacKey Also known as: 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.
244 245 246 247 248 249 250 251 252 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 244 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 |
#deleted? ⇒ Boolean
Whether the state of the HMAC key is DELETED
.
221 222 223 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 221 def deleted? state == "DELETED" end |
#etag ⇒ String
HTTP 1.1 Entity tag for the HMAC key.
106 107 108 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 106 def etag @gapi.etag end |
#id ⇒ String
The ID of the HMAC key, including the Project ID and the Access ID.
115 116 117 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 115 def id @gapi.id end |
#inactive! ⇒ Google::Cloud::Storage::HmacKey
Updates the state of the HMAC key to INACTIVE
.
211 212 213 214 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 211 def inactive! put_gapi! "INACTIVE" self end |
#inactive? ⇒ Boolean
Whether the state of the HMAC key is INACTIVE
.
191 192 193 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 191 def inactive? state == "INACTIVE" end |
#project_id ⇒ String
Project ID owning the service account to which the key authenticates.
124 125 126 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 124 def project_id @gapi.project_id end |
#reload! ⇒ Object Also known as: refresh!
Reloads the HMAC key with current data from the Storage service.
258 259 260 261 262 263 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 258 def reload! ensure_service! @gapi = service.get_hmac_key access_id, project_id: project_id, user_project: user_project self end |
#service_account_email ⇒ String
The email address of the key's associated service account.
133 134 135 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 133 def service_account_email @gapi.service_account_email end |
#state ⇒ String
The state of the key. Can be one of ACTIVE
, INACTIVE
, or
DELETED
.
143 144 145 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 143 def state @gapi.state end |
#updated_at ⇒ String
Last modification time of the HMAC key metadata.
152 153 154 |
# File 'lib/google/cloud/storage/hmac_key.rb', line 152 def updated_at @gapi.updated end |