Class HmacKey (6.4.2)

An HmacKey object contains metadata of an HMAC key created from a service account through the Storage client using .

See HMAC keys documentation

Inheritance

ServiceObject<HmacKeyMetadata | undefined> > HmacKey

Package

@google-cloud/storage

Constructors

(constructor)(storage, accessId, options)

constructor(storage: Storage, accessId: string, options?: HmacKeyOptions);

Constructs an HmacKey object.

Note: this only create a local reference to an HMAC key, to create an HMAC key, use .

Parameters
NameDescription
storage Storage

The Storage instance this HMAC key is attached to.

accessId string

The unique accessId for this HMAC key.

options HmacKeyOptions

Constructor configurations.

Example

const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
const hmacKey = storage.hmacKey('access-id');

Properties

metadata

metadata: HmacKeyMetadata | undefined;

storage

storage: Storage;

A reference to the Storage associated with this HmacKey instance. HmacKey#storage {Storage}

Methods

setMetadata(metadata, options)

setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;

Set the metadata for this object.

Parameters
NameDescription
metadata Metadata

The metadata to set on this object.

options SetMetadataOptions

Configuration options.

Returns
TypeDescription
Promise<SetMetadataResponse>

setMetadata(metadata, callback)

setMetadata(metadata: Metadata, callback: MetadataCallback): void;
Parameters
NameDescription
metadata Metadata
callback MetadataCallback
Returns
TypeDescription
void

setMetadata(metadata, options, callback)

setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
Parameters
NameDescription
metadata Metadata
options SetMetadataOptions
callback MetadataCallback
Returns
TypeDescription
void