Class v1.CloudShellServiceClient (1.0.5)

API for interacting with Google Cloud Shell. Each user of Cloud Shell has at least one environment, which has the ID "default". Environment consists of a Docker image defining what is installed on the environment and a home directory containing the user's data that will remain across sessions. Clients use this API to start and fetch information about their environment, which can then be used to connect to that environment via a separate SSH client. v1

Package

@google-cloud/shell

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of CloudShellServiceClient.

Parameter
Name Description
opts ClientOptions

Properties

apiEndpoint

static get apiEndpoint(): string;

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

auth

auth: gax.GoogleAuth;

cloudShellServiceStub

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

descriptors

descriptors: Descriptors;

innerApiCalls

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

Methods

addPublicKey(request, options)

addPublicKey(request: protos.google.cloud.shell.v1.IAddPublicKeyRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.shell.v1.IAddPublicKeyResponse, protos.google.cloud.shell.v1.IAddPublicKeyMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;
Parameters
Name Description
request protos.google.cloud.shell.v1.IAddPublicKeyRequest
options CallOptions
Returns
Type Description
Promise<[ LROperation<protos.google.cloud.shell.v1.IAddPublicKeyResponse, protos.google.cloud.shell.v1.IAddPublicKeyMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

addPublicKey(request, options, callback)

addPublicKey(request: protos.google.cloud.shell.v1.IAddPublicKeyRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.shell.v1.IAddPublicKeyResponse, protos.google.cloud.shell.v1.IAddPublicKeyMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IAddPublicKeyRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.shell.v1.IAddPublicKeyResponse, protos.google.cloud.shell.v1.IAddPublicKeyMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

addPublicKey(request, callback)

addPublicKey(request: protos.google.cloud.shell.v1.IAddPublicKeyRequest, callback: Callback<LROperation<protos.google.cloud.shell.v1.IAddPublicKeyResponse, protos.google.cloud.shell.v1.IAddPublicKeyMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IAddPublicKeyRequest
callback Callback<LROperation<protos.google.cloud.shell.v1.IAddPublicKeyResponse, protos.google.cloud.shell.v1.IAddPublicKeyMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

authorizeEnvironment(request, options)

authorizeEnvironment(request: protos.google.cloud.shell.v1.IAuthorizeEnvironmentRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.shell.v1.IAuthorizeEnvironmentResponse, protos.google.cloud.shell.v1.IAuthorizeEnvironmentMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;
Parameters
Name Description
request protos.google.cloud.shell.v1.IAuthorizeEnvironmentRequest
options CallOptions
Returns
Type Description
Promise<[ LROperation<protos.google.cloud.shell.v1.IAuthorizeEnvironmentResponse, protos.google.cloud.shell.v1.IAuthorizeEnvironmentMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

authorizeEnvironment(request, options, callback)

authorizeEnvironment(request: protos.google.cloud.shell.v1.IAuthorizeEnvironmentRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.shell.v1.IAuthorizeEnvironmentResponse, protos.google.cloud.shell.v1.IAuthorizeEnvironmentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IAuthorizeEnvironmentRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.shell.v1.IAuthorizeEnvironmentResponse, protos.google.cloud.shell.v1.IAuthorizeEnvironmentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

authorizeEnvironment(request, callback)

authorizeEnvironment(request: protos.google.cloud.shell.v1.IAuthorizeEnvironmentRequest, callback: Callback<LROperation<protos.google.cloud.shell.v1.IAuthorizeEnvironmentResponse, protos.google.cloud.shell.v1.IAuthorizeEnvironmentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IAuthorizeEnvironmentRequest
callback Callback<LROperation<protos.google.cloud.shell.v1.IAuthorizeEnvironmentResponse, protos.google.cloud.shell.v1.IAuthorizeEnvironmentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

checkAddPublicKeyProgress(name)

checkAddPublicKeyProgress(name: string): Promise<LROperation<protos.google.cloud.shell.v1.AddPublicKeyResponse, protos.google.cloud.shell.v1.AddPublicKeyMetadata>>;

Check the status of the long running operation returned by addPublicKey().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.shell.v1.AddPublicKeyResponse, protos.google.cloud.shell.v1.AddPublicKeyMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

const decodedOperation = await checkAddPublicKeyProgress(name); console.log(decodedOperation.result); console.log(decodedOperation.done); console.log(decodedOperation.metadata);

checkAuthorizeEnvironmentProgress(name)

checkAuthorizeEnvironmentProgress(name: string): Promise<LROperation<protos.google.cloud.shell.v1.AuthorizeEnvironmentResponse, protos.google.cloud.shell.v1.AuthorizeEnvironmentMetadata>>;

Check the status of the long running operation returned by authorizeEnvironment().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.shell.v1.AuthorizeEnvironmentResponse, protos.google.cloud.shell.v1.AuthorizeEnvironmentMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

const decodedOperation = await checkAuthorizeEnvironmentProgress(name); console.log(decodedOperation.result); console.log(decodedOperation.done); console.log(decodedOperation.metadata);

checkRemovePublicKeyProgress(name)

checkRemovePublicKeyProgress(name: string): Promise<LROperation<protos.google.cloud.shell.v1.RemovePublicKeyResponse, protos.google.cloud.shell.v1.RemovePublicKeyMetadata>>;

Check the status of the long running operation returned by removePublicKey().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.shell.v1.RemovePublicKeyResponse, protos.google.cloud.shell.v1.RemovePublicKeyMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

const decodedOperation = await checkRemovePublicKeyProgress(name); console.log(decodedOperation.result); console.log(decodedOperation.done); console.log(decodedOperation.metadata);

checkStartEnvironmentProgress(name)

checkStartEnvironmentProgress(name: string): Promise<LROperation<protos.google.cloud.shell.v1.StartEnvironmentResponse, protos.google.cloud.shell.v1.StartEnvironmentMetadata>>;

Check the status of the long running operation returned by startEnvironment().

Parameter
Name Description
name string

The operation name that will be passed.

Returns
Type Description
Promise<LROperation<protos.google.cloud.shell.v1.StartEnvironmentResponse, protos.google.cloud.shell.v1.StartEnvironmentMetadata>>

{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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

const decodedOperation = await checkStartEnvironmentProgress(name); console.log(decodedOperation.result); console.log(decodedOperation.done); console.log(decodedOperation.metadata);

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.

environmentPath(user, environment)

environmentPath(user: string, environment: string): string;

Return a fully-qualified environment resource name string.

Parameters
Name Description
user string
environment string
Returns
Type Description
string

{string} Resource name string.

getEnvironment(request, options)

getEnvironment(request: protos.google.cloud.shell.v1.IGetEnvironmentRequest, options?: CallOptions): Promise<[
        protos.google.cloud.shell.v1.IEnvironment,
        protos.google.cloud.shell.v1.IGetEnvironmentRequest | undefined,
        {} | undefined
    ]>;
Parameters
Name Description
request protos.google.cloud.shell.v1.IGetEnvironmentRequest
options CallOptions
Returns
Type Description
Promise<[ protos.google.cloud.shell.v1.IEnvironment, protos.google.cloud.shell.v1.IGetEnvironmentRequest | undefined, {} | undefined ]>

getEnvironment(request, options, callback)

getEnvironment(request: protos.google.cloud.shell.v1.IGetEnvironmentRequest, options: CallOptions, callback: Callback<protos.google.cloud.shell.v1.IEnvironment, protos.google.cloud.shell.v1.IGetEnvironmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IGetEnvironmentRequest
options CallOptions
callback Callback<protos.google.cloud.shell.v1.IEnvironment, protos.google.cloud.shell.v1.IGetEnvironmentRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getEnvironment(request, callback)

getEnvironment(request: protos.google.cloud.shell.v1.IGetEnvironmentRequest, callback: Callback<protos.google.cloud.shell.v1.IEnvironment, protos.google.cloud.shell.v1.IGetEnvironmentRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IGetEnvironmentRequest
callback Callback<protos.google.cloud.shell.v1.IEnvironment, protos.google.cloud.shell.v1.IGetEnvironmentRequest | 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.

matchEnvironmentFromEnvironmentName(environmentName)

matchEnvironmentFromEnvironmentName(environmentName: string): string | number;

Parse the environment from Environment resource.

Parameter
Name Description
environmentName string

A fully-qualified path representing Environment resource.

Returns
Type Description
string | number

{string} A string representing the environment.

matchUserFromEnvironmentName(environmentName)

matchUserFromEnvironmentName(environmentName: string): string | number;

Parse the user from Environment resource.

Parameter
Name Description
environmentName string

A fully-qualified path representing Environment resource.

Returns
Type Description
string | number

{string} A string representing the user.

removePublicKey(request, options)

removePublicKey(request: protos.google.cloud.shell.v1.IRemovePublicKeyRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.shell.v1.IRemovePublicKeyResponse, protos.google.cloud.shell.v1.IRemovePublicKeyMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;
Parameters
Name Description
request protos.google.cloud.shell.v1.IRemovePublicKeyRequest
options CallOptions
Returns
Type Description
Promise<[ LROperation<protos.google.cloud.shell.v1.IRemovePublicKeyResponse, protos.google.cloud.shell.v1.IRemovePublicKeyMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

removePublicKey(request, options, callback)

removePublicKey(request: protos.google.cloud.shell.v1.IRemovePublicKeyRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.shell.v1.IRemovePublicKeyResponse, protos.google.cloud.shell.v1.IRemovePublicKeyMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IRemovePublicKeyRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.shell.v1.IRemovePublicKeyResponse, protos.google.cloud.shell.v1.IRemovePublicKeyMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

removePublicKey(request, callback)

removePublicKey(request: protos.google.cloud.shell.v1.IRemovePublicKeyRequest, callback: Callback<LROperation<protos.google.cloud.shell.v1.IRemovePublicKeyResponse, protos.google.cloud.shell.v1.IRemovePublicKeyMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IRemovePublicKeyRequest
callback Callback<LROperation<protos.google.cloud.shell.v1.IRemovePublicKeyResponse, protos.google.cloud.shell.v1.IRemovePublicKeyMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

startEnvironment(request, options)

startEnvironment(request: protos.google.cloud.shell.v1.IStartEnvironmentRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.shell.v1.IStartEnvironmentResponse, protos.google.cloud.shell.v1.IStartEnvironmentMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;
Parameters
Name Description
request protos.google.cloud.shell.v1.IStartEnvironmentRequest
options CallOptions
Returns
Type Description
Promise<[ LROperation<protos.google.cloud.shell.v1.IStartEnvironmentResponse, protos.google.cloud.shell.v1.IStartEnvironmentMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

startEnvironment(request, options, callback)

startEnvironment(request: protos.google.cloud.shell.v1.IStartEnvironmentRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.shell.v1.IStartEnvironmentResponse, protos.google.cloud.shell.v1.IStartEnvironmentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IStartEnvironmentRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.shell.v1.IStartEnvironmentResponse, protos.google.cloud.shell.v1.IStartEnvironmentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void

startEnvironment(request, callback)

startEnvironment(request: protos.google.cloud.shell.v1.IStartEnvironmentRequest, callback: Callback<LROperation<protos.google.cloud.shell.v1.IStartEnvironmentResponse, protos.google.cloud.shell.v1.IStartEnvironmentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request protos.google.cloud.shell.v1.IStartEnvironmentRequest
callback Callback<LROperation<protos.google.cloud.shell.v1.IStartEnvironmentResponse, protos.google.cloud.shell.v1.IStartEnvironmentMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type Description
void