Analytics Hub API v1beta1 - Package cloud.google.com/go/bigquery/dataexchange/apiv1beta1 (v1.33.0)

Package dataexchange is an auto-generated package for the Analytics Hub API.

Exchange data and analytics assets securely and efficiently.

NOTE: This package is in beta. It is not stable, and may be subject to changes.

Example usage

To get started with this package, create a client.

ctx := context.Background()
c, err := dataexchange.NewAnalyticsHubClient(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()
c, err := dataexchange.NewAnalyticsHubClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &dataexchangepb.ListDataExchangesRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#ListDataExchangesRequest.
}
it := c.ListDataExchanges(ctx, req)
for {
    resp, err := it.Next()
    if err == iterator.Done {
        break
    }
    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.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

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

AnalyticsHubCallOptions

type AnalyticsHubCallOptions struct {
	ListDataExchanges    []gax.CallOption
	ListOrgDataExchanges []gax.CallOption
	GetDataExchange      []gax.CallOption
	CreateDataExchange   []gax.CallOption
	UpdateDataExchange   []gax.CallOption
	DeleteDataExchange   []gax.CallOption
	ListListings         []gax.CallOption
	GetListing           []gax.CallOption
	CreateListing        []gax.CallOption
	UpdateListing        []gax.CallOption
	DeleteListing        []gax.CallOption
	SubscribeListing     []gax.CallOption
	GetIamPolicy         []gax.CallOption
	SetIamPolicy         []gax.CallOption
	TestIamPermissions   []gax.CallOption
}

AnalyticsHubCallOptions contains the retry settings for each method of AnalyticsHubClient.

AnalyticsHubClient

type AnalyticsHubClient struct {

	// The call options for this service.
	CallOptions *AnalyticsHubCallOptions
	// contains filtered or unexported fields
}

AnalyticsHubClient is a client for interacting with Analytics Hub API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

The AnalyticsHubService API facilitates data sharing within and across organizations. It allows data providers to publish Listings — a discoverable and searchable SKU representing a dataset. Data consumers can subscribe to Listings. Upon subscription, AnalyticsHub provisions a “Linked Datasets” surfacing the data in the consumer’s project.

func NewAnalyticsHubClient

func NewAnalyticsHubClient(ctx context.Context, opts ...option.ClientOption) (*AnalyticsHubClient, error)

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

The AnalyticsHubService API facilitates data sharing within and across organizations. It allows data providers to publish Listings — a discoverable and searchable SKU representing a dataset. Data consumers can subscribe to Listings. Upon subscription, AnalyticsHub provisions a “Linked Datasets” surfacing the data in the consumer’s project.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*AnalyticsHubClient) Close

func (c *AnalyticsHubClient) Close() error

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

func (*AnalyticsHubClient) Connection

func (c *AnalyticsHubClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*AnalyticsHubClient) CreateDataExchange

CreateDataExchange creates a new DataExchange in a given project and location.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.CreateDataExchangeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#CreateDataExchangeRequest.
	}
	resp, err := c.CreateDataExchange(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) CreateListing

CreateListing creates a new Listing in a given project and location.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.CreateListingRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#CreateListingRequest.
	}
	resp, err := c.CreateListing(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) DeleteDataExchange

DeleteDataExchange deletes a single DataExchange.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.DeleteDataExchangeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#DeleteDataExchangeRequest.
	}
	err = c.DeleteDataExchange(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*AnalyticsHubClient) DeleteListing

DeleteListing deletes a single Listing, as long as there are no subscriptions associated with the source of this Listing.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.DeleteListingRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#DeleteListingRequest.
	}
	err = c.DeleteListing(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*AnalyticsHubClient) GetDataExchange

GetDataExchange gets details of a single DataExchange.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.GetDataExchangeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#GetDataExchangeRequest.
	}
	resp, err := c.GetDataExchange(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) GetIamPolicy

func (c *AnalyticsHubClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

GetIamPolicy gets the IAM policy for a dataExchange or a listing.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	iampb "google.golang.org/genproto/googleapis/iam/v1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iampb.GetIamPolicyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#GetIamPolicyRequest.
	}
	resp, err := c.GetIamPolicy(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) GetListing

GetListing gets details of a single Listing.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.GetListingRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#GetListingRequest.
	}
	resp, err := c.GetListing(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) ListDataExchanges

ListDataExchanges lists DataExchanges in a given project and location.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"
	"google.golang.org/api/iterator"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.ListDataExchangesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#ListDataExchangesRequest.
	}
	it := c.ListDataExchanges(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*AnalyticsHubClient) ListListings

ListListings lists Listings in a given project and location.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"
	"google.golang.org/api/iterator"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.ListListingsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#ListListingsRequest.
	}
	it := c.ListListings(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*AnalyticsHubClient) ListOrgDataExchanges

ListOrgDataExchanges lists DataExchanges from projects in a given organization and location.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"
	"google.golang.org/api/iterator"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.ListOrgDataExchangesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#ListOrgDataExchangesRequest.
	}
	it := c.ListOrgDataExchanges(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*AnalyticsHubClient) SetIamPolicy

func (c *AnalyticsHubClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

SetIamPolicy sets the IAM policy for a dataExchange or a listing.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	iampb "google.golang.org/genproto/googleapis/iam/v1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iampb.SetIamPolicyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#SetIamPolicyRequest.
	}
	resp, err := c.SetIamPolicy(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) SubscribeListing

SubscribeListing subscribes to a single Listing.

Data Exchange currently supports one type of Listing: a BigQuery dataset. Upon subscription to a Listing for a BigQuery dataset, Data Exchange creates a linked dataset in the subscriber’s project.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.SubscribeListingRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#SubscribeListingRequest.
	}
	resp, err := c.SubscribeListing(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) TestIamPermissions

TestIamPermissions returns the permissions that a caller has on a specified dataExchange or listing.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	iampb "google.golang.org/genproto/googleapis/iam/v1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iampb.TestIamPermissionsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#TestIamPermissionsRequest.
	}
	resp, err := c.TestIamPermissions(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) UpdateDataExchange

UpdateDataExchange updates the parameters of a single DataExchange.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.UpdateDataExchangeRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#UpdateDataExchangeRequest.
	}
	resp, err := c.UpdateDataExchange(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*AnalyticsHubClient) UpdateListing

UpdateListing updates the parameters of a single Listing.

Example

package main

import (
	"context"

	dataexchange "cloud.google.com/go/bigquery/dataexchange/apiv1beta1"

	dataexchangepb "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1"
)

func main() {
	ctx := context.Background()
	c, err := dataexchange.NewAnalyticsHubClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataexchangepb.UpdateListingRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1#UpdateListingRequest.
	}
	resp, err := c.UpdateListing(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

DataExchangeIterator

type DataExchangeIterator 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 []*dataexchangepb.DataExchange, nextPageToken string, err error)
	// contains filtered or unexported fields
}

DataExchangeIterator manages a stream of *dataexchangepb.DataExchange.

func (*DataExchangeIterator) Next

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 (*DataExchangeIterator) PageInfo

func (it *DataExchangeIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

ListingIterator

type ListingIterator 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 []*dataexchangepb.Listing, nextPageToken string, err error)
	// contains filtered or unexported fields
}

ListingIterator manages a stream of *dataexchangepb.Listing.

func (*ListingIterator) Next

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 (*ListingIterator) PageInfo

func (it *ListingIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.