Package
@google-cloud/computeConstructors
(constructor)(opts, gaxInstance)
constructor(opts?:ClientOptions,gaxInstance?:typeofgax|typeofgax.fallback);
Construct an instance of InstancesClient.
| Parameters |
|---|
| Name | Description |
opts | ClientOptions
|
gaxInstance | typeofgax | 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 InstancesClient({fallback: true}, gax); ``` |
Properties
apiEndpoint
The DNS address for this API service.
apiEndpoint
staticgetapiEndpoint():string;
The DNS address for this API service - same as servicePath.
auth
descriptors
innerApiCalls
innerApiCalls:{[name:string]:Function;};
instancesStub
instancesStub?:Promise<{[name:string]:Function;}>;
port
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
addAccessConfig(request, options)
addAccessConfig(request?:protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Adds an access config to an instance's network interface.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 accessConfigResource = {}/** * The instance name for this request. */// const instance = 'abc123'/** * The name of the network interface to add to this instance. */// const networkInterface = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallAddAccessConfig(){// Construct requestconstrequest={accessConfigResource,instance,networkInterface,project,zone,};// Run requestconstresponse=awaitcomputeClient.addAccessConfig(request);console.log(response);}callAddAccessConfig();
addAccessConfig(request, options, callback)
addAccessConfig(request:protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
addAccessConfig(request, callback)
addAccessConfig(request:protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IAddAccessConfigInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
addNetworkInterface(request, options)
addNetworkInterface(request?:protos.google.cloud.compute.v1.IAddNetworkInterfaceInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Adds one dynamic network interface to an active instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance name for this request stored as resource_id. Name should conform to RFC1035 or be an unsigned long integer. */// const instance = 'abc123'/** * The body resource for this request */// const networkInterfaceResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallAddNetworkInterface(){// Construct requestconstrequest={instance,networkInterfaceResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.addNetworkInterface(request);console.log(response);}callAddNetworkInterface();
addNetworkInterface(request, options, callback)
addNetworkInterface(request:protos.google.cloud.compute.v1.IAddNetworkInterfaceInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IAddNetworkInterfaceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
addNetworkInterface(request, callback)
addNetworkInterface(request:protos.google.cloud.compute.v1.IAddNetworkInterfaceInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IAddNetworkInterfaceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
addResourcePolicies(request, options)
addResourcePolicies(request?:protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance name for this request. */// const instance = 'abc123'/** * The body resource for this request */// const instancesAddResourcePoliciesRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallAddResourcePolicies(){// Construct requestconstrequest={instance,instancesAddResourcePoliciesRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.addResourcePolicies(request);console.log(response);}callAddResourcePolicies();
addResourcePolicies(request, options, callback)
addResourcePolicies(request:protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
addResourcePolicies(request, callback)
addResourcePolicies(request:protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IAddResourcePoliciesInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
aggregatedListAsync(request, options)
aggregatedListAsync(request?:protos.google.cloud.compute.v1.IAggregatedListInstancesRequest,options?:CallOptions):AsyncIterable<[string,protos.google.cloud.compute.v1.IInstancesScopedList]>;
Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. To prevent failure, Google recommends that you set thereturnPartialSuccess parameter totrue.
for-await-of syntax is used with the iterable to get response elements on-demand.
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.MostComputeresourcessupporttwotypesoffilterexpressions:expressionsthatsupportregularexpressionsandexpressionsthatfollowAPIimprovementproposalAIP-160.Thesetwotypesoffilterexpressionscannotbemixedinonerequest.IfyouwanttouseAIP-160,yourexpressionmustspecifythefieldname,anoperator,andthevaluethatyouwanttouseforfiltering.Thevaluemustbeastring,anumber,oraboolean.Theoperatormustbeeither`=`,`!=`,`>`,`<`,><=`, `="">=` 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 on resource 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 an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example:
(cpuPlatform="Intel Skylake")OR(cpuPlatform="Intel Broadwell")AND(scheduling.automaticRestart=true)
If you want to use a regular expression, use the `eq` (equal) or `ne` (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 Google RE2 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 use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
/ // const filter = 'abc123' /*
- Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included./// const includeAllScopes = true/*
- The maximum number of results per page that should be returned. If the number of available results is larger than
maxResults, Compute Engine returns anextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are0 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 using
orderBy="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 orcreationTimestamp desc is supported./// const orderBy = 'abc123'/* - Specifies a page token to use. Set
pageToken to thenextPageToken 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 Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api.*/// const serviceProjectNumber = 1234
// Imports the Compute libraryconst {InstancesClient} = require('@google-cloud/compute').v1;
// Instantiates a clientconst computeClient = new InstancesClient();
async function callAggregatedList() {// Construct requestconst request = {project,};
// Run requestconst iterable = computeClient.aggregatedListAsync(request);for await (const [key, value] of iterable) { console.log(response);}}
callAggregatedList();
attachDisk(request, options)
attachDisk(request?:protos.google.cloud.compute.v1.IAttachDiskInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 attachedDiskResource = {}/** * Whether to force attach the regional disk even if it's currently attached to another instance. If you try to force attach a zonal disk to an instance, you will receive an error. */// const forceAttach = true/** * The instance name for this request. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallAttachDisk(){// Construct requestconstrequest={attachedDiskResource,instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.attachDisk(request);console.log(response);}callAttachDisk();
attachDisk(request, options, callback)
attachDisk(request:protos.google.cloud.compute.v1.IAttachDiskInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IAttachDiskInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
attachDisk(request, callback)
attachDisk(request:protos.google.cloud.compute.v1.IAttachDiskInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IAttachDiskInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
bulkInsert(request, options)
bulkInsert(request?:protos.google.cloud.compute.v1.IBulkInsertInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 bulkInsertInstanceResourceResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallBulkInsert(){// Construct requestconstrequest={bulkInsertInstanceResourceResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.bulkInsert(request);console.log(response);}callBulkInsert();
bulkInsert(request, options, callback)
bulkInsert(request:protos.google.cloud.compute.v1.IBulkInsertInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IBulkInsertInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
bulkInsert(request, callback)
bulkInsert(request:protos.google.cloud.compute.v1.IBulkInsertInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IBulkInsertInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
close()
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. |
delete(request, options)
delete(request?:protos.google.cloud.compute.v1.IDeleteInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Deletes the specified Instance resource. For more information, see Deleting an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance resource to delete. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallDelete(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.delete(request);console.log(response);}callDelete();
delete(request, options, callback)
delete(request:protos.google.cloud.compute.v1.IDeleteInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IDeleteInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
delete(request, callback)
delete(request:protos.google.cloud.compute.v1.IDeleteInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IDeleteInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
deleteAccessConfig(request, options)
deleteAccessConfig(request?:protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Deletes an access config from an instance's network interface.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 name of the access config to delete. */// const accessConfig = 'abc123'/** * The instance name for this request. */// const instance = 'abc123'/** * The name of the network interface. */// const networkInterface = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallDeleteAccessConfig(){// Construct requestconstrequest={accessConfig,instance,networkInterface,project,zone,};// Run requestconstresponse=awaitcomputeClient.deleteAccessConfig(request);console.log(response);}callDeleteAccessConfig();
deleteAccessConfig(request, options, callback)
deleteAccessConfig(request:protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
deleteAccessConfig(request, callback)
deleteAccessConfig(request:protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IDeleteAccessConfigInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
deleteNetworkInterface(request, options)
deleteNetworkInterface(request?:protos.google.cloud.compute.v1.IDeleteNetworkInterfaceInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Deletes one dynamic network interface from an active instance. InstancesDeleteNetworkInterfaceRequest indicates: - instance from which to delete, using project+zone+resource_id fields; - dynamic network interface to be deleted, using network_interface_name field;
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance name for this request stored as resource_id. Name should conform to RFC1035 or be an unsigned long integer. */// const instance = 'abc123'/** * The name of the dynamic network interface to be deleted from the instance. */// const networkInterfaceName = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallDeleteNetworkInterface(){// Construct requestconstrequest={instance,networkInterfaceName,project,zone,};// Run requestconstresponse=awaitcomputeClient.deleteNetworkInterface(request);console.log(response);}callDeleteNetworkInterface();
deleteNetworkInterface(request, options, callback)
deleteNetworkInterface(request:protos.google.cloud.compute.v1.IDeleteNetworkInterfaceInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IDeleteNetworkInterfaceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
deleteNetworkInterface(request, callback)
deleteNetworkInterface(request:protos.google.cloud.compute.v1.IDeleteNetworkInterfaceInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IDeleteNetworkInterfaceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
detachDisk(request, options)
detachDisk(request?:protos.google.cloud.compute.v1.IDetachDiskInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Detaches a disk from an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names. */// const deviceName = 'abc123'/** * Instance name for this request. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallDetachDisk(){// Construct requestconstrequest={deviceName,instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.detachDisk(request);console.log(response);}callDetachDisk();
detachDisk(request, options, callback)
detachDisk(request:protos.google.cloud.compute.v1.IDetachDiskInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IDetachDiskInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
detachDisk(request, callback)
detachDisk(request:protos.google.cloud.compute.v1.IDetachDiskInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IDetachDiskInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
get(request, options)
get(request?:protos.google.cloud.compute.v1.IGetInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IInstance,protos.google.cloud.compute.v1.IGetInstanceRequest|undefined,{}|undefined]>;
Returns the specified Instance resource.
| Parameters |
|---|
| Name | Description |
request | IGetInstanceRequest
The request object that will be sent. |
options | CallOptions
Call options. SeeCallOptions for more details. |
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 instance resource to return. */// const instance = 'abc123'/** * Project ID for this request. */// const project = 'my-project'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallGet(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.get(request);console.log(response);}callGet();
get(request, options, callback)
get(request:protos.google.cloud.compute.v1.IGetInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IInstance,protos.google.cloud.compute.v1.IGetInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
get(request, callback)
get(request:protos.google.cloud.compute.v1.IGetInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IInstance,protos.google.cloud.compute.v1.IGetInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getEffectiveFirewalls(request, options)
getEffectiveFirewalls(request?:protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse,protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest|undefined,{}|undefined]>;
Returns effective firewalls applied to an interface of the instance.
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 instance scoping this request. */// const instance = 'abc123'/** * The name of the network interface to get the effective firewalls. */// const networkInterface = 'abc123'/** * Project ID for this request. */// const project = 'my-project'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallGetEffectiveFirewalls(){// Construct requestconstrequest={instance,networkInterface,project,zone,};// Run requestconstresponse=awaitcomputeClient.getEffectiveFirewalls(request);console.log(response);}callGetEffectiveFirewalls();
getEffectiveFirewalls(request, options, callback)
getEffectiveFirewalls(request:protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse,protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getEffectiveFirewalls(request, callback)
getEffectiveFirewalls(request:protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IInstancesGetEffectiveFirewallsResponse,protos.google.cloud.compute.v1.IGetEffectiveFirewallsInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getGuestAttributes(request, options)
getGuestAttributes(request?:protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IGuestAttributes,protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest|undefined,{}|undefined]>;
Returns the specified guest attributes entry.
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 instance scoping this request. */// const instance = 'abc123'/** * Project ID for this request. */// const project = 'my-project'/** * Specifies the guest attributes path to be queried. */// const queryPath = 'abc123'/** * Specifies the key for the guest attributes entry. */// const variableKey = 'abc123'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallGetGuestAttributes(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.getGuestAttributes(request);console.log(response);}callGetGuestAttributes();
getGuestAttributes(request, options, callback)
getGuestAttributes(request:protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IGuestAttributes,protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getGuestAttributes(request, callback)
getGuestAttributes(request:protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IGuestAttributes,protos.google.cloud.compute.v1.IGetGuestAttributesInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getIamPolicy(request, options)
getIamPolicy(request?:protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IPolicy,protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest|undefined,{}|undefined]>;
Gets the access control policy for a resource. May be empty if no such policy or resource exists.
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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallGetIamPolicy(){// Construct requestconstrequest={project,resource,zone,};// Run requestconstresponse=awaitcomputeClient.getIamPolicy(request);console.log(response);}callGetIamPolicy();
getIamPolicy(request, options, callback)
getIamPolicy(request:protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IPolicy,protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getIamPolicy(request, callback)
getIamPolicy(request:protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IPolicy,protos.google.cloud.compute.v1.IGetIamPolicyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getProjectId()
getProjectId():Promise<string>;
| Returns |
|---|
| Type | Description |
Promise<string> | |
getProjectId(callback)
getProjectId(callback:Callback<string,undefined,undefined>):void;
| Parameter |
|---|
| Name | Description |
callback | Callback<string, undefined, undefined>
|
| Returns |
|---|
| Type | Description |
void | |
getScreenshot(request, options)
getScreenshot(request?:protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IScreenshot,protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest|undefined,{}|undefined]>;
Returns the screenshot from the specified instance.
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 instance scoping this request. */// const instance = 'abc123'/** * Project ID for this request. */// const project = 'my-project'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallGetScreenshot(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.getScreenshot(request);console.log(response);}callGetScreenshot();
getScreenshot(request, options, callback)
getScreenshot(request:protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IScreenshot,protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getScreenshot(request, callback)
getScreenshot(request:protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IScreenshot,protos.google.cloud.compute.v1.IGetScreenshotInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getSerialPortOutput(request, options)
getSerialPortOutput(request?:protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.ISerialPortOutput,protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest|undefined,{}|undefined]>;
Returns the last 1 MB of serial port output from the specified instance.
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 instance for this request. */// const instance = 'abc123'/** * Specifies which COM or serial port to retrieve data from. */// const port = 1234/** * Project ID for this request. */// const project = 'my-project'/** * Specifies the starting byte position of the output to return. To start with the first byte of output to the specified port, omit this field or set it to `0`. If the output for that byte position is available, this field matches the `start` parameter sent with the request. If the amount of serial console output exceeds the size of the buffer (1 MB), the oldest output is discarded and is no longer available. If the requested start position refers to discarded output, the start position is adjusted to the oldest output still available, and the adjusted start position is returned as the `start` property value. You can also provide a negative start position, which translates to the most recent number of bytes written to the serial port. For example, -3 is interpreted as the most recent 3 bytes written to the serial console. Note that the negative start is bounded by the retained buffer size, and the returned serial console output will not exceed the max buffer size. */// const start = 1234/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallGetSerialPortOutput(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.getSerialPortOutput(request);console.log(response);}callGetSerialPortOutput();
getSerialPortOutput(request, options, callback)
getSerialPortOutput(request:protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.ISerialPortOutput,protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getSerialPortOutput(request, callback)
getSerialPortOutput(request:protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.ISerialPortOutput,protos.google.cloud.compute.v1.IGetSerialPortOutputInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getShieldedInstanceIdentity(request, options)
getShieldedInstanceIdentity(request?:protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IShieldedInstanceIdentity,protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest|undefined,{}|undefined]>;
Returns the Shielded Instance Identity of an instance
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 or id of the instance scoping this request. */// const instance = 'abc123'/** * Project ID for this request. */// const project = 'my-project'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallGetShieldedInstanceIdentity(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.getShieldedInstanceIdentity(request);console.log(response);}callGetShieldedInstanceIdentity();
getShieldedInstanceIdentity(request, options, callback)
getShieldedInstanceIdentity(request:protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IShieldedInstanceIdentity,protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
getShieldedInstanceIdentity(request, callback)
getShieldedInstanceIdentity(request:protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IShieldedInstanceIdentity,protos.google.cloud.compute.v1.IGetShieldedInstanceIdentityInstanceRequest|null|undefined,{}|null|undefined>):void;
| 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. |
insert(request, options)
insert(request?:protos.google.cloud.compute.v1.IInsertInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Creates an instance resource in the specified project using the data included in the request.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instanceResource = {}/** * 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'/** * Specifies instance template to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to an instance template: - https://www.googleapis.com/compute/v1/projects/project /global/instanceTemplates/instanceTemplate - projects/project/global/instanceTemplates/instanceTemplate - global/instanceTemplates/instanceTemplate */// const sourceInstanceTemplate = 'abc123'/** * Specifies the machine image to use to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to a machine image: - https://www.googleapis.com/compute/v1/projects/project/global/global /machineImages/machineImage - projects/project/global/global/machineImages/machineImage - global/machineImages/machineImage */// const sourceMachineImage = 'abc123'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallInsert(){// Construct requestconstrequest={instanceResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.insert(request);console.log(response);}callInsert();
insert(request, options, callback)
insert(request:protos.google.cloud.compute.v1.IInsertInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IInsertInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
insert(request, callback)
insert(request:protos.google.cloud.compute.v1.IInsertInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IInsertInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
list(request, options)
list(request?:protos.google.cloud.compute.v1.IListInstancesRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IInstance[],protos.google.cloud.compute.v1.IListInstancesRequest|null,protos.google.cloud.compute.v1.IInstanceList]>;
Retrieves the list of instances contained within the specified zone.
list(request, options, callback)
list(request:protos.google.cloud.compute.v1.IListInstancesRequest,options:CallOptions,callback:PaginationCallback<protos.google.cloud.compute.v1.IListInstancesRequest,protos.google.cloud.compute.v1.IInstanceList|null|undefined,protos.google.cloud.compute.v1.IInstance>):void;
| Returns |
|---|
| Type | Description |
void | |
list(request, callback)
list(request:protos.google.cloud.compute.v1.IListInstancesRequest,callback:PaginationCallback<protos.google.cloud.compute.v1.IListInstancesRequest,protos.google.cloud.compute.v1.IInstanceList|null|undefined,protos.google.cloud.compute.v1.IInstance>):void;
| Returns |
|---|
| Type | Description |
void | |
listAsync(request, options)
listAsync(request?:protos.google.cloud.compute.v1.IListInstancesRequest,options?:CallOptions):AsyncIterable<protos.google.cloud.compute.v1.IInstance>;
Equivalent tolist, but returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Returns |
|---|
| Type | Description |
AsyncIterable<protos.google.cloud.compute.v1.IInstance> | {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.MostComputeresourcessupporttwotypesoffilterexpressions:expressionsthatsupportregularexpressionsandexpressionsthatfollowAPIimprovementproposalAIP-160.Thesetwotypesoffilterexpressionscannotbemixedinonerequest.IfyouwanttouseAIP-160,yourexpressionmustspecifythefieldname,anoperator,andthevaluethatyouwanttouseforfiltering.Thevaluemustbeastring,anumber,oraboolean.Theoperatormustbeeither`=`,`!=`,`>`,`<`,><=`, `="">=` 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 on resource 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 an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example:
(cpuPlatform="Intel Skylake")OR(cpuPlatform="Intel Broadwell")AND(scheduling.automaticRestart=true)
If you want to use a regular expression, use the `eq` (equal) or `ne` (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 Google RE2 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 use `name 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 than
maxResults, Compute Engine returns anextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are0 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 using
orderBy="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 orcreationTimestamp desc is supported./// const orderBy = 'abc123'/* - Specifies a page token to use. Set
pageToken to thenextPageToken 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 name of the zone for this request.*/// const zone = 'abc123'
// Imports the Compute libraryconst {InstancesClient} = require('@google-cloud/compute').v1;
// Instantiates a clientconst computeClient = new InstancesClient();
async function callList() {// Construct requestconst request = {project,zone,};
// Run requestconst iterable = computeClient.listAsync(request);for await (const response of iterable) { console.log(response);}}
callList();
listReferrers(request, options)
listReferrers(request?:protos.google.cloud.compute.v1.IListReferrersInstancesRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IReference[],protos.google.cloud.compute.v1.IListReferrersInstancesRequest|null,protos.google.cloud.compute.v1.IInstanceListReferrers]>;
Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.
listReferrers(request, options, callback)
listReferrers(request:protos.google.cloud.compute.v1.IListReferrersInstancesRequest,options:CallOptions,callback:PaginationCallback<protos.google.cloud.compute.v1.IListReferrersInstancesRequest,protos.google.cloud.compute.v1.IInstanceListReferrers|null|undefined,protos.google.cloud.compute.v1.IReference>):void;
| Returns |
|---|
| Type | Description |
void | |
listReferrers(request, callback)
listReferrers(request:protos.google.cloud.compute.v1.IListReferrersInstancesRequest,callback:PaginationCallback<protos.google.cloud.compute.v1.IListReferrersInstancesRequest,protos.google.cloud.compute.v1.IInstanceListReferrers|null|undefined,protos.google.cloud.compute.v1.IReference>):void;
| Returns |
|---|
| Type | Description |
void | |
listReferrersAsync(request, options)
listReferrersAsync(request?:protos.google.cloud.compute.v1.IListReferrersInstancesRequest,options?:CallOptions):AsyncIterable<protos.google.cloud.compute.v1.IReference>;
Equivalent tolistReferrers, but returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Returns |
|---|
| Type | Description |
AsyncIterable<protos.google.cloud.compute.v1.IReference> | {Object} An iterable Object that allowsasync iteration. When you iterate the returned iterable, each element will be an object representingReference. 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.MostComputeresourcessupporttwotypesoffilterexpressions:expressionsthatsupportregularexpressionsandexpressionsthatfollowAPIimprovementproposalAIP-160.Thesetwotypesoffilterexpressionscannotbemixedinonerequest.IfyouwanttouseAIP-160,yourexpressionmustspecifythefieldname,anoperator,andthevaluethatyouwanttouseforfiltering.Thevaluemustbeastring,anumber,oraboolean.Theoperatormustbeeither`=`,`!=`,`>`,`<`,><=`, `="">=` 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 on resource 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 an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example:
(cpuPlatform="Intel Skylake")OR(cpuPlatform="Intel Broadwell")AND(scheduling.automaticRestart=true)
If you want to use a regular expression, use the `eq` (equal) or `ne` (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 Google RE2 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 use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
/ // const filter = 'abc123' /*
- Name of the target instance scoping this request, or '-' if the request should span over all instances in the container./// const instance = 'abc123'/*
- The maximum number of results per page that should be returned. If the number of available results is larger than
maxResults, Compute Engine returns anextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are0 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 using
orderBy="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 orcreationTimestamp desc is supported./// const orderBy = 'abc123'/* - Specifies a page token to use. Set
pageToken to thenextPageToken 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 name of the zone for this request.*/// const zone = 'abc123'
// Imports the Compute libraryconst {InstancesClient} = require('@google-cloud/compute').v1;
// Instantiates a clientconst computeClient = new InstancesClient();
async function callListReferrers() {// Construct requestconst request = {instance,project,zone,};
// Run requestconst iterable = computeClient.listReferrersAsync(request);for await (const response of iterable) { console.log(response);}}
callListReferrers();
listReferrersStream(request, options)
listReferrersStream(request?:protos.google.cloud.compute.v1.IListReferrersInstancesRequest,options?:CallOptions):Transform;
Equivalent tolistReferrers, but returns a NodeJS Stream object.
| Returns |
|---|
| Type | Description |
Transform | {Stream} An object stream which emits an object representingReference 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 usinglistReferrersAsync() method described below for async iteration which you can stop as needed. Please see thedocumentation for more details and examples. |
listStream(request, options)
listStream(request?:protos.google.cloud.compute.v1.IListInstancesRequest,options?:CallOptions):Transform;
Equivalent tolist, but returns a NodeJS Stream object.
| Returns |
|---|
| Type | Description |
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. |
performMaintenance(request, options)
performMaintenance(request?:protos.google.cloud.compute.v1.IPerformMaintenanceInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Perform a manual maintenance on the instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallPerformMaintenance(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.performMaintenance(request);console.log(response);}callPerformMaintenance();
performMaintenance(request, options, callback)
performMaintenance(request:protos.google.cloud.compute.v1.IPerformMaintenanceInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IPerformMaintenanceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
performMaintenance(request, callback)
performMaintenance(request:protos.google.cloud.compute.v1.IPerformMaintenanceInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IPerformMaintenanceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
removeResourcePolicies(request, options)
removeResourcePolicies(request?:protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Removes resource policies from an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance name for this request. */// const instance = 'abc123'/** * The body resource for this request */// const instancesRemoveResourcePoliciesRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallRemoveResourcePolicies(){// Construct requestconstrequest={instance,instancesRemoveResourcePoliciesRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.removeResourcePolicies(request);console.log(response);}callRemoveResourcePolicies();
removeResourcePolicies(request, options, callback)
removeResourcePolicies(request:protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
removeResourcePolicies(request, callback)
removeResourcePolicies(request:protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IRemoveResourcePoliciesInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
reportHostAsFaulty(request, options)
reportHostAsFaulty(request?:protos.google.cloud.compute.v1.IReportHostAsFaultyInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Mark the host as faulty and try to restart the instance on a new host.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = 'abc123'/** * The body resource for this request */// const instancesReportHostAsFaultyRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallReportHostAsFaulty(){// Construct requestconstrequest={instance,instancesReportHostAsFaultyRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.reportHostAsFaulty(request);console.log(response);}callReportHostAsFaulty();
reportHostAsFaulty(request, options, callback)
reportHostAsFaulty(request:protos.google.cloud.compute.v1.IReportHostAsFaultyInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IReportHostAsFaultyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
reportHostAsFaulty(request, callback)
reportHostAsFaulty(request:protos.google.cloud.compute.v1.IReportHostAsFaultyInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IReportHostAsFaultyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
reset(request, options)
reset(request?:protos.google.cloud.compute.v1.IResetInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallReset(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.reset(request);console.log(response);}callReset();
reset(request, options, callback)
reset(request:protos.google.cloud.compute.v1.IResetInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IResetInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
reset(request, callback)
reset(request:protos.google.cloud.compute.v1.IResetInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IResetInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
resume(request, options)
resume(request?:protos.google.cloud.compute.v1.IResumeInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Resumes an instance that was suspended using the instances().suspend method.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance resource to resume. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallResume(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.resume(request);console.log(response);}callResume();
resume(request, options, callback)
resume(request:protos.google.cloud.compute.v1.IResumeInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IResumeInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
resume(request, callback)
resume(request:protos.google.cloud.compute.v1.IResumeInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IResumeInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
sendDiagnosticInterrupt(request, options)
sendDiagnosticInterrupt(request?:protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse,protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest|undefined,{}|undefined]>;
Sends diagnostic interrupt to the instance.
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 instance scoping this request. */// const instance = 'abc123'/** * Project ID for this request. */// const project = 'my-project'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSendDiagnosticInterrupt(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.sendDiagnosticInterrupt(request);console.log(response);}callSendDiagnosticInterrupt();
sendDiagnosticInterrupt(request, options, callback)
sendDiagnosticInterrupt(request:protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse,protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
sendDiagnosticInterrupt(request, callback)
sendDiagnosticInterrupt(request:protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceResponse,protos.google.cloud.compute.v1.ISendDiagnosticInterruptInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setDeletionProtection(request, options)
setDeletionProtection(request?:protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets deletion protection on the instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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. *//** * Whether the resource should be protected against deletion. */// const deletionProtection = true/** * 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'/** * Name or id of the resource for this request. */// const resource = 'abc123'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetDeletionProtection(){// Construct requestconstrequest={project,resource,zone,};// Run requestconstresponse=awaitcomputeClient.setDeletionProtection(request);console.log(response);}callSetDeletionProtection();
setDeletionProtection(request, options, callback)
setDeletionProtection(request:protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setDeletionProtection(request, callback)
setDeletionProtection(request:protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetDeletionProtectionInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setDiskAutoDelete(request, options)
setDiskAutoDelete(request?:protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets the auto-delete flag for a disk attached to an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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. *//** * Whether to auto-delete the disk when the instance is deleted. */// const autoDelete = true/** * The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names. */// const deviceName = 'abc123'/** * The instance name for this request. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetDiskAutoDelete(){// Construct requestconstrequest={autoDelete,deviceName,instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.setDiskAutoDelete(request);console.log(response);}callSetDiskAutoDelete();
setDiskAutoDelete(request, options, callback)
setDiskAutoDelete(request:protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setDiskAutoDelete(request, callback)
setDiskAutoDelete(request:protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetDiskAutoDeleteInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setIamPolicy(request, options)
setIamPolicy(request?:protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.IPolicy,protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest|undefined,{}|undefined]>;
Sets the access control policy on the specified resource. Replaces any existing policy.
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 name of the zone for this request. */// const zone = 'abc123'/** * The body resource for this request */// const zoneSetPolicyRequestResource = {}// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetIamPolicy(){// Construct requestconstrequest={project,resource,zone,zoneSetPolicyRequestResource,};// Run requestconstresponse=awaitcomputeClient.setIamPolicy(request);console.log(response);}callSetIamPolicy();
setIamPolicy(request, options, callback)
setIamPolicy(request:protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IPolicy,protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setIamPolicy(request, callback)
setIamPolicy(request:protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IPolicy,protos.google.cloud.compute.v1.ISetIamPolicyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setLabels(request, options)
setLabels(request?:protos.google.cloud.compute.v1.ISetLabelsInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = 'abc123'/** * The body resource for this request */// const instancesSetLabelsRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetLabels(){// Construct requestconstrequest={instance,instancesSetLabelsRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.setLabels(request);console.log(response);}callSetLabels();
setLabels(request, options, callback)
setLabels(request:protos.google.cloud.compute.v1.ISetLabelsInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetLabelsInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setLabels(request, callback)
setLabels(request:protos.google.cloud.compute.v1.ISetLabelsInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetLabelsInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setMachineResources(request, options)
setMachineResources(request?:protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = 'abc123'/** * The body resource for this request */// const instancesSetMachineResourcesRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetMachineResources(){// Construct requestconstrequest={instance,instancesSetMachineResourcesRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.setMachineResources(request);console.log(response);}callSetMachineResources();
setMachineResources(request, options, callback)
setMachineResources(request:protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setMachineResources(request, callback)
setMachineResources(request:protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetMachineResourcesInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setMachineType(request, options)
setMachineType(request?:protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Changes the machine type for a stopped instance to the machine type specified in the request.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = 'abc123'/** * The body resource for this request */// const instancesSetMachineTypeRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetMachineType(){// Construct requestconstrequest={instance,instancesSetMachineTypeRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.setMachineType(request);console.log(response);}callSetMachineType();
setMachineType(request, options, callback)
setMachineType(request:protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setMachineType(request, callback)
setMachineType(request:protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetMachineTypeInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setMetadata(request, options)
setMetadata(request?:protos.google.cloud.compute.v1.ISetMetadataInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets metadata for the specified instance to the data included in the request.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = 'abc123'/** * The body resource for this request */// const metadataResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetMetadata(){// Construct requestconstrequest={instance,metadataResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.setMetadata(request);console.log(response);}callSetMetadata();
setMetadata(request, options, callback)
setMetadata(request:protos.google.cloud.compute.v1.ISetMetadataInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetMetadataInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setMetadata(request, callback)
setMetadata(request:protos.google.cloud.compute.v1.ISetMetadataInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetMetadataInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setMinCpuPlatform(request, options)
setMinCpuPlatform(request?:protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = 'abc123'/** * The body resource for this request */// const instancesSetMinCpuPlatformRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetMinCpuPlatform(){// Construct requestconstrequest={instance,instancesSetMinCpuPlatformRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.setMinCpuPlatform(request);console.log(response);}callSetMinCpuPlatform();
setMinCpuPlatform(request, options, callback)
setMinCpuPlatform(request:protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setMinCpuPlatform(request, callback)
setMinCpuPlatform(request:protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetMinCpuPlatformInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setName(request, options)
setName(request?:protos.google.cloud.compute.v1.ISetNameInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets name of an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance name for this request. */// const instance = 'abc123'/** * The body resource for this request */// const instancesSetNameRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetName(){// Construct requestconstrequest={instance,instancesSetNameRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.setName(request);console.log(response);}callSetName();
setName(request, options, callback)
setName(request:protos.google.cloud.compute.v1.ISetNameInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetNameInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setName(request, callback)
setName(request:protos.google.cloud.compute.v1.ISetNameInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetNameInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setScheduling(request, options)
setScheduling(request?:protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in aTERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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. *//** * Instance name for this request. */// const instance = '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'/** * The body resource for this request */// const schedulingResource = {}/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetScheduling(){// Construct requestconstrequest={instance,project,schedulingResource,zone,};// Run requestconstresponse=awaitcomputeClient.setScheduling(request);console.log(response);}callSetScheduling();
setScheduling(request, options, callback)
setScheduling(request:protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setScheduling(request, callback)
setScheduling(request:protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetSchedulingInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setSecurityPolicy(request, options)
setSecurityPolicy(request?:protos.google.cloud.compute.v1.ISetSecurityPolicyInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 Instance resource to which the security policy should be set. The name should conform to RFC1035. */// const instance = 'abc123'/** * The body resource for this request */// const instancesSetSecurityPolicyRequestResource = {}/** * 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'/** * Name of the zone scoping this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetSecurityPolicy(){// Construct requestconstrequest={instance,instancesSetSecurityPolicyRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.setSecurityPolicy(request);console.log(response);}callSetSecurityPolicy();
setSecurityPolicy(request, options, callback)
setSecurityPolicy(request:protos.google.cloud.compute.v1.ISetSecurityPolicyInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetSecurityPolicyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setSecurityPolicy(request, callback)
setSecurityPolicy(request:protos.google.cloud.compute.v1.ISetSecurityPolicyInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetSecurityPolicyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setServiceAccount(request, options)
setServiceAccount(request?:protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance resource to start. */// const instance = 'abc123'/** * The body resource for this request */// const instancesSetServiceAccountRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetServiceAccount(){// Construct requestconstrequest={instance,instancesSetServiceAccountRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.setServiceAccount(request);console.log(response);}callSetServiceAccount();
setServiceAccount(request, options, callback)
setServiceAccount(request:protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setServiceAccount(request, callback)
setServiceAccount(request:protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetServiceAccountInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setShieldedInstanceIntegrityPolicy(request, options)
setShieldedInstanceIntegrityPolicy(request?:protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 or id of the instance scoping this request. */// const instance = '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'/** * The body resource for this request */// const shieldedInstanceIntegrityPolicyResource = {}/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetShieldedInstanceIntegrityPolicy(){// Construct requestconstrequest={instance,project,shieldedInstanceIntegrityPolicyResource,zone,};// Run requestconstresponse=awaitcomputeClient.setShieldedInstanceIntegrityPolicy(request);console.log(response);}callSetShieldedInstanceIntegrityPolicy();
setShieldedInstanceIntegrityPolicy(request, options, callback)
setShieldedInstanceIntegrityPolicy(request:protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setShieldedInstanceIntegrityPolicy(request, callback)
setShieldedInstanceIntegrityPolicy(request:protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetShieldedInstanceIntegrityPolicyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setTags(request, options)
setTags(request?:protos.google.cloud.compute.v1.ISetTagsInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Sets network tags for the specified instance to the data included in the request.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = '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'/** * The body resource for this request */// const tagsResource = {}/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSetTags(){// Construct requestconstrequest={instance,project,tagsResource,zone,};// Run requestconstresponse=awaitcomputeClient.setTags(request);console.log(response);}callSetTags();
setTags(request, options, callback)
setTags(request:protos.google.cloud.compute.v1.ISetTagsInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetTagsInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
setTags(request, callback)
setTags(request:protos.google.cloud.compute.v1.ISetTagsInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISetTagsInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
simulateMaintenanceEvent(request, options)
simulateMaintenanceEvent(request?:protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance scoping this request. */// const instance = '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'/** * Determines whether the customers receive notifications before migration. Only applicable to SF vms. */// const withExtendedNotifications = true/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSimulateMaintenanceEvent(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.simulateMaintenanceEvent(request);console.log(response);}callSimulateMaintenanceEvent();
simulateMaintenanceEvent(request, options, callback)
simulateMaintenanceEvent(request:protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
simulateMaintenanceEvent(request, callback)
simulateMaintenanceEvent(request:protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISimulateMaintenanceEventInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
start(request, options)
start(request?:protos.google.cloud.compute.v1.IStartInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance resource to start. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallStart(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.start(request);console.log(response);}callStart();
start(request, options, callback)
start(request:protos.google.cloud.compute.v1.IStartInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IStartInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
start(request, callback)
start(request:protos.google.cloud.compute.v1.IStartInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IStartInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
startWithEncryptionKey(request, options)
startWithEncryptionKey(request?:protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance resource to start. */// const instance = 'abc123'/** * The body resource for this request */// const instancesStartWithEncryptionKeyRequestResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallStartWithEncryptionKey(){// Construct requestconstrequest={instance,instancesStartWithEncryptionKeyRequestResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.startWithEncryptionKey(request);console.log(response);}callStartWithEncryptionKey();
startWithEncryptionKey(request, options, callback)
startWithEncryptionKey(request:protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
startWithEncryptionKey(request, callback)
startWithEncryptionKey(request:protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IStartWithEncryptionKeyInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
stop(request, options)
stop(request?:protos.google.cloud.compute.v1.IStopInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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. *//** * This property is required if the instance has any attached Local SSD disks. If false, Local SSD data will be preserved when the instance is suspended. If true, the contents of any attached Local SSD disks will be discarded. */// const discardLocalSsd = true/** * Name of the instance resource to stop. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallStop(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.stop(request);console.log(response);}callStop();
stop(request, options, callback)
stop(request:protos.google.cloud.compute.v1.IStopInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IStopInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
stop(request, callback)
stop(request:protos.google.cloud.compute.v1.IStopInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IStopInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
suspend(request, options)
suspend(request?:protos.google.cloud.compute.v1.ISuspendInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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. *//** * This property is required if the instance has any attached Local SSD disks. If false, Local SSD data will be preserved when the instance is suspended. If true, the contents of any attached Local SSD disks will be discarded. */// const discardLocalSsd = true/** * Name of the instance resource to suspend. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallSuspend(){// Construct requestconstrequest={instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.suspend(request);console.log(response);}callSuspend();
suspend(request, options, callback)
suspend(request:protos.google.cloud.compute.v1.ISuspendInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISuspendInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
suspend(request, callback)
suspend(request:protos.google.cloud.compute.v1.ISuspendInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.ISuspendInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
testIamPermissions(request, options)
testIamPermissions(request?:protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest,options?:CallOptions):Promise<[protos.google.cloud.compute.v1.ITestPermissionsResponse,protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest|undefined,{}|undefined]>;
Returns permissions that a caller has on the specified resource.
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 = {}/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallTestIamPermissions(){// Construct requestconstrequest={project,resource,testPermissionsRequestResource,zone,};// Run requestconstresponse=awaitcomputeClient.testIamPermissions(request);console.log(response);}callTestIamPermissions();
testIamPermissions(request, options, callback)
testIamPermissions(request:protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse,protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
testIamPermissions(request, callback)
testIamPermissions(request:protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.ITestPermissionsResponse,protos.google.cloud.compute.v1.ITestIamPermissionsInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
update(request, options)
update(request?:protos.google.cloud.compute.v1.IUpdateInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance resource to update. */// const instance = 'abc123'/** * The body resource for this request */// const instanceResource = {}/** * Specifies the action to take when updating an instance even if the updated properties do not require it. If not specified, then Compute Engine acts based on the minimum action that the updated properties require. * Check the MinimalAction enum for the list of possible values. */// const minimalAction = 'abc123'/** * Specifies the most disruptive action that can be taken on the instance as part of the update. Compute Engine returns an error if the instance properties require a more disruptive action as part of the instance update. Valid options from lowest to highest are NO_EFFECT, REFRESH, and RESTART. * Check the MostDisruptiveAllowedAction enum for the list of possible values. */// const mostDisruptiveAllowedAction = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallUpdate(){// Construct requestconstrequest={instance,instanceResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.update(request);console.log(response);}callUpdate();
update(request, options, callback)
update(request:protos.google.cloud.compute.v1.IUpdateInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
update(request, callback)
update(request:protos.google.cloud.compute.v1.IUpdateInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
updateAccessConfig(request, options)
updateAccessConfig(request?:protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 accessConfigResource = {}/** * The instance name for this request. */// const instance = 'abc123'/** * The name of the network interface where the access config is attached. */// const networkInterface = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallUpdateAccessConfig(){// Construct requestconstrequest={accessConfigResource,instance,networkInterface,project,zone,};// Run requestconstresponse=awaitcomputeClient.updateAccessConfig(request);console.log(response);}callUpdateAccessConfig();
updateAccessConfig(request, options, callback)
updateAccessConfig(request:protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
updateAccessConfig(request, callback)
updateAccessConfig(request:protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateAccessConfigInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
updateDisplayDevice(request, options)
updateDisplayDevice(request?:protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 displayDeviceResource = {}/** * Name of the instance scoping this request. */// const instance = '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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallUpdateDisplayDevice(){// Construct requestconstrequest={displayDeviceResource,instance,project,zone,};// Run requestconstresponse=awaitcomputeClient.updateDisplayDevice(request);console.log(response);}callUpdateDisplayDevice();
updateDisplayDevice(request, options, callback)
updateDisplayDevice(request:protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
updateDisplayDevice(request, callback)
updateDisplayDevice(request:protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateDisplayDeviceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
updateNetworkInterface(request, options)
updateNetworkInterface(request?:protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 instance name for this request. */// const instance = 'abc123'/** * The name of the network interface to update. */// const networkInterface = 'abc123'/** * The body resource for this request */// const networkInterfaceResource = {}/** * 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'/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallUpdateNetworkInterface(){// Construct requestconstrequest={instance,networkInterface,networkInterfaceResource,project,zone,};// Run requestconstresponse=awaitcomputeClient.updateNetworkInterface(request);console.log(response);}callUpdateNetworkInterface();
updateNetworkInterface(request, options, callback)
updateNetworkInterface(request:protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
updateNetworkInterface(request, callback)
updateNetworkInterface(request:protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateNetworkInterfaceInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
updateShieldedInstanceConfig(request, options)
updateShieldedInstanceConfig(request?:protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest,options?:CallOptions):Promise<[LROperation<protos.google.cloud.compute.v1.IOperation,null>,protos.google.cloud.compute.v1.IOperation|undefined,{}|undefined]>;
Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
| Returns |
|---|
| Type | Description |
Promise<[LROperation<protos.google.cloud.compute.v1.IOperation, null>,protos.google.cloud.compute.v1.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 or id of the instance scoping this request. */// const instance = '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'/** * The body resource for this request */// const shieldedInstanceConfigResource = {}/** * The name of the zone for this request. */// const zone = 'abc123'// Imports the Compute libraryconst{InstancesClient}=require('@google-cloud/compute').v1;// Instantiates a clientconstcomputeClient=newInstancesClient();asyncfunctioncallUpdateShieldedInstanceConfig(){// Construct requestconstrequest={instance,project,shieldedInstanceConfigResource,zone,};// Run requestconstresponse=awaitcomputeClient.updateShieldedInstanceConfig(request);console.log(response);}callUpdateShieldedInstanceConfig();
updateShieldedInstanceConfig(request, options, callback)
updateShieldedInstanceConfig(request:protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest,options:CallOptions,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |
updateShieldedInstanceConfig(request, callback)
updateShieldedInstanceConfig(request:protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest,callback:Callback<protos.google.cloud.compute.v1.IOperation,protos.google.cloud.compute.v1.IUpdateShieldedInstanceConfigInstanceRequest|null|undefined,{}|null|undefined>):void;
| Returns |
|---|
| Type | Description |
void | |