Documentation ¶
Overview ¶
Package datatransfer is an auto-generated package for the BigQuery Data Transfer API.
Schedule queries or transfer external data from SaaS applications to Google BigQuery on a regular basis.
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.
// go get cloud.google.com/go/bigquery/datatransfer/apiv1@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 := datatransfer.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, mentioned above.
req := &datatransferpb.CheckValidCredsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#CheckValidCredsRequest. } resp, err := c.CheckValidCreds(ctx, req) 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 DataSourcePath(project, dataSource string) stringdeprecated
- func DefaultAuthScopes() []string
- func LocationDataSourcePath(project, location, dataSource string) stringdeprecated
- func LocationPath(project, location string) stringdeprecated
- func LocationRunPath(project, location, transferConfig, run string) stringdeprecated
- func LocationTransferConfigPath(project, location, transferConfig string) stringdeprecated
- func ProjectPath(project string) stringdeprecated
- func RunPath(project, transferConfig, run string) stringdeprecated
- func TransferConfigPath(project, transferConfig string) stringdeprecated
- type CallOptions
- type Client
- func (c *Client) CheckValidCreds(ctx context.Context, req *datatransferpb.CheckValidCredsRequest, ...) (*datatransferpb.CheckValidCredsResponse, error)
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConndeprecated
- func (c *Client) CreateTransferConfig(ctx context.Context, req *datatransferpb.CreateTransferConfigRequest, ...) (*datatransferpb.TransferConfig, error)
- func (c *Client) DeleteTransferConfig(ctx context.Context, req *datatransferpb.DeleteTransferConfigRequest, ...) error
- func (c *Client) DeleteTransferRun(ctx context.Context, req *datatransferpb.DeleteTransferRunRequest, ...) error
- func (c *Client) EnrollDataSources(ctx context.Context, req *datatransferpb.EnrollDataSourcesRequest, ...) error
- func (c *Client) GetDataSource(ctx context.Context, req *datatransferpb.GetDataSourceRequest, ...) (*datatransferpb.DataSource, error)
- func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, ...) (*locationpb.Location, error)
- func (c *Client) GetTransferConfig(ctx context.Context, req *datatransferpb.GetTransferConfigRequest, ...) (*datatransferpb.TransferConfig, error)
- func (c *Client) GetTransferRun(ctx context.Context, req *datatransferpb.GetTransferRunRequest, ...) (*datatransferpb.TransferRun, error)
- func (c *Client) ListDataSources(ctx context.Context, req *datatransferpb.ListDataSourcesRequest, ...) *DataSourceIterator
- func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, ...) *LocationIterator
- func (c *Client) ListTransferConfigs(ctx context.Context, req *datatransferpb.ListTransferConfigsRequest, ...) *TransferConfigIterator
- func (c *Client) ListTransferLogs(ctx context.Context, req *datatransferpb.ListTransferLogsRequest, ...) *TransferMessageIterator
- func (c *Client) ListTransferRuns(ctx context.Context, req *datatransferpb.ListTransferRunsRequest, ...) *TransferRunIterator
- func (c *Client) ScheduleTransferRuns(ctx context.Context, req *datatransferpb.ScheduleTransferRunsRequest, ...) (*datatransferpb.ScheduleTransferRunsResponse, error)deprecated
- func (c *Client) StartManualTransferRuns(ctx context.Context, req *datatransferpb.StartManualTransferRunsRequest, ...) (*datatransferpb.StartManualTransferRunsResponse, error)
- func (c *Client) UnenrollDataSources(ctx context.Context, req *datatransferpb.UnenrollDataSourcesRequest, ...) error
- func (c *Client) UpdateTransferConfig(ctx context.Context, req *datatransferpb.UpdateTransferConfigRequest, ...) (*datatransferpb.TransferConfig, error)
- type DataSourceIterator
- type LocationIterator
- type TransferConfigIterator
- type TransferMessageIterator
- type TransferRunIterator
Examples ¶
- Client.CheckValidCreds
- Client.CreateTransferConfig
- Client.DeleteTransferConfig
- Client.DeleteTransferRun
- Client.EnrollDataSources
- Client.GetDataSource
- Client.GetLocation
- Client.GetTransferConfig
- Client.GetTransferRun
- Client.ListDataSources
- Client.ListDataSources (All)
- Client.ListLocations
- Client.ListLocations (All)
- Client.ListTransferConfigs
- Client.ListTransferConfigs (All)
- Client.ListTransferLogs
- Client.ListTransferLogs (All)
- Client.ListTransferRuns
- Client.ListTransferRuns (All)
- Client.ScheduleTransferRuns
- Client.StartManualTransferRuns
- Client.UnenrollDataSources
- Client.UpdateTransferConfig
- NewClient
- NewRESTClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataSourcePath
deprecated
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
func LocationDataSourcePath
deprecated
func LocationPath
deprecated
func LocationRunPath
deprecated
func LocationTransferConfigPath
deprecated
func ProjectPath
deprecated
func TransferConfigPath
deprecated
Types ¶
type CallOptions ¶
type CallOptions struct { GetDataSource []gax.CallOption ListDataSources []gax.CallOption CreateTransferConfig []gax.CallOption UpdateTransferConfig []gax.CallOption DeleteTransferConfig []gax.CallOption GetTransferConfig []gax.CallOption ListTransferConfigs []gax.CallOption ScheduleTransferRuns []gax.CallOption StartManualTransferRuns []gax.CallOption GetTransferRun []gax.CallOption DeleteTransferRun []gax.CallOption ListTransferRuns []gax.CallOption ListTransferLogs []gax.CallOption CheckValidCreds []gax.CallOption EnrollDataSources []gax.CallOption UnenrollDataSources []gax.CallOption GetLocation []gax.CallOption ListLocations []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 // contains filtered or unexported fields }
Client is a client for interacting with BigQuery Data Transfer API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
This API allows users to manage their data transfers into BigQuery.
func NewClient ¶
NewClient creates a new data transfer service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
This API allows users to manage their data transfers into BigQuery.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func NewRESTClient ¶ added in v1.45.0
NewRESTClient creates a new data transfer service rest client.
This API allows users to manage their data transfers into BigQuery.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/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 := datatransfer.NewRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
Output:
func (*Client) CheckValidCreds ¶
func (c *Client) CheckValidCreds(ctx context.Context, req *datatransferpb.CheckValidCredsRequest, opts ...gax.CallOption) (*datatransferpb.CheckValidCredsResponse, error)
CheckValidCreds returns true if valid credentials exist for the given data source and requesting user.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.CheckValidCredsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#CheckValidCredsRequest. } resp, err := c.CheckValidCreds(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) CreateTransferConfig ¶
func (c *Client) CreateTransferConfig(ctx context.Context, req *datatransferpb.CreateTransferConfigRequest, opts ...gax.CallOption) (*datatransferpb.TransferConfig, error)
CreateTransferConfig creates a new data transfer configuration.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.CreateTransferConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#CreateTransferConfigRequest. } resp, err := c.CreateTransferConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) DeleteTransferConfig ¶
func (c *Client) DeleteTransferConfig(ctx context.Context, req *datatransferpb.DeleteTransferConfigRequest, opts ...gax.CallOption) error
DeleteTransferConfig deletes a data transfer configuration, including any associated transfer runs and logs.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.DeleteTransferConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#DeleteTransferConfigRequest. } err = c.DeleteTransferConfig(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) DeleteTransferRun ¶
func (c *Client) DeleteTransferRun(ctx context.Context, req *datatransferpb.DeleteTransferRunRequest, opts ...gax.CallOption) error
DeleteTransferRun deletes the specified transfer run.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.DeleteTransferRunRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#DeleteTransferRunRequest. } err = c.DeleteTransferRun(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) EnrollDataSources ¶ added in v1.28.0
func (c *Client) EnrollDataSources(ctx context.Context, req *datatransferpb.EnrollDataSourcesRequest, opts ...gax.CallOption) error
EnrollDataSources enroll data sources in a user project. This allows users to create transfer configurations for these data sources. They will also appear in the ListDataSources RPC and as such, will appear in the BigQuery UI (at https://console.cloud.google.com/bigquery), and the documents can be found in the public guide for BigQuery Web UI (at https://cloud.google.com/bigquery/bigquery-web-ui) and Data Transfer Service (at https://cloud.google.com/bigquery/docs/working-with-transfers).
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.EnrollDataSourcesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#EnrollDataSourcesRequest. } err = c.EnrollDataSources(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) GetDataSource ¶
func (c *Client) GetDataSource(ctx context.Context, req *datatransferpb.GetDataSourceRequest, opts ...gax.CallOption) (*datatransferpb.DataSource, error)
GetDataSource retrieves a supported data source and returns its settings.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.GetDataSourceRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#GetDataSourceRequest. } resp, err := c.GetDataSource(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetLocation ¶ added in v1.45.0
func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" locationpb "google.golang.org/genproto/googleapis/cloud/location" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &locationpb.GetLocationRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest. } resp, err := c.GetLocation(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetTransferConfig ¶
func (c *Client) GetTransferConfig(ctx context.Context, req *datatransferpb.GetTransferConfigRequest, opts ...gax.CallOption) (*datatransferpb.TransferConfig, error)
GetTransferConfig returns information about a data transfer config.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.GetTransferConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#GetTransferConfigRequest. } resp, err := c.GetTransferConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) GetTransferRun ¶
func (c *Client) GetTransferRun(ctx context.Context, req *datatransferpb.GetTransferRunRequest, opts ...gax.CallOption) (*datatransferpb.TransferRun, error)
GetTransferRun returns information about the particular transfer run.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.GetTransferRunRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#GetTransferRunRequest. } resp, err := c.GetTransferRun(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) ListDataSources ¶
func (c *Client) ListDataSources(ctx context.Context, req *datatransferpb.ListDataSourcesRequest, opts ...gax.CallOption) *DataSourceIterator
ListDataSources lists supported data sources and returns their settings.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" "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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ListDataSourcesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ListDataSourcesRequest. } it := c.ListDataSources(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.(*datatransferpb.ListDataSourcesResponse) } }
Output:
Example (All) ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ListDataSourcesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ListDataSourcesRequest. } for resp, err := range c.ListDataSources(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListLocations ¶ added in v1.45.0
func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" "google.golang.org/api/iterator" locationpb "google.golang.org/genproto/googleapis/cloud/location" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &locationpb.ListLocationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. } it := c.ListLocations(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.(*locationpb.ListLocationsResponse) } }
Output:
Example (All) ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" locationpb "google.golang.org/genproto/googleapis/cloud/location" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &locationpb.ListLocationsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest. } for resp, err := range c.ListLocations(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListTransferConfigs ¶
func (c *Client) ListTransferConfigs(ctx context.Context, req *datatransferpb.ListTransferConfigsRequest, opts ...gax.CallOption) *TransferConfigIterator
ListTransferConfigs returns information about all transfer configs owned by a project in the specified location.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" "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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ListTransferConfigsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ListTransferConfigsRequest. } it := c.ListTransferConfigs(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.(*datatransferpb.ListTransferConfigsResponse) } }
Output:
Example (All) ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ListTransferConfigsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ListTransferConfigsRequest. } for resp, err := range c.ListTransferConfigs(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListTransferLogs ¶
func (c *Client) ListTransferLogs(ctx context.Context, req *datatransferpb.ListTransferLogsRequest, opts ...gax.CallOption) *TransferMessageIterator
ListTransferLogs returns log messages for the transfer run.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" "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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ListTransferLogsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ListTransferLogsRequest. } it := c.ListTransferLogs(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.(*datatransferpb.ListTransferLogsResponse) } }
Output:
Example (All) ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ListTransferLogsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ListTransferLogsRequest. } for resp, err := range c.ListTransferLogs(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ListTransferRuns ¶
func (c *Client) ListTransferRuns(ctx context.Context, req *datatransferpb.ListTransferRunsRequest, opts ...gax.CallOption) *TransferRunIterator
ListTransferRuns returns information about running and completed transfer runs.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" "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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ListTransferRunsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ListTransferRunsRequest. } it := c.ListTransferRuns(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.(*datatransferpb.ListTransferRunsResponse) } }
Output:
Example (All) ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ListTransferRunsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ListTransferRunsRequest. } for resp, err := range c.ListTransferRuns(ctx, req).All() { if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*Client) ScheduleTransferRuns
deprecated
func (c *Client) ScheduleTransferRuns(ctx context.Context, req *datatransferpb.ScheduleTransferRunsRequest, opts ...gax.CallOption) (*datatransferpb.ScheduleTransferRunsResponse, error)
ScheduleTransferRuns creates transfer runs for a time range [start_time, end_time]. For each date - or whatever granularity the data source supports - in the range, one transfer run is created. Note that runs are created per UTC time in the time range. DEPRECATED: use StartManualTransferRuns instead.
Deprecated: ScheduleTransferRuns may be removed in a future version.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.ScheduleTransferRunsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#ScheduleTransferRunsRequest. } resp, err := c.ScheduleTransferRuns(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) StartManualTransferRuns ¶
func (c *Client) StartManualTransferRuns(ctx context.Context, req *datatransferpb.StartManualTransferRunsRequest, opts ...gax.CallOption) (*datatransferpb.StartManualTransferRunsResponse, error)
StartManualTransferRuns start manual transfer runs to be executed now with schedule_time equal to current time. The transfer runs can be created for a time range where the run_time is between start_time (inclusive) and end_time (exclusive), or for a specific run_time.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.StartManualTransferRunsRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#StartManualTransferRunsRequest. } resp, err := c.StartManualTransferRuns(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*Client) UnenrollDataSources ¶ added in v1.60.0
func (c *Client) UnenrollDataSources(ctx context.Context, req *datatransferpb.UnenrollDataSourcesRequest, opts ...gax.CallOption) error
UnenrollDataSources unenroll data sources in a user project. This allows users to remove transfer configurations for these data sources. They will no longer appear in the ListDataSources RPC and will also no longer appear in the BigQuery UI (at https://console.cloud.google.com/bigquery). Data transfers configurations of unenrolled data sources will not be scheduled.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.UnenrollDataSourcesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#UnenrollDataSourcesRequest. } err = c.UnenrollDataSources(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*Client) UpdateTransferConfig ¶
func (c *Client) UpdateTransferConfig(ctx context.Context, req *datatransferpb.UpdateTransferConfigRequest, opts ...gax.CallOption) (*datatransferpb.TransferConfig, error)
UpdateTransferConfig updates a data transfer configuration. All fields must be set, even if they are not updated.
Example ¶
package main import ( "context" datatransfer "cloud.google.com/go/bigquery/datatransfer/apiv1" datatransferpb "cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb" ) 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 := datatransfer.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &datatransferpb.UpdateTransferConfigRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/bigquery/datatransfer/apiv1/datatransferpb#UpdateTransferConfigRequest. } resp, err := c.UpdateTransferConfig(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type DataSourceIterator ¶
type DataSourceIterator 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 []*datatransferpb.DataSource, nextPageToken string, err error) // contains filtered or unexported fields }
DataSourceIterator manages a stream of *datatransferpb.DataSource.
func (*DataSourceIterator) All ¶ added in v1.63.0
func (it *DataSourceIterator) All() iter.Seq2[*datatransferpb.DataSource, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*DataSourceIterator) Next ¶
func (it *DataSourceIterator) Next() (*datatransferpb.DataSource, 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 (*DataSourceIterator) PageInfo ¶
func (it *DataSourceIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type LocationIterator ¶ added in v1.45.0
type LocationIterator 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 []*locationpb.Location, nextPageToken string, err error) // contains filtered or unexported fields }
LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All ¶ added in v1.63.0
func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next ¶ added in v1.45.0
func (it *LocationIterator) Next() (*locationpb.Location, 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 (*LocationIterator) PageInfo ¶ added in v1.45.0
func (it *LocationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TransferConfigIterator ¶
type TransferConfigIterator 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 []*datatransferpb.TransferConfig, nextPageToken string, err error) // contains filtered or unexported fields }
TransferConfigIterator manages a stream of *datatransferpb.TransferConfig.
func (*TransferConfigIterator) All ¶ added in v1.63.0
func (it *TransferConfigIterator) All() iter.Seq2[*datatransferpb.TransferConfig, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*TransferConfigIterator) Next ¶
func (it *TransferConfigIterator) Next() (*datatransferpb.TransferConfig, 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 (*TransferConfigIterator) PageInfo ¶
func (it *TransferConfigIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TransferMessageIterator ¶
type TransferMessageIterator 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 []*datatransferpb.TransferMessage, nextPageToken string, err error) // contains filtered or unexported fields }
TransferMessageIterator manages a stream of *datatransferpb.TransferMessage.
func (*TransferMessageIterator) All ¶ added in v1.63.0
func (it *TransferMessageIterator) All() iter.Seq2[*datatransferpb.TransferMessage, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*TransferMessageIterator) Next ¶
func (it *TransferMessageIterator) Next() (*datatransferpb.TransferMessage, 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 (*TransferMessageIterator) PageInfo ¶
func (it *TransferMessageIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TransferRunIterator ¶
type TransferRunIterator 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 []*datatransferpb.TransferRun, nextPageToken string, err error) // contains filtered or unexported fields }
TransferRunIterator manages a stream of *datatransferpb.TransferRun.
func (*TransferRunIterator) All ¶ added in v1.63.0
func (it *TransferRunIterator) All() iter.Seq2[*datatransferpb.TransferRun, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*TransferRunIterator) Next ¶
func (it *TransferRunIterator) Next() (*datatransferpb.TransferRun, 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 (*TransferRunIterator) PageInfo ¶
func (it *TransferRunIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.