Class v1beta.ImagesClient (6.5.0)

The Images API. v1beta

Package

@google-cloud/compute

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of ImagesClient.

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 ImagesClient({fallback: true}, gax); ```

Properties

apiEndpoint

getapiEndpoint():string;

The DNS address for this API service.

apiEndpoint

staticgetapiEndpoint():string;

The DNS address for this API service - same as servicePath.

auth

auth:gax.GoogleAuth;

descriptors

descriptors:Descriptors;

imagesStub

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

innerApiCalls

innerApiCalls:{[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.

universeDomain

getuniverseDomain():string;

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.

delete(request, options)

delete(request?:protos.google.cloud.compute.v1beta.IDeleteImageRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation,null>,protos.google.cloud.compute.v1beta.IOperation|undefined,{}|undefined]>;

Deletes the specified image.

Parameters
NameDescription
requestIDeleteImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation, null>,protos.google.cloud.compute.v1beta.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see thedocumentation for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time..promise() is not supported yet.

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.   *//**   *  Name of the image resource to delete.   */// const image = 'abc123'/**   *  Project ID for this request.   */// const project = 'my-project'/**   *  An optional request ID to identify requests. Specify a unique request ID so   *  that if you must retry your request, the server will know to ignore the   *  request if it has already been completed.   *  For example, consider a situation where you make an initial request and   *  the request times out. If you make the request again with the same   *  request ID, the server can check if original operation with the same   *  request ID was received, and if so, will ignore the second request. This   *  prevents clients from accidentally creating duplicate commitments.   *  The request ID must be   *  a valid UUID with the exception that zero UUID is not supported   *  (00000000-0000-0000-0000-000000000000).   */// const requestId = 'abc123'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallDelete(){// Construct requestconstrequest={image,project,};// Run requestconstresponse=awaitcomputeClient.delete(request);console.log(response);}callDelete();

delete(request, options, callback)

delete(request:protos.google.cloud.compute.v1beta.IDeleteImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IDeleteImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIDeleteImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IDeleteImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

delete(request, callback)

delete(request:protos.google.cloud.compute.v1beta.IDeleteImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IDeleteImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIDeleteImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IDeleteImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deprecate(request, options)

deprecate(request?:protos.google.cloud.compute.v1beta.IDeprecateImageRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation,null>,protos.google.cloud.compute.v1beta.IOperation|undefined,{}|undefined]>;

Sets the deprecation status of an image.

If an empty request body is given, clears the deprecation status instead.

Parameters
NameDescription
requestIDeprecateImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation, null>,protos.google.cloud.compute.v1beta.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see thedocumentation for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time..promise() is not supported yet.

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.   *//**   *  The body resource for this request   */// const deprecationStatusResource = {}/**   *  Image name.   */// const image = 'abc123'/**   *  Project ID for this request.   */// const project = 'my-project'/**   *  An optional request ID to identify requests. Specify a unique request ID so   *  that if you must retry your request, the server will know to ignore the   *  request if it has already been completed.   *  For example, consider a situation where you make an initial request and   *  the request times out. If you make the request again with the same   *  request ID, the server can check if original operation with the same   *  request ID was received, and if so, will ignore the second request. This   *  prevents clients from accidentally creating duplicate commitments.   *  The request ID must be   *  a valid UUID with the exception that zero UUID is not supported   *  (00000000-0000-0000-0000-000000000000).   */// const requestId = 'abc123'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallDeprecate(){// Construct requestconstrequest={deprecationStatusResource,image,project,};// Run requestconstresponse=awaitcomputeClient.deprecate(request);console.log(response);}callDeprecate();

deprecate(request, options, callback)

deprecate(request:protos.google.cloud.compute.v1beta.IDeprecateImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IDeprecateImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIDeprecateImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IDeprecateImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

deprecate(request, callback)

deprecate(request:protos.google.cloud.compute.v1beta.IDeprecateImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IDeprecateImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIDeprecateImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IDeprecateImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

get(request, options)

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

Returns the specified image.

Parameters
NameDescription
requestIGetImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetImageRequest | 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.   *//**   *  Name of the image resource to return.   */// const image = 'abc123'/**   *  Project ID for this request.   */// const project = 'my-project'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallGet(){// Construct requestconstrequest={image,project,};// Run requestconstresponse=awaitcomputeClient.get(request);console.log(response);}callGet();

get(request, options, callback)

get(request:protos.google.cloud.compute.v1beta.IGetImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

get(request, callback)

get(request:protos.google.cloud.compute.v1beta.IGetImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getFromFamily(request, options)

getFromFamily(request?:protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest|undefined,{}|undefined]>;

Returns the latest image that is part of an image family and is not deprecated. For more information on image families, seePublic image families documentation.

Parameters
NameDescription
requestIGetFromFamilyImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest | 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.   *//**   *  Name of the image family to search for.   */// const family = 'abc123'/**   *  The image project that the image belongs to. For example, to get a CentOS   *  image, specify centos-cloud as the image project.   */// const project = 'my-project'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallGetFromFamily(){// Construct requestconstrequest={family,project,};// Run requestconstresponse=awaitcomputeClient.getFromFamily(request);console.log(response);}callGetFromFamily();

getFromFamily(request, options, callback)

getFromFamily(request:protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetFromFamilyImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getFromFamily(request, callback)

getFromFamily(request:protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetFromFamilyImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IImage,protos.google.cloud.compute.v1beta.IGetFromFamilyImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIamPolicy(request, options)

getIamPolicy(request?:protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest|undefined,{}|undefined]>;

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Parameters
NameDescription
requestIGetIamPolicyImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representingPolicy. 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.   *//**   *  Requested IAM Policy version.   */// const optionsRequestedPolicyVersion = 1234/**   *  Project ID for this request.   */// const project = 'my-project'/**   *  Name or id of the resource for this request.   */// const resource = 'abc123'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallGetIamPolicy(){// Construct requestconstrequest={project,resource,};// Run requestconstresponse=awaitcomputeClient.getIamPolicy(request);console.log(response);}callGetIamPolicy();

getIamPolicy(request, options, callback)

getIamPolicy(request:protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetIamPolicyImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getIamPolicy(request, callback)

getIamPolicy(request:protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIGetIamPolicyImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.IGetIamPolicyImageRequest | 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.

insert(request, options)

insert(request?:protos.google.cloud.compute.v1beta.IInsertImageRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation,null>,protos.google.cloud.compute.v1beta.IOperation|undefined,{}|undefined]>;

Creates an image in the specified project using the data included in the request.

Parameters
NameDescription
requestIInsertImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation, null>,protos.google.cloud.compute.v1beta.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see thedocumentation for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time..promise() is not supported yet.

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.   *//**   *  Force image creation if true.   */// const forceCreate = true/**   *  The body resource for this request   */// const imageResource = {}/**   *  Project ID for this request.   */// const project = 'my-project'/**   *  An optional request ID to identify requests. Specify a unique request ID so   *  that if you must retry your request, the server will know to ignore the   *  request if it has already been completed.   *  For example, consider a situation where you make an initial request and   *  the request times out. If you make the request again with the same   *  request ID, the server can check if original operation with the same   *  request ID was received, and if so, will ignore the second request. This   *  prevents clients from accidentally creating duplicate commitments.   *  The request ID must be   *  a valid UUID with the exception that zero UUID is not supported   *  (00000000-0000-0000-0000-000000000000).   */// const requestId = 'abc123'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallInsert(){// Construct requestconstrequest={imageResource,project,};// Run requestconstresponse=awaitcomputeClient.insert(request);console.log(response);}callInsert();

insert(request, options, callback)

insert(request:protos.google.cloud.compute.v1beta.IInsertImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IInsertImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIInsertImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IInsertImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

insert(request, callback)

insert(request:protos.google.cloud.compute.v1beta.IInsertImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IInsertImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIInsertImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IInsertImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

list(request, options)

list(request?:protos.google.cloud.compute.v1beta.IListImagesRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1beta.IImage[],protos.google.cloud.compute.v1beta.IListImagesRequest|null,protos.google.cloud.compute.v1beta.IImageList]>;

Retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud.

Parameters
NameDescription
requestIListImagesRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.compute.v1beta.IImage[],protos.google.cloud.compute.v1beta.IListImagesRequest | null,protos.google.cloud.compute.v1beta.IImageList ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend usinglistAsync() method described below for async iteration which you can stop as needed. Please see thedocumentation for more details and examples.

list(request, options, callback)

list(request:protos.google.cloud.compute.v1beta.IListImagesRequest,options:CallOptions,callback:PaginationCallback<protos.google.cloud.compute.v1beta.IListImagesRequest,protos.google.cloud.compute.v1beta.IImageList|null|undefined,protos.google.cloud.compute.v1beta.IImage>):void;
Parameters
NameDescription
requestIListImagesRequest
optionsCallOptions
callbackPaginationCallback<protos.google.cloud.compute.v1beta.IListImagesRequest,protos.google.cloud.compute.v1beta.IImageList | null | undefined,protos.google.cloud.compute.v1beta.IImage>
Returns
TypeDescription
void

list(request, callback)

list(request:protos.google.cloud.compute.v1beta.IListImagesRequest,callback:PaginationCallback<protos.google.cloud.compute.v1beta.IListImagesRequest,protos.google.cloud.compute.v1beta.IImageList|null|undefined,protos.google.cloud.compute.v1beta.IImage>):void;
Parameters
NameDescription
requestIListImagesRequest
callbackPaginationCallback<protos.google.cloud.compute.v1beta.IListImagesRequest,protos.google.cloud.compute.v1beta.IImageList | null | undefined,protos.google.cloud.compute.v1beta.IImage>
Returns
TypeDescription
void

listAsync(request, options)

listAsync(request?:protos.google.cloud.compute.v1beta.IListImagesRequest,options?:CallOptions):AsyncIterable<protos.google.cloud.compute.v1beta.IImage>;

Equivalent tolist, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
requestIListImagesRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.compute.v1beta.IImage>

{Object} An iterable Object that allowsasync iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. 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.   *//***Afilterexpressionthatfiltersresourceslistedintheresponse.Most*Computeresourcessupporttwotypesoffilterexpressions:*expressionsthatsupportregularexpressionsandexpressionsthatfollow*APIimprovementproposalAIP-160.*Thesetwotypesoffilterexpressionscannotbemixedinonerequest.*IfyouwanttouseAIP-160,yourexpressionmustspecifythefieldname,an*operator,andthevaluethatyouwanttouseforfiltering.Thevalue*mustbeastring,anumber,oraboolean.Theoperator*mustbeeither`=`,`!=`,`>`,`<`,><=`, `="">=` or `:`.   *  For example, if you are filtering Compute Engine instances, you can   *  exclude instances named `example-instance` by specifying   *  `name!=example-instance`.   *  The `:*` comparison can be used to test whether a key has been defined.   *  For example, to find all objects with `owner` label use:   *
   *  labels.owner:*   *
  • You can also filter nested fields. For example, you could specify
  • scheduling.automaticRestart = false to include instances only
  • if they are not scheduled for automatic restarts. You can use filtering
  • on nested fields to filter based onresource labels.
  • To filter on multiple expressions, provide each separate expression within
  • parentheses. For example:
  • (scheduling.automaticRestart = true)
  • (cpuPlatform = "Intel Skylake")
  • By default, each expression is anAND expression. However, you
  • can includeAND andOR expressions explicitly.
  • For example:
  • (cpuPlatform = "Intel Skylake") OR
  • (cpuPlatform = "Intel Broadwell") AND
  • (scheduling.automaticRestart = true)
  • If you want to use a regular expression, use theeq (equal) orne
  • (not equal) operator against a single un-parenthesized expression with or
  • without quotes or against multiple parenthesized expressions. Examples:
  • fieldname eq unquoted literal
  • fieldname eq 'single quoted literal'
  • fieldname eq "double quoted literal"
  • (fieldname1 eq literal) (fieldname2 ne "literal")
  • The literal value is interpreted as a regular expression using GoogleRE2 library syntax.
  • The literal value must match the entire field.
  • For example, to filter for instances that do not end with name "instance",
  • you would usename ne .*instance.
  • You cannot combine constraints on multiple fields using regular
  • expressions./// const filter = 'abc123'/*
  • The maximum number of results per page that should be returned.
  • If the number of available results is larger thanmaxResults,
  • Compute Engine returns anextPageToken that can be used to get
  • the next page of results in subsequent list requests. Acceptable values are
  • 0 to500, inclusive. (Default:500)/// const maxResults = 1234/*
  • Sorts list results by a certain order. By default, results
  • are returned in alphanumerical order based on the resource name.
  • You can also sort results in descending order based on the creation
  • timestamp usingorderBy="creationTimestamp desc". This sorts
  • results based on thecreationTimestamp field in
  • reverse chronological order (newest result first). Use this to sort
  • resources like operations so that the newest operation is returned first.
  • Currently, only sorting byname or
  • creationTimestamp desc is supported./// const orderBy = 'abc123'/*
  • Specifies a page token to use. SetpageToken to the
  • nextPageToken returned by a previous list request to get
  • the next page of results./// const pageToken = 'abc123'/*
  • Project ID for this request./// const project = 'my-project'/*
  • Opt-in for partial success behavior which provides partial results in case
  • of failure. The default value is false.
  • For example, when partial success behavior is enabled, aggregatedList for a
  • single zone scope either returns all resources in the zone or no resources,
  • with an error code./// const returnPartialSuccess = true/*
  • The zone query parameter.*/// const zone = 'abc123'

    // Imports the Compute libraryconst {ImagesClient} = require('@google-cloud/compute').v1beta;

    // Instantiates a clientconst computeClient = new ImagesClient();

    async function callList() {// Construct requestconst request = {project,};

    // Run requestconst iterable = computeClient.listAsync(request);for await (const response of iterable) { console.log(response);}}

    callList();

listStream(request, options)

listStream(request?:protos.google.cloud.compute.v1beta.IListImagesRequest,options?:CallOptions):Transform;

Equivalent tolist, but returns a NodeJS Stream object.

Parameters
NameDescription
requestIListImagesRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend usinglistAsync() method described below for async iteration which you can stop as needed. Please see thedocumentation for more details and examples.

patch(request, options)

patch(request?:protos.google.cloud.compute.v1beta.IPatchImageRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation,null>,protos.google.cloud.compute.v1beta.IOperation|undefined,{}|undefined]>;

Patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status.

Parameters
NameDescription
requestIPatchImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation, null>,protos.google.cloud.compute.v1beta.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see thedocumentation for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time..promise() is not supported yet.

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.   *//**   *  Name of the image resource to patch.   */// const image = 'abc123'/**   *  The body resource for this request   */// const imageResource = {}/**   *  Project ID for this request.   */// const project = 'my-project'/**   *  An optional request ID to identify requests. Specify a unique request ID so   *  that if you must retry your request, the server will know to ignore the   *  request if it has already been completed.   *  For example, consider a situation where you make an initial request and   *  the request times out. If you make the request again with the same   *  request ID, the server can check if original operation with the same   *  request ID was received, and if so, will ignore the second request. This   *  prevents clients from accidentally creating duplicate commitments.   *  The request ID must be   *  a valid UUID with the exception that zero UUID is not supported   *  (00000000-0000-0000-0000-000000000000).   */// const requestId = 'abc123'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallPatch(){// Construct requestconstrequest={image,imageResource,project,};// Run requestconstresponse=awaitcomputeClient.patch(request);console.log(response);}callPatch();

patch(request, options, callback)

patch(request:protos.google.cloud.compute.v1beta.IPatchImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IPatchImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIPatchImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IPatchImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

patch(request, callback)

patch(request:protos.google.cloud.compute.v1beta.IPatchImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IPatchImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestIPatchImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.IPatchImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setIamPolicy(request, options)

setIamPolicy(request?:protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest|undefined,{}|undefined]>;

Sets the access control policy on the specified resource. Replaces any existing policy.

Parameters
NameDescription
requestISetIamPolicyImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representingPolicy. 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.   *//**   *  The body resource for this request   */// const globalSetPolicyRequestResource = {}/**   *  Project ID for this request.   */// const project = 'my-project'/**   *  Name or id of the resource for this request.   */// const resource = 'abc123'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallSetIamPolicy(){// Construct requestconstrequest={globalSetPolicyRequestResource,project,resource,};// Run requestconstresponse=awaitcomputeClient.setIamPolicy(request);console.log(response);}callSetIamPolicy();

setIamPolicy(request, options, callback)

setIamPolicy(request:protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestISetIamPolicyImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setIamPolicy(request, callback)

setIamPolicy(request:protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestISetIamPolicyImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IPolicy,protos.google.cloud.compute.v1beta.ISetIamPolicyImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setLabels(request, options)

setLabels(request?:protos.google.cloud.compute.v1beta.ISetLabelsImageRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation,null>,protos.google.cloud.compute.v1beta.IOperation|undefined,{}|undefined]>;

Sets the labels on an image. To learn more about labels, read theLabeling Resources documentation.

Parameters
NameDescription
requestISetLabelsImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[LROperation<protos.google.cloud.compute.v1beta.IOperation, null>,protos.google.cloud.compute.v1beta.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Please see thedocumentation for more details and examples. This method is considered to be in beta. This means while stable it is still a work-in-progress and under active development, and might get backwards-incompatible changes at any time..promise() is not supported yet.

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.   *//**   *  The body resource for this request   */// const globalSetLabelsRequestResource = {}/**   *  Project ID for this request.   */// const project = 'my-project'/**   *  Name or id of the resource for this request.   */// const resource = 'abc123'// Imports the Compute libraryconst{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();asyncfunctioncallSetLabels(){// Construct requestconstrequest={globalSetLabelsRequestResource,project,resource,};// Run requestconstresponse=awaitcomputeClient.setLabels(request);console.log(response);}callSetLabels();

setLabels(request, options, callback)

setLabels(request:protos.google.cloud.compute.v1beta.ISetLabelsImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.ISetLabelsImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestISetLabelsImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.ISetLabelsImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

setLabels(request, callback)

setLabels(request:protos.google.cloud.compute.v1beta.ISetLabelsImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.ISetLabelsImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestISetLabelsImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.IOperation,protos.google.cloud.compute.v1beta.ISetLabelsImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

testIamPermissions(request, options)

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

Returns permissions that a caller has on the specified resource.

Parameters
NameDescription
requestITestIamPermissionsImageRequest

The request object that will be sent.

optionsCallOptions

Call options. SeeCallOptions for more details.

Returns
TypeDescription
Promise<[protos.google.cloud.compute.v1beta.ITestPermissionsResponse,protos.google.cloud.compute.v1beta.ITestIamPermissionsImageRequest | 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{ImagesClient}=require('@google-cloud/compute').v1beta;// Instantiates a clientconstcomputeClient=newImagesClient();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.v1beta.ITestIamPermissionsImageRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1beta.ITestPermissionsResponse,protos.google.cloud.compute.v1beta.ITestIamPermissionsImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestITestIamPermissionsImageRequest
optionsCallOptions
callbackCallback<protos.google.cloud.compute.v1beta.ITestPermissionsResponse,protos.google.cloud.compute.v1beta.ITestIamPermissionsImageRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

testIamPermissions(request, callback)

testIamPermissions(request:protos.google.cloud.compute.v1beta.ITestIamPermissionsImageRequest,callback:Callback<protos.google.cloud.compute.v1beta.ITestPermissionsResponse,protos.google.cloud.compute.v1beta.ITestIamPermissionsImageRequest|null|undefined,{}|null|undefined>):void;
Parameters
NameDescription
requestITestIamPermissionsImageRequest
callbackCallback<protos.google.cloud.compute.v1beta.ITestPermissionsResponse,protos.google.cloud.compute.v1beta.ITestIamPermissionsImageRequest | 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.