inventory

package
v0.0.0-...-dac8b9b Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

FIXME: golangci-lint nolint:errcheck,gocritic,gosimple,govet,revive

Index

Constants

View Source
const (

	// Fields represents field we get from inventory
	Fields = "host_type,operating_system,greenboot_status,greenboot_fallback_detected,rpm_ostree_deployments,rhc_client_id,rhc_config_state"
	// FilterParams represents params to retrieve data from inventory
	FilterParams = "" /* 188-byte string literal not displayed */
)

Variables

This section is empty.

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) BuildURL

func (c *Client) BuildURL(parameters *Params) string

BuildURL call the inventoryApi endpoint

func (*Client) ReturnDeviceListByID

func (c *Client) ReturnDeviceListByID(deviceIDs []string) (Response, error)

ReturnDeviceListByID will return the list of devices by uuid

func (*Client) ReturnDevices

func (c *Client) ReturnDevices(parameters *Params) (Response, error)

ReturnDevices will return the list of devices without filter by tag or uuid

func (*Client) ReturnDevicesByID

func (c *Client) ReturnDevicesByID(deviceID string) (Response, error)

ReturnDevicesByID will return the list of devices by uuid

func (*Client) ReturnDevicesByTag

func (c *Client) ReturnDevicesByTag(tag string) (Response, error)

ReturnDevicesByTag will return the list of devices by tag

type ClientInterface

type ClientInterface interface {
	ReturnDevices(parameters *Params) (Response, error)
	ReturnDevicesByID(deviceID string) (Response, error)
	ReturnDeviceListByID(deviceIDs []string) (Response, error)
	ReturnDevicesByTag(tag string) (Response, error)
	BuildURL(parameters *Params) string
}

ClientInterface is an Interface to make request to InventoryAPI

func InitClient

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

InitClient initializes the client for Image Builder

type Device

type Device struct {
	ID              string        `json:"id"`
	DisplayName     string        `json:"display_name"`
	LastSeen        string        `json:"updated"`
	UpdateAvailable bool          `json:"update_available"`
	Ostree          SystemProfile `json:"system_profile"`
	Account         string        `json:"account"`
	OrgID           string        `json:"org_id"`
	Groups          []Group       `json:"groups"`
}

Device represents the struct of a Device on Inventory API

type Group

type Group struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type OSTree

type OSTree struct {
	Checksum string `json:"checksum"`
	Booted   bool   `json:"booted"`
}

OSTree represents the struct of a SystemProfile on Inventory API

type Params

type Params struct {
	PerPage      string
	Page         string
	OrderBy      string
	OrderHow     string
	HostnameOrID string
	DeviceStatus string
}

Params represents the struct of params to be sent

type Response

type Response struct {
	Total  int      `json:"total"`
	Count  int      `json:"count"`
	Result []Device `json:"results"`
}

Response lists devices returned by InventoryAPI

type SystemProfile

type SystemProfile struct {
	RHCClientID          string   `json:"rhc_client_id"`
	RpmOstreeDeployments []OSTree `json:"rpm_ostree_deployments"`
	HostType             string   `json:"host_type"`
}

SystemProfile represents the struct of a SystemProfile on Inventory API

Directories

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

Jump to

Keyboard shortcuts

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