package binaryauthorization
import "cloud.google.com/go/binaryauthorization/apiv1"
Package binaryauthorization is an auto-generated package for the Binary Authorization API.
The management interface for Binary Authorization, a system providing policy control for images deployed to Kubernetes Engine clusters, Anthos clusters on VMware, and Cloud Run.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/binaryauthorization/apiv1@latest ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := binaryauthorization.NewBinauthzManagementClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client
The following is an example of making an API call with the newly created client, mentioned above.
req := &binaryauthorizationpb.CreateAttestorRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#CreateAttestorRequest. } resp, err := c.CreateAttestor(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewBinauthzManagementClient 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.
Index ¶
- func DefaultAuthScopes() []string
- type AttestorIterator
- func (it *AttestorIterator) All() iter.Seq2[*binaryauthorizationpb.Attestor, error]
- func (it *AttestorIterator) Next() (*binaryauthorizationpb.Attestor, error)
- func (it *AttestorIterator) PageInfo() *iterator.PageInfo
- type BinauthzManagementCallOptions
- type BinauthzManagementClient
- func NewBinauthzManagementClient(ctx context.Context, opts ...option.ClientOption) (*BinauthzManagementClient, error)
- func NewBinauthzManagementRESTClient(ctx context.Context, opts ...option.ClientOption) (*BinauthzManagementClient, error)
- func (c *BinauthzManagementClient) Close() error
- func (c *BinauthzManagementClient) Connection() *grpc.ClientConn
- func (c *BinauthzManagementClient) CreateAttestor(ctx context.Context, req *binaryauthorizationpb.CreateAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error)
- func (c *BinauthzManagementClient) DeleteAttestor(ctx context.Context, req *binaryauthorizationpb.DeleteAttestorRequest, opts ...gax.CallOption) error
- func (c *BinauthzManagementClient) GetAttestor(ctx context.Context, req *binaryauthorizationpb.GetAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error)
- func (c *BinauthzManagementClient) GetPolicy(ctx context.Context, req *binaryauthorizationpb.GetPolicyRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Policy, error)
- func (c *BinauthzManagementClient) ListAttestors(ctx context.Context, req *binaryauthorizationpb.ListAttestorsRequest, opts ...gax.CallOption) *AttestorIterator
- func (c *BinauthzManagementClient) UpdateAttestor(ctx context.Context, req *binaryauthorizationpb.UpdateAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error)
- func (c *BinauthzManagementClient) UpdatePolicy(ctx context.Context, req *binaryauthorizationpb.UpdatePolicyRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Policy, error)
- type SystemPolicyCallOptions
- type SystemPolicyClient
- func NewSystemPolicyClient(ctx context.Context, opts ...option.ClientOption) (*SystemPolicyClient, error)
- func NewSystemPolicyRESTClient(ctx context.Context, opts ...option.ClientOption) (*SystemPolicyClient, error)
- func (c *SystemPolicyClient) Close() error
- func (c *SystemPolicyClient) Connection() *grpc.ClientConn
- func (c *SystemPolicyClient) GetSystemPolicy(ctx context.Context, req *binaryauthorizationpb.GetSystemPolicyRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Policy, error)
- type ValidationHelperCallOptions
- type ValidationHelperClient
- func NewValidationHelperClient(ctx context.Context, opts ...option.ClientOption) (*ValidationHelperClient, error)
- func NewValidationHelperRESTClient(ctx context.Context, opts ...option.ClientOption) (*ValidationHelperClient, error)
- func (c *ValidationHelperClient) Close() error
- func (c *ValidationHelperClient) Connection() *grpc.ClientConn
- func (c *ValidationHelperClient) ValidateAttestationOccurrence(ctx context.Context, req *binaryauthorizationpb.ValidateAttestationOccurrenceRequest, opts ...gax.CallOption) (*binaryauthorizationpb.ValidateAttestationOccurrenceResponse, error)
Examples ¶
- BinauthzManagementClient.CreateAttestor
- BinauthzManagementClient.DeleteAttestor
- BinauthzManagementClient.GetAttestor
- BinauthzManagementClient.GetPolicy
- BinauthzManagementClient.ListAttestors
- BinauthzManagementClient.ListAttestors (All)
- BinauthzManagementClient.UpdateAttestor
- BinauthzManagementClient.UpdatePolicy
- NewBinauthzManagementClient
- NewBinauthzManagementRESTClient
- NewSystemPolicyClient
- NewSystemPolicyRESTClient
- NewValidationHelperClient
- NewValidationHelperRESTClient
- SystemPolicyClient.GetSystemPolicy
- ValidationHelperClient.ValidateAttestationOccurrence
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type AttestorIterator ¶
type AttestorIterator struct { // 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 []*binaryauthorizationpb.Attestor, nextPageToken string, err error) // contains filtered or unexported fields }
AttestorIterator manages a stream of *binaryauthorizationpb.Attestor.
func (*AttestorIterator) All ¶
func (it *AttestorIterator) All() iter.Seq2[*binaryauthorizationpb.Attestor, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AttestorIterator) Next ¶
func (it *AttestorIterator) Next() (*binaryauthorizationpb.Attestor, error)
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 (*AttestorIterator) PageInfo ¶
func (it *AttestorIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type BinauthzManagementCallOptions ¶
type BinauthzManagementCallOptions struct { GetPolicy []gax.CallOption UpdatePolicy []gax.CallOption CreateAttestor []gax.CallOption GetAttestor []gax.CallOption UpdateAttestor []gax.CallOption ListAttestors []gax.CallOption DeleteAttestor []gax.CallOption }
BinauthzManagementCallOptions contains the retry settings for each method of BinauthzManagementClient.
type BinauthzManagementClient ¶
type BinauthzManagementClient struct { // The call options for this service. CallOptions *BinauthzManagementCallOptions // contains filtered or unexported fields }
BinauthzManagementClient is a client for interacting with Binary Authorization API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Google Cloud Management Service for Binary Authorization admission policies and attestation authorities.
This API implements a REST model with the following objects:
Policy Attestor
func NewBinauthzManagementClient ¶
func NewBinauthzManagementClient(ctx context.Context, opts ...option.ClientOption) (*BinauthzManagementClient, error)
NewBinauthzManagementClient creates a new binauthz management service v1 client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Google Cloud Management Service for Binary Authorization admission policies and attestation authorities.
This API implements a REST model with the following objects:
Policy Attestor
Example¶
Code:play
package main import ( "context" binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := binaryauthorization.NewBinauthzManagementClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
func NewBinauthzManagementRESTClient ¶
func NewBinauthzManagementRESTClient(ctx context.Context, opts ...option.ClientOption) (*BinauthzManagementClient, error)
NewBinauthzManagementRESTClient creates a new binauthz management service v1 rest client.
Google Cloud Management Service for Binary Authorization admission policies and attestation authorities.
This API implements a REST model with the following objects:
Policy Attestor
Example¶
Code:play
package main import ( "context" binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1" ) func main() { ctx := context.Background() // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c, err := binaryauthorization.NewBinauthzManagementRESTClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() // TODO: Use client. _ = c }
func (*BinauthzManagementClient) Close ¶
func (c *BinauthzManagementClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*BinauthzManagementClient) Connection ¶
func (c *BinauthzManagementClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*BinauthzManagementClient) CreateAttestor ¶
func (c *BinauthzManagementClient) CreateAttestor(ctx context.Context, req *binaryauthorizationpb.CreateAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error)
CreateAttestor creates an attestor, and returns a copy of the new
attestor. Returns NOT_FOUND if the project does not exist,
INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if the
attestor already exists.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewBinauthzManagementClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.CreateAttestorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#CreateAttestorRequest.
}
resp, err := c.CreateAttestor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*BinauthzManagementClient) DeleteAttestor ¶
func (c *BinauthzManagementClient) DeleteAttestor(ctx context.Context, req *binaryauthorizationpb.DeleteAttestorRequest, opts ...gax.CallOption) error
DeleteAttestor deletes an attestor. Returns NOT_FOUND if the
attestor does not exist.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewBinauthzManagementClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.DeleteAttestorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#DeleteAttestorRequest.
}
err = c.DeleteAttestor(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*BinauthzManagementClient) GetAttestor ¶
func (c *BinauthzManagementClient) GetAttestor(ctx context.Context, req *binaryauthorizationpb.GetAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error)
GetAttestor gets an attestor.
Returns NOT_FOUND if the attestor does not exist.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewBinauthzManagementClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.GetAttestorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#GetAttestorRequest.
}
resp, err := c.GetAttestor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*BinauthzManagementClient) GetPolicy ¶
func (c *BinauthzManagementClient) GetPolicy(ctx context.Context, req *binaryauthorizationpb.GetPolicyRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Policy, error)
GetPolicy a policy specifies the attestors that must attest to a container image, before the project is allowed to deploy that image. There is at most one policy per project. All image admission requests are permitted if a project has no policy.
Gets the policy for this project. Returns a default
policy if the project does not have one.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewBinauthzManagementClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.GetPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#GetPolicyRequest.
}
resp, err := c.GetPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*BinauthzManagementClient) ListAttestors ¶
func (c *BinauthzManagementClient) ListAttestors(ctx context.Context, req *binaryauthorizationpb.ListAttestorsRequest, opts ...gax.CallOption) *AttestorIterator
ListAttestors lists attestors.
Returns INVALID_ARGUMENT if the project does not exist.
Code:play
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewBinauthzManagementClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.ListAttestorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#ListAttestorsRequest.
}
it := c.ListAttestors(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*binaryauthorizationpb.ListAttestorsResponse)
}
}
Example (All)¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewBinauthzManagementClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.ListAttestorsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#ListAttestorsRequest.
}
for resp, err := range c.ListAttestors(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*BinauthzManagementClient) UpdateAttestor ¶
func (c *BinauthzManagementClient) UpdateAttestor(ctx context.Context, req *binaryauthorizationpb.UpdateAttestorRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Attestor, error)
UpdateAttestor updates an attestor.
Returns NOT_FOUND if the attestor does not exist.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewBinauthzManagementClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.UpdateAttestorRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#UpdateAttestorRequest.
}
resp, err := c.UpdateAttestor(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*BinauthzManagementClient) UpdatePolicy ¶
func (c *BinauthzManagementClient) UpdatePolicy(ctx context.Context, req *binaryauthorizationpb.UpdatePolicyRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Policy, error)
UpdatePolicy creates or updates a project’s policy, and returns a copy of the
new policy. A policy is always updated as a whole, to avoid race
conditions with concurrent policy enforcement (or management!)
requests. Returns NOT_FOUND if the project does not exist, INVALID_ARGUMENT
if the request is malformed.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewBinauthzManagementClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.UpdatePolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#UpdatePolicyRequest.
}
resp, err := c.UpdatePolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type SystemPolicyCallOptions ¶
type SystemPolicyCallOptions struct { GetSystemPolicy []gax.CallOption }
SystemPolicyCallOptions contains the retry settings for each method of SystemPolicyClient.
type SystemPolicyClient ¶
type SystemPolicyClient struct { // The call options for this service. CallOptions *SystemPolicyCallOptions // contains filtered or unexported fields }
SystemPolicyClient is a client for interacting with Binary Authorization API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
API for working with the system policy.
func NewSystemPolicyClient ¶
func NewSystemPolicyClient(ctx context.Context, opts ...option.ClientOption) (*SystemPolicyClient, error)
NewSystemPolicyClient creates a new system policy v1 client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
API for working with the system policy.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewSystemPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewSystemPolicyRESTClient ¶
func NewSystemPolicyRESTClient(ctx context.Context, opts ...option.ClientOption) (*SystemPolicyClient, error)
NewSystemPolicyRESTClient creates a new system policy v1 rest client.
API for working with the system policy.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewSystemPolicyRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*SystemPolicyClient) Close ¶
func (c *SystemPolicyClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*SystemPolicyClient) Connection ¶
func (c *SystemPolicyClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*SystemPolicyClient) GetSystemPolicy ¶
func (c *SystemPolicyClient) GetSystemPolicy(ctx context.Context, req *binaryauthorizationpb.GetSystemPolicyRequest, opts ...gax.CallOption) (*binaryauthorizationpb.Policy, error)
GetSystemPolicy gets the current system policy in the specified location.
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewSystemPolicyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.GetSystemPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#GetSystemPolicyRequest.
}
resp, err := c.GetSystemPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type ValidationHelperCallOptions ¶
type ValidationHelperCallOptions struct { ValidateAttestationOccurrence []gax.CallOption }
ValidationHelperCallOptions contains the retry settings for each method of ValidationHelperClient.
type ValidationHelperClient ¶
type ValidationHelperClient struct { // The call options for this service. CallOptions *ValidationHelperCallOptions // contains filtered or unexported fields }
ValidationHelperClient is a client for interacting with Binary Authorization API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
BinAuthz Attestor verification
func NewValidationHelperClient ¶
func NewValidationHelperClient(ctx context.Context, opts ...option.ClientOption) (*ValidationHelperClient, error)
NewValidationHelperClient creates a new validation helper v1 client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
BinAuthz Attestor verification
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewValidationHelperClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewValidationHelperRESTClient ¶
func NewValidationHelperRESTClient(ctx context.Context, opts ...option.ClientOption) (*ValidationHelperClient, error)
NewValidationHelperRESTClient creates a new validation helper v1 rest client.
BinAuthz Attestor verification
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewValidationHelperRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ValidationHelperClient) Close ¶
func (c *ValidationHelperClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ValidationHelperClient) Connection ¶
func (c *ValidationHelperClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*ValidationHelperClient) ValidateAttestationOccurrence ¶
func (c *ValidationHelperClient) ValidateAttestationOccurrence(ctx context.Context, req *binaryauthorizationpb.ValidateAttestationOccurrenceRequest, opts ...gax.CallOption) (*binaryauthorizationpb.ValidateAttestationOccurrenceResponse, error)
ValidateAttestationOccurrence returns whether the given Attestation for the given image URI
was signed by the given Attestor
Code:play
Example¶
package main
import (
"context"
binaryauthorization "cloud.google.com/go/binaryauthorization/apiv1"
binaryauthorizationpb "cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := binaryauthorization.NewValidationHelperClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &binaryauthorizationpb.ValidateAttestationOccurrenceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/binaryauthorization/apiv1/binaryauthorizationpb#ValidateAttestationOccurrenceRequest.
}
resp, err := c.ValidateAttestationOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Source Files ¶
auxiliary.go auxiliary_go123.go binauthz_management_client.go doc.go helpers.go system_policy_client.go validation_helper_client.go version.go
Directories ¶
Path | Synopsis |
---|---|
apiv1/binaryauthorizationpb |
- Version
- v1.9.3 (latest)
- Published
- Jan 2, 2025
- Platform
- linux/amd64
- Imports
- 26 packages
- Last checked
- 6 days ago –
Tools for package owners.