Class v1.LicenseCodesClient (4.1.0)

The LicenseCodes API. v1

Package

@google-cloud/compute

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?:ClientOptions,gaxInstance?:typeofgax|typeofgax.fallback);

Construct an instance of LicenseCodesClient.

Parameters
NameDescription
optsClientOptions
gaxInstancetypeofgax | typeoffallback

: loaded instance ofgoogle-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new LicenseCodesClient({fallback: true}, gax); ```

Properties

apiEndpoint

staticgetapiEndpoint():string;

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

auth

auth:gax.GoogleAuth;

descriptors

descriptors:Descriptors;

innerApiCalls

innerApiCalls:{[name:string]:Function;};

licenseCodesStub

licenseCodesStub?:Promise<{[name:string]:Function;}>;

port

staticgetport():number;

The port for this API service.

scopes

staticgetscopes():string[];

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

servicePath

staticgetservicePath():string;

The DNS address for this API service.

warn

warn:(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
TypeDescription
Promise<void>

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

get(request, options)

get(request?:protos.google.cloud.compute.v1.IGetLicenseCodeRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.ILicenseCode,protos.google.cloud.compute.v1.IGetLicenseCodeRequest|undefined,{}|undefined]>;

Return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.

Parameters
NameDescription
requestIGetLicenseCodeRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.compute.v1.ILicenseCode,protos.google.cloud.compute.v1.IGetLicenseCodeRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see thedocumentation for more details and examples.

Example
/**   * This snippet has been automatically generated and should be regarded as a code template only.   * It will require modifications to work.   * It may require correct/in-range values for request initialization.   * TODO(developer): Uncomment these variables before running the sample.   *//**   *  Number corresponding to the License code resource to return.   */// const licenseCode = 'abc123'/**   *  Project ID for this request.   */// const project = 'my-project'// Imports the Compute libraryconst{LicenseCodesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newLicenseCodesClient();asyncfunctioncallGet(){// Construct requestconstrequest={licenseCode,project,};// Run requestconstresponse=awaitcomputeClient.get(request);console.log(response);}callGet();

get(request, options, callback)

get(request:protos.google.cloud.compute.v1.IGetLicenseCodeRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.ILicenseCode,protos.google.cloud.compute.v1.IGetLicenseCodeRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetLicenseCodeRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1.ILicenseCode,protos.google.cloud.compute.v1.IGetLicenseCodeRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

get(request, callback)

get(request:protos.google.cloud.compute.v1.IGetLicenseCodeRequest,callback:Callback<protos.google.cloud.compute.v1.ILicenseCode,protos.google.cloud.compute.v1.IGetLicenseCodeRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetLicenseCodeRequest
callbackCallback<protos.google.cloud.compute.v1.ILicenseCode,protos.google.cloud.compute.v1.IGetLicenseCodeRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId():Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback:Callback<string,undefined,undefined>):void;
Parameter
NameDescription
callbackCallback<string, undefined, undefined>
Returns
TypeDescription
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
TypeDescription
Promise<{ [name: string]:Function; }>

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

testIamPermissions(request, options)

testIamPermissions(request?:protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.ITestPermissionsResponse,(protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest|undefined),{}|undefined]>;

Returns permissions that a caller has on the specified resource. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images.

Parameters
NameDescription
requestITestIamPermissionsLicenseCodeRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.compute.v1.ITestPermissionsResponse, (protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representingTestPermissionsResponse. Please see thedocumentation for more details and examples.

Example
/**   * This snippet has been automatically generated and should be regarded as a code template only.   * It will require modifications to work.   * It may require correct/in-range values for request initialization.   * TODO(developer): Uncomment these variables before running the sample.   *//**   *  Project ID for this request.   */// const project = 'my-project'/**   *  Name or id of the resource for this request.   */// const resource = 'abc123'/**   *  The body resource for this request   */// const testPermissionsRequestResource = {}// Imports the Compute libraryconst{LicenseCodesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newLicenseCodesClient();asyncfunctioncallTestIamPermissions(){// Construct requestconstrequest={project,resource,testPermissionsRequestResource,};// Run requestconstresponse=awaitcomputeClient.testIamPermissions(request);console.log(response);}callTestIamPermissions();

testIamPermissions(request, options, callback)

testIamPermissions(request:protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse,protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestITestIamPermissionsLicenseCodeRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1.ITestPermissionsResponse,protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

testIamPermissions(request, callback)

testIamPermissions(request:protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest,callback:Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse,protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestITestIamPermissionsLicenseCodeRequest
callbackCallback<protos.google.cloud.compute.v1.ITestPermissionsResponse,protos.google.cloud.compute.v1.ITestIamPermissionsLicenseCodeRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-03 UTC.