Manages instances of a version. v1
Package
@google-cloud/appengine-adminConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of InstancesClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
instancesStub
instancesStub?: Promise<{
[name: string]: Function;
}>;
operationsClient
operationsClient: gax.OperationsClient;
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
universeDomain
get universeDomain(): string;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
checkDebugInstanceProgress(name)
checkDebugInstanceProgress(name: string): Promise<LROperation<protos.google.appengine.v1.Instance, protos.google.appengine.v1.OperationMetadataV1>>;
Check the status of the long running operation returned by debugInstance()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.appengine.v1.Instance, protos.google.appengine.v1.OperationMetadataV1>> | {Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples. |
/**
* 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 resource requested. Example:
* `apps/myapp/services/default/versions/v1/instances/instance-1`.
*/
// const name = 'abc123'
/**
* Public SSH key to add to the instance. Examples:
* * `[USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME]`
* * `[USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}`
* For more information, see
* Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys).
*/
// const sshKey = 'abc123'
// Imports the Appengine library
const {InstancesClient} = require('@google-cloud/appengine-admin').v1;
// Instantiates a client
const appengineClient = new InstancesClient();
async function callDebugInstance() {
// Construct request
const request = {
};
// Run request
const [operation] = await appengineClient.debugInstance(request);
const [response] = await operation.promise();
console.log(response);
}
callDebugInstance();
checkDeleteInstanceProgress(name)
checkDeleteInstanceProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.appengine.v1.OperationMetadataV1>>;
Check the status of the long running operation returned by deleteInstance()
.
Parameter | |
---|---|
Name | Description |
name |
string
The operation name that will be passed. |
Returns | |
---|---|
Type | Description |
Promise<LROperation<protos.google.protobuf.Empty, protos.google.appengine.v1.OperationMetadataV1>> | {Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the documentation for more details and examples. |
/**
* 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 resource requested. Example:
* `apps/myapp/services/default/versions/v1/instances/instance-1`.
*/
// const name = 'abc123'
// Imports the Appengine library
const {InstancesClient} = require('@google-cloud/appengine-admin').v1;
// Instantiates a client
const appengineClient = new InstancesClient();
async function callDeleteInstance() {
// Construct request
const request = {
};
// Run request
const [operation] = await appengineClient.deleteInstance(request);
const [response] = await operation.promise();
console.log(response);
}
callDeleteInstance();
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns | |
---|---|
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed. |
debugInstance(request, options)
debugInstance(request?: protos.google.appengine.v1.IDebugInstanceRequest, options?: CallOptions): Promise<[
LROperation<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IOperationMetadataV1>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.
Only applicable for instances in App Engine flexible environment.
Parameters | |
---|---|
Name | Description |
request |
IDebugInstanceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IOperationMetadataV1>,
protos.google.longrunning.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. Its |
/**
* 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 resource requested. Example:
* `apps/myapp/services/default/versions/v1/instances/instance-1`.
*/
// const name = 'abc123'
/**
* Public SSH key to add to the instance. Examples:
* * `[USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME]`
* * `[USERNAME]:ssh-rsa [KEY_VALUE] google-ssh {"userName":"[USERNAME]","expireOn":"[EXPIRE_TIME]"}`
* For more information, see
* Adding and Removing SSH Keys (https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys).
*/
// const sshKey = 'abc123'
// Imports the Appengine library
const {InstancesClient} = require('@google-cloud/appengine-admin').v1;
// Instantiates a client
const appengineClient = new InstancesClient();
async function callDebugInstance() {
// Construct request
const request = {
};
// Run request
const [operation] = await appengineClient.debugInstance(request);
const [response] = await operation.promise();
console.log(response);
}
callDebugInstance();
debugInstance(request, options, callback)
debugInstance(request: protos.google.appengine.v1.IDebugInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDebugInstanceRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
debugInstance(request, callback)
debugInstance(request: protos.google.appengine.v1.IDebugInstanceRequest, callback: Callback<LROperation<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDebugInstanceRequest
|
callback |
Callback<LROperation<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteInstance(request, options)
deleteInstance(request?: protos.google.appengine.v1.IDeleteInstanceRequest, options?: CallOptions): Promise<[
LROperation<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IOperationMetadataV1>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
Stops a running instance.
The instance might be automatically recreated based on the scaling settings of the version. For more information, see "How Instances are Managed" ([standard environment](https://cloud.google.com/appengine/docs/standard/python/how-instances-are-managed) | [flexible environment](https://cloud.google.com/appengine/docs/flexible/python/how-instances-are-managed)).
To ensure that instances are not re-created and avoid getting billed, you can stop all instances within the target version by changing the serving status of the version to STOPPED
with the [apps.services.versions.patch
](https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions/patch) method.
Parameters | |
---|---|
Name | Description |
request |
IDeleteInstanceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
LROperation<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IOperationMetadataV1>,
protos.google.longrunning.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. Its |
/**
* 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 resource requested. Example:
* `apps/myapp/services/default/versions/v1/instances/instance-1`.
*/
// const name = 'abc123'
// Imports the Appengine library
const {InstancesClient} = require('@google-cloud/appengine-admin').v1;
// Instantiates a client
const appengineClient = new InstancesClient();
async function callDeleteInstance() {
// Construct request
const request = {
};
// Run request
const [operation] = await appengineClient.deleteInstance(request);
const [response] = await operation.promise();
console.log(response);
}
callDeleteInstance();
deleteInstance(request, options, callback)
deleteInstance(request: protos.google.appengine.v1.IDeleteInstanceRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteInstanceRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
deleteInstance(request, callback)
deleteInstance(request: protos.google.appengine.v1.IDeleteInstanceRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IDeleteInstanceRequest
|
callback |
Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.appengine.v1.IOperationMetadataV1>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getInstance(request, options)
getInstance(request?: protos.google.appengine.v1.IGetInstanceRequest, options?: CallOptions): Promise<[
protos.google.appengine.v1.IInstance,
protos.google.appengine.v1.IGetInstanceRequest | undefined,
{} | undefined
]>;
Gets instance information.
Parameters | |
---|---|
Name | Description |
request |
IGetInstanceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.appengine.v1.IInstance,
protos.google.appengine.v1.IGetInstanceRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
/**
* 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 resource requested. Example:
* `apps/myapp/services/default/versions/v1/instances/instance-1`.
*/
// const name = 'abc123'
// Imports the Appengine library
const {InstancesClient} = require('@google-cloud/appengine-admin').v1;
// Instantiates a client
const appengineClient = new InstancesClient();
async function callGetInstance() {
// Construct request
const request = {
};
// Run request
const response = await appengineClient.getInstance(request);
console.log(response);
}
callGetInstance();
getInstance(request, options, callback)
getInstance(request: protos.google.appengine.v1.IGetInstanceRequest, options: CallOptions, callback: Callback<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetInstanceRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getInstance(request, callback)
getInstance(request: protos.google.appengine.v1.IGetInstanceRequest, callback: Callback<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IGetInstanceRequest
|
callback |
Callback<protos.google.appengine.v1.IInstance, protos.google.appengine.v1.IGetInstanceRequest | null | undefined, {} | null | undefined>
|
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 |
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. |
instancePath(app, service, version, instance)
instancePath(app: string, service: string, version: string, instance: string): string;
Return a fully-qualified instance resource name string.
Parameters | |
---|---|
Name | Description |
app |
string
|
service |
string
|
version |
string
|
instance |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
listInstances(request, options)
listInstances(request?: protos.google.appengine.v1.IListInstancesRequest, options?: CallOptions): Promise<[
protos.google.appengine.v1.IInstance[],
protos.google.appengine.v1.IListInstancesRequest | null,
protos.google.appengine.v1.IListInstancesResponse
]>;
Lists the instances of a version.
Tip: To aggregate details about instances over time, see the [Stackdriver Monitoring API](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
Parameters | |
---|---|
Name | Description |
request |
IListInstancesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.appengine.v1.IInstance[],
protos.google.appengine.v1.IListInstancesRequest | null,
protos.google.appengine.v1.IListInstancesResponse
]> | {Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using |
listInstances(request, options, callback)
listInstances(request: protos.google.appengine.v1.IListInstancesRequest, options: CallOptions, callback: PaginationCallback<protos.google.appengine.v1.IListInstancesRequest, protos.google.appengine.v1.IListInstancesResponse | null | undefined, protos.google.appengine.v1.IInstance>): void;
Parameters | |
---|---|
Name | Description |
request |
IListInstancesRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.appengine.v1.IListInstancesRequest, protos.google.appengine.v1.IListInstancesResponse | null | undefined, protos.google.appengine.v1.IInstance>
|
Returns | |
---|---|
Type | Description |
void |
listInstances(request, callback)
listInstances(request: protos.google.appengine.v1.IListInstancesRequest, callback: PaginationCallback<protos.google.appengine.v1.IListInstancesRequest, protos.google.appengine.v1.IListInstancesResponse | null | undefined, protos.google.appengine.v1.IInstance>): void;
Parameters | |
---|---|
Name | Description |
request |
IListInstancesRequest
|
callback |
PaginationCallback<protos.google.appengine.v1.IListInstancesRequest, protos.google.appengine.v1.IListInstancesResponse | null | undefined, protos.google.appengine.v1.IInstance>
|
Returns | |
---|---|
Type | Description |
void |
listInstancesAsync(request, options)
listInstancesAsync(request?: protos.google.appengine.v1.IListInstancesRequest, options?: CallOptions): AsyncIterable<protos.google.appengine.v1.IInstance>;
Equivalent to listInstances
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
IListInstancesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<protos.google.appengine.v1.IInstance> | {Object} An iterable Object that allows async 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 the documentation for more details and examples. |
/**
* 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 parent Version resource. Example:
* `apps/myapp/services/default/versions/v1`.
*/
// const parent = 'abc123'
/**
* Maximum results to return per page.
*/
// const pageSize = 1234
/**
* Continuation token for fetching the next page of results.
*/
// const pageToken = 'abc123'
// Imports the Appengine library
const {InstancesClient} = require('@google-cloud/appengine-admin').v1;
// Instantiates a client
const appengineClient = new InstancesClient();
async function callListInstances() {
// Construct request
const request = {
};
// Run request
const iterable = appengineClient.listInstancesAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListInstances();
listInstancesStream(request, options)
listInstancesStream(request?: protos.google.appengine.v1.IListInstancesRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters | |
---|---|
Name | Description |
request |
IListInstancesRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
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 using |
matchAppFromInstanceName(instanceName)
matchAppFromInstanceName(instanceName: string): string | number;
Parse the app from Instance resource.
Parameter | |
---|---|
Name | Description |
instanceName |
string
A fully-qualified path representing Instance resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the app. |
matchInstanceFromInstanceName(instanceName)
matchInstanceFromInstanceName(instanceName: string): string | number;
Parse the instance from Instance resource.
Parameter | |
---|---|
Name | Description |
instanceName |
string
A fully-qualified path representing Instance resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the instance. |
matchServiceFromInstanceName(instanceName)
matchServiceFromInstanceName(instanceName: string): string | number;
Parse the service from Instance resource.
Parameter | |
---|---|
Name | Description |
instanceName |
string
A fully-qualified path representing Instance resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the service. |
matchVersionFromInstanceName(instanceName)
matchVersionFromInstanceName(instanceName: string): string | number;
Parse the version from Instance resource.
Parameter | |
---|---|
Name | Description |
instanceName |
string
A fully-qualified path representing Instance resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the version. |