Package cloud.google.com/go/capacityplanner/apiv1beta (v0.2.0)

Package capacityplanner is an auto-generated package for the Capacity Planner API.

Provides programmatic access to Capacity Planner features.

 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:

Example usage

To get started with this package, create a client.

 // go get cloud.google.com/go/capacityplanner/apiv1beta@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 
  
 := 
  
 capacityplanner 
 . 
 NewUsageClient 
 ( 
 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 
  
 := 
  
& capacityplannerpb 
 . 
 ExportForecastsRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb#ExportForecastsRequest. 
 } 
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 ExportForecasts 
 ( 
 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 NewUsageClient 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 
 () 
  
 [] 
  string 
 
 

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

ExportForecastsOperation

  type 
  
 ExportForecastsOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 

ExportForecastsOperation manages a long-running operation from ExportForecasts.

func (*ExportForecastsOperation) Done

Done reports whether the long-running operation has completed.

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 (*ExportForecastsOperation) Name

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 (*ExportForecastsOperation) Poll

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 (*ExportForecastsOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

ExportReservationsUsageOperation

  type 
  
 ExportReservationsUsageOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 

ExportReservationsUsageOperation manages a long-running operation from ExportReservationsUsage.

func (*ExportReservationsUsageOperation) Done

Done reports whether the long-running operation has completed.

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 (*ExportReservationsUsageOperation) Name

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 (*ExportReservationsUsageOperation) Poll

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 (*ExportReservationsUsageOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

ExportUsageHistoriesOperation

  type 
  
 ExportUsageHistoriesOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 

ExportUsageHistoriesOperation manages a long-running operation from ExportUsageHistories.

func (*ExportUsageHistoriesOperation) Done

Done reports whether the long-running operation has completed.

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 (*ExportUsageHistoriesOperation) Name

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 (*ExportUsageHistoriesOperation) Poll

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 (*ExportUsageHistoriesOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UsageCallOptions

  type 
  
 UsageCallOptions 
  
 struct 
  
 { 
  
 QueryUsageHistories 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 QueryForecasts 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 QueryReservations 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ExportUsageHistories 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ExportForecasts 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ExportReservationsUsage 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

UsageCallOptions contains the retry settings for each method of UsageClient.

UsageClient

  type 
  
 UsageClient 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  UsageCallOptions 
 
  
 // 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 
 } 
 

UsageClient is a client for interacting with Capacity Planner API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Provides access to historical and forecasted usage data.

func NewUsageClient

  func 
  
 NewUsageClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
 option 
 . 
 ClientOption 
 ) 
  
 ( 
 * 
  UsageClient 
 
 , 
  
  error 
 
 ) 
 

NewUsageClient creates a new usage service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Provides access to historical and forecasted usage data.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 capacityplanner 
  
 "cloud.google.com/go/capacityplanner/apiv1beta" 
 ) 
 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 
  
 := 
  
 capacityplanner 
 . 
  NewUsageClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func NewUsageRESTClient

  func 
  
 NewUsageRESTClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
 option 
 . 
 ClientOption 
 ) 
  
 ( 
 * 
  UsageClient 
 
 , 
  
  error 
 
 ) 
 

NewUsageRESTClient creates a new usage service rest client.

Provides access to historical and forecasted usage data.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 capacityplanner 
  
 "cloud.google.com/go/capacityplanner/apiv1beta" 
 ) 
 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 
  
 := 
  
 capacityplanner 
 . 
  NewUsageRESTClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*UsageClient) Close

  func 
  
 ( 
 c 
  
 * 
  UsageClient 
 
 ) 
  
 Close 
 () 
  
  error 
 
 

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*UsageClient) Connection (deprecated)

  func 
  
 ( 
 c 
  
 * 
  UsageClient 
 
 ) 
  
 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 (*UsageClient) ExportForecasts

ExportForecasts exports forecasted usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 capacityplanner 
  
 "cloud.google.com/go/capacityplanner/apiv1beta" 
  
 capacityplannerpb 
  
 "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb" 
 ) 
 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 
  
 := 
  
 capacityplanner 
 . 
  NewUsageClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& capacityplannerpb 
 . 
 ExportForecastsRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb#ExportForecastsRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 ExportForecasts 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*UsageClient) ExportForecastsOperation

  func 
  
 ( 
 c 
  
 * 
  UsageClient 
 
 ) 
  
 ExportForecastsOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  ExportForecastsOperation 
 
 

ExportForecastsOperation returns a new ExportForecastsOperation from a given name. The name must be that of a previously created ExportForecastsOperation, possibly from a different process.

func (*UsageClient) ExportReservationsUsage

ExportReservationsUsage exports reservations usage data requested by user into either an existing Cloud Storage bucket or a new/existing BigQuery table.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 capacityplanner 
  
 "cloud.google.com/go/capacityplanner/apiv1beta" 
  
 capacityplannerpb 
  
 "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb" 
 ) 
 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 
  
 := 
  
 capacityplanner 
 . 
  NewUsageClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& capacityplannerpb 
 . 
 ExportReservationsUsageRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb#ExportReservationsUsageRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 ExportReservationsUsage 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*UsageClient) ExportReservationsUsageOperation

  func 
  
 ( 
 c 
  
 * 
  UsageClient 
 
 ) 
  
 ExportReservationsUsageOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  ExportReservationsUsageOperation 
 
 

ExportReservationsUsageOperation returns a new ExportReservationsUsageOperation from a given name. The name must be that of a previously created ExportReservationsUsageOperation, possibly from a different process.

func (*UsageClient) ExportUsageHistories

ExportUsageHistories exports historical usage data requested by user into either an existing Cloud Storage bucket or a BigQuery table.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 capacityplanner 
  
 "cloud.google.com/go/capacityplanner/apiv1beta" 
  
 capacityplannerpb 
  
 "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb" 
 ) 
 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 
  
 := 
  
 capacityplanner 
 . 
  NewUsageClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& capacityplannerpb 
 . 
 ExportUsageHistoriesRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb#ExportUsageHistoriesRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 ExportUsageHistories 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*UsageClient) ExportUsageHistoriesOperation

  func 
  
 ( 
 c 
  
 * 
  UsageClient 
 
 ) 
  
 ExportUsageHistoriesOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  ExportUsageHistoriesOperation 
 
 

ExportUsageHistoriesOperation returns a new ExportUsageHistoriesOperation from a given name. The name must be that of a previously created ExportUsageHistoriesOperation, possibly from a different process.

func (*UsageClient) QueryForecasts

QueryForecasts returns a list of the forecasts that are in the parent parameter and match your specified filters.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 capacityplanner 
  
 "cloud.google.com/go/capacityplanner/apiv1beta" 
  
 capacityplannerpb 
  
 "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb" 
 ) 
 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 
  
 := 
  
 capacityplanner 
 . 
  NewUsageClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& capacityplannerpb 
 . 
 QueryForecastsRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb#QueryForecastsRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 QueryForecasts 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*UsageClient) QueryReservations

QueryReservations returns a list of the reservations that are in the parent parameter and match your specified filters.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 capacityplanner 
  
 "cloud.google.com/go/capacityplanner/apiv1beta" 
  
 capacityplannerpb 
  
 "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb" 
 ) 
 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 
  
 := 
  
 capacityplanner 
 . 
  NewUsageClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& capacityplannerpb 
 . 
 QueryReservationsRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb#QueryReservationsRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 QueryReservations 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*UsageClient) QueryUsageHistories

QueryUsageHistories returns a list of the usage histories that are in the parent parameter and match your specified filters.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 capacityplanner 
  
 "cloud.google.com/go/capacityplanner/apiv1beta" 
  
 capacityplannerpb 
  
 "cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb" 
 ) 
 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 
  
 := 
  
 capacityplanner 
 . 
  NewUsageClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& capacityplannerpb 
 . 
 QueryUsageHistoriesRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/capacityplanner/apiv1beta/capacityplannerpb#QueryUsageHistoriesRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 QueryUsageHistories 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 
Create a Mobile Website
View Site in Mobile | Classic
Share by: