go: cloud.google.com/go/containeranalysis/apiv1 Index | Examples | Files

package containeranalysis

import "cloud.google.com/go/containeranalysis/apiv1"

Package containeranalysis is an auto-generated package for the Container Analysis API.

NOTE: This package is in beta. It is not stable, and may be subject to changes.

An implementation of the Grafeas API, which stores, and enables querying and retrieval of critical metadata about all of your software artifacts.

Use of Context

The ctx passed to NewClient 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.

For information about setting deadlines, reusing contexts, and more please visit godoc.org/cloud.google.com/go.

Index

Examples

Package Files

container_analysis_client.go doc.go

func DefaultAuthScopes Uses

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

type CallOptions Uses

type CallOptions struct {
    SetIamPolicy       []gax.CallOption
    GetIamPolicy       []gax.CallOption
    TestIamPermissions []gax.CallOption
}

CallOptions contains the retry settings for each method of Client.

type Client Uses

type Client struct {

    // The call options for this service.
    CallOptions *CallOptions
    // contains filtered or unexported fields
}

Client 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.

func NewClient Uses

func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

NewClient creates a new container analysis 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:

ctx := context.Background()
c, err := containeranalysis.NewClient(ctx)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use client.
_ = c

func (*Client) Close Uses

func (c *Client) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*Client) Connection Uses

func (c *Client) Connection() *grpc.ClientConn

Connection returns the client's connection to the API service.

func (*Client) GetGrafeasClient Uses

func (c *Client) GetGrafeasClient() *grafeas.Client

GetGrafeasClient returns a grafeas client connected to containeranalysis.

Calling Close on either the grafeas or containeranalysis client will close the shared connection in both.

func (*Client) GetIamPolicy Uses

func (c *Client) 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:

ctx := context.Background()
c, err := containeranalysis.NewClient(ctx)
if err != nil {
    // TODO: Handle error.
}

req := &iampb.GetIamPolicyRequest{
    // TODO: Fill request struct fields.
}
resp, err := c.GetIamPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*Client) SetIamPolicy Uses

func (c *Client) 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:

ctx := context.Background()
c, err := containeranalysis.NewClient(ctx)
if err != nil {
    // TODO: Handle error.
}

req := &iampb.SetIamPolicyRequest{
    // TODO: Fill request struct fields.
}
resp, err := c.SetIamPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

func (*Client) TestIamPermissions Uses

func (c *Client) 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:

ctx := context.Background()
c, err := containeranalysis.NewClient(ctx)
if err != nil {
    // TODO: Handle error.
}

req := &iampb.TestIamPermissionsRequest{
    // TODO: Fill request struct fields.
}
resp, err := c.TestIamPermissions(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Package containeranalysis imports 14 packages (graph). Updated 2019-10-19. Refresh now. Tools for package owners.