v2

package
v0.0.0-...-11f2a26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	ID      string    `json:"id,omitempty"`
	Type    Type      `json:"type"`
	Size    int64     `json:"size,omitempty"` // length in bytes for regular files; 0 when Canceled or Deleted
	Status  Status    `json:"status"`
	Started time.Time `json:"started_at,omitempty"`
	Stopped time.Time `json:"stopped_at,omitempty"`
	Errors  []string  `json:"errors,omitempty"`
}

Bundle represents a bundle object received from the diagnostics API

func (*Bundle) IsFinished

func (b *Bundle) IsFinished() bool

IsFinished returns if the bundle has a status that indicating that it is finished.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a REST API wrapper around the new Diagnostics API.

func NewClient

func NewClient(baseClient *httpclient.Client) *Client

NewClient creates a new Client.

func (*Client) Create

func (c *Client) Create(options Options) (string, error)

Create creates a new cluster bundle and returns its ID.

func (*Client) Delete

func (c *Client) Delete(id string) error

Delete deletes the given cluster bundle.

func (*Client) Download

func (c *Client) Download(id string, dst io.Writer) error

Download downloads the bundle indicated by id into dst

func (*Client) Get

func (c *Client) Get(id string) (*Bundle, error)

Get gets a single bundle from the cluster

func (*Client) List

func (c *Client) List() ([]Bundle, error)

List gets a list of all cluster bundles.

type Options

type Options struct {
	Masters bool `json:"masters"`
	Agents  bool `json:"agents"`
}

Options represents a bundle creation options passed to the diagnostics Create API

type Status

type Status int

Status represents an bundle status

const (
	Unknown    Status = iota // No information about this bundle
	Started                  // Diagnostics is preparing
	InProgress               // Diagnostics in progress
	Done                     // Diagnostics finished and the file is ready to be downloaded
	Canceled                 // Diagnostics has been canceled
	Deleted                  // Diagnostics was finished but was deleted
	Failed                   // Diagnostics could not be downloaded
)

Possible statuses

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (Status) String

func (s Status) String() string

func (*Status) UnmarshalJSON

func (s *Status) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

type Type

type Type int

Type represents a bundle type

const (
	Local Type = iota
	Cluster
)

Possible types of diagnostics bundles

func (Type) MarshalJSON

func (s Type) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (Type) String

func (s Type) String() string

func (*Type) UnmarshalJSON

func (s *Type) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to the enum value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL