message: Changes to allow users to supply HTTP configuration to the Client constructor.
diff: @@ -23,6 +23,7 @@ import (
  "errors"
  "fmt"
  "io/ioutil"
  + "net/http"
  "runtime"
  "strings"
  @@ -50,10 +51,19 @@ type gcpClient struct {
  var _ registry.KMSClient = (*gcpClient)(nil)
  -// NewClient returns a new GCP KMS client which will use default
  -// credentials to handle keys with uriPrefix prefix.
  +// ClientConfig defines the configuration that can be provided to configure
  +// a GCP KMS client.
  +type ClientConfig struct {
  + // HTTP transport for use with the GCP KMS client.
  + // If it is nil, default config will be used.
  + HTTPTransport *http.Transport
  +}
  +
  +// NewClientWithConfig returns a new GCP KMS client
  +// using the provided ClientConfig.
  +// It will use default credentials to handle keys with uriPrefix prefix.
  // uriPrefix must have the following format: 'gcp-kms://[:path]'.
  -func NewClient(uriPrefix string) (registry.KMSClient, error) {
  +func NewClientWithConfig(uriPrefix string, config *ClientConfig) (registry.KMSClient, error) {
  if !strings.HasPrefix(strings.ToLower(uriPrefix), gcpPrefix) {
  return nil, fmt.Errorf("uriPrefix must start with %s", gcpPrefix)
  }
  @@ -63,6 +73,13 @@ func NewClient(uriPrefix string) (registry.KMSClient, error) {
  if err != nil {
  return nil, err
  }
  + if config != nil && config.HTTPTransport != nil {
  + t, ok := client.Transport.(*oauth2.Transport)
  + if !ok {
  + return nil, fmt.Errorf("unable to type assert HTTP client.Transport to *oauth2.Transport, got %T", client.Transport)
  + }
  + t.Base = config.HTTPTransport
  + }
  kmsService, err := cloudkms.New(client)
  if err != nil {
  @@ -75,6 +92,13 @@ func NewClient(uriPrefix string) (registry.KMSClient, error) {
  }, nil
  }
  +// NewClient returns a new GCP KMS client which will use default
  +// credentials to handle keys with uriPrefix prefix.
  +// uriPrefix must have the following format: 'gcp-kms://[:path]'.
  +func NewClient(uriPrefix string) (registry.KMSClient, error) {
  + return NewClientWithConfig(uriPrefix, nil)
  +}
  +
  // NewClientWithCredentials returns a new GCP KMS client which will use given
  // credentials to handle keys with uriPrefix prefix.
  // uriPrefix must have the following format: 'gcp-kms://[:path]'.
  