[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Storage API - Class Google::Cloud::Storage::HmacKey (v1.57.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.57.0 (latest)](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-HmacKey)\n- [1.56.0](/ruby/docs/reference/google-cloud-storage/1.56.0/Google-Cloud-Storage-HmacKey)\n- [1.55.0](/ruby/docs/reference/google-cloud-storage/1.55.0/Google-Cloud-Storage-HmacKey)\n- [1.54.0](/ruby/docs/reference/google-cloud-storage/1.54.0/Google-Cloud-Storage-HmacKey)\n- [1.53.0](/ruby/docs/reference/google-cloud-storage/1.53.0/Google-Cloud-Storage-HmacKey)\n- [1.52.0](/ruby/docs/reference/google-cloud-storage/1.52.0/Google-Cloud-Storage-HmacKey)\n- [1.51.0](/ruby/docs/reference/google-cloud-storage/1.51.0/Google-Cloud-Storage-HmacKey)\n- [1.50.0](/ruby/docs/reference/google-cloud-storage/1.50.0/Google-Cloud-Storage-HmacKey)\n- [1.49.0](/ruby/docs/reference/google-cloud-storage/1.49.0/Google-Cloud-Storage-HmacKey)\n- [1.48.1](/ruby/docs/reference/google-cloud-storage/1.48.1/Google-Cloud-Storage-HmacKey)\n- [1.47.0](/ruby/docs/reference/google-cloud-storage/1.47.0/Google-Cloud-Storage-HmacKey)\n- [1.46.0](/ruby/docs/reference/google-cloud-storage/1.46.0/Google-Cloud-Storage-HmacKey)\n- [1.45.0](/ruby/docs/reference/google-cloud-storage/1.45.0/Google-Cloud-Storage-HmacKey)\n- [1.44.0](/ruby/docs/reference/google-cloud-storage/1.44.0/Google-Cloud-Storage-HmacKey)\n- [1.43.0](/ruby/docs/reference/google-cloud-storage/1.43.0/Google-Cloud-Storage-HmacKey)\n- [1.42.0](/ruby/docs/reference/google-cloud-storage/1.42.0/Google-Cloud-Storage-HmacKey)\n- [1.41.0](/ruby/docs/reference/google-cloud-storage/1.41.0/Google-Cloud-Storage-HmacKey)\n- [1.40.0](/ruby/docs/reference/google-cloud-storage/1.40.0/Google-Cloud-Storage-HmacKey)\n- [1.39.0](/ruby/docs/reference/google-cloud-storage/1.39.0/Google-Cloud-Storage-HmacKey)\n- [1.38.0](/ruby/docs/reference/google-cloud-storage/1.38.0/Google-Cloud-Storage-HmacKey)\n- [1.37.0](/ruby/docs/reference/google-cloud-storage/1.37.0/Google-Cloud-Storage-HmacKey)\n- [1.36.2](/ruby/docs/reference/google-cloud-storage/1.36.2/Google-Cloud-Storage-HmacKey)\n- [1.35.0](/ruby/docs/reference/google-cloud-storage/1.35.0/Google-Cloud-Storage-HmacKey) \nReference documentation and code samples for the Cloud Storage API class Google::Cloud::Storage::HmacKey.\n\nHmacKey\n-------\n\nRepresents the metadata for an HMAC key, and also includes the key's\nsecret if returned by the [Project#create_hmac_key](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-Project#Google__Cloud__Storage__Project_create_hmac_key_instance_ \"Google::Cloud::Storage::Project#create_hmac_key (method)\") creation method. \n\nInherits\n--------\n\n- Object\n\nExample\n-------\n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nservice_account_email = \"my_account@developer.gserviceaccount.com\"\nhmac_key = storage.create_hmac_key service_account_email\nhmac_key.secret # ...\n\nhmac_key = storage.hmac_key hmac_key.access_id\nhmac_key.secret # nil\n\nhmac_key.inactive!\nhmac_key.delete\n```\n\nMethods\n-------\n\n### #access_id\n\n def access_id() -\u003e String\n\nThe ID of the HMAC Key. \n**Returns**\n\n- (String)\n\n### #active!\n\n def active!() -\u003e Google::Cloud::Storage::HmacKey\n\nUpdates the state of the HMAC key to `ACTIVE`. \n**Returns**\n\n- ([Google::Cloud::Storage::HmacKey](./Google-Cloud-Storage-HmacKey)) --- Returns the HMAC key for method chaining.\n**Example** \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nhmac_key = storage.hmac_keys.first\n\nhmac_key.active!\nhmac_key.state # \"ACTIVE\"\n```\n\n### #active?\n\n def active?() -\u003e Boolean\n\nWhether the state of the HMAC key is `ACTIVE`. \n**Returns**\n\n- (Boolean)\n\n### #api_url\n\n def api_url() -\u003e String\n\nA URL that can be used to access the HMAC key using the REST API. \n**Returns**\n\n- (String)\n\n### #created_at\n\n def created_at() -\u003e String\n\nCreation time of the HMAC key. \n**Returns**\n\n- (String)\n\n### #delete\n\n def delete() -\u003e Google::Cloud::Storage::HmacKey\n\n**Alias Of** : [#delete!](./Google-Cloud-Storage-HmacKey#Google__Cloud__Storage__HmacKey_delete!_instance_) \nDeletes the HMAC key, and loads the new state of the HMAC key,\nwhich will be `DELETED`.\n\n\n\u003cbr /\u003e\n\nThe API call to delete the HMAC key may be retried under certain\nconditions. See [Google::Cloud#storage](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud#Google__Cloud_storage_instance_ \"Google::Cloud#storage (method)\") to control this behavior. \n**Returns**\n\n- ([Google::Cloud::Storage::HmacKey](./Google-Cloud-Storage-HmacKey)) --- Returns the HMAC key for method chaining.\n**Example** \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nhmac_key = storage.hmac_keys.first\n\nhmac_key.inactive!.delete!\n```\n\n### #delete!\n\n def delete!() -\u003e Google::Cloud::Storage::HmacKey\n\n**Aliases**\n\n- [#delete](./Google-Cloud-Storage-HmacKey#Google__Cloud__Storage__HmacKey_delete_instance_) \nDeletes the HMAC key, and loads the new state of the HMAC key,\nwhich will be `DELETED`.\n\n\n\u003cbr /\u003e\n\nThe API call to delete the HMAC key may be retried under certain\nconditions. See [Google::Cloud#storage](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud#Google__Cloud_storage_instance_ \"Google::Cloud#storage (method)\") to control this behavior. \n**Returns**\n\n- ([Google::Cloud::Storage::HmacKey](./Google-Cloud-Storage-HmacKey)) --- Returns the HMAC key for method chaining.\n**Example** \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nhmac_key = storage.hmac_keys.first\n\nhmac_key.inactive!.delete!\n```\n\n### #deleted?\n\n def deleted?() -\u003e Boolean\n\nWhether the state of the HMAC key is `DELETED`. \n**Returns**\n\n- (Boolean)\n\n### #etag\n\n def etag() -\u003e String\n\nHTTP 1.1 Entity tag for the HMAC key. \n**Returns**\n\n- (String)\n\n### #id\n\n def id() -\u003e String\n\nThe ID of the HMAC key, including the Project ID and the Access ID. \n**Returns**\n\n- (String)\n\n### #inactive!\n\n def inactive!() -\u003e Google::Cloud::Storage::HmacKey\n\nUpdates the state of the HMAC key to `INACTIVE`. \n**Returns**\n\n- ([Google::Cloud::Storage::HmacKey](./Google-Cloud-Storage-HmacKey)) --- Returns the HMAC key for method chaining.\n**Example** \n\n```ruby\nrequire \"google/cloud/storage\"\n\nstorage = Google::Cloud::Storage.new\n\nhmac_key = storage.hmac_keys.first\n\nhmac_key.inactive!\nhmac_key.state # \"INACTIVE\"\n```\n\n### #inactive?\n\n def inactive?() -\u003e Boolean\n\nWhether the state of the HMAC key is `INACTIVE`. \n**Returns**\n\n- (Boolean)\n\n### #project_id\n\n def project_id() -\u003e String\n\nProject ID owning the service account to which the key authenticates. \n**Returns**\n\n- (String)\n\n### #refresh!\n\n def refresh!()\n\n**Alias Of** : [#reload!](./Google-Cloud-Storage-HmacKey#Google__Cloud__Storage__HmacKey_reload!_instance_) \nReloads the HMAC key with current data from the Storage service.\n\n### #reload!\n\n def reload!()\n\n**Aliases**\n\n- [#refresh!](./Google-Cloud-Storage-HmacKey#Google__Cloud__Storage__HmacKey_refresh!_instance_) \nReloads the HMAC key with current data from the Storage service.\n\n### #secret\n\n def secret() -\u003e String, nil\n\nHMAC secret key material, or `nil` if\nthe key was not returned by the [Project#create_hmac_key](/ruby/docs/reference/google-cloud-storage/latest/Google-Cloud-Storage-Project#Google__Cloud__Storage__Project_create_hmac_key_instance_ \"Google::Cloud::Storage::Project#create_hmac_key (method)\") creation\nmethod. \n**Returns**\n\n- (String, nil) --- the current value of secret\n\n### #service_account_email\n\n def service_account_email() -\u003e String\n\nThe email address of the key's associated service account. \n**Returns**\n\n- (String)\n\n### #state\n\n def state() -\u003e String\n\nThe state of the key. Can be one of `ACTIVE`, `INACTIVE`, or\n`DELETED`. \n**Returns**\n\n- (String)\n\n### #updated_at\n\n def updated_at() -\u003e String\n\nLast modification time of the HMAC key metadata. \n**Returns**\n\n- (String)"]]