Package ftp is an auto-generated package for the Cloud FTP API.
A managed, cloud-native solution to move data in and out of Google Cloud by using SSH File Transfer Protocol (SFTP).
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/ftp/apiv1@latest ctx := context.Background() // 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. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := ftp.NewCloudFtpRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req := &ftppb.CreateServerRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#CreateServerRequest. } op, err := c.CreateServer(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewCloudFtpRESTClient 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.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
CloudFtpCallOptions
type CloudFtpCallOptions struct {
ListServers []gax.CallOption
GetServer []gax.CallOption
CreateServer []gax.CallOption
UpdateServer []gax.CallOption
DeleteServer []gax.CallOption
ListUsers []gax.CallOption
GetUser []gax.CallOption
CreateUser []gax.CallOption
UpdateUser []gax.CallOption
DeleteUser []gax.CallOption
StartServer []gax.CallOption
StopServer []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
CancelOperation []gax.CallOption
DeleteOperation []gax.CallOption
GetOperation []gax.CallOption
ListOperations []gax.CallOption
}CloudFtpCallOptions contains the retry settings for each method of CloudFtpClient.
CloudFtpClient
type CloudFtpClient struct {
// The call options for this service.
CallOptions *CloudFtpCallOptions
// 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
}CloudFtpClient is a client for interacting with Cloud FTP API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service describing handlers for resources
func NewCloudFtpRESTClient
func NewCloudFtpRESTClient(ctx context.Context, opts ...option.ClientOption) (*CloudFtpClient, error)NewCloudFtpRESTClient creates a new cloud ftp rest client.
Service describing handlers for resources
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*CloudFtpClient) CancelOperation
func (c *CloudFtpClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) errorCancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*CloudFtpClient) Close
func (c *CloudFtpClient) Close() errorClose closes the connection to the API service. Always call Close() when the client is no longer required.
func (*CloudFtpClient) Connection (deprecated)
func (c *CloudFtpClient) Connection() *grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*CloudFtpClient) CreateServer
func (c *CloudFtpClient) CreateServer(ctx context.Context, req *ftppb.CreateServerRequest, opts ...gax.CallOption) (*CreateServerOperation, error)CreateServer creates a new Server in a given project and location.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.CreateServerRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#CreateServerRequest.
}
op, err := c.CreateServer(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) CreateServerOperation
func (c *CloudFtpClient) CreateServerOperation(name string) *CreateServerOperationCreateServerOperation returns a new CreateServerOperation from a given name. The name must be that of a previously created CreateServerOperation, possibly from a different process.
func (*CloudFtpClient) CreateUser
func (c *CloudFtpClient) CreateUser(ctx context.Context, req *ftppb.CreateUserRequest, opts ...gax.CallOption) (*CreateUserOperation, error)CreateUser creates a new User in a given project and location and Server.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.CreateUserRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#CreateUserRequest.
}
op, err := c.CreateUser(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) CreateUserOperation
func (c *CloudFtpClient) CreateUserOperation(name string) *CreateUserOperationCreateUserOperation returns a new CreateUserOperation from a given name. The name must be that of a previously created CreateUserOperation, possibly from a different process.
func (*CloudFtpClient) DeleteOperation
func (c *CloudFtpClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*CloudFtpClient) DeleteServer
func (c *CloudFtpClient) DeleteServer(ctx context.Context, req *ftppb.DeleteServerRequest, opts ...gax.CallOption) (*DeleteServerOperation, error)DeleteServer deletes a single Server.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.DeleteServerRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#DeleteServerRequest.
}
op, err := c.DeleteServer(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*CloudFtpClient) DeleteServerOperation
func (c *CloudFtpClient) DeleteServerOperation(name string) *DeleteServerOperationDeleteServerOperation returns a new DeleteServerOperation from a given name. The name must be that of a previously created DeleteServerOperation, possibly from a different process.
func (*CloudFtpClient) DeleteUser
func (c *CloudFtpClient) DeleteUser(ctx context.Context, req *ftppb.DeleteUserRequest, opts ...gax.CallOption) (*DeleteUserOperation, error)DeleteUser deletes a single User.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.DeleteUserRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#DeleteUserRequest.
}
op, err := c.DeleteUser(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*CloudFtpClient) DeleteUserOperation
func (c *CloudFtpClient) DeleteUserOperation(name string) *DeleteUserOperationDeleteUserOperation returns a new DeleteUserOperation from a given name. The name must be that of a previously created DeleteUserOperation, possibly from a different process.
func (*CloudFtpClient) GetLocation
func (c *CloudFtpClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)GetLocation gets information about a location.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) GetOperation
func (c *CloudFtpClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) GetServer
func (c *CloudFtpClient) GetServer(ctx context.Context, req *ftppb.GetServerRequest, opts ...gax.CallOption) (*ftppb.Server, error)GetServer gets details of a single Server.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.GetServerRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#GetServerRequest.
}
resp, err := c.GetServer(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) GetUser
func (c *CloudFtpClient) GetUser(ctx context.Context, req *ftppb.GetUserRequest, opts ...gax.CallOption) (*ftppb.User, error)GetUser gets details of a single User.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.GetUserRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#GetUserRequest.
}
resp, err := c.GetUser(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) ListLocations
func (c *CloudFtpClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIteratorListLocations lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name (at http://ListLocationsRequest.name)][google.cloud.location.ListLocationsRequest.name (at http://google.cloud.location.ListLocationsRequest.name)] field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.
Examples
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CloudFtpClient) ListOperations
func (c *CloudFtpClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*longrunningpb.ListOperationsResponse)
}
}
all
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CloudFtpClient) ListServers
func (c *CloudFtpClient) ListServers(ctx context.Context, req *ftppb.ListServersRequest, opts ...gax.CallOption) *ServerIteratorListServers lists Servers in a given project and location.
Examples
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.ListServersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#ListServersRequest.
}
it := c.ListServers(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*ftppb.ListServersResponse)
}
}
all
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.ListServersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#ListServersRequest.
}
for resp, err := range c.ListServers(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CloudFtpClient) ListUsers
func (c *CloudFtpClient) ListUsers(ctx context.Context, req *ftppb.ListUsersRequest, opts ...gax.CallOption) *UserIteratorListUsers lists Users in a given project and location.
Examples
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.ListUsersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#ListUsersRequest.
}
it := c.ListUsers(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*ftppb.ListUsersResponse)
}
}
all
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.ListUsersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#ListUsersRequest.
}
for resp, err := range c.ListUsers(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CloudFtpClient) StartServer
func (c *CloudFtpClient) StartServer(ctx context.Context, req *ftppb.StartServerRequest, opts ...gax.CallOption) (*StartServerOperation, error)StartServer starts a stopping/stopped Server.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.StartServerRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#StartServerRequest.
}
op, err := c.StartServer(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) StartServerOperation
func (c *CloudFtpClient) StartServerOperation(name string) *StartServerOperationStartServerOperation returns a new StartServerOperation from a given name. The name must be that of a previously created StartServerOperation, possibly from a different process.
func (*CloudFtpClient) StopServer
func (c *CloudFtpClient) StopServer(ctx context.Context, req *ftppb.StopServerRequest, opts ...gax.CallOption) (*StopServerOperation, error)StopServer stops an active Server.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.StopServerRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#StopServerRequest.
}
op, err := c.StopServer(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) StopServerOperation
func (c *CloudFtpClient) StopServerOperation(name string) *StopServerOperationStopServerOperation returns a new StopServerOperation from a given name. The name must be that of a previously created StopServerOperation, possibly from a different process.
func (*CloudFtpClient) UpdateServer
func (c *CloudFtpClient) UpdateServer(ctx context.Context, req *ftppb.UpdateServerRequest, opts ...gax.CallOption) (*UpdateServerOperation, error)UpdateServer updates the parameters of a single Server.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.UpdateServerRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#UpdateServerRequest.
}
op, err := c.UpdateServer(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) UpdateServerOperation
func (c *CloudFtpClient) UpdateServerOperation(name string) *UpdateServerOperationUpdateServerOperation returns a new UpdateServerOperation from a given name. The name must be that of a previously created UpdateServerOperation, possibly from a different process.
func (*CloudFtpClient) UpdateUser
func (c *CloudFtpClient) UpdateUser(ctx context.Context, req *ftppb.UpdateUserRequest, opts ...gax.CallOption) (*UpdateUserOperation, error)UpdateUser updates the parameters of a single User.
Example
package main
import (
"context"
ftp "cloud.google.com/go/ftp/apiv1"
ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)
func main() {
ctx := context.Background()
// 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.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := ftp.NewCloudFtpRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &ftppb.UpdateUserRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#UpdateUserRequest.
}
op, err := c.UpdateUser(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CloudFtpClient) UpdateUserOperation
func (c *CloudFtpClient) UpdateUserOperation(name string) *UpdateUserOperationUpdateUserOperation returns a new UpdateUserOperation from a given name. The name must be that of a previously created UpdateUserOperation, possibly from a different process.
CreateServerOperation
type CreateServerOperation struct {
// contains filtered or unexported fields
}CreateServerOperation manages a long-running operation from CreateServer.
func (*CreateServerOperation) Done
func (op *CreateServerOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateServerOperation) Metadata
func (op *CreateServerOperation) Metadata() (*ftppb.OperationMetadata, 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 (*CreateServerOperation) Name
func (op *CreateServerOperation) Name() stringName 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 (*CreateServerOperation) Poll
func (op *CreateServerOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*ftppb.Server, 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 (*CreateServerOperation) Wait
func (op *CreateServerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*ftppb.Server, 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.
CreateUserOperation
type CreateUserOperation struct {
// contains filtered or unexported fields
}CreateUserOperation manages a long-running operation from CreateUser.
func (*CreateUserOperation) Done
func (op *CreateUserOperation) Done() boolDone reports whether the long-running operation has completed.
func (*CreateUserOperation) Metadata
func (op *CreateUserOperation) Metadata() (*ftppb.OperationMetadata, 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 (*CreateUserOperation) Name
func (op *CreateUserOperation) Name() stringName 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 (*CreateUserOperation) Poll
func (op *CreateUserOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*ftppb.User, 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 (*CreateUserOperation) Wait
func (op *CreateUserOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*ftppb.User, 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.
DeleteServerOperation
type DeleteServerOperation struct {
// contains filtered or unexported fields
}DeleteServerOperation manages a long-running operation from DeleteServer.
func (*DeleteServerOperation) Done
func (op *DeleteServerOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DeleteServerOperation) Metadata
func (op *DeleteServerOperation) Metadata() (*ftppb.OperationMetadata, 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 (*DeleteServerOperation) Name
func (op *DeleteServerOperation) Name() stringName 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 (*DeleteServerOperation) Poll
func (op *DeleteServerOperation) Poll(ctx context.Context, opts ...gax.CallOption) errorPoll 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 (*DeleteServerOperation) Wait
func (op *DeleteServerOperation) Wait(ctx context.Context, opts ...gax.CallOption) errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteUserOperation
type DeleteUserOperation struct {
// contains filtered or unexported fields
}DeleteUserOperation manages a long-running operation from DeleteUser.
func (*DeleteUserOperation) Done
func (op *DeleteUserOperation) Done() boolDone reports whether the long-running operation has completed.
func (*DeleteUserOperation) Metadata
func (op *DeleteUserOperation) Metadata() (*ftppb.OperationMetadata, 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 (*DeleteUserOperation) Name
func (op *DeleteUserOperation) Name() stringName 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 (*DeleteUserOperation) Poll
func (op *DeleteUserOperation) Poll(ctx context.Context, opts ...gax.CallOption) errorPoll 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 (*DeleteUserOperation) Wait
func (op *DeleteUserOperation) Wait(ctx context.Context, opts ...gax.CallOption) errorWait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
LocationIterator
type LocationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error)
// contains filtered or unexported fields
}LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All
func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next
func (it *LocationIterator) Next() (*locationpb.Location, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*LocationIterator) PageInfo
func (it *LocationIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OperationIterator
type OperationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
// contains filtered or unexported fields
}OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next
func (it *OperationIterator) Next() (*longrunningpb.Operation, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo
func (it *OperationIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
ServerIterator
type ServerIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*ftppb.Server, nextPageToken string, err error)
// contains filtered or unexported fields
}ServerIterator manages a stream of *ftppb.Server.
func (*ServerIterator) All
func (it *ServerIterator) All() iter.Seq2[*ftppb.Server, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ServerIterator) Next
func (it *ServerIterator) Next() (*ftppb.Server, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ServerIterator) PageInfo
func (it *ServerIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
StartServerOperation
type StartServerOperation struct {
// contains filtered or unexported fields
}StartServerOperation manages a long-running operation from StartServer.
func (*StartServerOperation) Done
func (op *StartServerOperation) Done() boolDone reports whether the long-running operation has completed.
func (*StartServerOperation) Metadata
func (op *StartServerOperation) Metadata() (*ftppb.OperationMetadata, 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 (*StartServerOperation) Name
func (op *StartServerOperation) Name() stringName 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 (*StartServerOperation) Poll
func (op *StartServerOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*ftppb.Server, 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 (*StartServerOperation) Wait
func (op *StartServerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*ftppb.Server, 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.
StopServerOperation
type StopServerOperation struct {
// contains filtered or unexported fields
}StopServerOperation manages a long-running operation from StopServer.
func (*StopServerOperation) Done
func (op *StopServerOperation) Done() boolDone reports whether the long-running operation has completed.
func (*StopServerOperation) Metadata
func (op *StopServerOperation) Metadata() (*ftppb.OperationMetadata, 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 (*StopServerOperation) Name
func (op *StopServerOperation) Name() stringName 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 (*StopServerOperation) Poll
func (op *StopServerOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*ftppb.Server, 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 (*StopServerOperation) Wait
func (op *StopServerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*ftppb.Server, 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.
UpdateServerOperation
type UpdateServerOperation struct {
// contains filtered or unexported fields
}UpdateServerOperation manages a long-running operation from UpdateServer.
func (*UpdateServerOperation) Done
func (op *UpdateServerOperation) Done() boolDone reports whether the long-running operation has completed.
func (*UpdateServerOperation) Metadata
func (op *UpdateServerOperation) Metadata() (*ftppb.OperationMetadata, 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 (*UpdateServerOperation) Name
func (op *UpdateServerOperation) Name() stringName 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 (*UpdateServerOperation) Poll
func (op *UpdateServerOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*ftppb.Server, 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 (*UpdateServerOperation) Wait
func (op *UpdateServerOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*ftppb.Server, 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.
UpdateUserOperation
type UpdateUserOperation struct {
// contains filtered or unexported fields
}UpdateUserOperation manages a long-running operation from UpdateUser.
func (*UpdateUserOperation) Done
func (op *UpdateUserOperation) Done() boolDone reports whether the long-running operation has completed.
func (*UpdateUserOperation) Metadata
func (op *UpdateUserOperation) Metadata() (*ftppb.OperationMetadata, 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 (*UpdateUserOperation) Name
func (op *UpdateUserOperation) Name() stringName 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 (*UpdateUserOperation) Poll
func (op *UpdateUserOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*ftppb.User, 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 (*UpdateUserOperation) Wait
func (op *UpdateUserOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*ftppb.User, 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.
UserIterator
type UserIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*ftppb.User, nextPageToken string, err error)
// contains filtered or unexported fields
}UserIterator manages a stream of *ftppb.User.
func (*UserIterator) All
func (it *UserIterator) All() iter.Seq2[*ftppb.User, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*UserIterator) Next
func (it *UserIterator) Next() (*ftppb.User, error)Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*UserIterator) PageInfo
func (it *UserIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.