- 0.117.0 (latest)
- 0.116.0
- 0.115.1
- 0.114.0
- 0.113.0
- 0.112.2
- 0.111.0
- 0.110.10
- 0.109.0
- 0.108.0
- 0.107.0
- 0.106.0
- 0.105.0
- 0.104.0
- 0.103.0
- 0.102.1
- 0.101.1
- 0.100.2
- 0.99.0
- 0.98.0
- 0.97.0
- 0.96.0
- 0.95.0
- 0.94.1
- 0.93.3
- 0.92.3
- 0.91.1
- 0.90.0
- 0.89.0
- 0.88.0
- 0.87.0
- 0.86.0
- 0.85.0
- 0.84.0
- 0.83.0
- 0.82.0
- 0.81.0
- 0.80.0
- 0.79.0
- 0.78.0
- 0.77.0
- 0.76.0
- 0.75.0
Package grafeas is an auto-generated package for the Container Analysis API.
NOTE: This package is in alpha. It is not stable, and is likely to change.
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.
CallOptions
type CallOptions 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
}
CallOptions contains the retry settings for each method of Client.
Client
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
NewClient creates a new grafeas 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.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use client.
_ = c
}
func (*Client) BatchCreateNotes
func (c *Client) BatchCreateNotes(ctx context.Context, req *grafeaspb.BatchCreateNotesRequest, opts ...gax.CallOption) (*grafeaspb.BatchCreateNotesResponse, error)
BatchCreateNotes creates new notes in batch.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.BatchCreateNotesRequest{
// TODO: Fill request struct fields.
}
resp, err := c.BatchCreateNotes(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) BatchCreateOccurrences
func (c *Client) BatchCreateOccurrences(ctx context.Context, req *grafeaspb.BatchCreateOccurrencesRequest, opts ...gax.CallOption) (*grafeaspb.BatchCreateOccurrencesResponse, error)
BatchCreateOccurrences creates new occurrences in batch.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.BatchCreateOccurrencesRequest{
// TODO: Fill request struct fields.
}
resp, err := c.BatchCreateOccurrences(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) Close
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection
func (c *Client) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*Client) CreateNote
func (c *Client) CreateNote(ctx context.Context, req *grafeaspb.CreateNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
CreateNote creates a new note.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.CreateNoteRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) CreateOccurrence
func (c *Client) CreateOccurrence(ctx context.Context, req *grafeaspb.CreateOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
CreateOccurrence creates a new occurrence.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.CreateOccurrenceRequest{
// TODO: Fill request struct fields.
}
resp, err := c.CreateOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) DeleteNote
func (c *Client) DeleteNote(ctx context.Context, req *grafeaspb.DeleteNoteRequest, opts ...gax.CallOption) error
DeleteNote deletes the specified note.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.DeleteNoteRequest{
// TODO: Fill request struct fields.
}
err = c.DeleteNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DeleteOccurrence
func (c *Client) 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.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.DeleteOccurrenceRequest{
// TODO: Fill request struct fields.
}
err = c.DeleteOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) GetNote
func (c *Client) GetNote(ctx context.Context, req *grafeaspb.GetNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
GetNote gets the specified note.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.GetNoteRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetOccurrence
func (c *Client) GetOccurrence(ctx context.Context, req *grafeaspb.GetOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
GetOccurrence gets the specified occurrence.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.GetOccurrenceRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetOccurrenceNote
func (c *Client) 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.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.GetOccurrenceNoteRequest{
// TODO: Fill request struct fields.
}
resp, err := c.GetOccurrenceNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListNoteOccurrences
func (c *Client) 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.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
"google.golang.org/api/iterator"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.ListNoteOccurrencesRequest{
// TODO: Fill request struct fields.
}
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
}
}
func (*Client) ListNotes
func (c *Client) ListNotes(ctx context.Context, req *grafeaspb.ListNotesRequest, opts ...gax.CallOption) *NoteIterator
ListNotes lists notes for the specified project.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
"google.golang.org/api/iterator"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.ListNotesRequest{
// TODO: Fill request struct fields.
}
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
}
}
func (*Client) ListOccurrences
func (c *Client) ListOccurrences(ctx context.Context, req *grafeaspb.ListOccurrencesRequest, opts ...gax.CallOption) *OccurrenceIterator
ListOccurrences lists occurrences for the specified project.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
"google.golang.org/api/iterator"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.ListOccurrencesRequest{
// TODO: Fill request struct fields.
}
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
}
}
func (*Client) UpdateNote
func (c *Client) UpdateNote(ctx context.Context, req *grafeaspb.UpdateNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error)
UpdateNote updates the specified note.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.UpdateNoteRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateNote(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) UpdateOccurrence
func (c *Client) UpdateOccurrence(ctx context.Context, req *grafeaspb.UpdateOccurrenceRequest, opts ...gax.CallOption) (*grafeaspb.Occurrence, error)
UpdateOccurrence updates the specified occurrence.
Example
package main
import (
"context"
grafeas "cloud.google.com/go/grafeas/apiv1"
grafeaspb "google.golang.org/genproto/googleapis/grafeas/v1"
)
func main() {
ctx := context.Background()
c, err := grafeas.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &grafeaspb.UpdateOccurrenceRequest{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateOccurrence(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
NoteIterator
type NoteIterator struct {
// 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) 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.
OccurrenceIterator
type OccurrenceIterator struct {
// 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) 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.