inventorygroups

package
v0.0.0-...-744405a Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BasePath = "api/inventory/v1/groups"

BasePath the inventory groups base path

View Source
const DefaultPerPage = 50

DefaultPerPage the default per page limit when listing inventory groups

Variables

View Source
var ErrGroupHostsAreMandatory = errors.New("inventory group hosts are mandatory")
View Source
var ErrGroupNameIsMandatory = errors.New("inventory group name is mandatory")
View Source
var ErrGroupNotFound = errors.New("inventory group not found")
View Source
var ErrGroupUUIDIsMandatory = errors.New("inventory group uuid is mandatory")
View Source
var ErrGroupsRequestResponse = errors.New("inventory groups request error response")
View Source
var ErrParsingURL = errors.New("error occurred while parsing raw url")
View Source
var IOReadAll = io.ReadAll

IOReadAll The io body reader

View Source
var NewJSONEncoder = json.NewEncoder

NewJSONEncoder create a new json encoder

Functions

This section is empty.

Types

type Client

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

Client is the implementation of an ClientInterface

func (*Client) AddHostsToGroup

func (c *Client) AddHostsToGroup(groupUUID string, hosts []string) (*Group, error)

func (*Client) CreateGroup

func (c *Client) CreateGroup(groupName string, hostIDS []string) (*Group, error)

func (*Client) GetBaseURL

func (c *Client) GetBaseURL() (*url2.URL, error)

GetBaseURL return the base url of inventory groups

func (*Client) GetGroupByName

func (c *Client) GetGroupByName(name string) (*Group, error)

func (*Client) GetGroupByUUID

func (c *Client) GetGroupByUUID(groupUUID string) (*Group, error)

func (*Client) ListGroups

func (c *Client) ListGroups(requestParams ListGroupsParams) (*Response, error)

type ClientInterface

type ClientInterface interface {
	GetBaseURL() (*url2.URL, error)
	GetGroupByName(name string) (*Group, error)
	GetGroupByUUID(groupUUID string) (*Group, error)
	CreateGroup(groupName string, hostIDS []string) (*Group, error) // nolint:revive
	AddHostsToGroup(groupUUID string, hosts []string) (*Group, error)
	ListGroups(requestParams ListGroupsParams) (*Response, error)
}

ClientInterface is an Interface to make request to inventory Groups

func InitClient

func InitClient(ctx context.Context, log log.FieldLogger) ClientInterface

InitClient initializes the client for Image Builder

type CreateGroup

type CreateGroup struct {
	Name    string   `json:"name"`
	HostIDS []string `json:"host_ids,omitempty"` // nolint:revive
}

type Group

type Group struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	OrgID     string `json:"org_id"`
	HostCount int    `json:"host_count"`
}

Group the type representation returned from inventory groups endpoint

type ListGroupsParams

type ListGroupsParams struct {
	Name     string
	Page     int
	PerPage  int
	OrderBy  string
	OrderHow string
}

ListGroupsParams the parameters used for list request

type Response

type Response struct {
	Total   int     `json:"total"`
	Count   int     `json:"count"`
	Page    int     `json:"page"`
	PerPage int     `json:"per_page"`
	Results []Group `json:"results"`
}

Response the result type returned when getting a list of inventory groups

Directories

Path Synopsis
Package mock_inventorygroups is a generated GoMock package.
Package mock_inventorygroups is a generated GoMock package.

Jump to

Keyboard shortcuts

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