Class v1.IAMCredentialsClient

A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google APIs, so that the users aren't directly involved.

Service account credentials are used to temporarily assume the identity of the service account. Supported credential types include OAuth 2.0 access tokens, OpenID Connect ID tokens, self-signed JSON Web Tokens (JWTs), and more. v1

Package

@google-cloud/iam-credentials!

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of IAMCredentialsClient.

Parameter
Type Name Description
ClientOptions opts

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

Property Value
Type Description
string

auth

auth: gax.GoogleAuth;
Property Value
Type Description
gax.GoogleAuth

descriptors

descriptors: Descriptors;
Property Value
Type Description
Descriptors

iAMCredentialsStub

iAMCredentialsStub?: Promise<{
        [name: string]: Function;
    }>;
Property Value
Type Description
Promise<{ [name: string]: Function; }>

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };
Property Value
Type Description
{ [name: string]: Function; }

port

static get port(): number;

The port for this API service.

Property Value
Type Description
number

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

Property Value
Type Description
string[]

servicePath

static get servicePath(): string;

The DNS address for this API service.

Property Value
Type Description
string

warn

warn: (code: string, message: string, warnType?: string) => void;
Property Value
Type Description
(code: string, message: string, warnType?: string) => void

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

generateAccessToken(request, options)

generateAccessToken(request?: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, options?: CallOptions): Promise<[
        protos.google.iam.credentials.v1.IGenerateAccessTokenResponse,
        protos.google.iam.credentials.v1.IGenerateAccessTokenRequest | undefined,
        {} | undefined
    ]>;
Parameters
Type Name Description
protos.google.iam.credentials.v1.IGenerateAccessTokenRequest request
CallOptions options
Returns
Type Description
Promise<[ protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, protos.google.iam.credentials.v1.IGenerateAccessTokenRequest | undefined, {} | undefined ]>

generateAccessToken(request, options, callback)

generateAccessToken(request: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, options: CallOptions, callback: Callback<protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, protos.google.iam.credentials.v1.IGenerateAccessTokenRequest | null | undefined, {} | null | undefined>): void;
Parameters
Type Name Description
protos.google.iam.credentials.v1.IGenerateAccessTokenRequest request
CallOptions options
Callback<protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, protos.google.iam.credentials.v1.IGenerateAccessTokenRequest | null | undefined, {} | null | undefined> callback
Returns
Type Description
void

generateAccessToken(request, callback)

generateAccessToken(request: protos.google.iam.credentials.v1.IGenerateAccessTokenRequest, callback: Callback<protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, protos.google.iam.credentials.v1.IGenerateAccessTokenRequest | null | undefined, {} | null | undefined>): void;
Parameters
Type Name Description
protos.google.iam.credentials.v1.IGenerateAccessTokenRequest request
Callback<protos.google.iam.credentials.v1.IGenerateAccessTokenResponse, protos.google.iam.credentials.v1.IGenerateAccessTokenRequest | null | undefined, {} | null | undefined> callback
Returns
Type Description
void

generateIdToken(request, options)

generateIdToken(request?: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, options?: CallOptions): Promise<[
        protos.google.iam.credentials.v1.IGenerateIdTokenResponse,
        protos.google.iam.credentials.v1.IGenerateIdTokenRequest | undefined,
        {} | undefined
    ]>;
Parameters
Type Name Description
protos.google.iam.credentials.v1.IGenerateIdTokenRequest request
CallOptions options
Returns
Type Description
Promise<[ protos.google.iam.credentials.v1.IGenerateIdTokenResponse, protos.google.iam.credentials.v1.IGenerateIdTokenRequest | undefined, {} | undefined ]>

generateIdToken(request, options, callback)

generateIdToken(request: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, options: CallOptions, callback: Callback<protos.google.iam.credentials.v1.IGenerateIdTokenResponse, protos.google.iam.credentials.v1.IGenerateIdTokenRequest | null | undefined, {} | null | undefined>): void;
Parameters
Type Name Description
protos.google.iam.credentials.v1.IGenerateIdTokenRequest request
CallOptions options
Callback<protos.google.iam.credentials.v1.IGenerateIdTokenResponse, protos.google.iam.credentials.v1.IGenerateIdTokenRequest | null | undefined, {} | null | undefined> callback
Returns
Type Description
void

generateIdToken(request, callback)

generateIdToken(request: protos.google.iam.credentials.v1.IGenerateIdTokenRequest, callback: Callback<protos.google.iam.credentials.v1.IGenerateIdTokenResponse, protos.google.iam.credentials.v1.IGenerateIdTokenRequest | null | undefined, {} | null | undefined>): void;
Parameters
Type Name Description
protos.google.iam.credentials.v1.IGenerateIdTokenRequest request
Callback<protos.google.iam.credentials.v1.IGenerateIdTokenResponse, protos.google.iam.credentials.v1.IGenerateIdTokenRequest | null | undefined, {} | null | undefined> callback
Returns
Type Description
void

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Type Name Description
Callback<string, undefined, undefined> callback
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

signBlob(request, options)

signBlob(request?: protos.google.iam.credentials.v1.ISignBlobRequest, options?: CallOptions): Promise<[
        protos.google.iam.credentials.v1.ISignBlobResponse,
        protos.google.iam.credentials.v1.ISignBlobRequest | undefined,
        {} | undefined
    ]>;
Parameters
Type Name Description
protos.google.iam.credentials.v1.ISignBlobRequest request
CallOptions options
Returns
Type Description
Promise<[ protos.google.iam.credentials.v1.ISignBlobResponse, protos.google.iam.credentials.v1.ISignBlobRequest | undefined, {} | undefined ]>

signBlob(request, options, callback)

signBlob(request: protos.google.iam.credentials.v1.ISignBlobRequest, options: CallOptions, callback: Callback<protos.google.iam.credentials.v1.ISignBlobResponse, protos.google.iam.credentials.v1.ISignBlobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Type Name Description
protos.google.iam.credentials.v1.ISignBlobRequest request
CallOptions options
Callback<protos.google.iam.credentials.v1.ISignBlobResponse, protos.google.iam.credentials.v1.ISignBlobRequest | null | undefined, {} | null | undefined> callback
Returns
Type Description
void

signBlob(request, callback)

signBlob(request: protos.google.iam.credentials.v1.ISignBlobRequest, callback: Callback<protos.google.iam.credentials.v1.ISignBlobResponse, protos.google.iam.credentials.v1.ISignBlobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Type Name Description
protos.google.iam.credentials.v1.ISignBlobRequest request
Callback<protos.google.iam.credentials.v1.ISignBlobResponse, protos.google.iam.credentials.v1.ISignBlobRequest | null | undefined, {} | null | undefined> callback
Returns
Type Description
void

signJwt(request, options)

signJwt(request?: protos.google.iam.credentials.v1.ISignJwtRequest, options?: CallOptions): Promise<[
        protos.google.iam.credentials.v1.ISignJwtResponse,
        protos.google.iam.credentials.v1.ISignJwtRequest | undefined,
        {} | undefined
    ]>;
Parameters
Type Name Description
protos.google.iam.credentials.v1.ISignJwtRequest request
CallOptions options
Returns
Type Description
Promise<[ protos.google.iam.credentials.v1.ISignJwtResponse, protos.google.iam.credentials.v1.ISignJwtRequest | undefined, {} | undefined ]>

signJwt(request, options, callback)

signJwt(request: protos.google.iam.credentials.v1.ISignJwtRequest, options: CallOptions, callback: Callback<protos.google.iam.credentials.v1.ISignJwtResponse, protos.google.iam.credentials.v1.ISignJwtRequest | null | undefined, {} | null | undefined>): void;
Parameters
Type Name Description
protos.google.iam.credentials.v1.ISignJwtRequest request
CallOptions options
Callback<protos.google.iam.credentials.v1.ISignJwtResponse, protos.google.iam.credentials.v1.ISignJwtRequest | null | undefined, {} | null | undefined> callback
Returns
Type Description
void

signJwt(request, callback)

signJwt(request: protos.google.iam.credentials.v1.ISignJwtRequest, callback: Callback<protos.google.iam.credentials.v1.ISignJwtResponse, protos.google.iam.credentials.v1.ISignJwtRequest | null | undefined, {} | null | undefined>): void;
Parameters
Type Name Description
protos.google.iam.credentials.v1.ISignJwtRequest request
Callback<protos.google.iam.credentials.v1.ISignJwtResponse, protos.google.iam.credentials.v1.ISignJwtRequest | null | undefined, {} | null | undefined> callback
Returns
Type Description
void