all: auto-regenerate gapics
This is an auto-generated regeneration of the gapic clients by
cloud.google.com/go/internal/gapicgen. Once the corresponding genproto PR is
submitted, genmgr will update this CL with a newer dependency to the newer
version of genproto and assign reviewers to this CL.
If you have been assigned to review this CL, please:
- Ensure that the version of genproto in go.mod has been updated.
- Ensure that CI is passing. If it's failing, it requires your manual attention.
- +2 and submit this CL if you believe it's ready to ship.
Corresponding genproto PR: https://github.com/googleapis/go-genproto/pull/301
Change-Id: I3bcaf8b1ea2490d2b40c48d58149fc1640bb85e8
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/51650
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Cotter <cjcotter@google.com>
diff --git a/asset/apiv1/asset_client.go b/asset/apiv1/asset_client.go
index c8c18ad..869cf14 100644
--- a/asset/apiv1/asset_client.go
+++ b/asset/apiv1/asset_client.go
@@ -27,7 +27,7 @@
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -83,8 +83,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client assetpb.AssetServiceClient
@@ -105,40 +105,42 @@
//
// Asset service definition.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: assetpb.NewAssetServiceClient(conn),
+ client: assetpb.NewAssetServiceClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/asset/apiv1/doc.go b/asset/apiv1/doc.go
index 2b6e8a8..99deb47 100644
--- a/asset/apiv1/doc.go
+++ b/asset/apiv1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/asset/apiv1beta1/asset_client.go b/asset/apiv1beta1/asset_client.go
index 36d58aa..81bdd3d 100644
--- a/asset/apiv1beta1/asset_client.go
+++ b/asset/apiv1beta1/asset_client.go
@@ -27,7 +27,7 @@
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1beta1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -73,8 +73,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client assetpb.AssetServiceClient
@@ -95,40 +95,42 @@
//
// Asset service definition.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: assetpb.NewAssetServiceClient(conn),
+ client: assetpb.NewAssetServiceClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/asset/apiv1beta1/doc.go b/asset/apiv1beta1/doc.go
index 96845fe..a849dd6 100644
--- a/asset/apiv1beta1/doc.go
+++ b/asset/apiv1beta1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/asset/apiv1p2beta1/asset_client.go b/asset/apiv1p2beta1/asset_client.go
index a36d100..065b1fe 100644
--- a/asset/apiv1p2beta1/asset_client.go
+++ b/asset/apiv1p2beta1/asset_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
assetpb "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -98,8 +98,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client assetpb.AssetServiceClient
@@ -115,30 +115,32 @@
//
// Asset service definition.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: assetpb.NewAssetServiceClient(conn),
+ client: assetpb.NewAssetServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/asset/apiv1p2beta1/doc.go b/asset/apiv1p2beta1/doc.go
index 6a1cc01..a5479b5 100644
--- a/asset/apiv1p2beta1/doc.go
+++ b/asset/apiv1p2beta1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/automl/apiv1beta1/doc.go b/automl/apiv1beta1/doc.go
index 0862405..f40bea3 100644
--- a/automl/apiv1beta1/doc.go
+++ b/automl/apiv1beta1/doc.go
@@ -98,4 +98,4 @@
return "UNKNOWN"
}
-const versionClient = "20200205"
+const versionClient = "20200207"
diff --git a/bigquery/datatransfer/apiv1/data_transfer_client.go b/bigquery/datatransfer/apiv1/data_transfer_client.go
index 309d576..0478102 100644
--- a/bigquery/datatransfer/apiv1/data_transfer_client.go
+++ b/bigquery/datatransfer/apiv1/data_transfer_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
datatransferpb "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -195,8 +195,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client datatransferpb.DataTransferServiceClient
@@ -215,30 +215,32 @@
// BigQuery. This service contains methods that are end user exposed. It backs
// up the frontend.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: datatransferpb.NewDataTransferServiceClient(conn),
+ client: datatransferpb.NewDataTransferServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/bigquery/datatransfer/apiv1/doc.go b/bigquery/datatransfer/apiv1/doc.go
index 13ebc1b..c74141c 100644
--- a/bigquery/datatransfer/apiv1/doc.go
+++ b/bigquery/datatransfer/apiv1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/bigquery/go.mod b/bigquery/go.mod
index 02b9323..3179e92 100644
--- a/bigquery/go.mod
+++ b/bigquery/go.mod
@@ -9,8 +9,9 @@
github.com/golang/protobuf v1.3.3
github.com/google/go-cmp v0.4.0
github.com/googleapis/gax-go/v2 v2.0.5
- golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e // indirect
- google.golang.org/api v0.16.0
- google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 // indirect
+ google.golang.org/api v0.17.0
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
)
diff --git a/bigquery/go.sum b/bigquery/go.sum
index 919097a..ca0f499 100644
--- a/bigquery/go.sum
+++ b/bigquery/go.sum
@@ -115,6 +115,8 @@
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -227,8 +229,9 @@
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 h1:KW20qMcLRWuIgjdCpHFJbVZA7zsDKtFXPNcm7/eI5ZA=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e h1:JdEzLb04S2BEPrWqUDsgo7JXSq8pQlzIHbrBQN5o7TY=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -242,8 +245,8 @@
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0 h1:yzlyyDW/J0w8yNFJIhiAJy4kq74S+1DOLdawELNxFMA=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
-google.golang.org/api v0.16.0 h1:hhRbpE9nkabqMxGCewz2sikMYxm8yYWov7h2Eo4j3Is=
-google.golang.org/api v0.16.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.17.0 h1:0q95w+VuFtv4PAx4PZVQdBMmYbaCHbnfKaEiDIcVyag=
+google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -271,8 +274,8 @@
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90 h1:7THRSvPuzF1bql5kyFzX0JM0vpGhwuhskgJrJsbZ80Y=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 h1:MBO9fkVSrTpJ8vgHLPi5gb+ZWXEy7/auJN8yqyu9EiE=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
diff --git a/bigquery/reservation/apiv1beta1/doc.go b/bigquery/reservation/apiv1beta1/doc.go
index 0d8806d..d73110a 100644
--- a/bigquery/reservation/apiv1beta1/doc.go
+++ b/bigquery/reservation/apiv1beta1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/bigquery/reservation/apiv1beta1/reservation_client.go b/bigquery/reservation/apiv1beta1/reservation_client.go
index d26dc34..41da08a 100644
--- a/bigquery/reservation/apiv1beta1/reservation_client.go
+++ b/bigquery/reservation/apiv1beta1/reservation_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
reservationpb "google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -182,8 +182,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client reservationpb.ReservationServiceClient
@@ -213,30 +213,32 @@
// and location, e.g.:
// projects/myproject/locations/US/capacityCommitments/id.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: reservationpb.NewReservationServiceClient(conn),
+ client: reservationpb.NewReservationServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/bigquery/storage/apiv1/big_query_read_client.go b/bigquery/storage/apiv1/big_query_read_client.go
index 37091be..0846549 100644
--- a/bigquery/storage/apiv1/big_query_read_client.go
+++ b/bigquery/storage/apiv1/big_query_read_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
storagepb "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -93,8 +93,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type BigQueryReadClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
bigQueryReadClient storagepb.BigQueryReadClient
@@ -112,30 +112,32 @@
//
// The Read API can be used to read data from BigQuery.
func NewBigQueryReadClient(ctx context.Context, opts ...option.ClientOption) (*BigQueryReadClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultBigQueryReadClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultBigQueryReadClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &BigQueryReadClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultBigQueryReadCallOptions(),
- bigQueryReadClient: storagepb.NewBigQueryReadClient(conn),
+ bigQueryReadClient: storagepb.NewBigQueryReadClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *BigQueryReadClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *BigQueryReadClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/bigquery/storage/apiv1/doc.go b/bigquery/storage/apiv1/doc.go
index 2c3de14..f66ecd5 100644
--- a/bigquery/storage/apiv1/doc.go
+++ b/bigquery/storage/apiv1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/bigquery/storage/apiv1alpha2/big_query_write_client.go b/bigquery/storage/apiv1alpha2/big_query_write_client.go
index e21bb8d..6c74379 100644
--- a/bigquery/storage/apiv1alpha2/big_query_write_client.go
+++ b/bigquery/storage/apiv1alpha2/big_query_write_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
storagepb "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1alpha2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -119,8 +119,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type BigQueryWriteClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
bigQueryWriteClient storagepb.BigQueryWriteClient
@@ -138,30 +138,32 @@
//
// The Write API can be used to write data to BigQuery.
func NewBigQueryWriteClient(ctx context.Context, opts ...option.ClientOption) (*BigQueryWriteClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultBigQueryWriteClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultBigQueryWriteClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &BigQueryWriteClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultBigQueryWriteCallOptions(),
- bigQueryWriteClient: storagepb.NewBigQueryWriteClient(conn),
+ bigQueryWriteClient: storagepb.NewBigQueryWriteClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *BigQueryWriteClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *BigQueryWriteClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/bigquery/storage/apiv1alpha2/doc.go b/bigquery/storage/apiv1alpha2/doc.go
index 9bb0724..abe6946 100644
--- a/bigquery/storage/apiv1alpha2/doc.go
+++ b/bigquery/storage/apiv1alpha2/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/bigquery/storage/apiv1beta1/big_query_storage_client.go b/bigquery/storage/apiv1beta1/big_query_storage_client.go
index a243f4a..070cc7f 100644
--- a/bigquery/storage/apiv1beta1/big_query_storage_client.go
+++ b/bigquery/storage/apiv1beta1/big_query_storage_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
storagepb "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -119,8 +119,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type BigQueryStorageClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
bigQueryStorageClient storagepb.BigQueryStorageClient
@@ -138,30 +138,32 @@
//
// The BigQuery storage API can be used to read data stored in BigQuery.
func NewBigQueryStorageClient(ctx context.Context, opts ...option.ClientOption) (*BigQueryStorageClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultBigQueryStorageClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultBigQueryStorageClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &BigQueryStorageClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultBigQueryStorageCallOptions(),
- bigQueryStorageClient: storagepb.NewBigQueryStorageClient(conn),
+ bigQueryStorageClient: storagepb.NewBigQueryStorageClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *BigQueryStorageClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *BigQueryStorageClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/bigquery/storage/apiv1beta1/doc.go b/bigquery/storage/apiv1beta1/doc.go
index 548474d..c8cd9f5 100644
--- a/bigquery/storage/apiv1beta1/doc.go
+++ b/bigquery/storage/apiv1beta1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/bigquery/storage/apiv1beta2/big_query_read_client.go b/bigquery/storage/apiv1beta2/big_query_read_client.go
index 2bbd840..7aeef76 100644
--- a/bigquery/storage/apiv1beta2/big_query_read_client.go
+++ b/bigquery/storage/apiv1beta2/big_query_read_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
storagepb "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -93,8 +93,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type BigQueryReadClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
bigQueryReadClient storagepb.BigQueryReadClient
@@ -112,30 +112,32 @@
//
// The Read API can be used to read data from BigQuery.
func NewBigQueryReadClient(ctx context.Context, opts ...option.ClientOption) (*BigQueryReadClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultBigQueryReadClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultBigQueryReadClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &BigQueryReadClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultBigQueryReadCallOptions(),
- bigQueryReadClient: storagepb.NewBigQueryReadClient(conn),
+ bigQueryReadClient: storagepb.NewBigQueryReadClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *BigQueryReadClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *BigQueryReadClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/bigquery/storage/apiv1beta2/doc.go b/bigquery/storage/apiv1beta2/doc.go
index 05a1661..e2423d2 100644
--- a/bigquery/storage/apiv1beta2/doc.go
+++ b/bigquery/storage/apiv1beta2/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/bigtable/go.mod b/bigtable/go.mod
index 6ba83b4..d63f087 100644
--- a/bigtable/go.mod
+++ b/bigtable/go.mod
@@ -10,14 +10,15 @@
github.com/google/go-cmp v0.4.0
github.com/googleapis/gax-go/v2 v2.0.5
go.opencensus.io v0.22.3 // indirect
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
golang.org/x/lint v0.0.0-20200130185559-910be7a94367 // indirect
golang.org/x/mod v0.2.0 // indirect
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
- golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 // indirect
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 // indirect
google.golang.org/api v0.17.0
- google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
rsc.io/binaryregexp v0.2.0
)
diff --git a/bigtable/go.sum b/bigtable/go.sum
index 076b5b3..ac358f1 100644
--- a/bigtable/go.sum
+++ b/bigtable/go.sum
@@ -118,6 +118,8 @@
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -230,8 +232,9 @@
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a h1:7YaEqUc1tUg0yDwvdX+3U5bwrBg7u3FFAZ5D8gUs4/c=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 h1:KW20qMcLRWuIgjdCpHFJbVZA7zsDKtFXPNcm7/eI5ZA=
-golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -275,8 +278,8 @@
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150 h1:VPpdpQkGvFicX9yo4G5oxZPi9ALBnEOZblPSa/Wa2m4=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
-google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90 h1:7THRSvPuzF1bql5kyFzX0JM0vpGhwuhskgJrJsbZ80Y=
-google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
diff --git a/cloudbuild/apiv1/v2/cloud_build_client.go b/cloudbuild/apiv1/v2/cloud_build_client.go
index 9a1f3c8..b73afa2 100644
--- a/cloudbuild/apiv1/v2/cloud_build_client.go
+++ b/cloudbuild/apiv1/v2/cloud_build_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
cloudbuildpb "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -145,8 +145,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client cloudbuildpb.CloudBuildClient
@@ -174,40 +174,42 @@
// A user can list previously-requested builds or get builds by their ID to
// determine the status of the build.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: cloudbuildpb.NewCloudBuildClient(conn),
+ client: cloudbuildpb.NewCloudBuildClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/cloudbuild/apiv1/v2/doc.go b/cloudbuild/apiv1/v2/doc.go
index 3f804be..9bee473 100644
--- a/cloudbuild/apiv1/v2/doc.go
+++ b/cloudbuild/apiv1/v2/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/cloudtasks/apiv2/cloud_tasks_client.go b/cloudtasks/apiv2/cloud_tasks_client.go
index 5f1e228..9a0d29f 100644
--- a/cloudtasks/apiv2/cloud_tasks_client.go
+++ b/cloudtasks/apiv2/cloud_tasks_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2"
iampb "google.golang.org/genproto/googleapis/iam/v1"
"google.golang.org/grpc"
@@ -178,8 +178,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client taskspb.CloudTasksClient
@@ -196,30 +196,32 @@
// Cloud Tasks allows developers to manage the execution of background
// work in their applications.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: taskspb.NewCloudTasksClient(conn),
+ client: taskspb.NewCloudTasksClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/cloudtasks/apiv2/doc.go b/cloudtasks/apiv2/doc.go
index b86738e..7c9e4b4 100644
--- a/cloudtasks/apiv2/doc.go
+++ b/cloudtasks/apiv2/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/cloudtasks/apiv2beta2/cloud_tasks_client.go b/cloudtasks/apiv2beta2/cloud_tasks_client.go
index 6314be3..74c916a 100644
--- a/cloudtasks/apiv2beta2/cloud_tasks_client.go
+++ b/cloudtasks/apiv2beta2/cloud_tasks_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2"
iampb "google.golang.org/genproto/googleapis/iam/v1"
"google.golang.org/grpc"
@@ -186,8 +186,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client taskspb.CloudTasksClient
@@ -204,30 +204,32 @@
// Cloud Tasks allows developers to manage the execution of background
// work in their applications.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: taskspb.NewCloudTasksClient(conn),
+ client: taskspb.NewCloudTasksClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/cloudtasks/apiv2beta2/doc.go b/cloudtasks/apiv2beta2/doc.go
index 12a6587..02569d5 100644
--- a/cloudtasks/apiv2beta2/doc.go
+++ b/cloudtasks/apiv2beta2/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/cloudtasks/apiv2beta3/cloud_tasks_client.go b/cloudtasks/apiv2beta3/cloud_tasks_client.go
index 8c16dee..244af26 100644
--- a/cloudtasks/apiv2beta3/cloud_tasks_client.go
+++ b/cloudtasks/apiv2beta3/cloud_tasks_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
taskspb "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3"
iampb "google.golang.org/genproto/googleapis/iam/v1"
"google.golang.org/grpc"
@@ -178,8 +178,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client taskspb.CloudTasksClient
@@ -196,30 +196,32 @@
// Cloud Tasks allows developers to manage the execution of background
// work in their applications.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: taskspb.NewCloudTasksClient(conn),
+ client: taskspb.NewCloudTasksClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/cloudtasks/apiv2beta3/doc.go b/cloudtasks/apiv2beta3/doc.go
index 3915d0d..f91ac2e 100644
--- a/cloudtasks/apiv2beta3/doc.go
+++ b/cloudtasks/apiv2beta3/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go b/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go
index 8a3e24d..8581d0d 100644
--- a/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go
+++ b/containeranalysis/apiv1beta1/container_analysis_v1_beta1_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
containeranalysispb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
"google.golang.org/grpc"
@@ -92,8 +92,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ContainerAnalysisV1Beta1Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
containerAnalysisV1Beta1Client containeranalysispb.ContainerAnalysisV1Beta1Client
@@ -121,30 +121,32 @@
// there would be one note for the vulnerability and an occurrence for each
// image with the vulnerability referring to that note.
func NewContainerAnalysisV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*ContainerAnalysisV1Beta1Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultContainerAnalysisV1Beta1ClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultContainerAnalysisV1Beta1ClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ContainerAnalysisV1Beta1Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultContainerAnalysisV1Beta1CallOptions(),
- containerAnalysisV1Beta1Client: containeranalysispb.NewContainerAnalysisV1Beta1Client(conn),
+ containerAnalysisV1Beta1Client: containeranalysispb.NewContainerAnalysisV1Beta1Client(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ContainerAnalysisV1Beta1Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ContainerAnalysisV1Beta1Client) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/containeranalysis/apiv1beta1/doc.go b/containeranalysis/apiv1beta1/doc.go
index fd88fc6..8efdd71 100644
--- a/containeranalysis/apiv1beta1/doc.go
+++ b/containeranalysis/apiv1beta1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go b/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go
index b0f9cc9..48206e6 100644
--- a/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go
+++ b/containeranalysis/apiv1beta1/grafeas_v1_beta1_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -186,8 +186,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type GrafeasV1Beta1Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
grafeasV1Beta1Client grafeaspb.GrafeasV1Beta1Client
@@ -216,30 +216,32 @@
// there would be one note for the vulnerability and an occurrence for each
// image with the vulnerability referring to that note.
func NewGrafeasV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*GrafeasV1Beta1Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultGrafeasV1Beta1ClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultGrafeasV1Beta1ClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &GrafeasV1Beta1Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultGrafeasV1Beta1CallOptions(),
- grafeasV1Beta1Client: grafeaspb.NewGrafeasV1Beta1Client(conn),
+ grafeasV1Beta1Client: grafeaspb.NewGrafeasV1Beta1Client(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *GrafeasV1Beta1Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *GrafeasV1Beta1Client) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/datacatalog/apiv1beta1/data_catalog_client.go b/datacatalog/apiv1beta1/data_catalog_client.go
index 641706a..398ebf7 100644
--- a/datacatalog/apiv1beta1/data_catalog_client.go
+++ b/datacatalog/apiv1beta1/data_catalog_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
"google.golang.org/grpc"
@@ -39,13 +39,16 @@
type CallOptions struct {
SearchCatalog []gax.CallOption
CreateEntryGroup []gax.CallOption
+ UpdateEntryGroup []gax.CallOption
GetEntryGroup []gax.CallOption
DeleteEntryGroup []gax.CallOption
+ ListEntryGroups []gax.CallOption
CreateEntry []gax.CallOption
UpdateEntry []gax.CallOption
DeleteEntry []gax.CallOption
GetEntry []gax.CallOption
LookupEntry []gax.CallOption
+ ListEntries []gax.CallOption
CreateTagTemplate []gax.CallOption
GetTagTemplate []gax.CallOption
UpdateTagTemplate []gax.CallOption
@@ -77,6 +80,7 @@
return &CallOptions{
SearchCatalog: []gax.CallOption{},
CreateEntryGroup: []gax.CallOption{},
+ UpdateEntryGroup: []gax.CallOption{},
GetEntryGroup: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
@@ -101,8 +105,9 @@
})
}),
},
- CreateEntry: []gax.CallOption{},
- UpdateEntry: []gax.CallOption{},
+ ListEntryGroups: []gax.CallOption{},
+ CreateEntry: []gax.CallOption{},
+ UpdateEntry: []gax.CallOption{},
DeleteEntry: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
return gax.OnCodes([]codes.Code{
@@ -139,6 +144,7 @@
})
}),
},
+ ListEntries: []gax.CallOption{},
CreateTagTemplate: []gax.CallOption{},
GetTagTemplate: []gax.CallOption{
gax.WithRetry(func() gax.Retryer {
@@ -216,8 +222,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client datacatalogpb.DataCatalogClient
@@ -234,30 +240,32 @@
// Data Catalog API service allows clients to discover, understand, and manage
// their data.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: datacatalogpb.NewDataCatalogClient(conn),
+ client: datacatalogpb.NewDataCatalogClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
@@ -277,10 +285,10 @@
// the complete resource, only the resource identifier and high level
// fields. Clients can subsequentally call Get methods.
//
-// Note that searches do not have full recall. There may be results that match
-// your query but are not returned, even in subsequent pages of results. These
-// missing results may vary across repeated calls to search. Do not rely on
-// this method if you need to guarantee full recall.
+// Note that Data Catalog search queries do not guarantee full recall. Query
+// results that match your query may not be returned, even in subsequent
+// result pages. Also note that results returned (and not returned) can vary
+// across repeated search queries.
//
// See Data Catalog Search
// Syntax (at /data-catalog/docs/how-to/search-reference) for more information.
@@ -323,9 +331,22 @@
return it
}
-// CreateEntryGroup alpha feature.
-// Creates an EntryGroup.
-// The user should enable the Data Catalog API in the project identified by
+// CreateEntryGroup creates an EntryGroup.
+//
+// An entry group contains logically related entries together with Cloud
+// Identity and Access Management policies that specify the users who can
+// create, edit, and view entries within the entry group.
+//
+// Data Catalog automatically creates an entry group for BigQuery entries
+// (“@bigquery”) and Pub/Sub topics ("@pubsub"). Users create their own entry
+// group to contain Cloud Storage fileset entries or custom type entries,
+// and the IAM policies associated with those entries. Entry groups, like
+// entries, can be searched.
+//
+// A maximum of 10,000 entry groups may be created per organization across all
+// locations.
+//
+// Users should enable the Data Catalog API in the project identified by
// the parent parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
func (c *Client) CreateEntryGroup(ctx context.Context, req *datacatalogpb.CreateEntryGroupRequest, opts ...gax.CallOption) (*datacatalogpb.EntryGroup, error) {
@@ -344,8 +365,27 @@
return resp, nil
}
-// GetEntryGroup alpha feature.
-// Gets an EntryGroup.
+// UpdateEntryGroup updates an EntryGroup. The user should enable the Data Catalog API in the
+// project identified by the entry_group.name parameter (see [Data Catalog
+// Resource Project] (/data-catalog/docs/concepts/resource-project) for more
+// information).
+func (c *Client) UpdateEntryGroup(ctx context.Context, req *datacatalogpb.UpdateEntryGroupRequest, opts ...gax.CallOption) (*datacatalogpb.EntryGroup, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "entry_group.name", url.QueryEscape(req.GetEntryGroup().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateEntryGroup[0:len(c.CallOptions.UpdateEntryGroup):len(c.CallOptions.UpdateEntryGroup)], opts...)
+ var resp *datacatalogpb.EntryGroup
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.UpdateEntryGroup(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetEntryGroup gets an EntryGroup.
func (c *Client) GetEntryGroup(ctx context.Context, req *datacatalogpb.GetEntryGroupRequest, opts ...gax.CallOption) (*datacatalogpb.EntryGroup, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName())))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -362,9 +402,8 @@
return resp, nil
}
-// DeleteEntryGroup alpha feature.
-// Deletes an EntryGroup. Only entry groups that do not contain entries can be
-// deleted. The user should enable the Data Catalog API in the project
+// DeleteEntryGroup deletes an EntryGroup. Only entry groups that do not contain entries can be
+// deleted. Users should enable the Data Catalog API in the project
// identified by the name parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
func (c *Client) DeleteEntryGroup(ctx context.Context, req *datacatalogpb.DeleteEntryGroupRequest, opts ...gax.CallOption) error {
@@ -379,11 +418,55 @@
return err
}
-// CreateEntry alpha feature.
-// Creates an entry. Currently only entries of ‘FILESET’ type can be created.
-// The user should enable the Data Catalog API in the project identified by
+// ListEntryGroups lists entry groups.
+func (c *Client) ListEntryGroups(ctx context.Context, req *datacatalogpb.ListEntryGroupsRequest, opts ...gax.CallOption) *EntryGroupIterator {
+ 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.ListEntryGroups[0:len(c.CallOptions.ListEntryGroups):len(c.CallOptions.ListEntryGroups)], opts...)
+ it := &EntryGroupIterator{}
+ req = proto.Clone(req).(*datacatalogpb.ListEntryGroupsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*datacatalogpb.EntryGroup, string, error) {
+ var resp *datacatalogpb.ListEntryGroupsResponse
+ 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.ListEntryGroups(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.EntryGroups, 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
+}
+
+// CreateEntry creates an entry. Only entries of ‘FILESET’ type or user-specified type can
+// be created.
+//
+// Users should enable the Data Catalog API in the project identified by
// the parent parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
+//
+// A maximum of 100,000 entries may be created per entry group.
func (c *Client) CreateEntry(ctx context.Context, req *datacatalogpb.CreateEntryRequest, opts ...gax.CallOption) (*datacatalogpb.Entry, error) {
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent())))
ctx = insertMetadata(ctx, c.xGoogMetadata, md)
@@ -401,7 +484,7 @@
}
// UpdateEntry updates an existing entry.
-// The user should enable the Data Catalog API in the project identified by
+// Users should enable the Data Catalog API in the project identified by
// the entry.name parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
func (c *Client) UpdateEntry(ctx context.Context, req *datacatalogpb.UpdateEntryRequest, opts ...gax.CallOption) (*datacatalogpb.Entry, error) {
@@ -420,11 +503,10 @@
return resp, nil
}
-// DeleteEntry alpha feature.
-// Deletes an existing entry. Only entries created through
+// DeleteEntry deletes an existing entry. Only entries created through
// [CreateEntry][google.cloud.datacatalog.v1beta1.DataCatalog.CreateEntry]
// method can be deleted.
-// The user should enable the Data Catalog API in the project identified by
+// Users should enable the Data Catalog API in the project identified by
// the name parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
func (c *Client) DeleteEntry(ctx context.Context, req *datacatalogpb.DeleteEntryRequest, opts ...gax.CallOption) error {
@@ -474,6 +556,47 @@
return resp, nil
}
+// ListEntries lists entries.
+func (c *Client) ListEntries(ctx context.Context, req *datacatalogpb.ListEntriesRequest, opts ...gax.CallOption) *EntryIterator {
+ 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.ListEntries[0:len(c.CallOptions.ListEntries):len(c.CallOptions.ListEntries)], opts...)
+ it := &EntryIterator{}
+ req = proto.Clone(req).(*datacatalogpb.ListEntriesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*datacatalogpb.Entry, string, error) {
+ var resp *datacatalogpb.ListEntriesResponse
+ 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.ListEntries(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.Entries, 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
+}
+
// CreateTagTemplate creates a tag template. The user should enable the Data Catalog API in
// the project identified by the parent parameter (see Data Catalog
// Resource Project (at /data-catalog/docs/concepts/resource-project) for more
@@ -514,7 +637,7 @@
// UpdateTagTemplate updates a tag template. This method cannot be used to update the fields of
// a template. The tag template fields are represented as separate resources
// and should be updated using their own create/update/delete methods.
-// The user should enable the Data Catalog API in the project identified by
+// Users should enable the Data Catalog API in the project identified by
// the tag_template.name parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
func (c *Client) UpdateTagTemplate(ctx context.Context, req *datacatalogpb.UpdateTagTemplateRequest, opts ...gax.CallOption) (*datacatalogpb.TagTemplate, error) {
@@ -534,7 +657,7 @@
}
// DeleteTagTemplate deletes a tag template and all tags using the template.
-// The user should enable the Data Catalog API in the project identified by
+// Users should enable the Data Catalog API in the project identified by
// the name parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
func (c *Client) DeleteTagTemplate(ctx context.Context, req *datacatalogpb.DeleteTagTemplateRequest, opts ...gax.CallOption) error {
@@ -571,7 +694,7 @@
}
// UpdateTagTemplateField updates a field in a tag template. This method cannot be used to update the
-// field type. The user should enable the Data Catalog API in the project
+// field type. Users should enable the Data Catalog API in the project
// identified by the name parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
func (c *Client) UpdateTagTemplateField(ctx context.Context, req *datacatalogpb.UpdateTagTemplateFieldRequest, opts ...gax.CallOption) (*datacatalogpb.TagTemplateField, error) {
@@ -611,7 +734,7 @@
}
// DeleteTagTemplateField deletes a field in a tag template and all uses of that field.
-// The user should enable the Data Catalog API in the project identified by
+// Users should enable the Data Catalog API in the project identified by
// the name parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
func (c *Client) DeleteTagTemplateField(ctx context.Context, req *datacatalogpb.DeleteTagTemplateFieldRequest, opts ...gax.CallOption) error {
@@ -829,6 +952,100 @@
return resp, nil
}
+// EntryGroupIterator manages a stream of *datacatalogpb.EntryGroup.
+type EntryGroupIterator struct {
+ items []*datacatalogpb.EntryGroup
+ 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 []*datacatalogpb.EntryGroup, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *EntryGroupIterator) 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 *EntryGroupIterator) Next() (*datacatalogpb.EntryGroup, error) {
+ var item *datacatalogpb.EntryGroup
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *EntryGroupIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *EntryGroupIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
+// EntryIterator manages a stream of *datacatalogpb.Entry.
+type EntryIterator struct {
+ items []*datacatalogpb.Entry
+ 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 []*datacatalogpb.Entry, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *EntryIterator) 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 *EntryIterator) Next() (*datacatalogpb.Entry, error) {
+ var item *datacatalogpb.Entry
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *EntryIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *EntryIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
// SearchCatalogResultIterator manages a stream of *datacatalogpb.SearchCatalogResult.
type SearchCatalogResultIterator struct {
items []*datacatalogpb.SearchCatalogResult
diff --git a/datacatalog/apiv1beta1/data_catalog_client_example_test.go b/datacatalog/apiv1beta1/data_catalog_client_example_test.go
index 8712539..f3d93b4 100644
--- a/datacatalog/apiv1beta1/data_catalog_client_example_test.go
+++ b/datacatalog/apiv1beta1/data_catalog_client_example_test.go
@@ -82,6 +82,26 @@
_ = resp
}
+func ExampleClient_UpdateEntryGroup() {
+ // import datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
+
+ ctx := context.Background()
+ c, err := datacatalog.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &datacatalogpb.UpdateEntryGroupRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateEntryGroup(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
func ExampleClient_GetEntryGroup() {
// import datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
@@ -118,6 +138,33 @@
}
}
+func ExampleClient_ListEntryGroups() {
+ // import datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := datacatalog.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &datacatalogpb.ListEntryGroupsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListEntryGroups(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
func ExampleClient_CreateEntry() {
// import datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
@@ -214,6 +261,33 @@
_ = resp
}
+func ExampleClient_ListEntries() {
+ // import datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := datacatalog.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &datacatalogpb.ListEntriesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListEntries(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
func ExampleClient_CreateTagTemplate() {
// import datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
diff --git a/datacatalog/apiv1beta1/doc.go b/datacatalog/apiv1beta1/doc.go
index 1178de8..33e10d5 100644
--- a/datacatalog/apiv1beta1/doc.go
+++ b/datacatalog/apiv1beta1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/datacatalog/apiv1beta1/policy_tag_manager_client.go b/datacatalog/apiv1beta1/policy_tag_manager_client.go
index ed3dd08..ba9f205 100644
--- a/datacatalog/apiv1beta1/policy_tag_manager_client.go
+++ b/datacatalog/apiv1beta1/policy_tag_manager_client.go
@@ -26,7 +26,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
"google.golang.org/grpc"
@@ -82,8 +82,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type PolicyTagManagerClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
policyTagManagerClient datacatalogpb.PolicyTagManagerClient
@@ -100,30 +100,32 @@
// The policy tag manager API service allows clients to manage their taxonomies
// and policy tags.
func NewPolicyTagManagerClient(ctx context.Context, opts ...option.ClientOption) (*PolicyTagManagerClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultPolicyTagManagerClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultPolicyTagManagerClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &PolicyTagManagerClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultPolicyTagManagerCallOptions(),
- policyTagManagerClient: datacatalogpb.NewPolicyTagManagerClient(conn),
+ policyTagManagerClient: datacatalogpb.NewPolicyTagManagerClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *PolicyTagManagerClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *PolicyTagManagerClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/datacatalog/apiv1beta1/policy_tag_manager_serialization_client.go b/datacatalog/apiv1beta1/policy_tag_manager_serialization_client.go
index 99d1e17..aae0dd2 100644
--- a/datacatalog/apiv1beta1/policy_tag_manager_serialization_client.go
+++ b/datacatalog/apiv1beta1/policy_tag_manager_serialization_client.go
@@ -24,7 +24,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
datacatalogpb "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -57,8 +57,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type PolicyTagManagerSerializationClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
policyTagManagerSerializationClient datacatalogpb.PolicyTagManagerSerializationClient
@@ -75,30 +75,32 @@
// Policy tag manager serialization API service allows clients to manipulate
// their taxonomies and policy tags data with serialized format.
func NewPolicyTagManagerSerializationClient(ctx context.Context, opts ...option.ClientOption) (*PolicyTagManagerSerializationClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultPolicyTagManagerSerializationClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultPolicyTagManagerSerializationClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &PolicyTagManagerSerializationClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultPolicyTagManagerSerializationCallOptions(),
- policyTagManagerSerializationClient: datacatalogpb.NewPolicyTagManagerSerializationClient(conn),
+ policyTagManagerSerializationClient: datacatalogpb.NewPolicyTagManagerSerializationClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *PolicyTagManagerSerializationClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *PolicyTagManagerSerializationClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dataproc/apiv1/autoscaling_policy_client.go b/dataproc/apiv1/autoscaling_policy_client.go
index fca96f5..c29541a 100644
--- a/dataproc/apiv1/autoscaling_policy_client.go
+++ b/dataproc/apiv1/autoscaling_policy_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -100,8 +100,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type AutoscalingPolicyClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
autoscalingPolicyClient dataprocpb.AutoscalingPolicyServiceClient
@@ -118,30 +118,32 @@
// The API interface for managing autoscaling policies in the
// Dataproc API.
func NewAutoscalingPolicyClient(ctx context.Context, opts ...option.ClientOption) (*AutoscalingPolicyClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultAutoscalingPolicyClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultAutoscalingPolicyClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &AutoscalingPolicyClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultAutoscalingPolicyCallOptions(),
- autoscalingPolicyClient: dataprocpb.NewAutoscalingPolicyServiceClient(conn),
+ autoscalingPolicyClient: dataprocpb.NewAutoscalingPolicyServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *AutoscalingPolicyClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *AutoscalingPolicyClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dataproc/apiv1/cluster_controller_client.go b/dataproc/apiv1/cluster_controller_client.go
index 3c1d0c3..314bf31 100644
--- a/dataproc/apiv1/cluster_controller_client.go
+++ b/dataproc/apiv1/cluster_controller_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -134,8 +134,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ClusterControllerClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
clusterControllerClient dataprocpb.ClusterControllerClient
@@ -157,40 +157,42 @@
// The ClusterControllerService provides methods to manage clusters
// of Compute Engine instances.
func NewClusterControllerClient(ctx context.Context, opts ...option.ClientOption) (*ClusterControllerClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClusterControllerClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClusterControllerClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ClusterControllerClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultClusterControllerCallOptions(),
- clusterControllerClient: dataprocpb.NewClusterControllerClient(conn),
+ clusterControllerClient: dataprocpb.NewClusterControllerClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ClusterControllerClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ClusterControllerClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dataproc/apiv1/doc.go b/dataproc/apiv1/doc.go
index dd7fa75..f2a721e 100644
--- a/dataproc/apiv1/doc.go
+++ b/dataproc/apiv1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/dataproc/apiv1/job_controller_client.go b/dataproc/apiv1/job_controller_client.go
index c964d86..adeeee5 100644
--- a/dataproc/apiv1/job_controller_client.go
+++ b/dataproc/apiv1/job_controller_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -133,8 +133,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type JobControllerClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
jobControllerClient dataprocpb.JobControllerClient
@@ -150,30 +150,32 @@
//
// The JobController provides methods to manage jobs.
func NewJobControllerClient(ctx context.Context, opts ...option.ClientOption) (*JobControllerClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultJobControllerClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultJobControllerClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &JobControllerClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultJobControllerCallOptions(),
- jobControllerClient: dataprocpb.NewJobControllerClient(conn),
+ jobControllerClient: dataprocpb.NewJobControllerClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *JobControllerClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *JobControllerClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dataproc/apiv1/workflow_template_client.go b/dataproc/apiv1/workflow_template_client.go
index 7e3f39c..6a011cc 100644
--- a/dataproc/apiv1/workflow_template_client.go
+++ b/dataproc/apiv1/workflow_template_client.go
@@ -29,7 +29,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -148,8 +148,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type WorkflowTemplateClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
workflowTemplateClient dataprocpb.WorkflowTemplateServiceClient
@@ -171,40 +171,42 @@
// The API interface for managing Workflow Templates in the
// Dataproc API.
func NewWorkflowTemplateClient(ctx context.Context, opts ...option.ClientOption) (*WorkflowTemplateClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultWorkflowTemplateClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultWorkflowTemplateClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &WorkflowTemplateClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultWorkflowTemplateCallOptions(),
- workflowTemplateClient: dataprocpb.NewWorkflowTemplateServiceClient(conn),
+ workflowTemplateClient: dataprocpb.NewWorkflowTemplateServiceClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *WorkflowTemplateClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *WorkflowTemplateClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dataproc/apiv1beta2/autoscaling_policy_client.go b/dataproc/apiv1beta2/autoscaling_policy_client.go
index b97ffe2..1ad474d 100644
--- a/dataproc/apiv1beta2/autoscaling_policy_client.go
+++ b/dataproc/apiv1beta2/autoscaling_policy_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -100,8 +100,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type AutoscalingPolicyClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
autoscalingPolicyClient dataprocpb.AutoscalingPolicyServiceClient
@@ -118,30 +118,32 @@
// The API interface for managing autoscaling policies in the
// Google Cloud Dataproc API.
func NewAutoscalingPolicyClient(ctx context.Context, opts ...option.ClientOption) (*AutoscalingPolicyClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultAutoscalingPolicyClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultAutoscalingPolicyClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &AutoscalingPolicyClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultAutoscalingPolicyCallOptions(),
- autoscalingPolicyClient: dataprocpb.NewAutoscalingPolicyServiceClient(conn),
+ autoscalingPolicyClient: dataprocpb.NewAutoscalingPolicyServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *AutoscalingPolicyClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *AutoscalingPolicyClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dataproc/apiv1beta2/cluster_controller_client.go b/dataproc/apiv1beta2/cluster_controller_client.go
index a334cc9..f0ca9e2 100644
--- a/dataproc/apiv1beta2/cluster_controller_client.go
+++ b/dataproc/apiv1beta2/cluster_controller_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -134,8 +134,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ClusterControllerClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
clusterControllerClient dataprocpb.ClusterControllerClient
@@ -157,40 +157,42 @@
// The ClusterControllerService provides methods to manage clusters
// of Compute Engine instances.
func NewClusterControllerClient(ctx context.Context, opts ...option.ClientOption) (*ClusterControllerClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClusterControllerClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClusterControllerClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ClusterControllerClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultClusterControllerCallOptions(),
- clusterControllerClient: dataprocpb.NewClusterControllerClient(conn),
+ clusterControllerClient: dataprocpb.NewClusterControllerClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ClusterControllerClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ClusterControllerClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dataproc/apiv1beta2/doc.go b/dataproc/apiv1beta2/doc.go
index 3a9f541..41108ee 100644
--- a/dataproc/apiv1beta2/doc.go
+++ b/dataproc/apiv1beta2/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/dataproc/apiv1beta2/job_controller_client.go b/dataproc/apiv1beta2/job_controller_client.go
index 354ee0e..1109fa8 100644
--- a/dataproc/apiv1beta2/job_controller_client.go
+++ b/dataproc/apiv1beta2/job_controller_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -133,8 +133,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type JobControllerClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
jobControllerClient dataprocpb.JobControllerClient
@@ -150,30 +150,32 @@
//
// The JobController provides methods to manage jobs.
func NewJobControllerClient(ctx context.Context, opts ...option.ClientOption) (*JobControllerClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultJobControllerClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultJobControllerClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &JobControllerClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultJobControllerCallOptions(),
- jobControllerClient: dataprocpb.NewJobControllerClient(conn),
+ jobControllerClient: dataprocpb.NewJobControllerClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *JobControllerClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *JobControllerClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dataproc/apiv1beta2/workflow_template_client.go b/dataproc/apiv1beta2/workflow_template_client.go
index b0eedda..8fb4453 100644
--- a/dataproc/apiv1beta2/workflow_template_client.go
+++ b/dataproc/apiv1beta2/workflow_template_client.go
@@ -29,7 +29,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dataprocpb "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -148,8 +148,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type WorkflowTemplateClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
workflowTemplateClient dataprocpb.WorkflowTemplateServiceClient
@@ -171,40 +171,42 @@
// The API interface for managing Workflow Templates in the
// Cloud Dataproc API.
func NewWorkflowTemplateClient(ctx context.Context, opts ...option.ClientOption) (*WorkflowTemplateClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultWorkflowTemplateClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultWorkflowTemplateClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &WorkflowTemplateClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultWorkflowTemplateCallOptions(),
- workflowTemplateClient: dataprocpb.NewWorkflowTemplateServiceClient(conn),
+ workflowTemplateClient: dataprocpb.NewWorkflowTemplateServiceClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *WorkflowTemplateClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *WorkflowTemplateClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/datastore/go.mod b/datastore/go.mod
index 12334ce..9bde30a 100644
--- a/datastore/go.mod
+++ b/datastore/go.mod
@@ -9,12 +9,13 @@
github.com/google/go-cmp v0.4.0
github.com/googleapis/gax-go/v2 v2.0.5
go.opencensus.io v0.22.3 // indirect
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
golang.org/x/lint v0.0.0-20200130185559-910be7a94367 // indirect
golang.org/x/mod v0.2.0 // indirect
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
- golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 // indirect
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 // indirect
google.golang.org/api v0.17.0
- google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
)
diff --git a/datastore/go.sum b/datastore/go.sum
index 3c9f808..557b00f 100644
--- a/datastore/go.sum
+++ b/datastore/go.sum
@@ -115,6 +115,8 @@
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -226,8 +228,9 @@
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a h1:7YaEqUc1tUg0yDwvdX+3U5bwrBg7u3FFAZ5D8gUs4/c=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 h1:KW20qMcLRWuIgjdCpHFJbVZA7zsDKtFXPNcm7/eI5ZA=
-golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -270,8 +273,8 @@
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150 h1:VPpdpQkGvFicX9yo4G5oxZPi9ALBnEOZblPSa/Wa2m4=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
-google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90 h1:7THRSvPuzF1bql5kyFzX0JM0vpGhwuhskgJrJsbZ80Y=
-google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
diff --git a/debugger/apiv2/controller2_client.go b/debugger/apiv2/controller2_client.go
index 19dd502..4770551 100644
--- a/debugger/apiv2/controller2_client.go
+++ b/debugger/apiv2/controller2_client.go
@@ -23,7 +23,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -81,8 +81,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Controller2Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
controller2Client clouddebuggerpb.Controller2Client
@@ -117,30 +117,32 @@
// a completed breakpoint. This functionality is available using the Debugger
// service.
func NewController2Client(ctx context.Context, opts ...option.ClientOption) (*Controller2Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultController2ClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultController2ClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Controller2Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultController2CallOptions(),
- controller2Client: clouddebuggerpb.NewController2Client(conn),
+ controller2Client: clouddebuggerpb.NewController2Client(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Controller2Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *Controller2Client) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/debugger/apiv2/debugger2_client.go b/debugger/apiv2/debugger2_client.go
index c976c54..165302d 100644
--- a/debugger/apiv2/debugger2_client.go
+++ b/debugger/apiv2/debugger2_client.go
@@ -23,7 +23,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
clouddebuggerpb "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -107,8 +107,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Debugger2Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
debugger2Client clouddebuggerpb.Debugger2Client
@@ -135,30 +135,32 @@
// The Debugger service enables the client to set one or more Breakpoints on a
// Debuggee and collect the results of the set Breakpoints.
func NewDebugger2Client(ctx context.Context, opts ...option.ClientOption) (*Debugger2Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultDebugger2ClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultDebugger2ClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Debugger2Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultDebugger2CallOptions(),
- debugger2Client: clouddebuggerpb.NewDebugger2Client(conn),
+ debugger2Client: clouddebuggerpb.NewDebugger2Client(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Debugger2Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *Debugger2Client) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/debugger/apiv2/doc.go b/debugger/apiv2/doc.go
index 2bbfefb..45f36f2 100644
--- a/debugger/apiv2/doc.go
+++ b/debugger/apiv2/doc.go
@@ -41,7 +41,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/dialogflow/apiv2/agents_client.go b/dialogflow/apiv2/agents_client.go
index cf5cdef..08e4dbc 100644
--- a/dialogflow/apiv2/agents_client.go
+++ b/dialogflow/apiv2/agents_client.go
@@ -30,7 +30,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -154,8 +154,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type AgentsClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
agentsClient dialogflowpb.AgentsClient
@@ -203,40 +203,42 @@
// Dialogflow
// documentation (at https://cloud.google.com/dialogflow/docs/agents-overview).
func NewAgentsClient(ctx context.Context, opts ...option.ClientOption) (*AgentsClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultAgentsClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultAgentsClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &AgentsClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultAgentsCallOptions(),
- agentsClient: dialogflowpb.NewAgentsClient(conn),
+ agentsClient: dialogflowpb.NewAgentsClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *AgentsClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *AgentsClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dialogflow/apiv2/contexts_client.go b/dialogflow/apiv2/contexts_client.go
index ef7027c..516c5e0 100644
--- a/dialogflow/apiv2/contexts_client.go
+++ b/dialogflow/apiv2/contexts_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -113,8 +113,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ContextsClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
contextsClient dialogflowpb.ContextsClient
@@ -147,30 +147,32 @@
// Dialogflow
// documentation (at https://cloud.google.com/dialogflow/docs/contexts-overview).
func NewContextsClient(ctx context.Context, opts ...option.ClientOption) (*ContextsClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultContextsClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultContextsClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ContextsClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultContextsCallOptions(),
- contextsClient: dialogflowpb.NewContextsClient(conn),
+ contextsClient: dialogflowpb.NewContextsClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ContextsClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ContextsClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dialogflow/apiv2/doc.go b/dialogflow/apiv2/doc.go
index 74e512e..0dc3dd1 100644
--- a/dialogflow/apiv2/doc.go
+++ b/dialogflow/apiv2/doc.go
@@ -41,7 +41,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/dialogflow/apiv2/entity_types_client.go b/dialogflow/apiv2/entity_types_client.go
index 75413fb..af573b4 100644
--- a/dialogflow/apiv2/entity_types_client.go
+++ b/dialogflow/apiv2/entity_types_client.go
@@ -30,7 +30,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -136,8 +136,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type EntityTypesClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
entityTypesClient dialogflowpb.EntityTypesClient
@@ -185,40 +185,42 @@
// Dialogflow
// documentation (at https://cloud.google.com/dialogflow/docs/entities-overview).
func NewEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*EntityTypesClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultEntityTypesClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultEntityTypesClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &EntityTypesClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultEntityTypesCallOptions(),
- entityTypesClient: dialogflowpb.NewEntityTypesClient(conn),
+ entityTypesClient: dialogflowpb.NewEntityTypesClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *EntityTypesClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *EntityTypesClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dialogflow/apiv2/intents_client.go b/dialogflow/apiv2/intents_client.go
index c7efc01..217a0f4 100644
--- a/dialogflow/apiv2/intents_client.go
+++ b/dialogflow/apiv2/intents_client.go
@@ -30,7 +30,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -119,8 +119,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type IntentsClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
intentsClient dialogflowpb.IntentsClient
@@ -172,40 +172,42 @@
// Dialogflow
// documentation (at https://cloud.google.com/dialogflow/docs/intents-overview).
func NewIntentsClient(ctx context.Context, opts ...option.ClientOption) (*IntentsClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultIntentsClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultIntentsClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &IntentsClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultIntentsCallOptions(),
- intentsClient: dialogflowpb.NewIntentsClient(conn),
+ intentsClient: dialogflowpb.NewIntentsClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *IntentsClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *IntentsClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dialogflow/apiv2/session_entity_types_client.go b/dialogflow/apiv2/session_entity_types_client.go
index 8181cdc..98ebb7b 100644
--- a/dialogflow/apiv2/session_entity_types_client.go
+++ b/dialogflow/apiv2/session_entity_types_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -100,8 +100,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type SessionEntityTypesClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
sessionEntityTypesClient dialogflowpb.SessionEntityTypesClient
@@ -133,30 +133,32 @@
// Dialogflow
// documentation (at https://cloud.google.com/dialogflow/docs/entities-overview).
func NewSessionEntityTypesClient(ctx context.Context, opts ...option.ClientOption) (*SessionEntityTypesClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultSessionEntityTypesClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultSessionEntityTypesClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &SessionEntityTypesClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultSessionEntityTypesCallOptions(),
- sessionEntityTypesClient: dialogflowpb.NewSessionEntityTypesClient(conn),
+ sessionEntityTypesClient: dialogflowpb.NewSessionEntityTypesClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *SessionEntityTypesClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *SessionEntityTypesClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dialogflow/apiv2/sessions_client.go b/dialogflow/apiv2/sessions_client.go
index 2c53bc1..5c3cd84 100644
--- a/dialogflow/apiv2/sessions_client.go
+++ b/dialogflow/apiv2/sessions_client.go
@@ -24,7 +24,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -57,8 +57,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type SessionsClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
sessionsClient dialogflowpb.SessionsClient
@@ -77,30 +77,32 @@
// [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent]) method to determine
// user intent and respond.
func NewSessionsClient(ctx context.Context, opts ...option.ClientOption) (*SessionsClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultSessionsClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultSessionsClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &SessionsClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultSessionsCallOptions(),
- sessionsClient: dialogflowpb.NewSessionsClient(conn),
+ sessionsClient: dialogflowpb.NewSessionsClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *SessionsClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *SessionsClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dlp/apiv2/dlp_client.go b/dlp/apiv2/dlp_client.go
index 88a73c6..d301b19 100644
--- a/dlp/apiv2/dlp_client.go
+++ b/dlp/apiv2/dlp_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
dlppb "google.golang.org/genproto/googleapis/privacy/dlp/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -339,8 +339,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client dlppb.DlpServiceClient
@@ -364,30 +364,32 @@
// To learn more about concepts and find how-to guides see
// https://cloud.google.com/dlp/docs/ (at https://cloud.google.com/dlp/docs/).
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: dlppb.NewDlpServiceClient(conn),
+ client: dlppb.NewDlpServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/dlp/apiv2/doc.go b/dlp/apiv2/doc.go
index 164703e..6c3dc78 100644
--- a/dlp/apiv2/doc.go
+++ b/dlp/apiv2/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/errorreporting/apiv1beta1/doc.go b/errorreporting/apiv1beta1/doc.go
index fddb3eb..cf6b647 100644
--- a/errorreporting/apiv1beta1/doc.go
+++ b/errorreporting/apiv1beta1/doc.go
@@ -44,7 +44,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/errorreporting/apiv1beta1/error_group_client.go b/errorreporting/apiv1beta1/error_group_client.go
index 543477d..d01041f 100644
--- a/errorreporting/apiv1beta1/error_group_client.go
+++ b/errorreporting/apiv1beta1/error_group_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -81,8 +81,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ErrorGroupClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
errorGroupClient clouderrorreportingpb.ErrorGroupServiceClient
@@ -98,30 +98,32 @@
//
// Service for retrieving and updating individual error groups.
func NewErrorGroupClient(ctx context.Context, opts ...option.ClientOption) (*ErrorGroupClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultErrorGroupClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultErrorGroupClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ErrorGroupClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultErrorGroupCallOptions(),
- errorGroupClient: clouderrorreportingpb.NewErrorGroupServiceClient(conn),
+ errorGroupClient: clouderrorreportingpb.NewErrorGroupServiceClient(connPool),
}
c.SetGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ErrorGroupClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ErrorGroupClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/errorreporting/apiv1beta1/error_stats_client.go b/errorreporting/apiv1beta1/error_stats_client.go
index 77fe607..bb0e4b1 100644
--- a/errorreporting/apiv1beta1/error_stats_client.go
+++ b/errorreporting/apiv1beta1/error_stats_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -96,8 +96,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ErrorStatsClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
errorStatsClient clouderrorreportingpb.ErrorStatsServiceClient
@@ -114,30 +114,32 @@
// An API for retrieving and managing error statistics as well as data for
// individual events.
func NewErrorStatsClient(ctx context.Context, opts ...option.ClientOption) (*ErrorStatsClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultErrorStatsClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultErrorStatsClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ErrorStatsClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultErrorStatsCallOptions(),
- errorStatsClient: clouderrorreportingpb.NewErrorStatsServiceClient(conn),
+ errorStatsClient: clouderrorreportingpb.NewErrorStatsServiceClient(connPool),
}
c.SetGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ErrorStatsClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ErrorStatsClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/errorreporting/apiv1beta1/report_errors_client.go b/errorreporting/apiv1beta1/report_errors_client.go
index 28bdf8a..636cf82 100644
--- a/errorreporting/apiv1beta1/report_errors_client.go
+++ b/errorreporting/apiv1beta1/report_errors_client.go
@@ -24,7 +24,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
clouderrorreportingpb "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -55,8 +55,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ReportErrorsClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
reportErrorsClient clouderrorreportingpb.ReportErrorsServiceClient
@@ -72,30 +72,32 @@
//
// An API for reporting error events.
func NewReportErrorsClient(ctx context.Context, opts ...option.ClientOption) (*ReportErrorsClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultReportErrorsClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultReportErrorsClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ReportErrorsClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultReportErrorsCallOptions(),
- reportErrorsClient: clouderrorreportingpb.NewReportErrorsServiceClient(conn),
+ reportErrorsClient: clouderrorreportingpb.NewReportErrorsServiceClient(connPool),
}
c.SetGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ReportErrorsClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ReportErrorsClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/expr/apiv1alpha1/cel_client.go b/expr/apiv1alpha1/cel_client.go
index aa1fd6f..17a0445 100644
--- a/expr/apiv1alpha1/cel_client.go
+++ b/expr/apiv1alpha1/cel_client.go
@@ -22,7 +22,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -57,8 +57,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type CelClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
celClient exprpb.CelServiceClient
@@ -78,30 +78,32 @@
// a server for this API. The API will be used for conformance testing,
// utilities, and execution as a service.
func NewCelClient(ctx context.Context, opts ...option.ClientOption) (*CelClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultCelClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultCelClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &CelClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCelCallOptions(),
- celClient: exprpb.NewCelServiceClient(conn),
+ celClient: exprpb.NewCelServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *CelClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *CelClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/expr/apiv1alpha1/conformance_client.go b/expr/apiv1alpha1/conformance_client.go
index 748bd51..3cd1969 100644
--- a/expr/apiv1alpha1/conformance_client.go
+++ b/expr/apiv1alpha1/conformance_client.go
@@ -22,7 +22,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -57,8 +57,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ConformanceClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
conformanceClient exprpb.ConformanceServiceClient
@@ -78,30 +78,32 @@
// a server for this API. The API will be used for conformance testing
// and other utilities.
func NewConformanceClient(ctx context.Context, opts ...option.ClientOption) (*ConformanceClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultConformanceClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultConformanceClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ConformanceClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultConformanceCallOptions(),
- conformanceClient: exprpb.NewConformanceServiceClient(conn),
+ conformanceClient: exprpb.NewConformanceServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ConformanceClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ConformanceClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/expr/apiv1alpha1/doc.go b/expr/apiv1alpha1/doc.go
index 5923bc9..c72ae2e 100644
--- a/expr/apiv1alpha1/doc.go
+++ b/expr/apiv1alpha1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/firestore/apiv1/admin/doc.go b/firestore/apiv1/admin/doc.go
index 082fdc6..a646398 100644
--- a/firestore/apiv1/admin/doc.go
+++ b/firestore/apiv1/admin/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/firestore/apiv1/admin/firestore_admin_client.go b/firestore/apiv1/admin/firestore_admin_client.go
index d3afb9e..9cd9712 100644
--- a/firestore/apiv1/admin/firestore_admin_client.go
+++ b/firestore/apiv1/admin/firestore_admin_client.go
@@ -29,7 +29,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
adminpb "google.golang.org/genproto/googleapis/firestore/admin/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -138,8 +138,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type FirestoreAdminClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
firestoreAdminClient adminpb.FirestoreAdminClient
@@ -161,40 +161,42 @@
// Operations are created by service FirestoreAdmin, but are accessed via
// service google.longrunning.Operations.
func NewFirestoreAdminClient(ctx context.Context, opts ...option.ClientOption) (*FirestoreAdminClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultFirestoreAdminClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultFirestoreAdminClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &FirestoreAdminClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultFirestoreAdminCallOptions(),
- firestoreAdminClient: adminpb.NewFirestoreAdminClient(conn),
+ firestoreAdminClient: adminpb.NewFirestoreAdminClient(connPool),
}
c.SetGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *FirestoreAdminClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *FirestoreAdminClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/firestore/apiv1/doc.go b/firestore/apiv1/doc.go
index 92050b9..44579a1 100644
--- a/firestore/apiv1/doc.go
+++ b/firestore/apiv1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/firestore/apiv1/firestore_client.go b/firestore/apiv1/firestore_client.go
index c1bc253..477e01e 100644
--- a/firestore/apiv1/firestore_client.go
+++ b/firestore/apiv1/firestore_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
firestorepb "google.golang.org/genproto/googleapis/firestore/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -191,8 +191,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client firestorepb.FirestoreClient
@@ -215,30 +215,32 @@
// integrations with Firebase and Google Cloud Platform (GCP) accelerate
// building truly serverless apps.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: firestorepb.NewFirestoreClient(conn),
+ client: firestorepb.NewFirestoreClient(connPool),
}
c.SetGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/firestore/apiv1beta1/doc.go b/firestore/apiv1beta1/doc.go
index 191958a..d1d0c35 100644
--- a/firestore/apiv1beta1/doc.go
+++ b/firestore/apiv1beta1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/firestore/apiv1beta1/firestore_client.go b/firestore/apiv1beta1/firestore_client.go
index 378285b..95cbbd1 100644
--- a/firestore/apiv1beta1/firestore_client.go
+++ b/firestore/apiv1beta1/firestore_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
firestorepb "google.golang.org/genproto/googleapis/firestore/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -182,8 +182,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client firestorepb.FirestoreClient
@@ -217,30 +217,32 @@
// committed. Any read with an equal or greater read_time is guaranteed
// to see the effects of the transaction.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: firestorepb.NewFirestoreClient(conn),
+ client: firestorepb.NewFirestoreClient(connPool),
}
c.SetGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/firestore/go.mod b/firestore/go.mod
index f0a605d..ed0d873 100644
--- a/firestore/go.mod
+++ b/firestore/go.mod
@@ -8,8 +8,9 @@
github.com/golang/protobuf v1.3.3
github.com/google/go-cmp v0.4.0
github.com/googleapis/gax-go/v2 v2.0.5
- golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e // indirect
- google.golang.org/api v0.16.0
- google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 // indirect
+ google.golang.org/api v0.17.0
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
)
diff --git a/firestore/go.sum b/firestore/go.sum
index a86aea2..b601b8d 100644
--- a/firestore/go.sum
+++ b/firestore/go.sum
@@ -117,6 +117,8 @@
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -231,8 +233,9 @@
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 h1:KW20qMcLRWuIgjdCpHFJbVZA7zsDKtFXPNcm7/eI5ZA=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e h1:JdEzLb04S2BEPrWqUDsgo7JXSq8pQlzIHbrBQN5o7TY=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -246,8 +249,8 @@
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0 h1:yzlyyDW/J0w8yNFJIhiAJy4kq74S+1DOLdawELNxFMA=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
-google.golang.org/api v0.16.0 h1:hhRbpE9nkabqMxGCewz2sikMYxm8yYWov7h2Eo4j3Is=
-google.golang.org/api v0.16.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.17.0 h1:0q95w+VuFtv4PAx4PZVQdBMmYbaCHbnfKaEiDIcVyag=
+google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -276,8 +279,8 @@
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90 h1:7THRSvPuzF1bql5kyFzX0JM0vpGhwuhskgJrJsbZ80Y=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 h1:MBO9fkVSrTpJ8vgHLPi5gb+ZWXEy7/auJN8yqyu9EiE=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
diff --git a/go.mod b/go.mod
index 311a9ce..b916669 100644
--- a/go.mod
+++ b/go.mod
@@ -16,16 +16,16 @@
github.com/googleapis/gax-go/v2 v2.0.5
github.com/jstemmer/go-junit-report v0.9.1
go.opencensus.io v0.22.3
- golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd
golang.org/x/lint v0.0.0-20200130185559-910be7a94367
golang.org/x/mod v0.2.0 // indirect
golang.org/x/net v0.0.0-20200202094626-16171245cfb2
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
golang.org/x/text v0.3.2
- golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79
google.golang.org/api v0.17.0
- google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
honnef.co/go/tools v0.0.1-2019.2.3
)
diff --git a/go.sum b/go.sum
index c599e91..63b7e5e 100644
--- a/go.sum
+++ b/go.sum
@@ -119,8 +119,8 @@
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
-golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
-golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -230,8 +230,9 @@
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 h1:KW20qMcLRWuIgjdCpHFJbVZA7zsDKtFXPNcm7/eI5ZA=
-golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -274,8 +275,8 @@
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 h1:MBO9fkVSrTpJ8vgHLPi5gb+ZWXEy7/auJN8yqyu9EiE=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU=
diff --git a/iam/credentials/apiv1/doc.go b/iam/credentials/apiv1/doc.go
index d98e746..e8d29e8 100644
--- a/iam/credentials/apiv1/doc.go
+++ b/iam/credentials/apiv1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/iam/credentials/apiv1/iam_credentials_client.go b/iam/credentials/apiv1/iam_credentials_client.go
index ece1133..f2f745c 100644
--- a/iam/credentials/apiv1/iam_credentials_client.go
+++ b/iam/credentials/apiv1/iam_credentials_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
credentialspb "google.golang.org/genproto/googleapis/iam/credentials/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -107,8 +107,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type IamCredentialsClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
iamCredentialsClient credentialspb.IAMCredentialsClient
@@ -132,30 +132,32 @@
// tokens, OpenID Connect ID tokens, self-signed JSON Web Tokens (JWTs), and
// more.
func NewIamCredentialsClient(ctx context.Context, opts ...option.ClientOption) (*IamCredentialsClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultIamCredentialsClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultIamCredentialsClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &IamCredentialsClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultIamCredentialsCallOptions(),
- iamCredentialsClient: credentialspb.NewIAMCredentialsClient(conn),
+ iamCredentialsClient: credentialspb.NewIAMCredentialsClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *IamCredentialsClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *IamCredentialsClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json
index 5691994..5450cce 100644
--- a/internal/.repo-metadata-full.json
+++ b/internal/.repo-metadata-full.json
@@ -463,6 +463,14 @@
"docs_url": "https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1beta1",
"release_level": "beta"
},
+ "cloud.google.com/go/securitycenter/v1p1beta1": {
+ "distribution_name": "cloud.google.com/go/securitycenter/v1p1beta1",
+ "description": "Cloud Security Command Center API",
+ "language": "Go",
+ "client_library_type": "generated",
+ "docs_url": "https://pkg.go.dev/cloud.google.com/go/securitycenter/v1p1beta1",
+ "release_level": "beta"
+ },
"cloud.google.com/go/spanner": {
"distribution_name": "cloud.google.com/go/spanner",
"description": "Cloud Spanner",
diff --git a/internal/gapicgen/go.mod b/internal/gapicgen/go.mod
index 6fe350b..5d40430 100644
--- a/internal/gapicgen/go.mod
+++ b/internal/gapicgen/go.mod
@@ -15,6 +15,7 @@
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
google.golang.org/appengine v1.6.5 // indirect
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.2.8
diff --git a/internal/gapicgen/go.sum b/internal/gapicgen/go.sum
index 8315b12..5601827 100644
--- a/internal/gapicgen/go.sum
+++ b/internal/gapicgen/go.sum
@@ -161,6 +161,8 @@
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 h1:MBO9fkVSrTpJ8vgHLPi5gb+ZWXEy7/auJN8yqyu9EiE=
google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
diff --git a/iot/apiv1/device_manager_client.go b/iot/apiv1/device_manager_client.go
index f002232..ced0350 100644
--- a/iot/apiv1/device_manager_client.go
+++ b/iot/apiv1/device_manager_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
iotpb "google.golang.org/genproto/googleapis/cloud/iot/v1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
"google.golang.org/grpc"
@@ -208,8 +208,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type DeviceManagerClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
deviceManagerClient iotpb.DeviceManagerClient
@@ -225,30 +225,32 @@
//
// Internet of Things (IoT) service. Securely connect and manage IoT devices.
func NewDeviceManagerClient(ctx context.Context, opts ...option.ClientOption) (*DeviceManagerClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultDeviceManagerClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultDeviceManagerClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &DeviceManagerClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultDeviceManagerCallOptions(),
- deviceManagerClient: iotpb.NewDeviceManagerClient(conn),
+ deviceManagerClient: iotpb.NewDeviceManagerClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *DeviceManagerClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *DeviceManagerClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/iot/apiv1/doc.go b/iot/apiv1/doc.go
index 5cdc92e..553ecd9 100644
--- a/iot/apiv1/doc.go
+++ b/iot/apiv1/doc.go
@@ -41,7 +41,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/irm/apiv1alpha2/doc.go b/irm/apiv1alpha2/doc.go
index c150ee3..3f3eef5 100644
--- a/irm/apiv1alpha2/doc.go
+++ b/irm/apiv1alpha2/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/irm/apiv1alpha2/incident_client.go b/irm/apiv1alpha2/incident_client.go
index 17b4143..f2688b1 100644
--- a/irm/apiv1alpha2/incident_client.go
+++ b/irm/apiv1alpha2/incident_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
irmpb "google.golang.org/genproto/googleapis/cloud/irm/v1alpha2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -286,8 +286,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type IncidentClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
incidentClient irmpb.IncidentServiceClient
@@ -303,30 +303,32 @@
//
// The Incident API for Incident Response & Management.
func NewIncidentClient(ctx context.Context, opts ...option.ClientOption) (*IncidentClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultIncidentClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultIncidentClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &IncidentClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultIncidentCallOptions(),
- incidentClient: irmpb.NewIncidentServiceClient(conn),
+ incidentClient: irmpb.NewIncidentServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *IncidentClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *IncidentClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/kms/apiv1/doc.go b/kms/apiv1/doc.go
index 0d626ee..de22cf2 100644
--- a/kms/apiv1/doc.go
+++ b/kms/apiv1/doc.go
@@ -41,7 +41,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/kms/apiv1/key_management_client.go b/kms/apiv1/key_management_client.go
index a30c5b1..b460a3e 100644
--- a/kms/apiv1/key_management_client.go
+++ b/kms/apiv1/key_management_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
kmspb "google.golang.org/genproto/googleapis/cloud/kms/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -355,8 +355,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type KeyManagementClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
keyManagementClient kmspb.KeyManagementServiceClient
@@ -386,30 +386,32 @@
// If you are using manual gRPC libraries, see
// Using gRPC with Cloud KMS (at https://cloud.google.com/kms/docs/grpc).
func NewKeyManagementClient(ctx context.Context, opts ...option.ClientOption) (*KeyManagementClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultKeyManagementClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultKeyManagementClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &KeyManagementClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultKeyManagementCallOptions(),
- keyManagementClient: kmspb.NewKeyManagementServiceClient(conn),
+ keyManagementClient: kmspb.NewKeyManagementServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *KeyManagementClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *KeyManagementClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/language/apiv1/doc.go b/language/apiv1/doc.go
index 9f8a444..c9720ef 100644
--- a/language/apiv1/doc.go
+++ b/language/apiv1/doc.go
@@ -44,7 +44,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/language/apiv1/language_client.go b/language/apiv1/language_client.go
index 85898f8..869db36 100644
--- a/language/apiv1/language_client.go
+++ b/language/apiv1/language_client.go
@@ -23,7 +23,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
languagepb "google.golang.org/genproto/googleapis/cloud/language/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -131,8 +131,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client languagepb.LanguageServiceClient
@@ -149,30 +149,32 @@
// Provides text analysis operations such as sentiment analysis and entity
// recognition.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: languagepb.NewLanguageServiceClient(conn),
+ client: languagepb.NewLanguageServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/language/apiv1beta2/doc.go b/language/apiv1beta2/doc.go
index 980d234..8cf0967 100644
--- a/language/apiv1beta2/doc.go
+++ b/language/apiv1beta2/doc.go
@@ -44,7 +44,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/language/apiv1beta2/language_client.go b/language/apiv1beta2/language_client.go
index a3836fe..4b10a95 100644
--- a/language/apiv1beta2/language_client.go
+++ b/language/apiv1beta2/language_client.go
@@ -23,7 +23,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
languagepb "google.golang.org/genproto/googleapis/cloud/language/v1beta2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -131,8 +131,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client languagepb.LanguageServiceClient
@@ -149,30 +149,32 @@
// Provides text analysis operations such as sentiment analysis and entity
// recognition.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: languagepb.NewLanguageServiceClient(conn),
+ client: languagepb.NewLanguageServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/logging/apiv2/doc.go b/logging/apiv2/doc.go
index b088f78..a7e5001 100644
--- a/logging/apiv2/doc.go
+++ b/logging/apiv2/doc.go
@@ -106,4 +106,4 @@
return "UNKNOWN"
}
-const versionClient = "20200205"
+const versionClient = "20200207"
diff --git a/logging/go.mod b/logging/go.mod
index d8c3c26..2a1e5a6 100644
--- a/logging/go.mod
+++ b/logging/go.mod
@@ -10,9 +10,10 @@
github.com/google/go-cmp v0.4.0
github.com/googleapis/gax-go/v2 v2.0.5
go.opencensus.io v0.22.3
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
- golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e // indirect
- google.golang.org/api v0.16.0
- google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 // indirect
+ google.golang.org/api v0.17.0
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
)
diff --git a/logging/go.sum b/logging/go.sum
index 7779463..3c6bcdc 100644
--- a/logging/go.sum
+++ b/logging/go.sum
@@ -118,6 +118,8 @@
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -232,8 +234,9 @@
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 h1:KW20qMcLRWuIgjdCpHFJbVZA7zsDKtFXPNcm7/eI5ZA=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e h1:JdEzLb04S2BEPrWqUDsgo7JXSq8pQlzIHbrBQN5o7TY=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -248,8 +251,8 @@
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0 h1:yzlyyDW/J0w8yNFJIhiAJy4kq74S+1DOLdawELNxFMA=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
-google.golang.org/api v0.16.0 h1:hhRbpE9nkabqMxGCewz2sikMYxm8yYWov7h2Eo4j3Is=
-google.golang.org/api v0.16.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.17.0 h1:0q95w+VuFtv4PAx4PZVQdBMmYbaCHbnfKaEiDIcVyag=
+google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -277,8 +280,8 @@
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90 h1:7THRSvPuzF1bql5kyFzX0JM0vpGhwuhskgJrJsbZ80Y=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 h1:MBO9fkVSrTpJ8vgHLPi5gb+ZWXEy7/auJN8yqyu9EiE=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
diff --git a/longrunning/autogen/doc.go b/longrunning/autogen/doc.go
index e102316..35399ba 100644
--- a/longrunning/autogen/doc.go
+++ b/longrunning/autogen/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/longrunning/autogen/operations_client.go b/longrunning/autogen/operations_client.go
index 6cd2d55..fc243e8 100644
--- a/longrunning/autogen/operations_client.go
+++ b/longrunning/autogen/operations_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -107,8 +107,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type OperationsClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
operationsClient longrunningpb.OperationsClient
@@ -132,30 +132,32 @@
// returns long-running operations should implement the Operations interface
// so developers can have a consistent client experience.
func NewOperationsClient(ctx context.Context, opts ...option.ClientOption) (*OperationsClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultOperationsClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultOperationsClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &OperationsClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultOperationsCallOptions(),
- operationsClient: longrunningpb.NewOperationsClient(conn),
+ operationsClient: longrunningpb.NewOperationsClient(connPool),
}
c.SetGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *OperationsClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *OperationsClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/monitoring/apiv3/alert_policy_client.go b/monitoring/apiv3/alert_policy_client.go
index d251a73..ddf14ca 100644
--- a/monitoring/apiv3/alert_policy_client.go
+++ b/monitoring/apiv3/alert_policy_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -100,8 +100,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type AlertPolicyClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
alertPolicyClient monitoringpb.AlertPolicyServiceClient
@@ -125,30 +125,32 @@
// which can be reached by clicking the “Monitoring” tab in
// Cloud Console (at https://console.cloud.google.com/).
func NewAlertPolicyClient(ctx context.Context, opts ...option.ClientOption) (*AlertPolicyClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultAlertPolicyClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultAlertPolicyClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &AlertPolicyClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultAlertPolicyCallOptions(),
- alertPolicyClient: monitoringpb.NewAlertPolicyServiceClient(conn),
+ alertPolicyClient: monitoringpb.NewAlertPolicyServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *AlertPolicyClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *AlertPolicyClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/monitoring/apiv3/doc.go b/monitoring/apiv3/doc.go
index 1a0e795..d6c001bf 100644
--- a/monitoring/apiv3/doc.go
+++ b/monitoring/apiv3/doc.go
@@ -47,7 +47,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/monitoring/apiv3/group_client.go b/monitoring/apiv3/group_client.go
index 649a4c9..571e3dc 100644
--- a/monitoring/apiv3/group_client.go
+++ b/monitoring/apiv3/group_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/grpc"
@@ -125,8 +125,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type GroupClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
groupClient monitoringpb.GroupServiceClient
@@ -153,30 +153,32 @@
// updated automatically as monitored resources are added and removed
// from the infrastructure.
func NewGroupClient(ctx context.Context, opts ...option.ClientOption) (*GroupClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultGroupClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultGroupClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &GroupClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultGroupCallOptions(),
- groupClient: monitoringpb.NewGroupServiceClient(conn),
+ groupClient: monitoringpb.NewGroupServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *GroupClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *GroupClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/monitoring/apiv3/metric_client.go b/monitoring/apiv3/metric_client.go
index d3e363c..02962b7 100644
--- a/monitoring/apiv3/metric_client.go
+++ b/monitoring/apiv3/metric_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
metricpb "google.golang.org/genproto/googleapis/api/metric"
monitoredrespb "google.golang.org/genproto/googleapis/api/monitoredres"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
@@ -141,8 +141,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type MetricClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
metricClient monitoringpb.MetricServiceClient
@@ -159,30 +159,32 @@
// Manages metric descriptors, monitored resource descriptors, and
// time series data.
func NewMetricClient(ctx context.Context, opts ...option.ClientOption) (*MetricClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultMetricClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultMetricClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &MetricClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultMetricCallOptions(),
- metricClient: monitoringpb.NewMetricServiceClient(conn),
+ metricClient: monitoringpb.NewMetricServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *MetricClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *MetricClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/monitoring/apiv3/notification_channel_client.go b/monitoring/apiv3/notification_channel_client.go
index 8fbb9a4..32f5e12 100644
--- a/monitoring/apiv3/notification_channel_client.go
+++ b/monitoring/apiv3/notification_channel_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -154,8 +154,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type NotificationChannelClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
notificationChannelClient monitoringpb.NotificationChannelServiceClient
@@ -172,30 +172,32 @@
// The Notification Channel API provides access to configuration that
// controls how messages related to incidents are sent.
func NewNotificationChannelClient(ctx context.Context, opts ...option.ClientOption) (*NotificationChannelClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultNotificationChannelClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultNotificationChannelClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &NotificationChannelClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultNotificationChannelCallOptions(),
- notificationChannelClient: monitoringpb.NewNotificationChannelServiceClient(conn),
+ notificationChannelClient: monitoringpb.NewNotificationChannelServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *NotificationChannelClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *NotificationChannelClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/monitoring/apiv3/service_monitoring_client.go b/monitoring/apiv3/service_monitoring_client.go
index 3f64278..84de580 100644
--- a/monitoring/apiv3/service_monitoring_client.go
+++ b/monitoring/apiv3/service_monitoring_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -143,8 +143,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ServiceMonitoringClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
serviceMonitoringClient monitoringpb.ServiceMonitoringServiceClient
@@ -163,30 +163,32 @@
// Service's monitored resources, its Service-Level Objectives, and a taxonomy
// of categorized Health Metrics.
func NewServiceMonitoringClient(ctx context.Context, opts ...option.ClientOption) (*ServiceMonitoringClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultServiceMonitoringClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultServiceMonitoringClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ServiceMonitoringClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultServiceMonitoringCallOptions(),
- serviceMonitoringClient: monitoringpb.NewServiceMonitoringServiceClient(conn),
+ serviceMonitoringClient: monitoringpb.NewServiceMonitoringServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ServiceMonitoringClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ServiceMonitoringClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/monitoring/apiv3/uptime_check_client.go b/monitoring/apiv3/uptime_check_client.go
index 8822211..f0477a1 100644
--- a/monitoring/apiv3/uptime_check_client.go
+++ b/monitoring/apiv3/uptime_check_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
monitoringpb "google.golang.org/genproto/googleapis/monitoring/v3"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -113,8 +113,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type UptimeCheckClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
uptimeCheckClient monitoringpb.UptimeCheckServiceClient
@@ -137,30 +137,32 @@
// clicking on “Monitoring” on the left-hand side to navigate to Stackdriver,
// and then clicking on “Uptime”.
func NewUptimeCheckClient(ctx context.Context, opts ...option.ClientOption) (*UptimeCheckClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultUptimeCheckClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultUptimeCheckClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &UptimeCheckClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultUptimeCheckCallOptions(),
- uptimeCheckClient: monitoringpb.NewUptimeCheckServiceClient(conn),
+ uptimeCheckClient: monitoringpb.NewUptimeCheckServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *UptimeCheckClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *UptimeCheckClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/osconfig/agentendpoint/apiv1beta/agent_endpoint_client.go b/osconfig/agentendpoint/apiv1beta/agent_endpoint_client.go
index 5fb0e70..7840966 100644
--- a/osconfig/agentendpoint/apiv1beta/agent_endpoint_client.go
+++ b/osconfig/agentendpoint/apiv1beta/agent_endpoint_client.go
@@ -22,7 +22,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
agentendpointpb "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1beta"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -61,8 +61,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client agentendpointpb.AgentEndpointServiceClient
@@ -78,30 +78,32 @@
//
// OS Config agent endpoint API.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: agentendpointpb.NewAgentEndpointServiceClient(conn),
+ client: agentendpointpb.NewAgentEndpointServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/osconfig/agentendpoint/apiv1beta/doc.go b/osconfig/agentendpoint/apiv1beta/doc.go
index ad46723..05d36e8 100644
--- a/osconfig/agentendpoint/apiv1beta/doc.go
+++ b/osconfig/agentendpoint/apiv1beta/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/osconfig/apiv1beta/doc.go b/osconfig/apiv1beta/doc.go
index 216e598..4285a6a 100644
--- a/osconfig/apiv1beta/doc.go
+++ b/osconfig/apiv1beta/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/osconfig/apiv1beta/os_config_client.go b/osconfig/apiv1beta/os_config_client.go
index 4e86559..0613b75 100644
--- a/osconfig/apiv1beta/os_config_client.go
+++ b/osconfig/apiv1beta/os_config_client.go
@@ -26,7 +26,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1beta"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -85,8 +85,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client osconfigpb.OsConfigServiceClient
@@ -105,30 +105,32 @@
// The OS Config service is a server-side component that you can use to
// manage package installations and patch jobs for virtual machine instances.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: osconfigpb.NewOsConfigServiceClient(conn),
+ client: osconfigpb.NewOsConfigServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/oslogin/apiv1/doc.go b/oslogin/apiv1/doc.go
index 7038f37..a361c84 100644
--- a/oslogin/apiv1/doc.go
+++ b/oslogin/apiv1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/oslogin/apiv1/os_login_client.go b/oslogin/apiv1/os_login_client.go
index 8819497..8730090 100644
--- a/oslogin/apiv1/os_login_client.go
+++ b/oslogin/apiv1/os_login_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
commonpb "google.golang.org/genproto/googleapis/cloud/oslogin/common"
osloginpb "google.golang.org/genproto/googleapis/cloud/oslogin/v1"
"google.golang.org/grpc"
@@ -134,8 +134,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client osloginpb.OsLoginServiceClient
@@ -154,30 +154,32 @@
// The Cloud OS Login API allows you to manage users and their associated SSH
// public keys for logging into virtual machines on Google Cloud Platform.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: osloginpb.NewOsLoginServiceClient(conn),
+ client: osloginpb.NewOsLoginServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/oslogin/apiv1beta/doc.go b/oslogin/apiv1beta/doc.go
index 7bf2fd5..f9dd486 100644
--- a/oslogin/apiv1beta/doc.go
+++ b/oslogin/apiv1beta/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/oslogin/apiv1beta/os_login_client.go b/oslogin/apiv1beta/os_login_client.go
index 6542ea1..37e0fc5 100644
--- a/oslogin/apiv1beta/os_login_client.go
+++ b/oslogin/apiv1beta/os_login_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
commonpb "google.golang.org/genproto/googleapis/cloud/oslogin/common"
osloginpb "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta"
"google.golang.org/grpc"
@@ -134,8 +134,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client osloginpb.OsLoginServiceClient
@@ -154,30 +154,32 @@
// The Cloud OS Login API allows you to manage users and their associated SSH
// public keys for logging into virtual machines on Google Cloud Platform.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: osloginpb.NewOsLoginServiceClient(conn),
+ client: osloginpb.NewOsLoginServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/phishingprotection/apiv1beta1/doc.go b/phishingprotection/apiv1beta1/doc.go
index 655e33d..1a8586d 100644
--- a/phishingprotection/apiv1beta1/doc.go
+++ b/phishingprotection/apiv1beta1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/phishingprotection/apiv1beta1/phishing_protection_service_v1_beta1_client.go b/phishingprotection/apiv1beta1/phishing_protection_service_v1_beta1_client.go
index 4df5bbe..2399a44 100644
--- a/phishingprotection/apiv1beta1/phishing_protection_service_v1_beta1_client.go
+++ b/phishingprotection/apiv1beta1/phishing_protection_service_v1_beta1_client.go
@@ -24,7 +24,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
phishingprotectionpb "google.golang.org/genproto/googleapis/cloud/phishingprotection/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -55,8 +55,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type PhishingProtectionServiceV1Beta1Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
phishingProtectionServiceV1Beta1Client phishingprotectionpb.PhishingProtectionServiceV1Beta1Client
@@ -72,30 +72,32 @@
//
// Service to report phishing URIs.
func NewPhishingProtectionServiceV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*PhishingProtectionServiceV1Beta1Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultPhishingProtectionServiceV1Beta1ClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultPhishingProtectionServiceV1Beta1ClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &PhishingProtectionServiceV1Beta1Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultPhishingProtectionServiceV1Beta1CallOptions(),
- phishingProtectionServiceV1Beta1Client: phishingprotectionpb.NewPhishingProtectionServiceV1Beta1Client(conn),
+ phishingProtectionServiceV1Beta1Client: phishingprotectionpb.NewPhishingProtectionServiceV1Beta1Client(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *PhishingProtectionServiceV1Beta1Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *PhishingProtectionServiceV1Beta1Client) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/pubsub/apiv1/doc.go b/pubsub/apiv1/doc.go
index cca3e18..6b21c52 100644
--- a/pubsub/apiv1/doc.go
+++ b/pubsub/apiv1/doc.go
@@ -100,4 +100,4 @@
return "UNKNOWN"
}
-const versionClient = "20200205"
+const versionClient = "20200207"
diff --git a/pubsub/go.mod b/pubsub/go.mod
index 4373e6c..f4721aa 100644
--- a/pubsub/go.mod
+++ b/pubsub/go.mod
@@ -9,6 +9,7 @@
github.com/google/go-cmp v0.4.0
github.com/googleapis/gax-go/v2 v2.0.5
go.opencensus.io v0.22.3
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
golang.org/x/lint v0.0.0-20200130185559-910be7a94367 // indirect
golang.org/x/mod v0.2.0 // indirect
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
@@ -16,8 +17,8 @@
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
- golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e // indirect
- google.golang.org/api v0.16.0
- google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 // indirect
+ google.golang.org/api v0.17.0
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
)
diff --git a/pubsub/go.sum b/pubsub/go.sum
index fb3aee5..66d25f9 100644
--- a/pubsub/go.sum
+++ b/pubsub/go.sum
@@ -115,6 +115,8 @@
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -229,8 +231,9 @@
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a h1:7YaEqUc1tUg0yDwvdX+3U5bwrBg7u3FFAZ5D8gUs4/c=
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e h1:JdEzLb04S2BEPrWqUDsgo7JXSq8pQlzIHbrBQN5o7TY=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -244,8 +247,8 @@
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0 h1:yzlyyDW/J0w8yNFJIhiAJy4kq74S+1DOLdawELNxFMA=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
-google.golang.org/api v0.16.0 h1:hhRbpE9nkabqMxGCewz2sikMYxm8yYWov7h2Eo4j3Is=
-google.golang.org/api v0.16.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.17.0 h1:0q95w+VuFtv4PAx4PZVQdBMmYbaCHbnfKaEiDIcVyag=
+google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -272,8 +275,8 @@
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150 h1:VPpdpQkGvFicX9yo4G5oxZPi9ALBnEOZblPSa/Wa2m4=
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 h1:MBO9fkVSrTpJ8vgHLPi5gb+ZWXEy7/auJN8yqyu9EiE=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
diff --git a/recaptchaenterprise/apiv1beta1/doc.go b/recaptchaenterprise/apiv1beta1/doc.go
index 5d55f57..7e2cd37 100644
--- a/recaptchaenterprise/apiv1beta1/doc.go
+++ b/recaptchaenterprise/apiv1beta1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/recaptchaenterprise/apiv1beta1/recaptcha_enterprise_service_v1_beta1_client.go b/recaptchaenterprise/apiv1beta1/recaptcha_enterprise_service_v1_beta1_client.go
index de7b3de..0f04ee1 100644
--- a/recaptchaenterprise/apiv1beta1/recaptcha_enterprise_service_v1_beta1_client.go
+++ b/recaptchaenterprise/apiv1beta1/recaptcha_enterprise_service_v1_beta1_client.go
@@ -26,7 +26,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
recaptchaenterprisepb "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -69,8 +69,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type RecaptchaEnterpriseServiceV1Beta1Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
recaptchaEnterpriseServiceV1Beta1Client recaptchaenterprisepb.RecaptchaEnterpriseServiceV1Beta1Client
@@ -86,30 +86,32 @@
//
// Service to determine the likelihood an event is legitimate.
func NewRecaptchaEnterpriseServiceV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*RecaptchaEnterpriseServiceV1Beta1Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultRecaptchaEnterpriseServiceV1Beta1ClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultRecaptchaEnterpriseServiceV1Beta1ClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &RecaptchaEnterpriseServiceV1Beta1Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultRecaptchaEnterpriseServiceV1Beta1CallOptions(),
- recaptchaEnterpriseServiceV1Beta1Client: recaptchaenterprisepb.NewRecaptchaEnterpriseServiceV1Beta1Client(conn),
+ recaptchaEnterpriseServiceV1Beta1Client: recaptchaenterprisepb.NewRecaptchaEnterpriseServiceV1Beta1Client(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *RecaptchaEnterpriseServiceV1Beta1Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *RecaptchaEnterpriseServiceV1Beta1Client) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/recommender/apiv1/doc.go b/recommender/apiv1/doc.go
index a0ce163..35f0ac1 100644
--- a/recommender/apiv1/doc.go
+++ b/recommender/apiv1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/recommender/apiv1/recommender_client.go b/recommender/apiv1/recommender_client.go
index 42c1be7..ed833c0 100644
--- a/recommender/apiv1/recommender_client.go
+++ b/recommender/apiv1/recommender_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
recommenderpb "google.golang.org/genproto/googleapis/cloud/recommender/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -89,8 +89,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client recommenderpb.RecommenderClient
@@ -109,30 +109,32 @@
// These recommendations are generated automatically based on analysis of user
// resources, configuration and monitoring metrics.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: recommenderpb.NewRecommenderClient(conn),
+ client: recommenderpb.NewRecommenderClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/recommender/apiv1beta1/doc.go b/recommender/apiv1beta1/doc.go
index 432c272..f1028f6 100644
--- a/recommender/apiv1beta1/doc.go
+++ b/recommender/apiv1beta1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/recommender/apiv1beta1/recommender_client.go b/recommender/apiv1beta1/recommender_client.go
index f9dda17..5ec83d5 100644
--- a/recommender/apiv1beta1/recommender_client.go
+++ b/recommender/apiv1beta1/recommender_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
recommenderpb "google.golang.org/genproto/googleapis/cloud/recommender/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -89,8 +89,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client recommenderpb.RecommenderClient
@@ -109,30 +109,32 @@
// discovery, etc. Insights and recommendations are generated automatically
// based on analysis of user resources, configuration and monitoring metrics.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: recommenderpb.NewRecommenderClient(conn),
+ client: recommenderpb.NewRecommenderClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/redis/apiv1/cloud_redis_client.go b/redis/apiv1/cloud_redis_client.go
index d3d2802..44cd35d 100644
--- a/redis/apiv1/cloud_redis_client.go
+++ b/redis/apiv1/cloud_redis_client.go
@@ -29,7 +29,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
redispb "google.golang.org/genproto/googleapis/cloud/redis/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -75,8 +75,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type CloudRedisClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
cloudRedisClient redispb.CloudRedisClient
@@ -116,40 +116,42 @@
//
// projects/redpepper-1290/locations/us-central1/instances/my-redis
func NewCloudRedisClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultCloudRedisClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultCloudRedisClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &CloudRedisClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCloudRedisCallOptions(),
- cloudRedisClient: redispb.NewCloudRedisClient(conn),
+ cloudRedisClient: redispb.NewCloudRedisClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *CloudRedisClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *CloudRedisClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/redis/apiv1/doc.go b/redis/apiv1/doc.go
index b0231e3..20b460a 100644
--- a/redis/apiv1/doc.go
+++ b/redis/apiv1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/redis/apiv1beta1/cloud_redis_client.go b/redis/apiv1beta1/cloud_redis_client.go
index 33d6150..5a7a433 100644
--- a/redis/apiv1beta1/cloud_redis_client.go
+++ b/redis/apiv1beta1/cloud_redis_client.go
@@ -30,7 +30,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
redispb "google.golang.org/genproto/googleapis/cloud/redis/v1beta1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -78,8 +78,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type CloudRedisClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
cloudRedisClient redispb.CloudRedisClient
@@ -119,40 +119,42 @@
//
// projects/redpepper-1290/locations/us-central1/instances/my-redis
func NewCloudRedisClient(ctx context.Context, opts ...option.ClientOption) (*CloudRedisClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultCloudRedisClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultCloudRedisClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &CloudRedisClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCloudRedisCallOptions(),
- cloudRedisClient: redispb.NewCloudRedisClient(conn),
+ cloudRedisClient: redispb.NewCloudRedisClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *CloudRedisClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *CloudRedisClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/redis/apiv1beta1/doc.go b/redis/apiv1beta1/doc.go
index 6a2b1b4..9369605 100644
--- a/redis/apiv1beta1/doc.go
+++ b/redis/apiv1beta1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/scheduler/apiv1/cloud_scheduler_client.go b/scheduler/apiv1/cloud_scheduler_client.go
index fdb4f98..74c35dc 100644
--- a/scheduler/apiv1/cloud_scheduler_client.go
+++ b/scheduler/apiv1/cloud_scheduler_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -106,8 +106,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type CloudSchedulerClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
cloudSchedulerClient schedulerpb.CloudSchedulerClient
@@ -124,30 +124,32 @@
// The Cloud Scheduler API allows external entities to reliably
// schedule asynchronous jobs.
func NewCloudSchedulerClient(ctx context.Context, opts ...option.ClientOption) (*CloudSchedulerClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultCloudSchedulerClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultCloudSchedulerClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &CloudSchedulerClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCloudSchedulerCallOptions(),
- cloudSchedulerClient: schedulerpb.NewCloudSchedulerClient(conn),
+ cloudSchedulerClient: schedulerpb.NewCloudSchedulerClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *CloudSchedulerClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *CloudSchedulerClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/scheduler/apiv1/doc.go b/scheduler/apiv1/doc.go
index a31b9b7..d76199a 100644
--- a/scheduler/apiv1/doc.go
+++ b/scheduler/apiv1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/scheduler/apiv1beta1/cloud_scheduler_client.go b/scheduler/apiv1beta1/cloud_scheduler_client.go
index 849857a..9040841 100644
--- a/scheduler/apiv1beta1/cloud_scheduler_client.go
+++ b/scheduler/apiv1beta1/cloud_scheduler_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
schedulerpb "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -128,8 +128,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type CloudSchedulerClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
cloudSchedulerClient schedulerpb.CloudSchedulerClient
@@ -146,30 +146,32 @@
// The Cloud Scheduler API allows external entities to reliably
// schedule asynchronous jobs.
func NewCloudSchedulerClient(ctx context.Context, opts ...option.ClientOption) (*CloudSchedulerClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultCloudSchedulerClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultCloudSchedulerClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &CloudSchedulerClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCloudSchedulerCallOptions(),
- cloudSchedulerClient: schedulerpb.NewCloudSchedulerClient(conn),
+ cloudSchedulerClient: schedulerpb.NewCloudSchedulerClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *CloudSchedulerClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *CloudSchedulerClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/scheduler/apiv1beta1/doc.go b/scheduler/apiv1beta1/doc.go
index d4d180b..90fee38 100644
--- a/scheduler/apiv1beta1/doc.go
+++ b/scheduler/apiv1beta1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/secretmanager/apiv1beta1/doc.go b/secretmanager/apiv1beta1/doc.go
index f10b4c6..e0f502b 100644
--- a/secretmanager/apiv1beta1/doc.go
+++ b/secretmanager/apiv1beta1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/secretmanager/apiv1beta1/secret_manager_client.go b/secretmanager/apiv1beta1/secret_manager_client.go
index 9991d08..2ea79aa 100644
--- a/secretmanager/apiv1beta1/secret_manager_client.go
+++ b/secretmanager/apiv1beta1/secret_manager_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
secretmanagerpb "google.golang.org/genproto/googleapis/cloud/secretmanager/v1beta1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
"google.golang.org/grpc"
@@ -99,8 +99,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client secretmanagerpb.SecretManagerServiceClient
@@ -123,30 +123,32 @@
//
// [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: secretmanagerpb.NewSecretManagerServiceClient(conn),
+ client: secretmanagerpb.NewSecretManagerServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/securitycenter/apiv1/doc.go b/securitycenter/apiv1/doc.go
index aebb003..19affad 100644
--- a/securitycenter/apiv1/doc.go
+++ b/securitycenter/apiv1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/securitycenter/apiv1/security_center_client.go b/securitycenter/apiv1/security_center_client.go
index cb97924..1cd2323 100644
--- a/securitycenter/apiv1/security_center_client.go
+++ b/securitycenter/apiv1/security_center_client.go
@@ -30,7 +30,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
@@ -197,8 +197,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client securitycenterpb.SecurityCenterClient
@@ -219,40 +219,42 @@
//
// V1 APIs for Security Center service.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: securitycenterpb.NewSecurityCenterClient(conn),
+ client: securitycenterpb.NewSecurityCenterClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/securitycenter/apiv1beta1/doc.go b/securitycenter/apiv1beta1/doc.go
index e6b0c74..acc609d 100644
--- a/securitycenter/apiv1beta1/doc.go
+++ b/securitycenter/apiv1beta1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/securitycenter/apiv1beta1/security_center_client.go b/securitycenter/apiv1beta1/security_center_client.go
index 07a74f3..4f6d35a 100644
--- a/securitycenter/apiv1beta1/security_center_client.go
+++ b/securitycenter/apiv1beta1/security_center_client.go
@@ -30,7 +30,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
@@ -197,8 +197,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client securitycenterpb.SecurityCenterClient
@@ -219,40 +219,42 @@
//
// V1 Beta APIs for Security Center service.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: securitycenterpb.NewSecurityCenterClient(conn),
+ client: securitycenterpb.NewSecurityCenterClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/securitycenter/v1p1beta1/doc.go b/securitycenter/v1p1beta1/doc.go
new file mode 100644
index 0000000..ee42da3
--- /dev/null
+++ b/securitycenter/v1p1beta1/doc.go
@@ -0,0 +1,101 @@
+// 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 securitycenter is an auto-generated package for the
+// Cloud Security Command Center API.
+//
+// Cloud Security Command Center API provides access to temporal views of
+// assets and findings within an organization.
+//
+// NOTE: This package is in beta. It is not stable, and may be subject to changes.
+//
+// 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 securitycenter // import "cloud.google.com/go/securitycenter/v1p1beta1"
+
+import (
+ "context"
+ "runtime"
+ "strings"
+ "unicode"
+
+ "google.golang.org/grpc/metadata"
+)
+
+const versionClient = "20200207"
+
+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/cloud-platform",
+ }
+}
+
+// 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/securitycenter/v1p1beta1/security_center_client.go b/securitycenter/v1p1beta1/security_center_client.go
new file mode 100644
index 0000000..10567ae
--- /dev/null
+++ b/securitycenter/v1p1beta1/security_center_client.go
@@ -0,0 +1,1151 @@
+// 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 securitycenter
+
+import (
+ "context"
+ "fmt"
+ "math"
+ "net/url"
+ "time"
+
+ "cloud.google.com/go/longrunning"
+ lroauto "cloud.google.com/go/longrunning/autogen"
+ "github.com/golang/protobuf/proto"
+ emptypb "github.com/golang/protobuf/ptypes/empty"
+ gax "github.com/googleapis/gax-go/v2"
+ "google.golang.org/api/iterator"
+ "google.golang.org/api/option"
+ gtransport "google.golang.org/api/transport/grpc"
+ securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+ iampb "google.golang.org/genproto/googleapis/iam/v1"
+ longrunningpb "google.golang.org/genproto/googleapis/longrunning"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/metadata"
+)
+
+// CallOptions contains the retry settings for each method of Client.
+type CallOptions struct {
+ CreateSource []gax.CallOption
+ CreateFinding []gax.CallOption
+ CreateNotificationConfig []gax.CallOption
+ DeleteNotificationConfig []gax.CallOption
+ GetIamPolicy []gax.CallOption
+ GetNotificationConfig []gax.CallOption
+ GetOrganizationSettings []gax.CallOption
+ GetSource []gax.CallOption
+ GroupAssets []gax.CallOption
+ GroupFindings []gax.CallOption
+ ListAssets []gax.CallOption
+ ListFindings []gax.CallOption
+ ListNotificationConfigs []gax.CallOption
+ ListSources []gax.CallOption
+ RunAssetDiscovery []gax.CallOption
+ SetFindingState []gax.CallOption
+ SetIamPolicy []gax.CallOption
+ TestIamPermissions []gax.CallOption
+ UpdateFinding []gax.CallOption
+ UpdateNotificationConfig []gax.CallOption
+ UpdateOrganizationSettings []gax.CallOption
+ UpdateSource []gax.CallOption
+ UpdateSecurityMarks []gax.CallOption
+}
+
+func defaultClientOptions() []option.ClientOption {
+ return []option.ClientOption{
+ option.WithEndpoint("securitycenter.googleapis.com:443"),
+ option.WithGRPCDialOption(grpc.WithDisableServiceConfig()),
+ option.WithScopes(DefaultAuthScopes()...),
+ option.WithGRPCDialOption(grpc.WithDefaultCallOptions(
+ grpc.MaxCallRecvMsgSize(math.MaxInt32))),
+ }
+}
+
+func defaultCallOptions() *CallOptions {
+ return &CallOptions{
+ CreateSource: []gax.CallOption{},
+ CreateFinding: []gax.CallOption{},
+ CreateNotificationConfig: []gax.CallOption{},
+ DeleteNotificationConfig: []gax.CallOption{},
+ GetIamPolicy: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ GetNotificationConfig: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ GetOrganizationSettings: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ GetSource: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ GroupAssets: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ GroupFindings: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ ListAssets: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ ListFindings: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ ListNotificationConfigs: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ ListSources: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ RunAssetDiscovery: []gax.CallOption{},
+ SetFindingState: []gax.CallOption{},
+ SetIamPolicy: []gax.CallOption{},
+ TestIamPermissions: []gax.CallOption{
+ gax.WithRetry(func() gax.Retryer {
+ return gax.OnCodes([]codes.Code{
+ codes.DeadlineExceeded,
+ codes.Unavailable,
+ }, gax.Backoff{
+ Initial: 100 * time.Millisecond,
+ Max: 60000 * time.Millisecond,
+ Multiplier: 1.30,
+ })
+ }),
+ },
+ UpdateFinding: []gax.CallOption{},
+ UpdateNotificationConfig: []gax.CallOption{},
+ UpdateOrganizationSettings: []gax.CallOption{},
+ UpdateSource: []gax.CallOption{},
+ UpdateSecurityMarks: []gax.CallOption{},
+ }
+}
+
+// Client is a client for interacting with Cloud Security Command Center API.
+//
+// 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 securitycenterpb.SecurityCenterClient
+
+ // LROClient is used internally to handle longrunning operations.
+ // It is exposed so that its CallOptions can be modified if required.
+ // Users should not Close this client.
+ LROClient *lroauto.OperationsClient
+
+ // 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 security center client.
+//
+// V1p1Beta1 APIs for Security Center service.
+func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
+ if err != nil {
+ return nil, err
+ }
+ c := &Client{
+ connPool: connPool,
+ CallOptions: defaultCallOptions(),
+
+ client: securitycenterpb.NewSecurityCenterClient(connPool),
+ }
+ c.setGoogleClientInfo()
+
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
+ if err != nil {
+ // This error "should not happen", since we are just reusing old connection pool
+ // and never actually need to dial.
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
+ // we would close a connection that's still in use.
+ // TODO: investigate error conditions.
+ return nil, err
+ }
+ 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...))
+}
+
+// CreateSource creates a source.
+func (c *Client) CreateSource(ctx context.Context, req *securitycenterpb.CreateSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, 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.CreateSource[0:len(c.CallOptions.CreateSource):len(c.CallOptions.CreateSource)], opts...)
+ var resp *securitycenterpb.Source
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.CreateSource(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateFinding creates a finding. The corresponding source must exist for finding
+// creation to succeed.
+func (c *Client) CreateFinding(ctx context.Context, req *securitycenterpb.CreateFindingRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, 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.CreateFinding[0:len(c.CallOptions.CreateFinding):len(c.CallOptions.CreateFinding)], opts...)
+ var resp *securitycenterpb.Finding
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.CreateFinding(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// CreateNotificationConfig creates a notification config.
+func (c *Client) CreateNotificationConfig(ctx context.Context, req *securitycenterpb.CreateNotificationConfigRequest, opts ...gax.CallOption) (*securitycenterpb.NotificationConfig, 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.CreateNotificationConfig[0:len(c.CallOptions.CreateNotificationConfig):len(c.CallOptions.CreateNotificationConfig)], opts...)
+ var resp *securitycenterpb.NotificationConfig
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.CreateNotificationConfig(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// DeleteNotificationConfig deletes a notification config.
+func (c *Client) DeleteNotificationConfig(ctx context.Context, req *securitycenterpb.DeleteNotificationConfigRequest, 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.DeleteNotificationConfig[0:len(c.CallOptions.DeleteNotificationConfig):len(c.CallOptions.DeleteNotificationConfig)], opts...)
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ _, err = c.client.DeleteNotificationConfig(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ return err
+}
+
+// GetIamPolicy gets the access control policy on the specified Source.
+func (c *Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.GetIamPolicy[0:len(c.CallOptions.GetIamPolicy):len(c.CallOptions.GetIamPolicy)], opts...)
+ var resp *iampb.Policy
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.GetIamPolicy(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetNotificationConfig gets a notification config.
+func (c *Client) GetNotificationConfig(ctx context.Context, req *securitycenterpb.GetNotificationConfigRequest, opts ...gax.CallOption) (*securitycenterpb.NotificationConfig, 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.GetNotificationConfig[0:len(c.CallOptions.GetNotificationConfig):len(c.CallOptions.GetNotificationConfig)], opts...)
+ var resp *securitycenterpb.NotificationConfig
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.GetNotificationConfig(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetOrganizationSettings gets the settings for an organization.
+func (c *Client) GetOrganizationSettings(ctx context.Context, req *securitycenterpb.GetOrganizationSettingsRequest, opts ...gax.CallOption) (*securitycenterpb.OrganizationSettings, 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.GetOrganizationSettings[0:len(c.CallOptions.GetOrganizationSettings):len(c.CallOptions.GetOrganizationSettings)], opts...)
+ var resp *securitycenterpb.OrganizationSettings
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.GetOrganizationSettings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GetSource gets a source.
+func (c *Client) GetSource(ctx context.Context, req *securitycenterpb.GetSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, 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.GetSource[0:len(c.CallOptions.GetSource):len(c.CallOptions.GetSource)], opts...)
+ var resp *securitycenterpb.Source
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.GetSource(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// GroupAssets filters an organization’s assets and groups them by their specified
+// properties.
+func (c *Client) GroupAssets(ctx context.Context, req *securitycenterpb.GroupAssetsRequest, opts ...gax.CallOption) *GroupResultIterator {
+ 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.GroupAssets[0:len(c.CallOptions.GroupAssets):len(c.CallOptions.GroupAssets)], opts...)
+ it := &GroupResultIterator{}
+ req = proto.Clone(req).(*securitycenterpb.GroupAssetsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.GroupResult, string, error) {
+ var resp *securitycenterpb.GroupAssetsResponse
+ 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.GroupAssets(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GroupByResults, 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
+}
+
+// GroupFindings filters an organization or source’s findings and groups them by their
+// specified properties.
+//
+// To group across all sources provide a - as the source id.
+// Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings
+func (c *Client) GroupFindings(ctx context.Context, req *securitycenterpb.GroupFindingsRequest, opts ...gax.CallOption) *GroupResultIterator {
+ 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.GroupFindings[0:len(c.CallOptions.GroupFindings):len(c.CallOptions.GroupFindings)], opts...)
+ it := &GroupResultIterator{}
+ req = proto.Clone(req).(*securitycenterpb.GroupFindingsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.GroupResult, string, error) {
+ var resp *securitycenterpb.GroupFindingsResponse
+ 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.GroupFindings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.GroupByResults, 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
+}
+
+// ListAssets lists an organization’s assets.
+func (c *Client) ListAssets(ctx context.Context, req *securitycenterpb.ListAssetsRequest, opts ...gax.CallOption) *ListAssetsResponse_ListAssetsResultIterator {
+ 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.ListAssets[0:len(c.CallOptions.ListAssets):len(c.CallOptions.ListAssets)], opts...)
+ it := &ListAssetsResponse_ListAssetsResultIterator{}
+ req = proto.Clone(req).(*securitycenterpb.ListAssetsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.ListAssetsResponse_ListAssetsResult, string, error) {
+ var resp *securitycenterpb.ListAssetsResponse
+ 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.ListAssets(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.ListAssetsResults, 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
+}
+
+// ListFindings lists an organization or source’s findings.
+//
+// To list across all sources provide a - as the source id.
+// Example: /v1p1beta1/organizations/{organization_id}/sources/-/findings
+func (c *Client) ListFindings(ctx context.Context, req *securitycenterpb.ListFindingsRequest, opts ...gax.CallOption) *ListFindingsResponse_ListFindingsResultIterator {
+ 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.ListFindings[0:len(c.CallOptions.ListFindings):len(c.CallOptions.ListFindings)], opts...)
+ it := &ListFindingsResponse_ListFindingsResultIterator{}
+ req = proto.Clone(req).(*securitycenterpb.ListFindingsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.ListFindingsResponse_ListFindingsResult, string, error) {
+ var resp *securitycenterpb.ListFindingsResponse
+ 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.ListFindings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.ListFindingsResults, 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
+}
+
+// ListNotificationConfigs lists notification configs.
+func (c *Client) ListNotificationConfigs(ctx context.Context, req *securitycenterpb.ListNotificationConfigsRequest, opts ...gax.CallOption) *NotificationConfigIterator {
+ 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.ListNotificationConfigs[0:len(c.CallOptions.ListNotificationConfigs):len(c.CallOptions.ListNotificationConfigs)], opts...)
+ it := &NotificationConfigIterator{}
+ req = proto.Clone(req).(*securitycenterpb.ListNotificationConfigsRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.NotificationConfig, string, error) {
+ var resp *securitycenterpb.ListNotificationConfigsResponse
+ 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.ListNotificationConfigs(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.NotificationConfigs, 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
+}
+
+// ListSources lists all sources belonging to an organization.
+func (c *Client) ListSources(ctx context.Context, req *securitycenterpb.ListSourcesRequest, opts ...gax.CallOption) *SourceIterator {
+ 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.ListSources[0:len(c.CallOptions.ListSources):len(c.CallOptions.ListSources)], opts...)
+ it := &SourceIterator{}
+ req = proto.Clone(req).(*securitycenterpb.ListSourcesRequest)
+ it.InternalFetch = func(pageSize int, pageToken string) ([]*securitycenterpb.Source, string, error) {
+ var resp *securitycenterpb.ListSourcesResponse
+ 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.ListSources(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, "", err
+ }
+
+ it.Response = resp
+ return resp.Sources, 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
+}
+
+// RunAssetDiscovery runs asset discovery. The discovery is tracked with a long-running
+// operation.
+//
+// This API can only be called with limited frequency for an organization. If
+// it is called too frequently the caller will receive a TOO_MANY_REQUESTS
+// error.
+func (c *Client) RunAssetDiscovery(ctx context.Context, req *securitycenterpb.RunAssetDiscoveryRequest, opts ...gax.CallOption) (*RunAssetDiscoveryOperation, 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.RunAssetDiscovery[0:len(c.CallOptions.RunAssetDiscovery):len(c.CallOptions.RunAssetDiscovery)], opts...)
+ var resp *longrunningpb.Operation
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.RunAssetDiscovery(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &RunAssetDiscoveryOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, resp),
+ }, nil
+}
+
+// SetFindingState updates the state of a finding.
+func (c *Client) SetFindingState(ctx context.Context, req *securitycenterpb.SetFindingStateRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, 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.SetFindingState[0:len(c.CallOptions.SetFindingState):len(c.CallOptions.SetFindingState)], opts...)
+ var resp *securitycenterpb.Finding
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.SetFindingState(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// SetIamPolicy sets the access control policy on the specified Source.
+func (c *Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.SetIamPolicy[0:len(c.CallOptions.SetIamPolicy):len(c.CallOptions.SetIamPolicy)], opts...)
+ var resp *iampb.Policy
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.SetIamPolicy(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// TestIamPermissions returns the permissions that a caller has on the specified source.
+func (c *Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "resource", url.QueryEscape(req.GetResource())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.TestIamPermissions[0:len(c.CallOptions.TestIamPermissions):len(c.CallOptions.TestIamPermissions)], opts...)
+ var resp *iampb.TestIamPermissionsResponse
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.TestIamPermissions(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateFinding creates or updates a finding. The corresponding source must exist for a
+// finding creation to succeed.
+func (c *Client) UpdateFinding(ctx context.Context, req *securitycenterpb.UpdateFindingRequest, opts ...gax.CallOption) (*securitycenterpb.Finding, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "finding.name", url.QueryEscape(req.GetFinding().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateFinding[0:len(c.CallOptions.UpdateFinding):len(c.CallOptions.UpdateFinding)], opts...)
+ var resp *securitycenterpb.Finding
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.UpdateFinding(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateNotificationConfig updates a notification config.
+func (c *Client) UpdateNotificationConfig(ctx context.Context, req *securitycenterpb.UpdateNotificationConfigRequest, opts ...gax.CallOption) (*securitycenterpb.NotificationConfig, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "notification_config.name", url.QueryEscape(req.GetNotificationConfig().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateNotificationConfig[0:len(c.CallOptions.UpdateNotificationConfig):len(c.CallOptions.UpdateNotificationConfig)], opts...)
+ var resp *securitycenterpb.NotificationConfig
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.UpdateNotificationConfig(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateOrganizationSettings updates an organization’s settings.
+func (c *Client) UpdateOrganizationSettings(ctx context.Context, req *securitycenterpb.UpdateOrganizationSettingsRequest, opts ...gax.CallOption) (*securitycenterpb.OrganizationSettings, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "organization_settings.name", url.QueryEscape(req.GetOrganizationSettings().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateOrganizationSettings[0:len(c.CallOptions.UpdateOrganizationSettings):len(c.CallOptions.UpdateOrganizationSettings)], opts...)
+ var resp *securitycenterpb.OrganizationSettings
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.UpdateOrganizationSettings(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateSource updates a source.
+func (c *Client) UpdateSource(ctx context.Context, req *securitycenterpb.UpdateSourceRequest, opts ...gax.CallOption) (*securitycenterpb.Source, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "source.name", url.QueryEscape(req.GetSource().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateSource[0:len(c.CallOptions.UpdateSource):len(c.CallOptions.UpdateSource)], opts...)
+ var resp *securitycenterpb.Source
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.UpdateSource(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// UpdateSecurityMarks updates security marks.
+func (c *Client) UpdateSecurityMarks(ctx context.Context, req *securitycenterpb.UpdateSecurityMarksRequest, opts ...gax.CallOption) (*securitycenterpb.SecurityMarks, error) {
+ md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "security_marks.name", url.QueryEscape(req.GetSecurityMarks().GetName())))
+ ctx = insertMetadata(ctx, c.xGoogMetadata, md)
+ opts = append(c.CallOptions.UpdateSecurityMarks[0:len(c.CallOptions.UpdateSecurityMarks):len(c.CallOptions.UpdateSecurityMarks)], opts...)
+ var resp *securitycenterpb.SecurityMarks
+ err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
+ var err error
+ resp, err = c.client.UpdateSecurityMarks(ctx, req, settings.GRPC...)
+ return err
+ }, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+// RunAssetDiscoveryOperation manages a long-running operation from RunAssetDiscovery.
+type RunAssetDiscoveryOperation struct {
+ lro *longrunning.Operation
+}
+
+// RunAssetDiscoveryOperation returns a new RunAssetDiscoveryOperation from a given name.
+// The name must be that of a previously created RunAssetDiscoveryOperation, possibly from a different process.
+func (c *Client) RunAssetDiscoveryOperation(name string) *RunAssetDiscoveryOperation {
+ return &RunAssetDiscoveryOperation{
+ lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}),
+ }
+}
+
+// Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
+//
+// See documentation of Poll for error-handling information.
+func (op *RunAssetDiscoveryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*securitycenterpb.RunAssetDiscoveryResponse, error) {
+ var resp securitycenterpb.RunAssetDiscoveryResponse
+ if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {
+ return nil, err
+ }
+ return &resp, nil
+}
+
+// Poll fetches the latest state of the long-running operation.
+//
+// Poll also fetches the latest metadata, which can be retrieved by Metadata.
+//
+// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and
+// the operation has completed with failure, the error is returned and op.Done will return true.
+// If Poll succeeds and the operation has completed successfully,
+// op.Done will return true, and the response of the operation is returned.
+// If Poll succeeds and the operation has not completed, the returned response and error are both nil.
+func (op *RunAssetDiscoveryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*securitycenterpb.RunAssetDiscoveryResponse, error) {
+ var resp securitycenterpb.RunAssetDiscoveryResponse
+ if err := op.lro.Poll(ctx, &resp, opts...); err != nil {
+ return nil, err
+ }
+ if !op.Done() {
+ return nil, nil
+ }
+ return &resp, nil
+}
+
+// Metadata returns metadata associated with the long-running operation.
+// Metadata itself does not contact the server, but Poll does.
+// To get the latest metadata, call this method after a successful call to Poll.
+// If the metadata is not available, the returned metadata and error are both nil.
+func (op *RunAssetDiscoveryOperation) Metadata() (*emptypb.Empty, error) {
+ var meta emptypb.Empty
+ if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata {
+ return nil, nil
+ } else if err != nil {
+ return nil, err
+ }
+ return &meta, nil
+}
+
+// Done reports whether the long-running operation has completed.
+func (op *RunAssetDiscoveryOperation) Done() bool {
+ return op.lro.Done()
+}
+
+// Name returns the name of the long-running operation.
+// The name is assigned by the server and is unique within the service from which the operation is created.
+func (op *RunAssetDiscoveryOperation) Name() string {
+ return op.lro.Name()
+}
+
+// GroupResultIterator manages a stream of *securitycenterpb.GroupResult.
+type GroupResultIterator struct {
+ items []*securitycenterpb.GroupResult
+ 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 []*securitycenterpb.GroupResult, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *GroupResultIterator) 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 *GroupResultIterator) Next() (*securitycenterpb.GroupResult, error) {
+ var item *securitycenterpb.GroupResult
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *GroupResultIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *GroupResultIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
+// ListAssetsResponse_ListAssetsResultIterator manages a stream of *securitycenterpb.ListAssetsResponse_ListAssetsResult.
+type ListAssetsResponse_ListAssetsResultIterator struct {
+ items []*securitycenterpb.ListAssetsResponse_ListAssetsResult
+ 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 []*securitycenterpb.ListAssetsResponse_ListAssetsResult, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *ListAssetsResponse_ListAssetsResultIterator) 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 *ListAssetsResponse_ListAssetsResultIterator) Next() (*securitycenterpb.ListAssetsResponse_ListAssetsResult, error) {
+ var item *securitycenterpb.ListAssetsResponse_ListAssetsResult
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *ListAssetsResponse_ListAssetsResultIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *ListAssetsResponse_ListAssetsResultIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
+// ListFindingsResponse_ListFindingsResultIterator manages a stream of *securitycenterpb.ListFindingsResponse_ListFindingsResult.
+type ListFindingsResponse_ListFindingsResultIterator struct {
+ items []*securitycenterpb.ListFindingsResponse_ListFindingsResult
+ 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 []*securitycenterpb.ListFindingsResponse_ListFindingsResult, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *ListFindingsResponse_ListFindingsResultIterator) 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 *ListFindingsResponse_ListFindingsResultIterator) Next() (*securitycenterpb.ListFindingsResponse_ListFindingsResult, error) {
+ var item *securitycenterpb.ListFindingsResponse_ListFindingsResult
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *ListFindingsResponse_ListFindingsResultIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *ListFindingsResponse_ListFindingsResultIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
+// NotificationConfigIterator manages a stream of *securitycenterpb.NotificationConfig.
+type NotificationConfigIterator struct {
+ items []*securitycenterpb.NotificationConfig
+ 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 []*securitycenterpb.NotificationConfig, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *NotificationConfigIterator) 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 *NotificationConfigIterator) Next() (*securitycenterpb.NotificationConfig, error) {
+ var item *securitycenterpb.NotificationConfig
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *NotificationConfigIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *NotificationConfigIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
+
+// SourceIterator manages a stream of *securitycenterpb.Source.
+type SourceIterator struct {
+ items []*securitycenterpb.Source
+ 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 []*securitycenterpb.Source, nextPageToken string, err error)
+}
+
+// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
+func (it *SourceIterator) 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 *SourceIterator) Next() (*securitycenterpb.Source, error) {
+ var item *securitycenterpb.Source
+ if err := it.nextFunc(); err != nil {
+ return item, err
+ }
+ item = it.items[0]
+ it.items = it.items[1:]
+ return item, nil
+}
+
+func (it *SourceIterator) bufLen() int {
+ return len(it.items)
+}
+
+func (it *SourceIterator) takeBuf() interface{} {
+ b := it.items
+ it.items = nil
+ return b
+}
diff --git a/securitycenter/v1p1beta1/security_center_client_example_test.go b/securitycenter/v1p1beta1/security_center_client_example_test.go
new file mode 100644
index 0000000..572e57b
--- /dev/null
+++ b/securitycenter/v1p1beta1/security_center_client_example_test.go
@@ -0,0 +1,539 @@
+// 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 securitycenter_test
+
+import (
+ "context"
+
+ securitycenter "cloud.google.com/go/securitycenter/v1p1beta1"
+ "google.golang.org/api/iterator"
+ securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+ iampb "google.golang.org/genproto/googleapis/iam/v1"
+)
+
+func ExampleNewClient() {
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use client.
+ _ = c
+}
+
+func ExampleClient_CreateSource() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.CreateSourceRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateSource(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_CreateFinding() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.CreateFindingRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateFinding(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_CreateNotificationConfig() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.CreateNotificationConfigRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.CreateNotificationConfig(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_DeleteNotificationConfig() {
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.DeleteNotificationConfigRequest{
+ // TODO: Fill request struct fields.
+ }
+ err = c.DeleteNotificationConfig(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+}
+
+func ExampleClient_GetIamPolicy() {
+ // import iampb "google.golang.org/genproto/googleapis/iam/v1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &iampb.GetIamPolicyRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetIamPolicy(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_GetNotificationConfig() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.GetNotificationConfigRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetNotificationConfig(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_GetOrganizationSettings() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.GetOrganizationSettingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetOrganizationSettings(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_GetSource() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.GetSourceRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.GetSource(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_GroupAssets() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.GroupAssetsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.GroupAssets(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleClient_GroupFindings() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.GroupFindingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.GroupFindings(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleClient_ListAssets() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.ListAssetsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListAssets(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleClient_ListFindings() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.ListFindingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListFindings(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleClient_ListNotificationConfigs() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.ListNotificationConfigsRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListNotificationConfigs(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleClient_ListSources() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+ // import "google.golang.org/api/iterator"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.ListSourcesRequest{
+ // TODO: Fill request struct fields.
+ }
+ it := c.ListSources(ctx, req)
+ for {
+ resp, err := it.Next()
+ if err == iterator.Done {
+ break
+ }
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+ }
+}
+
+func ExampleClient_RunAssetDiscovery() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.RunAssetDiscoveryRequest{
+ // TODO: Fill request struct fields.
+ }
+ op, err := c.RunAssetDiscovery(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ resp, err := op.Wait(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_SetFindingState() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.SetFindingStateRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.SetFindingState(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_SetIamPolicy() {
+ // import iampb "google.golang.org/genproto/googleapis/iam/v1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &iampb.SetIamPolicyRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.SetIamPolicy(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_TestIamPermissions() {
+ // import iampb "google.golang.org/genproto/googleapis/iam/v1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &iampb.TestIamPermissionsRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.TestIamPermissions(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_UpdateFinding() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.UpdateFindingRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateFinding(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_UpdateNotificationConfig() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.UpdateNotificationConfigRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateNotificationConfig(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_UpdateOrganizationSettings() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.UpdateOrganizationSettingsRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateOrganizationSettings(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_UpdateSource() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.UpdateSourceRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateSource(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
+
+func ExampleClient_UpdateSecurityMarks() {
+ // import securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
+
+ ctx := context.Background()
+ c, err := securitycenter.NewClient(ctx)
+ if err != nil {
+ // TODO: Handle error.
+ }
+
+ req := &securitycenterpb.UpdateSecurityMarksRequest{
+ // TODO: Fill request struct fields.
+ }
+ resp, err := c.UpdateSecurityMarks(ctx, req)
+ if err != nil {
+ // TODO: Handle error.
+ }
+ // TODO: Use resp.
+ _ = resp
+}
diff --git a/spanner/admin/database/apiv1/database_admin_client.go b/spanner/admin/database/apiv1/database_admin_client.go
index 25663ee..ba6f71a 100644
--- a/spanner/admin/database/apiv1/database_admin_client.go
+++ b/spanner/admin/database/apiv1/database_admin_client.go
@@ -29,7 +29,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
iampb "google.golang.org/genproto/googleapis/iam/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
databasepb "google.golang.org/genproto/googleapis/spanner/admin/database/v1"
@@ -145,8 +145,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type DatabaseAdminClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
databaseAdminClient databasepb.DatabaseAdminClient
@@ -171,40 +171,42 @@
// list databases. It also enables updating the schema of pre-existing
// databases.
func NewDatabaseAdminClient(ctx context.Context, opts ...option.ClientOption) (*DatabaseAdminClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultDatabaseAdminClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultDatabaseAdminClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &DatabaseAdminClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultDatabaseAdminCallOptions(),
- databaseAdminClient: databasepb.NewDatabaseAdminClient(conn),
+ databaseAdminClient: databasepb.NewDatabaseAdminClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *DatabaseAdminClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *DatabaseAdminClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/spanner/admin/database/apiv1/doc.go b/spanner/admin/database/apiv1/doc.go
index 7d11052..9c1d44a 100644
--- a/spanner/admin/database/apiv1/doc.go
+++ b/spanner/admin/database/apiv1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/spanner/admin/instance/apiv1/doc.go b/spanner/admin/instance/apiv1/doc.go
index 1efc9f4..c3617f1 100644
--- a/spanner/admin/instance/apiv1/doc.go
+++ b/spanner/admin/instance/apiv1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/spanner/admin/instance/apiv1/instance_admin_client.go b/spanner/admin/instance/apiv1/instance_admin_client.go
index 20a8ec3..608aa75 100644
--- a/spanner/admin/instance/apiv1/instance_admin_client.go
+++ b/spanner/admin/instance/apiv1/instance_admin_client.go
@@ -29,7 +29,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
iampb "google.golang.org/genproto/googleapis/iam/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
instancepb "google.golang.org/genproto/googleapis/spanner/admin/instance/v1"
@@ -147,8 +147,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type InstanceAdminClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
instanceAdminClient instancepb.InstanceAdminClient
@@ -189,40 +189,42 @@
// instance resources, fewer resources are available for other
// databases in that instance, and their performance may suffer.
func NewInstanceAdminClient(ctx context.Context, opts ...option.ClientOption) (*InstanceAdminClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultInstanceAdminClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultInstanceAdminClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &InstanceAdminClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultInstanceAdminCallOptions(),
- instanceAdminClient: instancepb.NewInstanceAdminClient(conn),
+ instanceAdminClient: instancepb.NewInstanceAdminClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *InstanceAdminClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *InstanceAdminClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/spanner/apiv1/doc.go b/spanner/apiv1/doc.go
index 9a4bbee..48bc575 100644
--- a/spanner/apiv1/doc.go
+++ b/spanner/apiv1/doc.go
@@ -41,7 +41,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/spanner/apiv1/spanner_client.go b/spanner/apiv1/spanner_client.go
index 495fc90..6067f9c 100644
--- a/spanner/apiv1/spanner_client.go
+++ b/spanner/apiv1/spanner_client.go
@@ -27,7 +27,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
spannerpb "google.golang.org/genproto/googleapis/spanner/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -217,8 +217,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client spannerpb.SpannerClient
@@ -237,30 +237,32 @@
// The Cloud Spanner API can be used to manage sessions and execute
// transactions on data stored in Cloud Spanner databases.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: spannerpb.NewSpannerClient(conn),
+ client: spannerpb.NewSpannerClient(connPool),
}
c.SetGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/spanner/go.mod b/spanner/go.mod
index 2a5f10c..dd4da01 100644
--- a/spanner/go.mod
+++ b/spanner/go.mod
@@ -9,9 +9,10 @@
github.com/google/go-cmp v0.4.0
github.com/googleapis/gax-go/v2 v2.0.5
go.opencensus.io v0.22.3
- golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e // indirect
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
- google.golang.org/api v0.16.0
- google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67
+ google.golang.org/api v0.17.0
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
)
diff --git a/spanner/go.sum b/spanner/go.sum
index 7bdc297..6ae437f 100644
--- a/spanner/go.sum
+++ b/spanner/go.sum
@@ -117,6 +117,8 @@
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -229,8 +231,9 @@
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 h1:KW20qMcLRWuIgjdCpHFJbVZA7zsDKtFXPNcm7/eI5ZA=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e h1:JdEzLb04S2BEPrWqUDsgo7JXSq8pQlzIHbrBQN5o7TY=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -244,8 +247,8 @@
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0 h1:yzlyyDW/J0w8yNFJIhiAJy4kq74S+1DOLdawELNxFMA=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
-google.golang.org/api v0.16.0 h1:hhRbpE9nkabqMxGCewz2sikMYxm8yYWov7h2Eo4j3Is=
-google.golang.org/api v0.16.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.17.0 h1:0q95w+VuFtv4PAx4PZVQdBMmYbaCHbnfKaEiDIcVyag=
+google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -273,8 +276,8 @@
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90 h1:7THRSvPuzF1bql5kyFzX0JM0vpGhwuhskgJrJsbZ80Y=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 h1:MBO9fkVSrTpJ8vgHLPi5gb+ZWXEy7/auJN8yqyu9EiE=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
diff --git a/speech/apiv1/doc.go b/speech/apiv1/doc.go
index 18153eb..f66abae 100644
--- a/speech/apiv1/doc.go
+++ b/speech/apiv1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/speech/apiv1/speech_client.go b/speech/apiv1/speech_client.go
index 7142dca..def4ae2 100644
--- a/speech/apiv1/speech_client.go
+++ b/speech/apiv1/speech_client.go
@@ -25,7 +25,7 @@
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -84,8 +84,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client speechpb.SpeechClient
@@ -106,40 +106,42 @@
//
// Service that implements Google Cloud Speech API.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: speechpb.NewSpeechClient(conn),
+ client: speechpb.NewSpeechClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/speech/apiv1p1beta1/doc.go b/speech/apiv1p1beta1/doc.go
index 65dfa65..a712deb 100644
--- a/speech/apiv1p1beta1/doc.go
+++ b/speech/apiv1p1beta1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/speech/apiv1p1beta1/speech_client.go b/speech/apiv1p1beta1/speech_client.go
index ebf191d..493d9a3 100644
--- a/speech/apiv1p1beta1/speech_client.go
+++ b/speech/apiv1p1beta1/speech_client.go
@@ -25,7 +25,7 @@
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
speechpb "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -84,8 +84,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client speechpb.SpeechClient
@@ -106,40 +106,42 @@
//
// Service that implements Google Cloud Speech API.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: speechpb.NewSpeechClient(conn),
+ client: speechpb.NewSpeechClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/storage/go.mod b/storage/go.mod
index 17065d1..6ab651f 100644
--- a/storage/go.mod
+++ b/storage/go.mod
@@ -8,9 +8,10 @@
github.com/golang/protobuf v1.3.3
github.com/google/go-cmp v0.4.0
github.com/googleapis/gax-go/v2 v2.0.5
+ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
- golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e // indirect
- google.golang.org/api v0.16.0
- google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67
+ golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 // indirect
+ google.golang.org/api v0.17.0
+ google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6
google.golang.org/grpc v1.27.0
)
diff --git a/storage/go.sum b/storage/go.sum
index 90744e3..442f65a 100644
--- a/storage/go.sum
+++ b/storage/go.sum
@@ -111,6 +111,8 @@
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a h1:7Wlg8L54In96HTWOaI4sreLJ6qfyGuvSau5el3fK41Y=
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd h1:zkO/Lhoka23X63N9OSzpSeROEUQ5ODw47tM3YWjygbs=
+golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -219,8 +221,9 @@
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74 h1:KW20qMcLRWuIgjdCpHFJbVZA7zsDKtFXPNcm7/eI5ZA=
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e h1:JdEzLb04S2BEPrWqUDsgo7JXSq8pQlzIHbrBQN5o7TY=
-golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79 h1:RzUstWYelD2cZ/1coffqsx/LoMRuSJfKr6YM08GqyuQ=
+golang.org/x/tools v0.0.0-20200207200015-7cfd24942e79/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
@@ -234,8 +237,8 @@
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
google.golang.org/api v0.15.0 h1:yzlyyDW/J0w8yNFJIhiAJy4kq74S+1DOLdawELNxFMA=
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
-google.golang.org/api v0.16.0 h1:hhRbpE9nkabqMxGCewz2sikMYxm8yYWov7h2Eo4j3Is=
-google.golang.org/api v0.16.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
+google.golang.org/api v0.17.0 h1:0q95w+VuFtv4PAx4PZVQdBMmYbaCHbnfKaEiDIcVyag=
+google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -262,8 +265,8 @@
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90 h1:7THRSvPuzF1bql5kyFzX0JM0vpGhwuhskgJrJsbZ80Y=
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 h1:MBO9fkVSrTpJ8vgHLPi5gb+ZWXEy7/auJN8yqyu9EiE=
-google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6 h1:tirixpud1WdjE3/NrL9ar4ot0ADfwls8sOcIf1ivRDw=
+google.golang.org/genproto v0.0.0-20200207204624-4f3edf09f4f6/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
diff --git a/talent/apiv4beta1/doc.go b/talent/apiv4beta1/doc.go
index 12a6f4e..2578010 100644
--- a/talent/apiv4beta1/doc.go
+++ b/talent/apiv4beta1/doc.go
@@ -99,4 +99,4 @@
return "UNKNOWN"
}
-const versionClient = "20200205"
+const versionClient = "20200207"
diff --git a/texttospeech/apiv1/doc.go b/texttospeech/apiv1/doc.go
index 2668113..4716810 100644
--- a/texttospeech/apiv1/doc.go
+++ b/texttospeech/apiv1/doc.go
@@ -43,7 +43,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/texttospeech/apiv1/text_to_speech_client.go b/texttospeech/apiv1/text_to_speech_client.go
index 0034115..7f1973c 100644
--- a/texttospeech/apiv1/text_to_speech_client.go
+++ b/texttospeech/apiv1/text_to_speech_client.go
@@ -23,7 +23,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
texttospeechpb "google.golang.org/genproto/googleapis/cloud/texttospeech/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -79,8 +79,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client texttospeechpb.TextToSpeechClient
@@ -96,30 +96,32 @@
//
// Service that implements Google Cloud Text-to-Speech API.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: texttospeechpb.NewTextToSpeechClient(conn),
+ client: texttospeechpb.NewTextToSpeechClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/trace/apiv1/doc.go b/trace/apiv1/doc.go
index 0066aa4..3eb8f39 100644
--- a/trace/apiv1/doc.go
+++ b/trace/apiv1/doc.go
@@ -46,7 +46,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/trace/apiv1/trace_client.go b/trace/apiv1/trace_client.go
index 693f3fe..0a83255 100644
--- a/trace/apiv1/trace_client.go
+++ b/trace/apiv1/trace_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -94,8 +94,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client cloudtracepb.TraceServiceClient
@@ -115,30 +115,32 @@
// timed event which forms a node of the trace tree. Spans for a single trace
// may span multiple services.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: cloudtracepb.NewTraceServiceClient(conn),
+ client: cloudtracepb.NewTraceServiceClient(connPool),
}
c.SetGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// SetGoogleClientInfo sets the name and version of the application in
diff --git a/trace/apiv2/doc.go b/trace/apiv2/doc.go
index 1c67107..3bb79bb 100644
--- a/trace/apiv2/doc.go
+++ b/trace/apiv2/doc.go
@@ -46,7 +46,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/trace/apiv2/trace_client.go b/trace/apiv2/trace_client.go
index 4b92026..54713c7 100644
--- a/trace/apiv2/trace_client.go
+++ b/trace/apiv2/trace_client.go
@@ -25,7 +25,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -70,8 +70,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client cloudtracepb.TraceServiceClient
@@ -91,30 +91,32 @@
// timed event which forms a node of the trace tree. A single trace may
// contain span(s) from multiple services.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: cloudtracepb.NewTraceServiceClient(conn),
+ client: cloudtracepb.NewTraceServiceClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/translate/apiv3/doc.go b/translate/apiv3/doc.go
index 3c9a824..6299922 100644
--- a/translate/apiv3/doc.go
+++ b/translate/apiv3/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/translate/apiv3/translation_client.go b/translate/apiv3/translation_client.go
index a8a4aba..6c736cc 100644
--- a/translate/apiv3/translation_client.go
+++ b/translate/apiv3/translation_client.go
@@ -29,7 +29,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
translatepb "google.golang.org/genproto/googleapis/cloud/translate/v3"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -120,8 +120,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type TranslationClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
translationClient translatepb.TranslationServiceClient
@@ -142,40 +142,42 @@
//
// Provides natural language translation operations.
func NewTranslationClient(ctx context.Context, opts ...option.ClientOption) (*TranslationClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultTranslationClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultTranslationClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &TranslationClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultTranslationCallOptions(),
- translationClient: translatepb.NewTranslationServiceClient(conn),
+ translationClient: translatepb.NewTranslationServiceClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *TranslationClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *TranslationClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/videointelligence/apiv1/doc.go b/videointelligence/apiv1/doc.go
index a0317b8..97709a3 100644
--- a/videointelligence/apiv1/doc.go
+++ b/videointelligence/apiv1/doc.go
@@ -44,7 +44,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/videointelligence/apiv1/video_intelligence_client.go b/videointelligence/apiv1/video_intelligence_client.go
index c23e48d..da7a683 100644
--- a/videointelligence/apiv1/video_intelligence_client.go
+++ b/videointelligence/apiv1/video_intelligence_client.go
@@ -25,7 +25,7 @@
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -69,8 +69,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client videointelligencepb.VideoIntelligenceServiceClient
@@ -91,40 +91,42 @@
//
// Service that implements Google Cloud Video Intelligence API.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: videointelligencepb.NewVideoIntelligenceServiceClient(conn),
+ client: videointelligencepb.NewVideoIntelligenceServiceClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/videointelligence/apiv1beta2/doc.go b/videointelligence/apiv1beta2/doc.go
index 8727c09..01d4d6c 100644
--- a/videointelligence/apiv1beta2/doc.go
+++ b/videointelligence/apiv1beta2/doc.go
@@ -44,7 +44,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/videointelligence/apiv1beta2/video_intelligence_client.go b/videointelligence/apiv1beta2/video_intelligence_client.go
index af548f7..7129bf6 100644
--- a/videointelligence/apiv1beta2/video_intelligence_client.go
+++ b/videointelligence/apiv1beta2/video_intelligence_client.go
@@ -25,7 +25,7 @@
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
videointelligencepb "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -69,8 +69,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
client videointelligencepb.VideoIntelligenceServiceClient
@@ -91,40 +91,42 @@
//
// Service that implements Google Cloud Video Intelligence API.
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultCallOptions(),
- client: videointelligencepb.NewVideoIntelligenceServiceClient(conn),
+ client: videointelligencepb.NewVideoIntelligenceServiceClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/vision/apiv1/doc.go b/vision/apiv1/doc.go
index b10c42b..b58edee 100644
--- a/vision/apiv1/doc.go
+++ b/vision/apiv1/doc.go
@@ -42,7 +42,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/vision/apiv1/image_annotator_client.go b/vision/apiv1/image_annotator_client.go
index c9b7249..d79f166 100644
--- a/vision/apiv1/image_annotator_client.go
+++ b/vision/apiv1/image_annotator_client.go
@@ -27,7 +27,7 @@
lroauto "cloud.google.com/go/longrunning/autogen"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -110,8 +110,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ImageAnnotatorClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
imageAnnotatorClient visionpb.ImageAnnotatorClient
@@ -134,40 +134,42 @@
// images, such as face, landmark, logo, label, and text detection. The
// ImageAnnotator service returns detected entities from the images.
func NewImageAnnotatorClient(ctx context.Context, opts ...option.ClientOption) (*ImageAnnotatorClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultImageAnnotatorClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultImageAnnotatorClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ImageAnnotatorClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultImageAnnotatorCallOptions(),
- imageAnnotatorClient: visionpb.NewImageAnnotatorClient(conn),
+ imageAnnotatorClient: visionpb.NewImageAnnotatorClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ImageAnnotatorClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ImageAnnotatorClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/vision/apiv1/product_search_client.go b/vision/apiv1/product_search_client.go
index 82199eb..9462c62 100644
--- a/vision/apiv1/product_search_client.go
+++ b/vision/apiv1/product_search_client.go
@@ -29,7 +29,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1"
longrunningpb "google.golang.org/genproto/googleapis/longrunning"
"google.golang.org/grpc"
@@ -292,8 +292,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ProductSearchClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
productSearchClient visionpb.ProductSearchClient
@@ -327,40 +327,42 @@
// Each [Product][google.cloud.vision.v1.Product] has a collection of [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, named
// projects/*/locations/*/products/*/referenceImages/*
func NewProductSearchClient(ctx context.Context, opts ...option.ClientOption) (*ProductSearchClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultProductSearchClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultProductSearchClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ProductSearchClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultProductSearchCallOptions(),
- productSearchClient: visionpb.NewProductSearchClient(conn),
+ productSearchClient: visionpb.NewProductSearchClient(connPool),
}
c.setGoogleClientInfo()
- c.LROClient, err = lroauto.NewOperationsClient(ctx, option.WithGRPCConn(conn))
+ c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))
if err != nil {
- // This error "should not happen", since we are just reusing old connection
+ // This error "should not happen", since we are just reusing old connection pool
// and never actually need to dial.
- // If this does happen, we could leak conn. However, we cannot close conn:
- // If the user invoked the function with option.WithGRPCConn,
+ // If this does happen, we could leak connp. However, we cannot close conn:
+ // If the user invoked the constructor with option.WithGRPCConn,
// we would close a connection that's still in use.
- // TODO(pongad): investigate error conditions.
+ // TODO: investigate error conditions.
return nil, err
}
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ProductSearchClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ProductSearchClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/vision/apiv1p1beta1/doc.go b/vision/apiv1p1beta1/doc.go
index 06cc819..962a4f4 100644
--- a/vision/apiv1p1beta1/doc.go
+++ b/vision/apiv1p1beta1/doc.go
@@ -44,7 +44,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/vision/apiv1p1beta1/image_annotator_client.go b/vision/apiv1p1beta1/image_annotator_client.go
index 8c3ed5a..4d8e2fa 100644
--- a/vision/apiv1p1beta1/image_annotator_client.go
+++ b/vision/apiv1p1beta1/image_annotator_client.go
@@ -23,7 +23,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
visionpb "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -66,8 +66,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type ImageAnnotatorClient struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
imageAnnotatorClient visionpb.ImageAnnotatorClient
@@ -85,30 +85,32 @@
// images, such as face, landmark, logo, label, and text detection. The
// ImageAnnotator service returns detected entities from the images.
func NewImageAnnotatorClient(ctx context.Context, opts ...option.ClientOption) (*ImageAnnotatorClient, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultImageAnnotatorClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultImageAnnotatorClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &ImageAnnotatorClient{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultImageAnnotatorCallOptions(),
- imageAnnotatorClient: visionpb.NewImageAnnotatorClient(conn),
+ imageAnnotatorClient: visionpb.NewImageAnnotatorClient(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *ImageAnnotatorClient) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *ImageAnnotatorClient) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in
diff --git a/webrisk/apiv1beta1/doc.go b/webrisk/apiv1beta1/doc.go
index 12faedf..1d0b3aa 100644
--- a/webrisk/apiv1beta1/doc.go
+++ b/webrisk/apiv1beta1/doc.go
@@ -40,7 +40,7 @@
"google.golang.org/grpc/metadata"
)
-const versionClient = "20200205"
+const versionClient = "20200207"
func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context {
out, _ := metadata.FromOutgoingContext(ctx)
diff --git a/webrisk/apiv1beta1/web_risk_service_v1_beta1_client.go b/webrisk/apiv1beta1/web_risk_service_v1_beta1_client.go
index d80bde8..7146a9d 100644
--- a/webrisk/apiv1beta1/web_risk_service_v1_beta1_client.go
+++ b/webrisk/apiv1beta1/web_risk_service_v1_beta1_client.go
@@ -23,7 +23,7 @@
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/option"
- "google.golang.org/api/transport"
+ gtransport "google.golang.org/api/transport/grpc"
webriskpb "google.golang.org/genproto/googleapis/cloud/webrisk/v1beta1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -92,8 +92,8 @@
//
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type WebRiskServiceV1Beta1Client struct {
- // The connection to the service.
- conn *grpc.ClientConn
+ // Connection pool of gRPC connections to the service.
+ connPool gtransport.ConnPool
// The gRPC API client.
webRiskServiceV1Beta1Client webriskpb.WebRiskServiceV1Beta1Client
@@ -110,30 +110,32 @@
// Web Risk v1beta1 API defines an interface to detect malicious URLs on your
// website and in client applications.
func NewWebRiskServiceV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*WebRiskServiceV1Beta1Client, error) {
- conn, err := transport.DialGRPC(ctx, append(defaultWebRiskServiceV1Beta1ClientOptions(), opts...)...)
+ connPool, err := gtransport.DialPool(ctx, append(defaultWebRiskServiceV1Beta1ClientOptions(), opts...)...)
if err != nil {
return nil, err
}
c := &WebRiskServiceV1Beta1Client{
- conn: conn,
+ connPool: connPool,
CallOptions: defaultWebRiskServiceV1Beta1CallOptions(),
- webRiskServiceV1Beta1Client: webriskpb.NewWebRiskServiceV1Beta1Client(conn),
+ webRiskServiceV1Beta1Client: webriskpb.NewWebRiskServiceV1Beta1Client(connPool),
}
c.setGoogleClientInfo()
return c, nil
}
-// Connection returns the client's connection to the API service.
+// Connection returns a connection to the API service.
+//
+// Deprecated.
func (c *WebRiskServiceV1Beta1Client) Connection() *grpc.ClientConn {
- return c.conn
+ 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 *WebRiskServiceV1Beta1Client) Close() error {
- return c.conn.Close()
+ return c.connPool.Close()
}
// setGoogleClientInfo sets the name and version of the application in