mops

package module
v0.0.0-...-ed0f381 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package ops implements the metal ops service.

Index

Constants

View Source
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

type Client struct {
	http.Client

	URL   string
	Debug bool
}

Client is a minimalist REST client for making HTTP requests to the mops service.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, url string) error

Delete sends a DELETE request to the specified URL.

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string, resp any) error

Get sends a GET request to the specified URL and decodes the response into the provided struct.

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, url string, req, resp any) error

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

func (c *Client) Post(ctx context.Context, url string, req, resp any) error

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

func (c *Client) Put(ctx context.Context, url string, req, resp any) error

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

type ReportScope struct {
	Zone    string
	Cluster string
	Host    string
}

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.

type Response

type Response struct {
	Header http.Header
	Body   io.Reader
}

Response represents an HTTP response from the mops service.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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