rest

package
v2.0.0-...-4a26371 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout should be > than ONTAP's default REST timeout, which is 15 seconds for GET requests
	DefaultTimeout = "30s"
	// DefaultDialerTimeout limits the time spent establishing a TCP connection
	DefaultDialerTimeout = 10 * time.Second
	Message              = "message"
	Code                 = "code"
	Target               = "target"
)

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "rest",
	Short: "ONTAP Rest Utility",
	Long:  "ONTAP Rest Utility - Explore available ONTAP REST APIs",
}

Functions

func Fetch

func Fetch(client *Client, href string) ([]gjson.Result, error)

Fetch collects all records

func FetchAnalytics

func FetchAnalytics(client *Client, href string) ([]gjson.Result, gjson.Result, error)

func FetchForCli

func FetchForCli(client *Client, href string, records *[]any, downloadAll bool, curls *[]string) error

FetchForCli used for CLI only

func FetchRestPerfData

func FetchRestPerfData(client *Client, href string, perfRecords *[]PerfRecord) error

FetchRestPerfData This method is used in PerfRest collector. This method returns timestamp per batch

func GetPollerAndAddr

func GetPollerAndAddr(pName string) (*conf.Poller, string, error)

func ReadOrDownloadSwagger

func ReadOrDownloadSwagger(pName string) (string, error)

Types

type Args

type Args struct {
	Item          string
	Poller        string
	API           string
	Endpoint      string
	Config        string
	SwaggerPath   string
	Fields        string
	Field         []string
	QueryField    string
	QueryValue    string
	DownloadAll   bool
	MaxRecords    string
	ForceDownload bool
	Verbose       bool
	Timeout       string
}

type Client

type Client struct {
	Logger *logging.Logger

	Timeout time.Duration

	Metadata *util.Metadata
	// contains filtered or unexported fields
}

func New

func New(poller *conf.Poller, timeout time.Duration, credentials *auth.Credentials) (*Client, error)

func (*Client) Cluster

func (c *Client) Cluster() Cluster

func (*Client) GetRest

func (c *Client) GetRest(request string) ([]byte, error)

GetRest makes a REST request to the cluster and returns a json response as a []byte

func (*Client) Init

func (c *Client) Init(retries int) error

func (*Client) TraceLogSet

func (c *Client) TraceLogSet(collectorName string, config *node.Node)

func (*Client) UpdateClusterInfo

func (c *Client) UpdateClusterInfo(retries int) error

type Cluster

type Cluster struct {
	Name    string
	Info    string
	UUID    string
	Version [3]int
}

func (Cluster) GetVersion

func (cl Cluster) GetVersion() string

type HrefBuilder

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

func NewHrefBuilder

func NewHrefBuilder() *HrefBuilder

func (*HrefBuilder) APIPath

func (b *HrefBuilder) APIPath(apiPath string) *HrefBuilder

func (*HrefBuilder) Build

func (b *HrefBuilder) Build() string

func (*HrefBuilder) CounterSchema

func (b *HrefBuilder) CounterSchema(counterSchema []string) *HrefBuilder

func (*HrefBuilder) Fields

func (b *HrefBuilder) Fields(fields []string) *HrefBuilder

func (*HrefBuilder) Filter

func (b *HrefBuilder) Filter(filter []string) *HrefBuilder

func (*HrefBuilder) IsIgnoreUnknownFieldsEnabled

func (b *HrefBuilder) IsIgnoreUnknownFieldsEnabled(isIgnoreUnknownFieldsEnabled bool) *HrefBuilder

func (*HrefBuilder) MaxRecords

func (b *HrefBuilder) MaxRecords(maxRecords *int) *HrefBuilder

func (*HrefBuilder) QueryFields

func (b *HrefBuilder) QueryFields(queryFields string) *HrefBuilder

func (*HrefBuilder) QueryValue

func (b *HrefBuilder) QueryValue(queryValue string) *HrefBuilder

func (*HrefBuilder) ReturnTimeout

func (b *HrefBuilder) ReturnTimeout(returnTimeout *int) *HrefBuilder

type Pagination

type Pagination struct {
	Records    []any `json:"records"`
	NumRecords int   `json:"num_records"`
	Links      *struct {
		Next struct {
			Href string `json:"href"`
		} `json:"next"`
	} `json:"_links,omitempty"`
}

type PerfRecord

type PerfRecord struct {
	Records   gjson.Result `json:"records"`
	Timestamp int64        `json:"time"`
}

type Results

type Results struct {
	Poller         string `json:"poller,omitempty"`
	Addr           string `json:"addr,omitempty"`
	API            string `json:"api,omitempty"`
	Version        string `json:"version,omitempty"`
	ClusterName    string `json:"cluster_name,omitempty"`
	Records        []any  `json:"records"`
	NumRecords     int    `json:"num_records"`
	PollDurationMs int64  `json:"poll_ms"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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