Documentation ¶
Overview ¶
Package cloud contains Google Cloud Platform APIs related types and common functions.
Index ¶
- func NewContext(projID string, c *http.Client) context.Context
- func WithContext(parent context.Context, projID string, c *http.Client) context.Context
- type ClientOption
- func WithBaseGRPC(client *grpc.ClientConn) ClientOption
- func WithBaseHTTP(client *http.Client) ClientOption
- func WithEndpoint(url string) ClientOption
- func WithGRPCDialOption(opt grpc.DialOption) ClientOption
- func WithScopes(scope ...string) ClientOption
- func WithTokenSource(s oauth2.TokenSource) ClientOption
- func WithUserAgent(ua string) ClientOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext returns a new context that uses the provided http.Client. Provided http.Client is responsible to authorize and authenticate the requests made to the Google Cloud APIs. It mutates the client's original Transport to append the cloud package's user-agent to the outgoing requests. You can obtain the project ID from the Google Developers Console, https://console.developers.google.com.
Types ¶
type ClientOption ¶ added in v0.1.0
type ClientOption interface { // Resolve configures the given DialOpts for this option. Resolve(*opts.DialOpt) }
ClientOption is used when construct clients for each cloud service.
func WithBaseGRPC ¶ added in v0.1.0
func WithBaseGRPC(client *grpc.ClientConn) ClientOption
WithBaseGRPC returns a ClientOption that specifies the gRPC client connection to use as the basis of communications. This option many only be used with services that support gRPC as their communication transport.
func WithBaseHTTP ¶ added in v0.1.0
func WithBaseHTTP(client *http.Client) ClientOption
WithBaseHTTP returns a ClientOption that specifies the HTTP client to use as the basis of communications. This option may only be used with services that support HTTP as their communication transport.
func WithEndpoint ¶ added in v0.1.0
func WithEndpoint(url string) ClientOption
WithEndpoint returns a ClientOption that overrides the default endpoint to be used for a service.
func WithGRPCDialOption ¶ added in v0.1.0
func WithGRPCDialOption(opt grpc.DialOption) ClientOption
WithGRPCDialOption returns a ClientOption that appends a new grpc.DialOption to an underlying gRPC dial. It does not work with WithBaseGRPC.
func WithScopes ¶ added in v0.1.0
func WithScopes(scope ...string) ClientOption
WithScopes returns a ClientOption that overrides the default OAuth2 scopes to be used for a service.
func WithTokenSource ¶ added in v0.1.0
func WithTokenSource(s oauth2.TokenSource) ClientOption
WithTokenSource returns a ClientOption that specifies an OAuth2 token source to be used as the basis for authentication.
func WithUserAgent ¶ added in v0.1.0
func WithUserAgent(ua string) ClientOption
WithUserAgent returns a ClientOption that sets the User-Agent.
Directories ¶
Path | Synopsis |
---|---|
compute
|
|
metadata
Package metadata provides access to Google Compute Engine (GCE) metadata and API service accounts.
|
Package metadata provides access to Google Compute Engine (GCE) metadata and API service accounts. |
Package internal provides support for the cloud packages.
|
Package internal provides support for the cloud packages. |
opts
Package opts holds the DialOpts struct, configurable by cloud.ClientOptions to set up transports for cloud packages.
|
Package opts holds the DialOpts struct, configurable by cloud.ClientOptions to set up transports for cloud packages. |