Documentation
¶
Overview ¶
Package ops implements the metal ops service.
Index ¶
- Constants
- type Client
- func (c *Client) Delete(ctx context.Context, url string) error
- func (c *Client) Get(ctx context.Context, url string, resp any) error
- func (c *Client) Patch(ctx context.Context, url string, req, resp any) error
- func (c *Client) Post(ctx context.Context, url string, req, resp any) error
- func (c *Client) Put(ctx context.Context, url string, req, resp any) error
- func (c *Client) Request(ctx context.Context, method, path string, header map[string]string, ...) (*Response, error)
- type GetReportResponse
- type ReportScope
- type Response
Constants ¶
const DefaultPort = 8888
DefaultPort is the default port to listen on. It can be overridden with the --port flag.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a minimalist REST client for making HTTP requests to the mops service.
func (*Client) Get ¶
Get sends a GET request to the specified URL and decodes the response into the provided struct.
func (*Client) Patch ¶
Patch sends a PATCH request to the specified URL with the given request body and decodes the response into the provided struct.
func (*Client) Post ¶
Post sends a POST request to the specified URL with the given request body and decodes the response into the provided struct.
func (*Client) Put ¶
Put sends a PUT request to the specified URL with the given request body and decodes the response into the provided struct.
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, method, path string, header map[string]string, body io.Reader) (*Response, error)
Request sends an HTTP request to the specified path with the given method, headers, and body. It returns the HTTP response or an error if the request fails.
type GetReportResponse ¶
type GetReportResponse struct {
Report string `json:"report"`
}
type ReportScope ¶
ReportScope represents the scope of a report, which can be filtered by zone, cluster, and host. It provides a way to build a query string for generating reports based on these parameters.
func (*ReportScope) From ¶
func (r *ReportScope) From(req *http.Request)
From populates the ReportScope from an HTTP request. It extracts the "zone", "cluster", and "host" parameters from the query string of the request URL and assigns them to the corresponding fields in the ReportScope.
func (ReportScope) Query ¶
func (r ReportScope) Query() string
Query returns the query string for the report scope. If no parameters are set, it returns an empty string.