diff --git a/area120/tables/apiv1alpha1/doc.go b/area120/tables/apiv1alpha1/doc.go new file mode 100644 index 00000000000..471deaea893 --- /dev/null +++ b/area120/tables/apiv1alpha1/doc.go @@ -0,0 +1,106 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +// +// NOTE: This package is in alpha. It is not stable, and is likely to change. +// +// 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 godoc.org/cloud.google.com/go. +package tables // import "cloud.google.com/go/area120/tables/apiv1alpha1" + +import ( + "context" + "runtime" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "20200901" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/drive", + "https://www.googleapis.com/auth/drive.file", + "https://www.googleapis.com/auth/drive.readonly", + "https://www.googleapis.com/auth/spreadsheets", + "https://www.googleapis.com/auth/spreadsheets.readonly", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/area120/tables/apiv1alpha1/tables_client.go b/area120/tables/apiv1alpha1/tables_client.go new file mode 100644 index 00000000000..3ae35154b9a --- /dev/null +++ b/area120/tables/apiv1alpha1/tables_client.go @@ -0,0 +1,437 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package tables + +import ( + "context" + "fmt" + "math" + "net/url" + + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + gtransport "google.golang.org/api/transport/grpc" + tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +var newClientHook clientHook + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + GetTable []gax.CallOption + ListTables []gax.CallOption + GetRow []gax.CallOption + ListRows []gax.CallOption + CreateRow []gax.CallOption + BatchCreateRows []gax.CallOption + UpdateRow []gax.CallOption + BatchUpdateRows []gax.CallOption + DeleteRow []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + option.WithEndpoint("area120tables.googleapis.com:443"), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultCallOptions() *CallOptions { + return &CallOptions{ + GetTable: []gax.CallOption{}, + ListTables: []gax.CallOption{}, + GetRow: []gax.CallOption{}, + ListRows: []gax.CallOption{}, + CreateRow: []gax.CallOption{}, + BatchCreateRows: []gax.CallOption{}, + UpdateRow: []gax.CallOption{}, + BatchUpdateRows: []gax.CallOption{}, + DeleteRow: []gax.CallOption{}, + } +} + +// Client is a client for interacting with . +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // The gRPC API client. + client tablespb.TablesServiceClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new tables service client. +// +// The Tables Service provides an API for reading and updating tables. +// It defines the following resource model: +// +// The API has a collection of [Table][google.area120.tables.v1alpha1.Table] +// resources, named tables/* +// +// Each Table has a collection of [Row][google.area120.tables.v1alpha1.Row] +// resources, named tables/*/rows/* +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + clientOpts := defaultClientOptions() + + if newClientHook != nil { + hookOpts, err := newClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + connPool: connPool, + CallOptions: defaultCallOptions(), + + client: tablespb.NewTablesServiceClient(connPool), + } + c.setGoogleClientInfo() + + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *Client) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.connPool.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// GetTable gets a table. Returns NOT_FOUND if the table does not exist. +func (c *Client) GetTable(ctx context.Context, req *tablespb.GetTableRequest, opts ...gax.CallOption) (*tablespb.Table, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetTable[0:len(c.CallOptions.GetTable):len(c.CallOptions.GetTable)], opts...) + var resp *tablespb.Table + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetTable(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListTables lists tables for the user. +func (c *Client) ListTables(ctx context.Context, req *tablespb.ListTablesRequest, opts ...gax.CallOption) *TableIterator { + ctx = insertMetadata(ctx, c.xGoogMetadata) + opts = append(c.CallOptions.ListTables[0:len(c.CallOptions.ListTables):len(c.CallOptions.ListTables)], opts...) + it := &TableIterator{} + req = proto.Clone(req).(*tablespb.ListTablesRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*tablespb.Table, string, error) { + var resp *tablespb.ListTablesResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListTables(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.Tables, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + it.pageInfo.Token = req.PageToken + return it +} + +// GetRow gets a row. Returns NOT_FOUND if the row does not exist in the table. +func (c *Client) GetRow(ctx context.Context, req *tablespb.GetRowRequest, opts ...gax.CallOption) (*tablespb.Row, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetRow[0:len(c.CallOptions.GetRow):len(c.CallOptions.GetRow)], opts...) + var resp *tablespb.Row + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetRow(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ListRows lists rows in a table. Returns NOT_FOUND if the table does not exist. +func (c *Client) ListRows(ctx context.Context, req *tablespb.ListRowsRequest, opts ...gax.CallOption) *RowIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListRows[0:len(c.CallOptions.ListRows):len(c.CallOptions.ListRows)], opts...) + it := &RowIterator{} + req = proto.Clone(req).(*tablespb.ListRowsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*tablespb.Row, string, error) { + var resp *tablespb.ListRowsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListRows(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.Rows, resp.NextPageToken, nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.PageSize) + it.pageInfo.Token = req.PageToken + return it +} + +// CreateRow creates a row. +func (c *Client) CreateRow(ctx context.Context, req *tablespb.CreateRowRequest, opts ...gax.CallOption) (*tablespb.Row, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.CreateRow[0:len(c.CallOptions.CreateRow):len(c.CallOptions.CreateRow)], opts...) + var resp *tablespb.Row + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.CreateRow(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// BatchCreateRows creates multiple rows. +func (c *Client) BatchCreateRows(ctx context.Context, req *tablespb.BatchCreateRowsRequest, opts ...gax.CallOption) (*tablespb.BatchCreateRowsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.BatchCreateRows[0:len(c.CallOptions.BatchCreateRows):len(c.CallOptions.BatchCreateRows)], opts...) + var resp *tablespb.BatchCreateRowsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.BatchCreateRows(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateRow updates a row. +func (c *Client) UpdateRow(ctx context.Context, req *tablespb.UpdateRowRequest, opts ...gax.CallOption) (*tablespb.Row, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "row.name", url.QueryEscape(req.GetRow().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateRow[0:len(c.CallOptions.UpdateRow):len(c.CallOptions.UpdateRow)], opts...) + var resp *tablespb.Row + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateRow(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// BatchUpdateRows updates multiple rows. +func (c *Client) BatchUpdateRows(ctx context.Context, req *tablespb.BatchUpdateRowsRequest, opts ...gax.CallOption) (*tablespb.BatchUpdateRowsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.BatchUpdateRows[0:len(c.CallOptions.BatchUpdateRows):len(c.CallOptions.BatchUpdateRows)], opts...) + var resp *tablespb.BatchUpdateRowsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.BatchUpdateRows(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// DeleteRow deletes a row. +func (c *Client) DeleteRow(ctx context.Context, req *tablespb.DeleteRowRequest, opts ...gax.CallOption) error { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteRow[0:len(c.CallOptions.DeleteRow):len(c.CallOptions.DeleteRow)], opts...) + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + _, err = c.client.DeleteRow(ctx, req, settings.GRPC...) + return err + }, opts...) + return err +} + +// RowIterator manages a stream of *tablespb.Row. +type RowIterator struct { + items []*tablespb.Row + pageInfo *iterator.PageInfo + nextFunc func() error + + // 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 []*tablespb.Row, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *RowIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// 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 (it *RowIterator) Next() (*tablespb.Row, error) { + var item *tablespb.Row + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *RowIterator) bufLen() int { + return len(it.items) +} + +func (it *RowIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} + +// TableIterator manages a stream of *tablespb.Table. +type TableIterator struct { + items []*tablespb.Table + pageInfo *iterator.PageInfo + nextFunc func() error + + // 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 []*tablespb.Table, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *TableIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// 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 (it *TableIterator) Next() (*tablespb.Table, error) { + var item *tablespb.Table + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *TableIterator) bufLen() int { + return len(it.items) +} + +func (it *TableIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/area120/tables/apiv1alpha1/tables_client_example_test.go b/area120/tables/apiv1alpha1/tables_client_example_test.go new file mode 100644 index 00000000000..8b40110cb62 --- /dev/null +++ b/area120/tables/apiv1alpha1/tables_client_example_test.go @@ -0,0 +1,225 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package tables_test + +import ( + "context" + + tables "cloud.google.com/go/area120/tables/apiv1alpha1" + "google.golang.org/api/iterator" + tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_GetTable() { + // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.GetTableRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetTable(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListTables() { + // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.ListTablesRequest{ + // TODO: Fill request struct fields. + } + it := c.ListTables(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetRow() { + // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.GetRowRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetRow(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListRows() { + // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.ListRowsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListRows(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_CreateRow() { + // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.CreateRowRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.CreateRow(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_BatchCreateRows() { + // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.BatchCreateRowsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BatchCreateRows(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateRow() { + // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.UpdateRowRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.UpdateRow(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_BatchUpdateRows() { + // import tablespb "google.golang.org/genproto/googleapis/area120/tables/v1alpha1" + + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.BatchUpdateRowsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.BatchUpdateRows(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteRow() { + ctx := context.Background() + c, err := tables.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &tablespb.DeleteRowRequest{ + // TODO: Fill request struct fields. + } + err = c.DeleteRow(ctx, req) + if err != nil { + // TODO: Handle error. + } +} diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json index 53f536c5e46..acf6a38aef5 100644 --- a/internal/.repo-metadata-full.json +++ b/internal/.repo-metadata-full.json @@ -15,6 +15,14 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/analytics/data/apiv1alpha", "release_level": "alpha" }, + "cloud.google.com/go/area120/tables/apiv1alpha1": { + "distribution_name": "cloud.google.com/go/area120/tables/apiv1alpha1", + "description": "", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/area120/tables/apiv1alpha1", + "release_level": "alpha" + }, "cloud.google.com/go/asset/apiv1": { "distribution_name": "cloud.google.com/go/asset/apiv1", "description": "Cloud Asset API", diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go index f2e026c56a1..8930e76152b 100644 --- a/internal/gapicgen/generator/config.go +++ b/internal/gapicgen/generator/config.go @@ -818,4 +818,12 @@ var microgenGapicConfigs = []*microgenConfig{ apiServiceConfigPath: "google/analytics/data/v1alpha/analyticsdata_gapic.yaml", releaseLevel: "alpha", }, + { + inputDirectoryPath: "google/area120/tables/v1alpha1", + pkg: "tables", + importPath: "cloud.google.com/go/area120/tables/apiv1alpha1", + gRPCServiceConfigPath: "google/area120/tables/v1alpha1/tables_grpc_service_config.json", + apiServiceConfigPath: "google/area120/tables/v1alpha1/language_gapic.yaml", + releaseLevel: "alpha", + }, }