Documentation ¶
Overview ¶
General documentation
For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.
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 := v1.NewStakingClient(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 := v1.NewStakingClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &stakingpb.ListProtocolsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1#ListProtocolsRequest. } resp, err := c.ListProtocols(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context ¶
The ctx passed to NewStakingClient 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 StakingCallOptions
- type StakingClient
- func (c *StakingClient) Close() error
- func (c *StakingClient) Connection() *grpc.ClientConndeprecated
- func (c *StakingClient) CreateWorkflow(ctx context.Context, req *stakingpb.CreateWorkflowRequest, ...) (*stakingpb.Workflow, error)
- func (c *StakingClient) GetWorkflow(ctx context.Context, req *stakingpb.GetWorkflowRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error)
- func (c *StakingClient) ListActions(ctx context.Context, req *stakingpb.ListActionsRequest, opts ...gax.CallOption) (*stakingpb.ListActionsResponse, error)
- func (c *StakingClient) ListNetworks(ctx context.Context, req *stakingpb.ListNetworksRequest, ...) (*stakingpb.ListNetworksResponse, error)
- func (c *StakingClient) ListProtocols(ctx context.Context, req *stakingpb.ListProtocolsRequest, ...) (*stakingpb.ListProtocolsResponse, error)
- func (c *StakingClient) ListStakingTargets(ctx context.Context, req *stakingpb.ListStakingTargetsRequest, ...) *StakingTargetIterator
- func (c *StakingClient) ListWorkflows(ctx context.Context, req *stakingpb.ListWorkflowsRequest, ...) *WorkflowIterator
- func (c *StakingClient) PerformWorkflowStep(ctx context.Context, req *stakingpb.PerformWorkflowStepRequest, ...) (*stakingpb.Workflow, error)
- func (c *StakingClient) ViewStakingContext(ctx context.Context, req *stakingpb.ViewStakingContextRequest, ...) (*stakingpb.ViewStakingContextResponse, error)
- type StakingTargetIterator
- type WorkflowIterator
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 StakingCallOptions ¶
type StakingCallOptions struct { ListProtocols []gax.CallOption ListNetworks []gax.CallOption ListStakingTargets []gax.CallOption ListActions []gax.CallOption CreateWorkflow []gax.CallOption GetWorkflow []gax.CallOption ListWorkflows []gax.CallOption PerformWorkflowStep []gax.CallOption ViewStakingContext []gax.CallOption }
StakingCallOptions contains the retry settings for each method of StakingClient.
type StakingClient ¶
type StakingClient struct { // The call options for this service. CallOptions *StakingCallOptions // contains filtered or unexported fields }
StakingClient is a client for interacting with . Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
StakingService manages staking related resources such as protocols, networks, validators and workflows.
func NewStakingClient ¶
func NewStakingClient(ctx context.Context, opts ...option.ClientOption) (*StakingClient, error)
NewStakingClient creates a new staking service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
StakingService manages staking related resources such as protocols, networks, validators and workflows.
func NewStakingRESTClient ¶
func NewStakingRESTClient(ctx context.Context, opts ...option.ClientOption) (*StakingClient, error)
NewStakingRESTClient creates a new staking service rest client.
StakingService manages staking related resources such as protocols, networks, validators and workflows.
func (*StakingClient) Close ¶
func (c *StakingClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*StakingClient) Connection
deprecated
func (c *StakingClient) 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 (*StakingClient) CreateWorkflow ¶
func (c *StakingClient) CreateWorkflow(ctx context.Context, req *stakingpb.CreateWorkflowRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error)
CreateWorkflow create a workflow to perform an action.
func (*StakingClient) GetWorkflow ¶
func (c *StakingClient) GetWorkflow(ctx context.Context, req *stakingpb.GetWorkflowRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error)
GetWorkflow get the current state of an active workflow.
func (*StakingClient) ListActions ¶
func (c *StakingClient) ListActions(ctx context.Context, req *stakingpb.ListActionsRequest, opts ...gax.CallOption) (*stakingpb.ListActionsResponse, error)
ListActions list supported actions for a given protocol and network.
func (*StakingClient) ListNetworks ¶
func (c *StakingClient) ListNetworks(ctx context.Context, req *stakingpb.ListNetworksRequest, opts ...gax.CallOption) (*stakingpb.ListNetworksResponse, error)
ListNetworks list supported staking networks for a given protocol.
func (*StakingClient) ListProtocols ¶
func (c *StakingClient) ListProtocols(ctx context.Context, req *stakingpb.ListProtocolsRequest, opts ...gax.CallOption) (*stakingpb.ListProtocolsResponse, error)
ListProtocols list supported protocols.
func (*StakingClient) ListStakingTargets ¶
func (c *StakingClient) ListStakingTargets(ctx context.Context, req *stakingpb.ListStakingTargetsRequest, opts ...gax.CallOption) *StakingTargetIterator
ListStakingTargets list supported staking targets for a given protocol and network.
func (*StakingClient) ListWorkflows ¶
func (c *StakingClient) ListWorkflows(ctx context.Context, req *stakingpb.ListWorkflowsRequest, opts ...gax.CallOption) *WorkflowIterator
ListWorkflows list all workflows in a project.
func (*StakingClient) PerformWorkflowStep ¶
func (c *StakingClient) PerformWorkflowStep(ctx context.Context, req *stakingpb.PerformWorkflowStepRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error)
PerformWorkflowStep perform the next step in a workflow.
func (*StakingClient) ViewStakingContext ¶
func (c *StakingClient) ViewStakingContext(ctx context.Context, req *stakingpb.ViewStakingContextRequest, opts ...gax.CallOption) (*stakingpb.ViewStakingContextResponse, error)
ViewStakingContext view Staking context information given a specific network address.
type StakingTargetIterator ¶
type StakingTargetIterator 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 []*stakingpb.StakingTarget, nextPageToken string, err error) // contains filtered or unexported fields }
StakingTargetIterator manages a stream of *stakingpb.StakingTarget.
func (*StakingTargetIterator) Next ¶
func (it *StakingTargetIterator) Next() (*stakingpb.StakingTarget, 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 (*StakingTargetIterator) PageInfo ¶
func (it *StakingTargetIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type WorkflowIterator ¶
type WorkflowIterator 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 []*stakingpb.Workflow, nextPageToken string, err error) // contains filtered or unexported fields }
WorkflowIterator manages a stream of *stakingpb.Workflow.
func (*WorkflowIterator) Next ¶
func (it *WorkflowIterator) Next() (*stakingpb.Workflow, 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 (*WorkflowIterator) PageInfo ¶
func (it *WorkflowIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.