Package mapsplatformdatasets is an auto-generated package for the Maps Platform Datasets API.
The Maps Platform Datasets API enables developers to ingest geospatially-tied datasets that they can use to enrich their experience of Maps Platform solutions (e.g. styling, routing).
NOTE: This package is in alpha. It is not stable, and is likely to change.
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.
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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &mapsplatformdatasetspb.CreateDatasetRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb#CreateDatasetRequest. } resp, err := c.CreateDataset(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewMapsPlatformDatasetsV1AlphaClient 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.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
DatasetIterator
type DatasetIterator 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 []*mapsplatformdatasetspb.Dataset, nextPageToken string, err error)
// contains filtered or unexported fields
}
DatasetIterator manages a stream of *mapsplatformdatasetspb.Dataset.
func (*DatasetIterator) Next
func (it *DatasetIterator) Next() (*mapsplatformdatasetspb.Dataset, 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 (*DatasetIterator) PageInfo
func (it *DatasetIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
MapsPlatformDatasetsV1AlphaCallOptions
type MapsPlatformDatasetsV1AlphaCallOptions struct {
CreateDataset []gax.CallOption
UpdateDatasetMetadata []gax.CallOption
GetDataset []gax.CallOption
ListDatasetVersions []gax.CallOption
ListDatasets []gax.CallOption
DeleteDataset []gax.CallOption
DeleteDatasetVersion []gax.CallOption
}
MapsPlatformDatasetsV1AlphaCallOptions contains the retry settings for each method of MapsPlatformDatasetsV1AlphaClient.
MapsPlatformDatasetsV1AlphaClient
type MapsPlatformDatasetsV1AlphaClient struct {
// The call options for this service.
CallOptions *MapsPlatformDatasetsV1AlphaCallOptions
// contains filtered or unexported fields
}
MapsPlatformDatasetsV1AlphaClient is a client for interacting with Maps Platform Datasets API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service definition for the Maps Platform Datasets API.
func NewMapsPlatformDatasetsV1AlphaClient
func NewMapsPlatformDatasetsV1AlphaClient(ctx context.Context, opts ...option.ClientOption) (*MapsPlatformDatasetsV1AlphaClient, error)
NewMapsPlatformDatasetsV1AlphaClient creates a new maps platform datasets v1 alpha client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service definition for the Maps Platform Datasets API.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
)
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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewMapsPlatformDatasetsV1AlphaRESTClient
func NewMapsPlatformDatasetsV1AlphaRESTClient(ctx context.Context, opts ...option.ClientOption) (*MapsPlatformDatasetsV1AlphaClient, error)
NewMapsPlatformDatasetsV1AlphaRESTClient creates a new maps platform datasets v1 alpha rest client.
Service definition for the Maps Platform Datasets API.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
)
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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*MapsPlatformDatasetsV1AlphaClient) Close
func (c *MapsPlatformDatasetsV1AlphaClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*MapsPlatformDatasetsV1AlphaClient) Connection (deprecated)
func (c *MapsPlatformDatasetsV1AlphaClient) 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 (*MapsPlatformDatasetsV1AlphaClient) CreateDataset
func (c *MapsPlatformDatasetsV1AlphaClient) CreateDataset(ctx context.Context, req *mapsplatformdatasetspb.CreateDatasetRequest, opts ...gax.CallOption) (*mapsplatformdatasetspb.Dataset, error)
CreateDataset create a new dataset for the specified project.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
mapsplatformdatasetspb "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb"
)
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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &mapsplatformdatasetspb.CreateDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb#CreateDatasetRequest.
}
resp, err := c.CreateDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MapsPlatformDatasetsV1AlphaClient) DeleteDataset
func (c *MapsPlatformDatasetsV1AlphaClient) DeleteDataset(ctx context.Context, req *mapsplatformdatasetspb.DeleteDatasetRequest, opts ...gax.CallOption) error
DeleteDataset delete the specified dataset and optionally all its corresponding versions.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
mapsplatformdatasetspb "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb"
)
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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &mapsplatformdatasetspb.DeleteDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb#DeleteDatasetRequest.
}
err = c.DeleteDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*MapsPlatformDatasetsV1AlphaClient) DeleteDatasetVersion
func (c *MapsPlatformDatasetsV1AlphaClient) DeleteDatasetVersion(ctx context.Context, req *mapsplatformdatasetspb.DeleteDatasetVersionRequest, opts ...gax.CallOption) error
DeleteDatasetVersion delete a specific version of the dataset.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
mapsplatformdatasetspb "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb"
)
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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &mapsplatformdatasetspb.DeleteDatasetVersionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb#DeleteDatasetVersionRequest.
}
err = c.DeleteDatasetVersion(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*MapsPlatformDatasetsV1AlphaClient) GetDataset
func (c *MapsPlatformDatasetsV1AlphaClient) GetDataset(ctx context.Context, req *mapsplatformdatasetspb.GetDatasetRequest, opts ...gax.CallOption) (*mapsplatformdatasetspb.Dataset, error)
GetDataset get the published or latest version of the dataset.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
mapsplatformdatasetspb "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb"
)
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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &mapsplatformdatasetspb.GetDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb#GetDatasetRequest.
}
resp, err := c.GetDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*MapsPlatformDatasetsV1AlphaClient) ListDatasetVersions
func (c *MapsPlatformDatasetsV1AlphaClient) ListDatasetVersions(ctx context.Context, req *mapsplatformdatasetspb.ListDatasetVersionsRequest, opts ...gax.CallOption) *DatasetIterator
ListDatasetVersions list all the versions of a dataset.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
mapsplatformdatasetspb "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb"
"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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &mapsplatformdatasetspb.ListDatasetVersionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb#ListDatasetVersionsRequest.
}
it := c.ListDatasetVersions(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.(*mapsplatformdatasetspb.ListDatasetVersionsResponse)
}
}
func (*MapsPlatformDatasetsV1AlphaClient) ListDatasets
func (c *MapsPlatformDatasetsV1AlphaClient) ListDatasets(ctx context.Context, req *mapsplatformdatasetspb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator
ListDatasets list all the datasets for the specified project.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
mapsplatformdatasetspb "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb"
"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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &mapsplatformdatasetspb.ListDatasetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb#ListDatasetsRequest.
}
it := c.ListDatasets(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.(*mapsplatformdatasetspb.ListDatasetsResponse)
}
}
func (*MapsPlatformDatasetsV1AlphaClient) UpdateDatasetMetadata
func (c *MapsPlatformDatasetsV1AlphaClient) UpdateDatasetMetadata(ctx context.Context, req *mapsplatformdatasetspb.UpdateDatasetMetadataRequest, opts ...gax.CallOption) (*mapsplatformdatasetspb.Dataset, error)
UpdateDatasetMetadata update the metadata for the dataset. To update the data use: UploadDataset.
Example
package main
import (
"context"
mapsplatformdatasets "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha"
mapsplatformdatasetspb "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb"
)
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 := mapsplatformdatasets.NewMapsPlatformDatasetsV1AlphaClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &mapsplatformdatasetspb.UpdateDatasetMetadataRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb#UpdateDatasetMetadataRequest.
}
resp, err := c.UpdateDatasetMetadata(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}