package containeranalysis
import "cloud.google.com/go/containeranalysis/apiv1beta1"
Package containeranalysis is an auto-generated package for the Container Analysis API.
An implementation of the Grafeas API, which stores, and enables querying and retrieval of critical metadata about all of your software artifacts.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
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/containeranalysis/apiv1beta1@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 := containeranalysis.NewContainerAnalysisV1Beta1Client(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 := &containeranalysispb.ExportSBOMRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb#ExportSBOMRequest. } resp, err := c.ExportSBOM(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewContainerAnalysisV1Beta1Client 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 ContainerAnalysisV1Beta1CallOptions
- type ContainerAnalysisV1Beta1Client
- func NewContainerAnalysisV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*ContainerAnalysisV1Beta1Client, error)
- func NewContainerAnalysisV1Beta1RESTClient(ctx context.Context, opts ...option.ClientOption) (*ContainerAnalysisV1Beta1Client, error)
- func (c *ContainerAnalysisV1Beta1Client) Close() error
- func (c *ContainerAnalysisV1Beta1Client) Connection() *grpc.ClientConn
- func (c *ContainerAnalysisV1Beta1Client) ExportSBOM(ctx context.Context, req *containeranalysispb.ExportSBOMRequest, opts ...gax.CallOption) (*containeranalysispb.ExportSBOMResponse, error)
- func (c *ContainerAnalysisV1Beta1Client) GeneratePackagesSummary(ctx context.Context, req *containeranalysispb.GeneratePackagesSummaryRequest, opts ...gax.CallOption) (*containeranalysispb.PackagesSummaryResponse, error)
- func (c *ContainerAnalysisV1Beta1Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *ContainerAnalysisV1Beta1Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *ContainerAnalysisV1Beta1Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
- type GrafeasV1Beta1CallOptions
- type GrafeasV1Beta1Client
- func NewGrafeasV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*GrafeasV1Beta1Client, error)
- func NewGrafeasV1Beta1RESTClient(ctx context.Context, opts ...option.ClientOption) (*GrafeasV1Beta1Client, error)
- func (c *GrafeasV1Beta1Client) BatchCreateNotes(ctx context.Context, req *grafeaspb.BatchCreateNotesRequest, opts ...gax.CallOption) (*grafeaspb.BatchCreateNotesResponse, error)
- func (c *GrafeasV1Beta1Client) BatchCreateOccurrences(ctx context.Context, req *grafeaspb.BatchCreateOccurrencesRequest, opts ...gax.CallOption) (*grafeaspb.BatchCreateOccurrencesResponse, error)
- func (c *GrafeasV1Beta1Client) Close() error
- func (c *GrafeasV1Beta1Client) Connection() *grpc.ClientConn
- func (c *GrafeasV1Beta1Client) CreateNote(ctx context.Context, req *grafeaspb.CreateNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
- func (c *GrafeasV1Beta1Client) CreateOccurrence(ctx context.Context, req *grafeaspb.CreateOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
- func (c *GrafeasV1Beta1Client) DeleteNote(ctx context.Context, req *grafeaspb.DeleteNoteRequest, opts ...gax.CallOption) error
- func (c *GrafeasV1Beta1Client) DeleteOccurrence(ctx context.Context, req *grafeaspb.DeleteOccurrenceRequest, opts ...gax.CallOption) error
- func (c *GrafeasV1Beta1Client) GetNote(ctx context.Context, req *grafeaspb.GetNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
- func (c *GrafeasV1Beta1Client) GetOccurrence(ctx context.Context, req *grafeaspb.GetOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
- func (c *GrafeasV1Beta1Client) GetOccurrenceNote(ctx context.Context, req *grafeaspb.GetOccurrenceNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
- func (c *GrafeasV1Beta1Client) GetVulnerabilityOccurrencesSummary(ctx context.Context, req *grafeaspb.GetVulnerabilityOccurrencesSummaryRequest, opts ...gax.CallOption) (*grafeaspb.VulnerabilityOccurrencesSummary, error)
- func (c *GrafeasV1Beta1Client) ListNoteOccurrences(ctx context.Context, req *grafeaspb.ListNoteOccurrencesRequest, opts ...gax.CallOption) *OccurrenceIterator
- func (c *GrafeasV1Beta1Client) ListNotes(ctx context.Context, req *grafeaspb.ListNotesRequest, opts ...gax.CallOption) *NoteIterator
- func (c *GrafeasV1Beta1Client) ListOccurrences(ctx context.Context, req *grafeaspb.ListOccurrencesRequest, opts ...gax.CallOption) *OccurrenceIterator
- func (c *GrafeasV1Beta1Client) UpdateNote(ctx context.Context, req *grafeaspb.UpdateNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
- func (c *GrafeasV1Beta1Client) UpdateOccurrence(ctx context.Context, req *grafeaspb.UpdateOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
- type NoteIterator
- func (it *NoteIterator) All() iter.Seq2[*grafeaspb.Note, error]
- func (it *NoteIterator) Next() (*grafeaspb.Note, error)
- func (it *NoteIterator) PageInfo() *iterator.PageInfo
- type OccurrenceIterator
Examples ¶
- ContainerAnalysisV1Beta1Client.ExportSBOM
- ContainerAnalysisV1Beta1Client.GeneratePackagesSummary
- ContainerAnalysisV1Beta1Client.GetIamPolicy
- ContainerAnalysisV1Beta1Client.SetIamPolicy
- ContainerAnalysisV1Beta1Client.TestIamPermissions
- GrafeasV1Beta1Client.BatchCreateNotes
- GrafeasV1Beta1Client.BatchCreateOccurrences
- GrafeasV1Beta1Client.CreateNote
- GrafeasV1Beta1Client.CreateOccurrence
- GrafeasV1Beta1Client.DeleteNote
- GrafeasV1Beta1Client.DeleteOccurrence
- GrafeasV1Beta1Client.GetNote
- GrafeasV1Beta1Client.GetOccurrence
- GrafeasV1Beta1Client.GetOccurrenceNote
- GrafeasV1Beta1Client.GetVulnerabilityOccurrencesSummary
- GrafeasV1Beta1Client.ListNoteOccurrences
- GrafeasV1Beta1Client.ListNoteOccurrences (All)
- GrafeasV1Beta1Client.ListNotes
- GrafeasV1Beta1Client.ListNotes (All)
- GrafeasV1Beta1Client.ListOccurrences
- GrafeasV1Beta1Client.ListOccurrences (All)
- GrafeasV1Beta1Client.UpdateNote
- GrafeasV1Beta1Client.UpdateOccurrence
- NewContainerAnalysisV1Beta1Client
- NewContainerAnalysisV1Beta1RESTClient
- NewGrafeasV1Beta1Client
- NewGrafeasV1Beta1RESTClient
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type ContainerAnalysisV1Beta1CallOptions ¶
type ContainerAnalysisV1Beta1CallOptions struct { SetIamPolicy []gax.CallOption GetIamPolicy []gax.CallOption TestIamPermissions []gax.CallOption GeneratePackagesSummary []gax.CallOption ExportSBOM []gax.CallOption }
ContainerAnalysisV1Beta1CallOptions contains the retry settings for each method of ContainerAnalysisV1Beta1Client.
type ContainerAnalysisV1Beta1Client ¶
type ContainerAnalysisV1Beta1Client struct { // The call options for this service. CallOptions *ContainerAnalysisV1Beta1CallOptions // contains filtered or unexported fields }
ContainerAnalysisV1Beta1Client is a client for interacting with Container Analysis API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the Grafeas (at https://grafeas.io) API.
Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.
For example, an SSL vulnerability could affect multiple images. In this case, there would be one note for the vulnerability and an occurrence for each image with the vulnerability referring to that note.
func NewContainerAnalysisV1Beta1Client ¶
func NewContainerAnalysisV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*ContainerAnalysisV1Beta1Client, error)
NewContainerAnalysisV1Beta1Client creates a new container analysis v1 beta1 client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the Grafeas (at https://grafeas.io) API.
Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.
For example, an SSL vulnerability could affect multiple images. In this case,
there would be one note for the vulnerability and an occurrence for each
image with the vulnerability referring to that note.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
)
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 := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewContainerAnalysisV1Beta1RESTClient ¶
func NewContainerAnalysisV1Beta1RESTClient(ctx context.Context, opts ...option.ClientOption) (*ContainerAnalysisV1Beta1Client, error)
NewContainerAnalysisV1Beta1RESTClient creates a new container analysis v1 beta1 rest client.
Retrieves analysis results of Cloud components such as Docker container images. The Container Analysis API is an implementation of the Grafeas (at https://grafeas.io) API.
Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.
For example, an SSL vulnerability could affect multiple images. In this case,
there would be one note for the vulnerability and an occurrence for each
image with the vulnerability referring to that note.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
)
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 := containeranalysis.NewContainerAnalysisV1Beta1RESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*ContainerAnalysisV1Beta1Client) Close ¶
func (c *ContainerAnalysisV1Beta1Client) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*ContainerAnalysisV1Beta1Client) Connection ¶
func (c *ContainerAnalysisV1Beta1Client) 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 (*ContainerAnalysisV1Beta1Client) ExportSBOM ¶
func (c *ContainerAnalysisV1Beta1Client) ExportSBOM(ctx context.Context, req *containeranalysispb.ExportSBOMRequest, opts ...gax.CallOption) (*containeranalysispb.ExportSBOMResponse, error)
ExportSBOM generates an SBOM and other dependency information for the given resource.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
containeranalysispb "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb"
)
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 := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &containeranalysispb.ExportSBOMRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb#ExportSBOMRequest.
}
resp, err := c.ExportSBOM(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ContainerAnalysisV1Beta1Client) GeneratePackagesSummary ¶
func (c *ContainerAnalysisV1Beta1Client) GeneratePackagesSummary(ctx context.Context, req *containeranalysispb.GeneratePackagesSummaryRequest, opts ...gax.CallOption) (*containeranalysispb.PackagesSummaryResponse, error)
GeneratePackagesSummary gets a summary of the packages within a given resource.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
containeranalysispb "cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb"
)
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 := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &containeranalysispb.GeneratePackagesSummaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/containeranalysis/apiv1beta1/containeranalysispb#GeneratePackagesSummaryRequest.
}
resp, err := c.GeneratePackagesSummary(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ContainerAnalysisV1Beta1Client) GetIamPolicy ¶
func (c *ContainerAnalysisV1Beta1Client) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetIamPolicy gets the access control policy for a note or an occurrence resource. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or occurrence, respectively.
The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for
notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for
occurrences.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
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 := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.GetIamPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
}
resp, err := c.GetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ContainerAnalysisV1Beta1Client) SetIamPolicy ¶
func (c *ContainerAnalysisV1Beta1Client) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
SetIamPolicy sets the access control policy on the specified note or occurrence. Requires containeranalysis.notes.setIamPolicy or containeranalysis.occurrences.setIamPolicy permission if the resource is a note or an occurrence, respectively.
The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for
notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for
occurrences.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
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 := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.SetIamPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
}
resp, err := c.SetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*ContainerAnalysisV1Beta1Client) TestIamPermissions ¶
func (c *ContainerAnalysisV1Beta1Client) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
TestIamPermissions returns the permissions that a caller has on the specified note or occurrence. Requires list permission on the project (for example, containeranalysis.notes.list).
The resource takes the format projects/[PROJECT_ID]/notes/[NOTE_ID] for
notes and projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID] for
occurrences.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
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 := containeranalysis.NewContainerAnalysisV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.TestIamPermissionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
}
resp, err := c.TestIamPermissions(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type GrafeasV1Beta1CallOptions ¶
type GrafeasV1Beta1CallOptions struct { GetOccurrence []gax.CallOption ListOccurrences []gax.CallOption DeleteOccurrence []gax.CallOption CreateOccurrence []gax.CallOption BatchCreateOccurrences []gax.CallOption UpdateOccurrence []gax.CallOption GetOccurrenceNote []gax.CallOption GetNote []gax.CallOption ListNotes []gax.CallOption DeleteNote []gax.CallOption CreateNote []gax.CallOption BatchCreateNotes []gax.CallOption UpdateNote []gax.CallOption ListNoteOccurrences []gax.CallOption GetVulnerabilityOccurrencesSummary []gax.CallOption }
GrafeasV1Beta1CallOptions contains the retry settings for each method of GrafeasV1Beta1Client.
type GrafeasV1Beta1Client ¶
type GrafeasV1Beta1Client struct { // The call options for this service. CallOptions *GrafeasV1Beta1CallOptions // contains filtered or unexported fields }
GrafeasV1Beta1Client is a client for interacting with Container Analysis API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Grafeas (at grafeas.io) API.
Retrieves analysis results of Cloud components such as Docker container images.
Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.
For example, an SSL vulnerability could affect multiple images. In this case, there would be one note for the vulnerability and an occurrence for each image with the vulnerability referring to that note.
func NewGrafeasV1Beta1Client ¶
func NewGrafeasV1Beta1Client(ctx context.Context, opts ...option.ClientOption) (*GrafeasV1Beta1Client, error)
NewGrafeasV1Beta1Client creates a new grafeas v1 beta1 client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Grafeas (at grafeas.io) API.
Retrieves analysis results of Cloud components such as Docker container images.
Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.
For example, an SSL vulnerability could affect multiple images. In this case,
there would be one note for the vulnerability and an occurrence for each
image with the vulnerability referring to that note.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewGrafeasV1Beta1RESTClient ¶
func NewGrafeasV1Beta1RESTClient(ctx context.Context, opts ...option.ClientOption) (*GrafeasV1Beta1Client, error)
NewGrafeasV1Beta1RESTClient creates a new grafeas v1 beta1 rest client.
Grafeas (at grafeas.io) API.
Retrieves analysis results of Cloud components such as Docker container images.
Analysis results are stored as a series of occurrences. An Occurrence contains information about a specific analysis instance on a resource. An occurrence refers to a Note. A note contains details describing the analysis and is generally stored in a separate project, called a Provider. Multiple occurrences can refer to the same note.
For example, an SSL vulnerability could affect multiple images. In this case,
there would be one note for the vulnerability and an occurrence for each
image with the vulnerability referring to that note.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
)
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 := containeranalysis.NewGrafeasV1Beta1RESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*GrafeasV1Beta1Client) BatchCreateNotes ¶
func (c *GrafeasV1Beta1Client) BatchCreateNotes(ctx context.Context, req *grafeaspb.BatchCreateNotesRequest, opts ...gax.CallOption) (*grafeaspb.BatchCreateNotesResponse, error)
BatchCreateNotes creates new notes in batch.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.BatchCreateNotesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#BatchCreateNotesRequest.
}
resp, err := c.BatchCreateNotes(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) BatchCreateOccurrences ¶
func (c *GrafeasV1Beta1Client) BatchCreateOccurrences(ctx context.Context, req *grafeaspb.BatchCreateOccurrencesRequest, opts ...gax.CallOption) (*grafeaspb.BatchCreateOccurrencesResponse, error)
BatchCreateOccurrences creates new occurrences in batch.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.BatchCreateOccurrencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#BatchCreateOccurrencesRequest.
}
resp, err := c.BatchCreateOccurrences(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) Close ¶
func (c *GrafeasV1Beta1Client) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*GrafeasV1Beta1Client) Connection ¶
func (c *GrafeasV1Beta1Client) 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 (*GrafeasV1Beta1Client) CreateNote ¶
func (c *GrafeasV1Beta1Client) CreateNote(ctx context.Context, req *grafeaspb.CreateNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
CreateNote creates a new note.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.CreateNoteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#CreateNoteRequest.
}
resp, err := c.CreateNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) CreateOccurrence ¶
func (c *GrafeasV1Beta1Client) CreateOccurrence(ctx context.Context, req *grafeaspb.CreateOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
CreateOccurrence creates a new occurrence.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.CreateOccurrenceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#CreateOccurrenceRequest.
}
resp, err := c.CreateOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) DeleteNote ¶
func (c *GrafeasV1Beta1Client) DeleteNote(ctx context.Context, req *grafeaspb.DeleteNoteRequest, opts ...gax.CallOption) error
DeleteNote deletes the specified note.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.DeleteNoteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#DeleteNoteRequest.
}
err = c.DeleteNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*GrafeasV1Beta1Client) DeleteOccurrence ¶
func (c *GrafeasV1Beta1Client) DeleteOccurrence(ctx context.Context, req *grafeaspb.DeleteOccurrenceRequest, opts ...gax.CallOption) error
DeleteOccurrence deletes the specified occurrence. For example, use this method to delete an
occurrence when the occurrence is no longer applicable for the given
resource.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.DeleteOccurrenceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#DeleteOccurrenceRequest.
}
err = c.DeleteOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*GrafeasV1Beta1Client) GetNote ¶
func (c *GrafeasV1Beta1Client) GetNote(ctx context.Context, req *grafeaspb.GetNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
GetNote gets the specified note.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.GetNoteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#GetNoteRequest.
}
resp, err := c.GetNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) GetOccurrence ¶
func (c *GrafeasV1Beta1Client) GetOccurrence(ctx context.Context, req *grafeaspb.GetOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
GetOccurrence gets the specified occurrence.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.GetOccurrenceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#GetOccurrenceRequest.
}
resp, err := c.GetOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) GetOccurrenceNote ¶
func (c *GrafeasV1Beta1Client) GetOccurrenceNote(ctx context.Context, req *grafeaspb.GetOccurrenceNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
GetOccurrenceNote gets the note attached to the specified occurrence. Consumer projects can
use this method to get a note that belongs to a provider project.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.GetOccurrenceNoteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#GetOccurrenceNoteRequest.
}
resp, err := c.GetOccurrenceNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) GetVulnerabilityOccurrencesSummary ¶
func (c *GrafeasV1Beta1Client) GetVulnerabilityOccurrencesSummary(ctx context.Context, req *grafeaspb.GetVulnerabilityOccurrencesSummaryRequest, opts ...gax.CallOption) (*grafeaspb.VulnerabilityOccurrencesSummary, error)
GetVulnerabilityOccurrencesSummary gets a summary of the number and severity of occurrences.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.GetVulnerabilityOccurrencesSummaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#GetVulnerabilityOccurrencesSummaryRequest.
}
resp, err := c.GetVulnerabilityOccurrencesSummary(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) ListNoteOccurrences ¶
func (c *GrafeasV1Beta1Client) ListNoteOccurrences(ctx context.Context, req *grafeaspb.ListNoteOccurrencesRequest, opts ...gax.CallOption) *OccurrenceIterator
ListNoteOccurrences lists occurrences referencing the specified note. Provider projects can use
this method to get all occurrences across consumer projects referencing the
specified note.
Code:play
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
"google.golang.org/api/iterator"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.ListNoteOccurrencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#ListNoteOccurrencesRequest.
}
it := c.ListNoteOccurrences(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.(*grafeaspb.ListNoteOccurrencesResponse)
}
}
Example (All)¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.ListNoteOccurrencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#ListNoteOccurrencesRequest.
}
for resp, err := range c.ListNoteOccurrences(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*GrafeasV1Beta1Client) ListNotes ¶
func (c *GrafeasV1Beta1Client) ListNotes(ctx context.Context, req *grafeaspb.ListNotesRequest, opts ...gax.CallOption) *NoteIterator
ListNotes lists notes for the specified project.
Code:play
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
"google.golang.org/api/iterator"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.ListNotesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#ListNotesRequest.
}
it := c.ListNotes(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.(*grafeaspb.ListNotesResponse)
}
}
Example (All)¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.ListNotesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#ListNotesRequest.
}
for resp, err := range c.ListNotes(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*GrafeasV1Beta1Client) ListOccurrences ¶
func (c *GrafeasV1Beta1Client) ListOccurrences(ctx context.Context, req *grafeaspb.ListOccurrencesRequest, opts ...gax.CallOption) *OccurrenceIterator
ListOccurrences lists occurrences for the specified project.
Code:play
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
"google.golang.org/api/iterator"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.ListOccurrencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#ListOccurrencesRequest.
}
it := c.ListOccurrences(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.(*grafeaspb.ListOccurrencesResponse)
}
}
Example (All)¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.ListOccurrencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#ListOccurrencesRequest.
}
for resp, err := range c.ListOccurrences(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*GrafeasV1Beta1Client) UpdateNote ¶
func (c *GrafeasV1Beta1Client) UpdateNote(ctx context.Context, req *grafeaspb.UpdateNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
UpdateNote updates the specified note.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.UpdateNoteRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#UpdateNoteRequest.
}
resp, err := c.UpdateNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*GrafeasV1Beta1Client) UpdateOccurrence ¶
func (c *GrafeasV1Beta1Client) UpdateOccurrence(ctx context.Context, req *grafeaspb.UpdateOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
UpdateOccurrence updates the specified occurrence.
Code:play
Example¶
package main
import (
"context"
containeranalysis "cloud.google.com/go/containeranalysis/apiv1beta1"
grafeaspb "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas"
)
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 := containeranalysis.NewGrafeasV1Beta1Client(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &grafeaspb.UpdateOccurrenceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas#UpdateOccurrenceRequest.
}
resp, err := c.UpdateOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type NoteIterator ¶
type NoteIterator 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 []*grafeaspb.Note, nextPageToken string, err error) // contains filtered or unexported fields }
NoteIterator manages a stream of *grafeaspb.Note.
func (*NoteIterator) All ¶
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*NoteIterator) Next ¶
func (it *NoteIterator) Next() (*grafeaspb.Note, 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 (*NoteIterator) PageInfo ¶
func (it *NoteIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type OccurrenceIterator ¶
type OccurrenceIterator 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 []*grafeaspb.Occurrence, nextPageToken string, err error) // contains filtered or unexported fields }
OccurrenceIterator manages a stream of *grafeaspb.Occurrence.
func (*OccurrenceIterator) All ¶
func (it *OccurrenceIterator) All() iter.Seq2[*grafeaspb.Occurrence, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OccurrenceIterator) Next ¶
func (it *OccurrenceIterator) Next() (*grafeaspb.Occurrence, 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 (*OccurrenceIterator) PageInfo ¶
func (it *OccurrenceIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
Source Files ¶
auxiliary.go auxiliary_go123.go container_analysis_v1_beta1_client.go doc.go grafeas_v1_beta1_client.go helpers.go version.go
Directories ¶
Path | Synopsis |
---|---|
apiv1beta1/containeranalysispb | |
apiv1beta1/grafeas | |
apiv1beta1/grafeas/grafeaspb |
- Version
- v0.13.3 (latest)
- Published
- Jan 2, 2025
- Platform
- linux/amd64
- Imports
- 28 packages
- Last checked
- 5 days ago –
Tools for package owners.