all: remove remaining uses of gtransport.Dial

Fixes: #1777
Change-Id: Ia891c95c9c82fcd5d7b32cc9aa5bcbae9cbed5bb
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/56950
Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
diff --git a/bigquery/datatransfer/apiv1/data_source_client.go b/bigquery/datatransfer/apiv1/data_source_client.go
index ee945db..e0f3afe 100644
--- a/bigquery/datatransfer/apiv1/data_source_client.go
+++ b/bigquery/datatransfer/apiv1/data_source_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"
 	datatransferpb "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/metadata"
@@ -74,7 +74,7 @@
 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
 type DataSourceClient struct {
 	// The connection to the service.
-	conn *grpc.ClientConn
+	connPool gtransport.ConnPool
 
 	// The gRPC API client.
 	dataSourceClient datatransferpb.DataSourceServiceClient
@@ -92,15 +92,15 @@
 // configure transfer of their data from other Google Products into BigQuery.
 // This service exposes methods that should be used by data source backend.
 func NewDataSourceClient(ctx context.Context, opts ...option.ClientOption) (*DataSourceClient, error) {
-	conn, err := transport.DialGRPC(ctx, append(defaultDataSourceClientOptions(), opts...)...)
+	connPool, err := gtransport.DialPool(ctx, append(defaultDataSourceClientOptions(), opts...)...)
 	if err != nil {
 		return nil, err
 	}
 	c := &DataSourceClient{
-		conn:        conn,
+		connPool:    connPool,
 		CallOptions: defaultDataSourceCallOptions(),
 
-		dataSourceClient: datatransferpb.NewDataSourceServiceClient(conn),
+		dataSourceClient: datatransferpb.NewDataSourceServiceClient(connPool),
 	}
 	c.setGoogleClientInfo()
 
@@ -109,13 +109,13 @@
 
 // Connection returns the client's connection to the API service.
 func (c *DataSourceClient) 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 *DataSourceClient) 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/cloud_build_client.go b/cloudbuild/apiv1/cloud_build_client.go
index 07c0d93..9541055 100644
--- a/cloudbuild/apiv1/cloud_build_client.go
+++ b/cloudbuild/apiv1/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"
@@ -104,7 +104,7 @@
 // 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
+	connPool gtransport.ConnPool
 
 	// The gRPC API client.
 	client cloudbuildpb.CloudBuildClient
@@ -127,15 +127,15 @@
 // 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()
 	return c, nil
@@ -143,13 +143,13 @@
 
 // Connection returns the client's connection to the API service.
 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/containeranalysis/apiv1/container_analysis_client.go b/containeranalysis/apiv1/container_analysis_client.go
index 78a9b24..b2f2cb7 100644
--- a/containeranalysis/apiv1/container_analysis_client.go
+++ b/containeranalysis/apiv1/container_analysis_client.go
@@ -24,7 +24,7 @@
 	grafeas "cloud.google.com/go/grafeas/apiv1"
 	gax "github.com/googleapis/gax-go/v2"
 	"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/v1"
 	iampb "google.golang.org/genproto/googleapis/iam/v1"
 	"google.golang.org/grpc"
@@ -59,7 +59,7 @@
 // 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
+	connPool gtransport.ConnPool
 
 	// The gRPC API client.
 	client containeranalysispb.ContainerAnalysisClient
@@ -90,7 +90,7 @@
 // there would be one note for the vulnerability and an occurrence for each
 // image with the vulnerability referring to that note.
 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
 	}
@@ -99,10 +99,10 @@
 		return nil, err
 	}
 	c := &Client{
-		conn:        conn,
+		connPool:    connPool,
 		CallOptions: defaultCallOptions(),
 
-		client:        containeranalysispb.NewContainerAnalysisClient(conn),
+		client:        containeranalysispb.NewContainerAnalysisClient(connPool),
 		grafeasClient: gc,
 	}
 	c.setGoogleClientInfo()
@@ -119,13 +119,13 @@
 
 // Connection returns the client's connection to the API service.
 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/grafeas/apiv1/grafeas_client.go b/grafeas/apiv1/grafeas_client.go
index e9d16d6..4d74558 100644
--- a/grafeas/apiv1/grafeas_client.go
+++ b/grafeas/apiv1/grafeas_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"
 	grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
@@ -89,7 +89,7 @@
 // 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
+	connPool gtransport.ConnPool
 
 	// The gRPC API client.
 	client grafeaspb.GrafeasClient
@@ -118,15 +118,15 @@
 // there would be one note for the vulnerability and an occurrence for each
 // image with the vulnerability referring to that note.
 func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) {
-	conn, err := transport.DialGRPC(ctx, opts...)
+	connPool, err := gtransport.DialPool(ctx, opts...)
 	if err != nil {
 		return nil, err
 	}
 	c := &Client{
-		conn:        conn,
+		connPool:    connPool,
 		CallOptions: defaultCallOptions(),
 
-		client: grafeaspb.NewGrafeasClient(conn),
+		client: grafeaspb.NewGrafeasClient(connPool),
 	}
 	c.setGoogleClientInfo()
 	return c, nil
@@ -134,13 +134,13 @@
 
 // Connection returns the client's connection to the API service.
 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/iam/admin/apiv1/iam_client.go b/iam/admin/apiv1/iam_client.go
index 542c6c1..cd0a524 100644
--- a/iam/admin/apiv1/iam_client.go
+++ b/iam/admin/apiv1/iam_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"
 	adminpb "google.golang.org/genproto/googleapis/iam/admin/v1"
 	iampb "google.golang.org/genproto/googleapis/iam/v1"
 	"google.golang.org/grpc"
@@ -116,7 +116,7 @@
 // Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
 type IamClient struct {
 	// The connection to the service.
-	conn *grpc.ClientConn
+	connPool gtransport.ConnPool
 
 	// The gRPC API client.
 	iamClient adminpb.IAMClient
@@ -147,15 +147,15 @@
 // the account. The account value can be the email address or the
 // unique_id of the service account.
 func NewIamClient(ctx context.Context, opts ...option.ClientOption) (*IamClient, error) {
-	conn, err := transport.DialGRPC(ctx, append(defaultIamClientOptions(), opts...)...)
+	connPool, err := gtransport.DialPool(ctx, append(defaultIamClientOptions(), opts...)...)
 	if err != nil {
 		return nil, err
 	}
 	c := &IamClient{
-		conn:        conn,
+		connPool:    connPool,
 		CallOptions: defaultIamCallOptions(),
 
-		iamClient: adminpb.NewIAMClient(conn),
+		iamClient: adminpb.NewIAMClient(connPool),
 	}
 	c.setGoogleClientInfo()
 	return c, nil
@@ -163,13 +163,13 @@
 
 // Connection returns the client's connection to the API service.
 func (c *IamClient) 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 *IamClient) Close() error {
-	return c.conn.Close()
+	return c.connPool.Close()
 }
 
 // setGoogleClientInfo sets the name and version of the application in