- 0.116.0 (latest)
- 0.115.1
- 0.114.0
- 0.113.0
- 0.112.2
- 0.111.0
- 0.110.10
- 0.109.0
- 0.108.0
- 0.107.0
- 0.106.0
- 0.105.0
- 0.104.0
- 0.103.0
- 0.102.1
- 0.101.1
- 0.100.2
- 0.99.0
- 0.98.0
- 0.97.0
- 0.96.0
- 0.95.0
- 0.94.1
- 0.93.3
- 0.92.3
- 0.91.1
- 0.90.0
- 0.89.0
- 0.88.0
- 0.87.0
- 0.86.0
- 0.85.0
- 0.84.0
- 0.83.0
- 0.82.0
- 0.81.0
- 0.80.0
- 0.79.0
- 0.78.0
- 0.77.0
- 0.76.0
- 0.75.0
Package shell is an auto-generated package for the Cloud Shell API.
Allows users to start, configure, and connect to interactive shell sessions running in the cloud.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
Use of Context
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
AddPublicKeyOperation
type AddPublicKeyOperation struct {
// contains filtered or unexported fields
}
AddPublicKeyOperation manages a long-running operation from AddPublicKey.
func (*AddPublicKeyOperation) Done
func (op *AddPublicKeyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*AddPublicKeyOperation) Metadata
func (op *AddPublicKeyOperation) Metadata() (*shellpb.AddPublicKeyMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*AddPublicKeyOperation) Name
func (op *AddPublicKeyOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*AddPublicKeyOperation) Poll
func (op *AddPublicKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*shellpb.AddPublicKeyResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*AddPublicKeyOperation) Wait
func (op *AddPublicKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*shellpb.AddPublicKeyResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
AuthorizeEnvironmentOperation
type AuthorizeEnvironmentOperation struct {
// contains filtered or unexported fields
}
AuthorizeEnvironmentOperation manages a long-running operation from AuthorizeEnvironment.
func (*AuthorizeEnvironmentOperation) Done
func (op *AuthorizeEnvironmentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*AuthorizeEnvironmentOperation) Metadata
func (op *AuthorizeEnvironmentOperation) Metadata() (*shellpb.AuthorizeEnvironmentMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*AuthorizeEnvironmentOperation) Name
func (op *AuthorizeEnvironmentOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*AuthorizeEnvironmentOperation) Poll
func (op *AuthorizeEnvironmentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*shellpb.AuthorizeEnvironmentResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*AuthorizeEnvironmentOperation) Wait
func (op *AuthorizeEnvironmentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*shellpb.AuthorizeEnvironmentResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CloudShellCallOptions
type CloudShellCallOptions struct {
GetEnvironment []gax.CallOption
StartEnvironment []gax.CallOption
AuthorizeEnvironment []gax.CallOption
AddPublicKey []gax.CallOption
RemovePublicKey []gax.CallOption
}
CloudShellCallOptions contains the retry settings for each method of CloudShellClient.
CloudShellClient
type CloudShellClient struct {
// The call options for this service.
CallOptions *CloudShellCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
CloudShellClient is a client for interacting with Cloud Shell API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
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.
func NewCloudShellClient
func NewCloudShellClient(ctx context.Context, opts ...option.ClientOption) (*CloudShellClient, error)
NewCloudShellClient creates a new cloud shell service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
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.
Example
package main
import (
"context"
shell "cloud.google.com/go/shell/apiv1"
)
func main() {
ctx := context.Background()
c, err := shell.NewCloudShellClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*CloudShellClient) AddPublicKey
func (c *CloudShellClient) AddPublicKey(ctx context.Context, req *shellpb.AddPublicKeyRequest, opts ...gax.CallOption) (*AddPublicKeyOperation, error)
AddPublicKey adds a public SSH key to an environment, allowing clients with the corresponding private key to connect to that environment via SSH. If a key with the same content already exists, this will error with ALREADY_EXISTS.
Example
package main
import (
"context"
shell "cloud.google.com/go/shell/apiv1"
shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1"
)
func main() {
ctx := context.Background()
c, err := shell.NewCloudShellClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &shellpb.AddPublicKeyRequest{
// TODO: Fill request struct fields.
}
op, err := c.AddPublicKey(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudShellClient) AddPublicKeyOperation
func (c *CloudShellClient) AddPublicKeyOperation(name string) *AddPublicKeyOperation
AddPublicKeyOperation returns a new AddPublicKeyOperation from a given name. The name must be that of a previously created AddPublicKeyOperation, possibly from a different process.
func (*CloudShellClient) AuthorizeEnvironment
func (c *CloudShellClient) AuthorizeEnvironment(ctx context.Context, req *shellpb.AuthorizeEnvironmentRequest, opts ...gax.CallOption) (*AuthorizeEnvironmentOperation, error)
AuthorizeEnvironment sends OAuth credentials to a running environment on behalf of a user. When this completes, the environment will be authorized to run various Google Cloud command line tools without requiring the user to manually authenticate.
Example
package main
import (
"context"
shell "cloud.google.com/go/shell/apiv1"
shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1"
)
func main() {
ctx := context.Background()
c, err := shell.NewCloudShellClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &shellpb.AuthorizeEnvironmentRequest{
// TODO: Fill request struct fields.
}
op, err := c.AuthorizeEnvironment(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudShellClient) AuthorizeEnvironmentOperation
func (c *CloudShellClient) AuthorizeEnvironmentOperation(name string) *AuthorizeEnvironmentOperation
AuthorizeEnvironmentOperation returns a new AuthorizeEnvironmentOperation from a given name. The name must be that of a previously created AuthorizeEnvironmentOperation, possibly from a different process.
func (*CloudShellClient) Close
func (c *CloudShellClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CloudShellClient) Connection
func (c *CloudShellClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*CloudShellClient) GetEnvironment
func (c *CloudShellClient) GetEnvironment(ctx context.Context, req *shellpb.GetEnvironmentRequest, opts ...gax.CallOption) (*shellpb.Environment, error)
GetEnvironment gets an environment. Returns NOT_FOUND if the environment does not exist.
Example
package main
import (
"context"
shell "cloud.google.com/go/shell/apiv1"
shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1"
)
func main() {
ctx := context.Background()
c, err := shell.NewCloudShellClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &shellpb.GetEnvironmentRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetEnvironment(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudShellClient) RemovePublicKey
func (c *CloudShellClient) RemovePublicKey(ctx context.Context, req *shellpb.RemovePublicKeyRequest, opts ...gax.CallOption) (*RemovePublicKeyOperation, error)
RemovePublicKey removes a public SSH key from an environment. Clients will no longer be able to connect to the environment using the corresponding private key. If a key with the same content is not present, this will error with NOT_FOUND.
Example
package main
import (
"context"
shell "cloud.google.com/go/shell/apiv1"
shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1"
)
func main() {
ctx := context.Background()
c, err := shell.NewCloudShellClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &shellpb.RemovePublicKeyRequest{
// TODO: Fill request struct fields.
}
op, err := c.RemovePublicKey(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudShellClient) RemovePublicKeyOperation
func (c *CloudShellClient) RemovePublicKeyOperation(name string) *RemovePublicKeyOperation
RemovePublicKeyOperation returns a new RemovePublicKeyOperation from a given name. The name must be that of a previously created RemovePublicKeyOperation, possibly from a different process.
func (*CloudShellClient) StartEnvironment
func (c *CloudShellClient) StartEnvironment(ctx context.Context, req *shellpb.StartEnvironmentRequest, opts ...gax.CallOption) (*StartEnvironmentOperation, error)
StartEnvironment starts an existing environment, allowing clients to connect to it. The returned operation will contain an instance of StartEnvironmentMetadata in its metadata field. Users can wait for the environment to start by polling this operation via GetOperation. Once the environment has finished starting and is ready to accept connections, the operation will contain a StartEnvironmentResponse in its response field.
Example
package main
import (
"context"
shell "cloud.google.com/go/shell/apiv1"
shellpb "google.golang.org/genproto/googleapis/cloud/shell/v1"
)
func main() {
ctx := context.Background()
c, err := shell.NewCloudShellClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &shellpb.StartEnvironmentRequest{
// TODO: Fill request struct fields.
}
op, err := c.StartEnvironment(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudShellClient) StartEnvironmentOperation
func (c *CloudShellClient) StartEnvironmentOperation(name string) *StartEnvironmentOperation
StartEnvironmentOperation returns a new StartEnvironmentOperation from a given name. The name must be that of a previously created StartEnvironmentOperation, possibly from a different process.
RemovePublicKeyOperation
type RemovePublicKeyOperation struct {
// contains filtered or unexported fields
}
RemovePublicKeyOperation manages a long-running operation from RemovePublicKey.
func (*RemovePublicKeyOperation) Done
func (op *RemovePublicKeyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*RemovePublicKeyOperation) Metadata
func (op *RemovePublicKeyOperation) Metadata() (*shellpb.RemovePublicKeyMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*RemovePublicKeyOperation) Name
func (op *RemovePublicKeyOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*RemovePublicKeyOperation) Poll
func (op *RemovePublicKeyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*shellpb.RemovePublicKeyResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*RemovePublicKeyOperation) Wait
func (op *RemovePublicKeyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*shellpb.RemovePublicKeyResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
StartEnvironmentOperation
type StartEnvironmentOperation struct {
// contains filtered or unexported fields
}
StartEnvironmentOperation manages a long-running operation from StartEnvironment.
func (*StartEnvironmentOperation) Done
func (op *StartEnvironmentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*StartEnvironmentOperation) Metadata
func (op *StartEnvironmentOperation) Metadata() (*shellpb.StartEnvironmentMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*StartEnvironmentOperation) Name
func (op *StartEnvironmentOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*StartEnvironmentOperation) Poll
func (op *StartEnvironmentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*shellpb.StartEnvironmentResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*StartEnvironmentOperation) Wait
func (op *StartEnvironmentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*shellpb.StartEnvironmentResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.