Documentation ¶
Overview ¶
Package serviceusage is an auto-generated package for the Service Usage API.
Enables services that service consumers want to use on Google Cloud Platform, lists the available or enabled services, or disables services that service consumers no longer use.
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.
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 := serviceusage.NewClient(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.
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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.BatchEnableServicesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/serviceusage/apiv1/serviceusagepb#BatchEnableServicesRequest. } op, err := c.BatchEnableServices(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 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.
Index ¶
- func DefaultAuthScopes() []string
- type BatchEnableServicesOperation
- func (op *BatchEnableServicesOperation) Done() bool
- func (op *BatchEnableServicesOperation) Metadata() (*serviceusagepb.OperationMetadata, error)
- func (op *BatchEnableServicesOperation) Name() string
- func (op *BatchEnableServicesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.BatchEnableServicesResponse, error)
- func (op *BatchEnableServicesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.BatchEnableServicesResponse, error)
- type CallOptions
- type Client
- func (c *Client) BatchEnableServices(ctx context.Context, req *serviceusagepb.BatchEnableServicesRequest, ...) (*BatchEnableServicesOperation, error)
- func (c *Client) BatchEnableServicesOperation(name string) *BatchEnableServicesOperation
- func (c *Client) BatchGetServices(ctx context.Context, req *serviceusagepb.BatchGetServicesRequest, ...) (*serviceusagepb.BatchGetServicesResponse, error)
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConndeprecated
- func (c *Client) DisableService(ctx context.Context, req *serviceusagepb.DisableServiceRequest, ...) (*DisableServiceOperation, error)
- func (c *Client) DisableServiceOperation(name string) *DisableServiceOperation
- func (c *Client) EnableService(ctx context.Context, req *serviceusagepb.EnableServiceRequest, ...) (*EnableServiceOperation, error)
- func (c *Client) EnableServiceOperation(name string) *EnableServiceOperation
- func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, ...) (*longrunningpb.Operation, error)
- func (c *Client) GetService(ctx context.Context, req *serviceusagepb.GetServiceRequest, ...) (*serviceusagepb.Service, error)
- func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, ...) *OperationIterator
- func (c *Client) ListServices(ctx context.Context, req *serviceusagepb.ListServicesRequest, ...) *ServiceIterator
- type DisableServiceOperation
- func (op *DisableServiceOperation) Done() bool
- func (op *DisableServiceOperation) Metadata() (*serviceusagepb.OperationMetadata, error)
- func (op *DisableServiceOperation) Name() string
- func (op *DisableServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.DisableServiceResponse, error)
- func (op *DisableServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.DisableServiceResponse, error)
- type EnableServiceOperation
- func (op *EnableServiceOperation) Done() bool
- func (op *EnableServiceOperation) Metadata() (*serviceusagepb.OperationMetadata, error)
- func (op *EnableServiceOperation) Name() string
- func (op *EnableServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.EnableServiceResponse, error)
- func (op *EnableServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.EnableServiceResponse, error)
- type OperationIterator
- type ServiceIterator
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type BatchEnableServicesOperation ¶
type BatchEnableServicesOperation struct {
// contains filtered or unexported fields
}
BatchEnableServicesOperation manages a long-running operation from BatchEnableServices.
func (*BatchEnableServicesOperation) Done ¶
func (op *BatchEnableServicesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchEnableServicesOperation) Metadata ¶
func (op *BatchEnableServicesOperation) Metadata() (*serviceusagepb.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 (*BatchEnableServicesOperation) Name ¶
func (op *BatchEnableServicesOperation) 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 (*BatchEnableServicesOperation) Poll ¶
func (op *BatchEnableServicesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.BatchEnableServicesResponse, 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 (*BatchEnableServicesOperation) Wait ¶
func (op *BatchEnableServicesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.BatchEnableServicesResponse, 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.
type CallOptions ¶
type CallOptions struct { EnableService []gax.CallOption DisableService []gax.CallOption GetService []gax.CallOption ListServices []gax.CallOption BatchEnableServices []gax.CallOption BatchGetServices []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption }
CallOptions contains the retry settings for each method of Client.
type Client ¶
type Client struct { // The call options for this service. CallOptions *CallOptions // 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 }
Client is a client for interacting with Service Usage API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Enables services that service consumers want to use on Google Cloud Platform, lists the available or enabled services, or disables services that service consumers no longer use.
See Service Usage API (at https://cloud.google.com/service-usage/docs/overview)
func NewClient ¶
NewClient creates a new service usage client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Enables services that service consumers want to use on Google Cloud Platform, lists the available or enabled services, or disables services that service consumers no longer use.
See Service Usage API (at https://cloud.google.com/service-usage/docs/overview)
Example ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewRESTClient ¶ added in v1.5.0
NewRESTClient creates a new service usage rest client.
Enables services that service consumers want to use on Google Cloud Platform, lists the available or enabled services, or disables services that service consumers no longer use.
See Service Usage API (at https://cloud.google.com/service-usage/docs/overview)
Example ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/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 := serviceusage.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*Client) BatchEnableServices ¶
func (c *Client) BatchEnableServices(ctx context.Context, req *serviceusagepb.BatchEnableServicesRequest, opts ...gax.CallOption) (*BatchEnableServicesOperation, error)
BatchEnableServices enable multiple services on a project. The operation is atomic: if enabling any service fails, then the entire batch fails, and no state changes occur. To enable a single service, use the EnableService method instead.
Example ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/apiv1" serviceusagepb "cloud.google.com/go/serviceusage/apiv1/serviceusagepb" ) 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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.BatchEnableServicesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/serviceusage/apiv1/serviceusagepb#BatchEnableServicesRequest. } op, err := c.BatchEnableServices(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) BatchEnableServicesOperation ¶
func (c *Client) BatchEnableServicesOperation(name string) *BatchEnableServicesOperation
BatchEnableServicesOperation returns a new BatchEnableServicesOperation from a given name. The name must be that of a previously created BatchEnableServicesOperation, possibly from a different process.
func (*Client) BatchGetServices ¶
func (c *Client) BatchGetServices(ctx context.Context, req *serviceusagepb.BatchGetServicesRequest, opts ...gax.CallOption) (*serviceusagepb.BatchGetServicesResponse, error)
BatchGetServices returns the service configurations and enabled states for a given list of services.
Example ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/apiv1" serviceusagepb "cloud.google.com/go/serviceusage/apiv1/serviceusagepb" ) 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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.BatchGetServicesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/serviceusage/apiv1/serviceusagepb#BatchGetServicesRequest. } resp, err := c.BatchGetServices(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection
deprecated
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*Client) DisableService ¶
func (c *Client) DisableService(ctx context.Context, req *serviceusagepb.DisableServiceRequest, opts ...gax.CallOption) (*DisableServiceOperation, error)
DisableService disable a service so that it can no longer be used with a project. This prevents unintended usage that may cause unexpected billing charges or security leaks.
It is not valid to call the disable method on a service that is not currently enabled. Callers will receive a FAILED_PRECONDITION status if the target service is not currently enabled.
Example ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/apiv1" serviceusagepb "cloud.google.com/go/serviceusage/apiv1/serviceusagepb" ) 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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.DisableServiceRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/serviceusage/apiv1/serviceusagepb#DisableServiceRequest. } op, err := c.DisableService(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) DisableServiceOperation ¶
func (c *Client) DisableServiceOperation(name string) *DisableServiceOperation
DisableServiceOperation returns a new DisableServiceOperation from a given name. The name must be that of a previously created DisableServiceOperation, possibly from a different process.
func (*Client) EnableService ¶
func (c *Client) EnableService(ctx context.Context, req *serviceusagepb.EnableServiceRequest, opts ...gax.CallOption) (*EnableServiceOperation, error)
EnableService enable a service so that it can be used with a project.
Example ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/apiv1" serviceusagepb "cloud.google.com/go/serviceusage/apiv1/serviceusagepb" ) 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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.EnableServiceRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/serviceusage/apiv1/serviceusagepb#EnableServiceRequest. } op, err := c.EnableService(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) EnableServiceOperation ¶
func (c *Client) EnableServiceOperation(name string) *EnableServiceOperation
EnableServiceOperation returns a new EnableServiceOperation from a given name. The name must be that of a previously created EnableServiceOperation, possibly from a different process.
func (*Client) GetOperation ¶ added in v1.8.0
func (c *Client) 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" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" serviceusage "cloud.google.com/go/serviceusage/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 := serviceusage.NewClient(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 }
Output:
func (*Client) GetService ¶
func (c *Client) GetService(ctx context.Context, req *serviceusagepb.GetServiceRequest, opts ...gax.CallOption) (*serviceusagepb.Service, error)
GetService returns the service configuration and enabled state for a given service.
Example ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/apiv1" serviceusagepb "cloud.google.com/go/serviceusage/apiv1/serviceusagepb" ) 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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.GetServiceRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/serviceusage/apiv1/serviceusagepb#GetServiceRequest. } resp, err := c.GetService(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) ListOperations ¶ added in v1.8.0
func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Example ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" serviceusage "cloud.google.com/go/serviceusage/apiv1" "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 := serviceusage.NewClient(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) } }
Output:
Example (All) ¶
package main import ( "context" longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" serviceusage "cloud.google.com/go/serviceusage/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 := serviceusage.NewClient(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. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListServices ¶
func (c *Client) ListServices(ctx context.Context, req *serviceusagepb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator
ListServices list all services available to the specified project, and the current state of those services with respect to the project. The list includes all public services, all services for which the calling user has the servicemanagement.services.bind permission, and all services that have already been enabled on the project. The list can be filtered to only include services in a specific state, for example to only include services enabled on the project.
WARNING: If you need to query enabled services frequently or across an organization, you should use Cloud Asset Inventory API (at https://cloud.google.com/asset-inventory/docs/apis), which provides higher throughput and richer filtering capability.
Example ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/apiv1" serviceusagepb "cloud.google.com/go/serviceusage/apiv1/serviceusagepb" "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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.ListServicesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/serviceusage/apiv1/serviceusagepb#ListServicesRequest. } it := c.ListServices(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.(*serviceusagepb.ListServicesResponse) } }
Output:
Example (All) ¶
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/apiv1" serviceusagepb "cloud.google.com/go/serviceusage/apiv1/serviceusagepb" ) 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 := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.ListServicesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/serviceusage/apiv1/serviceusagepb#ListServicesRequest. } for resp, err := range c.ListServices(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
type DisableServiceOperation ¶
type DisableServiceOperation struct {
// contains filtered or unexported fields
}
DisableServiceOperation manages a long-running operation from DisableService.
func (*DisableServiceOperation) Done ¶
func (op *DisableServiceOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DisableServiceOperation) Metadata ¶
func (op *DisableServiceOperation) Metadata() (*serviceusagepb.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 (*DisableServiceOperation) Name ¶
func (op *DisableServiceOperation) 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 (*DisableServiceOperation) Poll ¶
func (op *DisableServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.DisableServiceResponse, 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 (*DisableServiceOperation) Wait ¶
func (op *DisableServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.DisableServiceResponse, 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.
type EnableServiceOperation ¶
type EnableServiceOperation struct {
// contains filtered or unexported fields
}
EnableServiceOperation manages a long-running operation from EnableService.
func (*EnableServiceOperation) Done ¶
func (op *EnableServiceOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*EnableServiceOperation) Metadata ¶
func (op *EnableServiceOperation) Metadata() (*serviceusagepb.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 (*EnableServiceOperation) Name ¶
func (op *EnableServiceOperation) 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 (*EnableServiceOperation) Poll ¶
func (op *EnableServiceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.EnableServiceResponse, 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 (*EnableServiceOperation) Wait ¶
func (op *EnableServiceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.EnableServiceResponse, 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.
type OperationIterator ¶ added in v1.8.0
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 ¶ added in v1.9.1
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 ¶ added in v1.8.0
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 ¶ added in v1.8.0
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ServiceIterator ¶
type ServiceIterator 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 []*serviceusagepb.Service, nextPageToken string, err error) // contains filtered or unexported fields }
ServiceIterator manages a stream of *serviceusagepb.Service.
func (*ServiceIterator) All ¶ added in v1.9.1
func (it *ServiceIterator) All() iter.Seq2[*serviceusagepb.Service, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ServiceIterator) Next ¶
func (it *ServiceIterator) Next() (*serviceusagepb.Service, 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 (*ServiceIterator) PageInfo ¶
func (it *ServiceIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.