Skip to content

Commit

Permalink
Merge pull request #50 from grafeas/container-analysis-client
Browse files Browse the repository at this point in the history
containeranalysis: close grpcClient
  • Loading branch information
thepwagner authored Dec 15, 2021
2 parents 44492dd + b2da75d commit 3536639
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions v2/containeranalysis/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/docker/distribution/reference"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
grafeas "google.golang.org/genproto/googleapis/grafeas/v1"

voucher "github.com/grafeas/voucher/v2"
Expand Down Expand Up @@ -188,15 +189,13 @@ func (g *Client) GetBuildDetail(ctx context.Context, ref reference.Canonical) (r

// NewClient creates a new containeranalysis Grafeas Client.
func NewClient(ctx context.Context, binauthProject string, keyring signer.AttestationSigner) (*Client, error) {
var err error

caClient, err := containeranalysisapi.NewClient(ctx)
// These options emulate cloud.google.com/go/containeranalysis/apiv1.NewClient
grafeasClient, err := grafeasv1.NewClient(ctx, option.WithEndpoint("containeranalysis.googleapis.com:443"), option.WithScopes(containeranalysisapi.DefaultAuthScopes()...))
if err != nil {
return nil, err
}

client := &Client{
containeranalysis: caClient.GetGrafeasClient(),
containeranalysis: grafeasClient,
keyring: keyring,
binauthProject: binauthProject,
}
Expand Down
1 change: 1 addition & 0 deletions v2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/grafeas/voucher/v2
go 1.16

require (
// if updating containeranalysis or grafeas, ensure the options in containeranalysis/client.go are still valid
cloud.google.com/go/containeranalysis v0.1.0
cloud.google.com/go/grafeas v0.1.0
cloud.google.com/go/kms v1.0.0
Expand Down

0 comments on commit 3536639

Please sign in to comment.