Movatterモバイル変換


[0]ホーム

URL:


transport

package
v0.257.0Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License:BSD-3-ClauseImports:8Imported by:2,014

Details

Repository

github.com/googleapis/google-api-go-client

Links

Documentation

Overview

Package transport provides utility methods for creating authenticatedtransports to Google's HTTP and gRPC APIs. It is intended to be used inconjunction with google.golang.org/api/option.

This package is not intended for use by end developers. Use thegoogle.golang.org/api/option package to configure API clients.

Example (ApplicationDefaultCredentials)
package mainimport ("context""log""google.golang.org/api/transport")func main() {ctx := context.Background()// Providing no auth option will cause NewClient to look for Application// Default Creds as specified at https://godoc.org/golang.org/x/oauth2/google#FindDefaultCredentials.//// Note: Given the same set of options, transport.NewHTTPClient and// transport.DialGRPC use the same credentials.c, _, err := transport.NewHTTPClient(ctx)if err != nil {log.Fatal(err)}_ = c // Use authenticated client.}

Example (WithCredentialsFile)
package mainimport ("context""log""google.golang.org/api/option""google.golang.org/api/transport")func main() {ctx := context.Background()// Download service account creds per https://cloud.google.com/docs/authentication/production.//// Note: Given the same set of options, transport.NewHTTPClient and// transport.DialGRPC use the same credentials.c, _, err := transport.NewHTTPClient(ctx, option.WithCredentialsFile("/path/to/service-account-creds.json"))if err != nil {log.Fatal(err)}_ = c // Use authenticated client.}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

funcCreds

Creds constructs a google.Credentials from the information in the options,or obtains the default credentials in the same way as google.FindDefaultCredentials.

funcDialGRPC

func DialGRPC(ctxcontext.Context, opts ...option.ClientOption) (*grpc.ClientConn,error)

DialGRPC returns a GRPC connection for use communicating with a Google cloudservice, configured with the given ClientOptions.

funcDialGRPCInsecure

func DialGRPCInsecure(ctxcontext.Context, opts ...option.ClientOption) (*grpc.ClientConn,error)

DialGRPCInsecure returns an insecure GRPC connection for use communicatingwith fake or mock Google cloud service implementations, such as emulators.The connection is configured with the given ClientOptions.

funcNewHTTPClient

func NewHTTPClient(ctxcontext.Context, opts ...option.ClientOption) (*http.Client,string,error)

NewHTTPClient returns an HTTP client for use communicating with a Google cloudservice, configured with the given ClientOptions. It also returns the endpointfor the service as specified in the options.

Types

This section is empty.

Source Files

View all Source files

Directories

PathSynopsis
Package bytestream provides a client for any service that exposes a ByteStream API.
Package bytestream provides a client for any service that exposes a ByteStream API.
Package grpc supports network connections to GRPC servers.
Package grpc supports network connections to GRPC servers.
Package http supports network connections to HTTP servers.
Package http supports network connections to HTTP servers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp