rhsm

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	BaseURL       string
	Client        *Client
	Resources     map[string]*RestResource
	DefaultRouter *CBRouter
}

func NewAPI

func NewAPI(baseurl, token string) *API

func (*API) AddResource

func (a *API) AddResource(name string, resource *RestResource)

func (*API) Call

func (a *API) Call(name string, params map[string]string, body interface{}) error

func (*API) ListResources

func (a *API) ListResources() []string

type CBRouter

type CBRouter struct {
	Routers       map[int]RouterFunc
	DefaultRouter RouterFunc
}

func NewRouter

func NewRouter() *CBRouter

func (*CBRouter) AddFunc

func (r *CBRouter) AddFunc(status int, handler RouterFunc)

func (*CBRouter) Call

func (r *CBRouter) Call(resp *http.Response) error

type Client

type Client struct {
	Client *http.Client
}

func NewClient

func NewClient(token string) *Client

func (*Client) ProcessRequest

func (c *Client) ProcessRequest(baseurl string, resource *RestResource, params map[string]string, body interface{}) error

type RestResource

type RestResource struct {
	Method   string
	Endpoint string
	Router   *CBRouter
}

func NewRestResource

func NewRestResource(method, endpoint string, router *CBRouter) *RestResource

func (*RestResource) RenderEndpoint

func (r *RestResource) RenderEndpoint(params map[string]string) string

type RouterFunc

type RouterFunc func(resp *http.Response) error

Jump to

Keyboard shortcuts

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