api

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Every Foreman API call has the following prefix to the path component
	// of the URL.  The client hepler functions utilize this to automatically
	// create endpoint URLs.
	FOREMAN_API_URL_PREFIX = "/api"
	// FOREMAN_KATELLO_API_URL_PREFIX is the Foreman Katello API endpoint
	FOREMAN_KATELLO_API_URL_PREFIX = "/katello/api"
	// API Prefix for Puppet plugin
	FOREMAN_PUPPET_API_URL_PREFIX = "/foreman_puppet/api"
	// The Foreman API allows you to request a specific API version in the
	// Accept header of the HTTP request.  The two supported versions (at
	// the time of writing) are 1 and 2, which version 1 planning on being
	// deprecated after version 1.17.
	FOREMAN_API_VERSION = "2"
)
View Source
const (
	// HostEndpointPrefix : Prefix appended to API url for hosts
	HostEndpointPrefix = "hosts"
	// PowerSuffix : Suffix appended to API url for power operations
	PowerSuffix = "power"
	// ComputeAttributesSuffix : Suffix appended to API url for getting the VM attributes
	ComputeAttributesSuffix = "vm_compute_attributes"
	// PowerOn : Power on operation
	PowerOn = "on"
	// PowerOff : Power off operation
	PowerOff = "off"
	// PowerSoft : Power reboot operation (soft)
	PowerSoft = "soft"
	// PowerCycle : Power reset operation (hard)
	PowerCycle = "cycle"
	// PowerState : Power state check operation
	PowerState = "state"
	// BootSuffix : Suffix appended to API url for power operations
	BootSuffix = "boot"
	// BootDisk : Boot to Disk
	BootDisk = "disk"
	// BootCdrom : Boot to CDROM
	BootCdrom = "cdrom"
	// BootPxe : Boot to PXE
	BootPxe = "pxe"
	// PowerBios : Boot to BIOS
	PowerBios = "bios"
)
View Source
const (
	SmartClassParameterEndpointPrefix      = "puppet/smarts_class_paramaters"
	SmartClassParameterQueryEndpointPrefix = "puppet/puppetclasses/%d/smart_class_parameters"
)
View Source
const (
	ArchitectureEndpointPrefix = "architectures"
)
View Source
const (
	CommonParameterEndpointPrefix = "/common_parameters"
)
View Source
const (
	ComputeProfileEndpointPrefix = "compute_profiles"
)
View Source
const (
	ComputeResourceEndpoint = "compute_resources"
)
View Source
const (
	ComputeResourceEndpointPrefix = "compute_resources"
)
View Source
const (
	DefaultTemplateEndpointPrefix = "/operatingsystems/%d/os_default_templates"
)
View Source
const (
	DomainEndpointPrefix = "domains"
)
View Source
const (
	EnvironmentEndpointPrefix = "environments"
)
View Source
const (
	HTTPProxyEndpointPrefix = "http_proxies"
)
View Source
const (
	HostgroupEndpointPrefix = "hostgroups"
)
View Source
const (
	// KatelloContentCredentialEndpointPrefix api endpoint prefix for katello content_credentials
	// 'katello/ will be removed, it's a marker to detect talking with katello api
	KatelloContentCredentialEndpointPrefix = "katello/content_credentials"
)
View Source
const (
	// KatelloProductEndpointPrefix api endpoint prefix for katello products
	// 'katello/ will be removed, it's a marker to detect talking with katello api
	KatelloProductEndpointPrefix = "katello/products"
)
View Source
const (
	// KatelloRepositoryEndpointPrefix api endpoint prefix for katello repositories
	// 'katello/ will be removed, it's a marker to detect talking with katello api
	KatelloRepositoryEndpointPrefix = "katello/repositories"
)
View Source
const (
	// KatelloSyncPlanEndpointPrefix api endpoint prefix for katello sync_plans
	// 'katello/ will be removed, it's a marker to detect talking with katello api
	// %d will be replaced with organization_id
	KatelloSyncPlanEndpointPrefix = "katello/organizations/%d/sync_plans"
)
View Source
const (
	MediaEndpointPrefix = "media"
)
View Source
const (
	ModelEndpointPrefix = "models"
)
View Source
const (
	OperatingSystemEndpointPrefix = "operatingsystems"
)
View Source
const (
	OverrideValueEndpointPrefix = "smart_class_parameters/%d/override_values"
)
View Source
const (
	ParameterEndpointPrefix = "/%s/%d/parameters"
)
View Source
const (
	PartitionTableEndpointPrefix = "ptables"
)
View Source
const (
	ProvisioningTemplateEndpointPrefix = "provisioning_templates"
)
View Source
const (
	PuppetClassEndpointPrefix = "puppet/puppetclasses"
)
View Source
const (
	SettingEndpointPrefix = "settings"
)
View Source
const (
	SmartProxyEndpointPrefix = "smart_proxies"
)
View Source
const (
	SubnetEndpointPrefix = "subnets"
)
View Source
const (
	TemplateKindEndpointPrefix = "template_kinds"
)
View Source
const (
	UserEndpointPrefix = "users"
)
View Source
const (
	UsergroupEndpointPrefix = "usergroups"
)

Variables

This section is empty.

Functions

func CheckDeleted

func CheckDeleted(d *schema.ResourceData, err error) error

Taken from terraform-openstack-provider CheckDeleted checks the error to see if it's a 404 (Not Found) and, if so, sets the resource ID to the empty string instead of throwing an error.

func FromKV

func FromKV(kv []ForemanKVParameter) (ret map[string]string)

Types

type BMCBoot

type BMCBoot struct {
	Device string `json:"device,omitempty"`
	Boot   struct {
		Action string `json:"action,omitempty"`
		Result bool   `json:"result,omitempty"`
	} `json:"boot,omitempty"`
}

BMCBoot struct used for marshal/unmarshal of BMC boot device valid boot devices are disk, cdrom, pxe, bios `omitempty` lets use the same struct for boot operations.BMCCommand

type Client

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

func NewClient

func NewClient(s Server, c ClientCredentials, cfg ClientConfig) *Client

NewClient creates a new instance of the REST client for communication with the API gateway.

func (*Client) CreateArchitecture

func (c *Client) CreateArchitecture(ctx context.Context, a *ForemanArchitecture) (*ForemanArchitecture, error)

CreateArchitecture creates a new ForemanArchitecture with the attributes of the supplied ForemanArchitecture reference and returns the created ForemanArchitecture reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateCommonParameter

func (c *Client) CreateCommonParameter(ctx context.Context, d *ForemanCommonParameter) (*ForemanCommonParameter, error)

CreateCommonParameter creates a new ForemanCommonParameter with the attributes of the supplied ForemanCommonParameter reference and returns the created ForemanCommonParameter reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateComputeResource

func (c *Client) CreateComputeResource(ctx context.Context, d *ForemanComputeResource) (*ForemanComputeResource, error)

CreateComputeResource creates a new ForemanComputeResource with the attributes of the supplied ForemanComputeResource reference and returns the created ForemanComputeResource reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateComputeprofile added in v0.6.2

func (c *Client) CreateComputeprofile(ctx context.Context, d *ForemanComputeProfile) (*ForemanComputeProfile, error)

func (*Client) CreateDefaultTemplate

func (c *Client) CreateDefaultTemplate(ctx context.Context, d *ForemanDefaultTemplate) (*ForemanDefaultTemplate, error)

CreateDefaultTemplate creates a new ForemanDefaultTemplate with the attributes of the supplied ForemanDefaultTemplate reference and returns the created ForemanDefaultTemplate reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateDomain

func (c *Client) CreateDomain(ctx context.Context, d *ForemanDomain) (*ForemanDomain, error)

CreateDomain creates a new ForemanDomain with the attributes of the supplied ForemanDomain reference and returns the created ForemanDomain reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateEnvironment

func (c *Client) CreateEnvironment(ctx context.Context, e *ForemanEnvironment) (*ForemanEnvironment, error)

CreateEnvironment creates a new ForemanEnvironment with the attributes of the supplied ForemanEnvironment reference and returns the created ForemanEnvironment reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateHTTPProxy

func (c *Client) CreateHTTPProxy(ctx context.Context, s *ForemanHTTPProxy) (*ForemanHTTPProxy, error)

CreateHTTPProxy creates a new ForemanHTTPProxy with the attributes of the supplied ForemanHTTPProxy reference and returns the created ForemanHTTPProxy reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateHost

func (c *Client) CreateHost(ctx context.Context, h *ForemanHost, retryCount int) (*ForemanHost, error)

CreateHost creates a new ForemanHost with the attributes of the supplied ForemanHost reference and returns the created ForemanHost reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateHostgroup

func (c *Client) CreateHostgroup(ctx context.Context, h *ForemanHostgroup) (*ForemanHostgroup, error)

CreateHostgroup creates a new ForemanHostgroup with the attributes of the supplied ForemanHostgroup reference and returns the created ForemanHostgroup reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateImage

func (c *Client) CreateImage(ctx context.Context, d *ForemanImage, compute_resource int) (*ForemanImage, error)

CreateImage creates a new ForemanImage with the attributes of the supplied ForemanImage reference and returns the created ForemanImage reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateKatelloContentCredential

func (c *Client) CreateKatelloContentCredential(ctx context.Context, s *ForemanKatelloContentCredential) (*ForemanKatelloContentCredential, error)

CreateKatelloContentCredential creates a new ForemanKatelloContentCredential with the attributes of the supplied ForemanKatelloContentCredential reference and returns the created ForemanKatelloContentCredential reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateKatelloProduct

func (c *Client) CreateKatelloProduct(ctx context.Context, p *ForemanKatelloProduct) (*ForemanKatelloProduct, error)

CreateKatelloProduct creates a new ForemanKatelloProduct with the attributes of the supplied ForemanKatelloProduct reference and returns the created ForemanKatelloProduct reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateKatelloRepository

func (c *Client) CreateKatelloRepository(ctx context.Context, p *ForemanKatelloRepository) (*ForemanKatelloRepository, error)

CreateKatelloRepository creates a new ForemanKatelloRepository with the attributes of the supplied ForemanKatelloRepository reference and returns the created ForemanKatelloRepository reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateKatelloSyncPlan

func (c *Client) CreateKatelloSyncPlan(ctx context.Context, sp *ForemanKatelloSyncPlan) (*ForemanKatelloSyncPlan, error)

CreateKatelloSyncPlan creates a new ForemanKatelloSyncPlan with the attributes of the supplied ForemanKatelloSyncPlan reference and returns the created ForemanKatelloSyncPlan reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateMedia

func (c *Client) CreateMedia(ctx context.Context, m *ForemanMedia) (*ForemanMedia, error)

CreateMedia creates a new ForemanMedia with the attributes of the supplied ForemanMedia reference and returns the created ForemanMedia reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateModel

func (c *Client) CreateModel(ctx context.Context, m *ForemanModel) (*ForemanModel, error)

CreateModel creates a new ForemanModel with the attributes of the supplied ForemanModel reference and returns the created ForemanModel reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateOperatingSystem

func (c *Client) CreateOperatingSystem(ctx context.Context, o *ForemanOperatingSystem) (*ForemanOperatingSystem, error)

CreateOperatingSystem creates a new ForemanOperatingSystem with the attributes of the supplied ForemanOperatingSystem reference and returns the created ForemanOperatingSystem reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateOverrideValue

func (c *Client) CreateOverrideValue(ctx context.Context, ov *ForemanOverrideValue) (*ForemanOverrideValue, error)

CreateOverrideValue creates a new ForemanOverrideValue with the attributes of the supplied ForemanOverrideValue reference and returns the created ForemanOverrideValue reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateParameter

func (c *Client) CreateParameter(ctx context.Context, d *ForemanParameter) (*ForemanParameter, error)

CreateParameter creates a new ForemanParameter with the attributes of the supplied ForemanParameter reference and returns the created ForemanParameter reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreatePartitionTable

func (c *Client) CreatePartitionTable(ctx context.Context, t *ForemanPartitionTable) (*ForemanPartitionTable, error)

CreatePartitionTable creates a new ForemanPartitionTable with the attributes of the supplied ForemanPartitionTable reference and returns the created ForemanPartitionTable reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateProvisioningTemplate

func (c *Client) CreateProvisioningTemplate(ctx context.Context, t *ForemanProvisioningTemplate) (*ForemanProvisioningTemplate, error)

CreateProvisioningTemplate creates a new ForemanProvisioningTemplate with the attributes of the supplied ForemanProvisioningTemplate reference and returns the created ForemanProvisioningTemplate reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateSmartProxy

func (c *Client) CreateSmartProxy(ctx context.Context, s *ForemanSmartProxy) (*ForemanSmartProxy, error)

CreateSmartProxy creates a new ForemanSmartProxy with the attributes of the supplied ForemanSmartProxy reference and returns the created ForemanSmartProxy reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateSubnet

func (c *Client) CreateSubnet(ctx context.Context, s *ForemanSubnet) (*ForemanSubnet, error)

CreateSubnet creates a new ForemanSubnet with the attributes of the supplied ForemanSubnet reference and returns the created ForemanSubnet reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, u *ForemanUser) (*ForemanUser, error)

CreateUser creates a new ForemanUser with the attributes of the supplied ForemanUser reference and returns the created ForemanUser reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) CreateUsergroup

func (c *Client) CreateUsergroup(ctx context.Context, h *ForemanUsergroup) (*ForemanUsergroup, error)

CreateUsergroup creates a new ForemanUsergroup with the attributes of the supplied ForemanUsergroup reference and returns the created ForemanUsergroup reference. The returned reference will have its ID and other API default values set by this function.

func (*Client) DeleteArchitecture

func (c *Client) DeleteArchitecture(ctx context.Context, id int) error

DeleteArchitecture deletes the ForemanArchitecture identified by the supplied ID

func (*Client) DeleteCommonParameter

func (c *Client) DeleteCommonParameter(ctx context.Context, d *ForemanCommonParameter, id int) error

DeleteCommonParameter deletes the ForemanCommonParameters for the given resource

func (*Client) DeleteComputeProfile added in v0.6.2

func (c *Client) DeleteComputeProfile(ctx context.Context, id int) error

func (*Client) DeleteComputeResource

func (c *Client) DeleteComputeResource(ctx context.Context, id int) error

DeleteComputeResource deletes the ForemanComputeResource identified by the supplied ID

func (*Client) DeleteDefaultTemplate

func (c *Client) DeleteDefaultTemplate(ctx context.Context, d *ForemanDefaultTemplate, id int) error

DeleteDefaultTemplate deletes the ForemanDefaultTemplates for the given resource

func (*Client) DeleteDomain

func (c *Client) DeleteDomain(ctx context.Context, id int) error

DeleteDomain deletes the ForemanDomain identified by the supplied ID

func (*Client) DeleteEnvironment

func (c *Client) DeleteEnvironment(ctx context.Context, id int) error

DeleteEnvironment deletes the ForemanEnvironment identified by the supplied ID

func (*Client) DeleteHTTPProxy

func (c *Client) DeleteHTTPProxy(ctx context.Context, id int) error

DeleteHTTPProxy deletes the ForemanHTTPProxy identified by the supplied ID

func (*Client) DeleteHost

func (c *Client) DeleteHost(ctx context.Context, id int) error

DeleteHost deletes the ForemanHost identified by the supplied ID

func (*Client) DeleteHostgroup

func (c *Client) DeleteHostgroup(ctx context.Context, id int) error

DeleteHostgroup deletes the ForemanHostgroup identified by the supplied ID

func (*Client) DeleteImage

func (c *Client) DeleteImage(ctx context.Context, compute_resource, id int) error

DeleteImage deletes the ForemanImage identified by the supplied ID

func (*Client) DeleteKatelloContentCredential

func (c *Client) DeleteKatelloContentCredential(ctx context.Context, id int) error

DeleteKatelloContentCredential deletes the ForemanKatelloContentCredential identified by the supplied ID

func (*Client) DeleteKatelloProduct

func (c *Client) DeleteKatelloProduct(ctx context.Context, id int) error

DeleteKatelloProduct deletes the ForemanKatelloProduct identified by the supplied ID

func (*Client) DeleteKatelloRepository

func (c *Client) DeleteKatelloRepository(ctx context.Context, id int) error

DeleteKatelloRepository deletes the ForemanKatelloRepository identified by the supplied ID

func (*Client) DeleteKatelloSyncPlan

func (c *Client) DeleteKatelloSyncPlan(ctx context.Context, id int) error

DeleteKatelloSyncPlan deletes the ForemanKatelloSyncPlan identified by the supplied ID

func (*Client) DeleteMedia

func (c *Client) DeleteMedia(ctx context.Context, id int) error

DeleteMedia deletes the ForemanMedia identified by the supplied ID

func (*Client) DeleteModel

func (c *Client) DeleteModel(ctx context.Context, id int) error

DeleteModel deletes the ForemanModel identified by the supplied ID

func (*Client) DeleteOperatingSystem

func (c *Client) DeleteOperatingSystem(ctx context.Context, id int) error

DeleteOperatingSystem deletes the ForemanOperatingSystem identified by the supplied ID

func (*Client) DeleteOverrideValue

func (c *Client) DeleteOverrideValue(ctx context.Context, id int, scp_id int) error

DeleteOverideValue deletes the ForemanOverrideValue identified by the supplied ID and smarts class param ID

func (*Client) DeleteParameter

func (c *Client) DeleteParameter(ctx context.Context, d *ForemanParameter, id int) error

DeleteParameter deletes the ForemanParameters for the given resource

func (*Client) DeletePartitionTable

func (c *Client) DeletePartitionTable(ctx context.Context, id int) error

DeletePartitionTable deletes the ForemanPartitionTable identified by the supplied ID

func (*Client) DeleteProvisioningTemplate

func (c *Client) DeleteProvisioningTemplate(ctx context.Context, id int) error

DeleteProvisioningTemplate deletes the ForemanProvisioningTemplate identified by the supplied ID

func (*Client) DeleteSmartProxy

func (c *Client) DeleteSmartProxy(ctx context.Context, id int) error

DeleteSmartProxy deletes the ForemanSmartProxy identified by the supplied ID

func (*Client) DeleteSubnet

func (c *Client) DeleteSubnet(ctx context.Context, id int) error

DeleteSubnet deletes the ForemanSubnet identified by the supplied ID

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, id int) error

DeleteUser deletes the ForemanUser identified by the supplied ID

func (*Client) DeleteUsergroup

func (c *Client) DeleteUsergroup(ctx context.Context, id int) error

DeleteUsergroup deletes the ForemanUsergroup identified by the supplied ID

func (*Client) NewRequestWithContext

func (client *Client) NewRequestWithContext(ctx context.Context, method string, endpoint string, body io.Reader) (*http.Request, error)

NewRequestWithContext constructs an HTTP request using the client configuration. Common request functionality is abstracted and wrapped into this function (ie: headers, cookies, MIME-info, etc). The client should never interact with the underlying HTTP client or request object directly.

If the user provides an invalid HTTP method, the function returns 'nil' for the request and will return an Error.

The following headers are added and set automatically:

User-Agent
ACCEPT
Content-Type
Authorization

method

The HTTP Verb to use.  This should correspond to a 'Method*' constant
from 'net/http'.

endpoint

The server's endpoint to send the request.  The endpoint value is
appended to the client's server URL to construct the full URL for the
request.  NewRequestWithContext() will automatically prepend the Foreman API URL
prefix to the endpoint.

body

Functions exactly like net/http/NewRequestWithContext()

func (*Client) QueryArchitecture

func (c *Client) QueryArchitecture(ctx context.Context, a *ForemanArchitecture) (QueryResponse, error)

QueryArchitecture queries for a ForemanArchitecture based on the attributes of the supplied ForemanArchitecture reference and returns a QueryResponse struct containing query/response metadata and the matching architectures.

func (*Client) QueryCommonParameter

func (c *Client) QueryCommonParameter(ctx context.Context, d *ForemanCommonParameter) (QueryResponse, error)

QueryCommonParameter queries for a ForemanCommonParameter based on the attributes of the supplied ForemanCommonParameter reference and returns a QueryResponse struct containing query/response metadata and the matching commonParameters.

func (*Client) QueryComputeProfile

func (c *Client) QueryComputeProfile(ctx context.Context, t *ForemanComputeProfile) (QueryResponse, error)

QueryComputeProfile queries for a ForemanComputeProfile based on the attributes of the supplied ForemanComputeProfile reference and returns a QueryResponse struct containing query/response metadata and the matching template kinds

func (*Client) QueryComputeResource

func (c *Client) QueryComputeResource(ctx context.Context, d *ForemanComputeResource) (QueryResponse, error)

QueryComputeResource queries for a ForemanComputeResource based on the attributes of the supplied ForemanComputeResource reference and returns a QueryResponse struct containing query/response metadata and the matching computeresources.

func (*Client) QueryDefaultTemplate

func (c *Client) QueryDefaultTemplate(ctx context.Context, d *ForemanDefaultTemplate) (QueryResponse, error)

QueryDefaultTemplate queries for a ForemanDefaultTemplate based on the attributes of the supplied ForemanDefaultTemplate reference and returns a QueryResponse struct containing query/response metadata and the matching parameters.

func (*Client) QueryDomain

func (c *Client) QueryDomain(ctx context.Context, d *ForemanDomain) (QueryResponse, error)

QueryDomain queries for a ForemanDomain based on the attributes of the supplied ForemanDomain reference and returns a QueryResponse struct containing query/response metadata and the matching domains.

func (*Client) QueryEnvironment

func (c *Client) QueryEnvironment(ctx context.Context, e *ForemanEnvironment) (QueryResponse, error)

QueryEnvironment queries for a ForemanEnvironment based on the attributes of the supplied ForemanEnvironment reference and returns a QueryResponse struct containing query/response metadata and the matching environments.

func (*Client) QueryHTTPProxy

func (c *Client) QueryHTTPProxy(ctx context.Context, s *ForemanHTTPProxy) (QueryResponse, error)

QueryHTTPProxy queries for a ForemanHTTPProxy based on the attributes of the supplied ForemanHTTPProxy reference and returns a QueryResponse struct containing query/response metadata and the matching smart proxy.

func (*Client) QueryHostgroup

func (c *Client) QueryHostgroup(ctx context.Context, h *ForemanHostgroup) (QueryResponse, error)

QueryHostgroup queries for a ForemanHostgroup based on the attributes of the supplied ForemanHostgroup reference and returns a QueryResponse struct containing query/response metadata and the matching hostgroups.

func (*Client) QueryImage

func (c *Client) QueryImage(ctx context.Context, d *ForemanImage) (QueryResponse, error)

QueryImage queries for a ForemanImage based on the attributes of the supplied ForemanImage reference and returns a QueryResponse struct containing query/response metadata and the matching images.

func (*Client) QueryKatelloContentCredential

func (c *Client) QueryKatelloContentCredential(ctx context.Context, s *ForemanKatelloContentCredential) (QueryResponse, error)

QueryKatelloContentCredential queries for a ForemanKatelloContentCredential based on the attributes of the supplied ForemanKatelloContentCredential reference and returns a QueryResponse struct containing query/response metadata and the matching smart proxy.

func (*Client) QueryKatelloProduct

func (c *Client) QueryKatelloProduct(ctx context.Context, p *ForemanKatelloProduct) (QueryResponse, error)

QueryKatelloProduct queries for a ForemanKatelloProduct based on the attributes of the supplied ForemanKatelloProduct reference and returns a QueryResponse struct containing query/response metadata and the matching sync plan.

func (*Client) QueryKatelloRepository

func (c *Client) QueryKatelloRepository(ctx context.Context, p *ForemanKatelloRepository) (QueryResponse, error)

QueryKatelloRepository queries for a ForemanKatelloRepository based on the attributes of the supplied ForemanKatelloRepository reference and returns a QueryResponse struct containing query/response metadata and the matching sync plan.

func (*Client) QueryKatelloSyncPlan

func (c *Client) QueryKatelloSyncPlan(ctx context.Context, sp *ForemanKatelloSyncPlan) (QueryResponse, error)

QueryKatelloSyncPlan queries for a ForemanKatelloSyncPlan based on the attributes of the supplied ForemanKatelloSyncPlan reference and returns a QueryResponse struct containing query/response metadata and the matching sync plan.

func (*Client) QueryMedia

func (c *Client) QueryMedia(ctx context.Context, m *ForemanMedia) (QueryResponse, error)

QueryMedia queries for a ForemanMedia based on the attributes of the supplied ForemanMedia reference and returns a QueryResponse struct containing query/response metadata and the matching media.

func (*Client) QueryModel

func (c *Client) QueryModel(ctx context.Context, m *ForemanModel) (QueryResponse, error)

QueryModel queries for a ForemanModel based on the attributes of the supplied ForemanModel reference and returns a QueryResponse struct containing query/response metadata and the matching model.

func (*Client) QueryOperatingSystem

func (c *Client) QueryOperatingSystem(ctx context.Context, o *ForemanOperatingSystem) (QueryResponse, error)

QueryOperatingSystem queries for a ForemanOperatingSystem based on the attributes of the supplied ForemanOperatingSystem reference and returns a QueryResponse struct containing query/response metadata and the matching operating systems.

func (*Client) QueryParameter

func (c *Client) QueryParameter(ctx context.Context, d *ForemanParameter) (QueryResponse, error)

QueryParameter queries for a ForemanParameter based on the attributes of the supplied ForemanParameter reference and returns a QueryResponse struct containing query/response metadata and the matching parameters.

func (*Client) QueryPartitionTable

func (c *Client) QueryPartitionTable(ctx context.Context, t *ForemanPartitionTable) (QueryResponse, error)

QueryPartitionTable queries for a ForemanPartitionTable based on the attributes of the supplied ForemanPartitionTable reference and returns a QueryResponse struct containing query/response metadata and the matching partition tables.

func (*Client) QueryProvisioningTemplate

func (c *Client) QueryProvisioningTemplate(ctx context.Context, t *ForemanProvisioningTemplate) (QueryResponse, error)

QueryProvisioningTemplate queries for a ForemanProvisioningTemplate based on the attributes of the supplied ForemanProvisioningTemplate reference and returns a QueryResponse struct containing query/response metadata and the matching templates.

func (*Client) QueryPuppetClass

func (c *Client) QueryPuppetClass(ctx context.Context, t *ForemanPuppetClass) (QueryResponse, error)

QueryPuppetClass queries for a ForemanPuppetClass based on the attributes of the supplied ForemanPuppetClass reference and returns a QueryResponse struct containing query/response metadata The Puppet module search API has a different response format to normal. Results are returned in a map instead of an array, with the class name as the key. To work around this the results field is unmarshalled and then remarshalled into an array to normalise it

func (*Client) QuerySetting added in v0.6.1

func (c *Client) QuerySetting(ctx context.Context, d *ForemanSetting) (QueryResponse, error)

QuerySetting queries for a ForemanSetting based on the attributes of the supplied ForemanSetting reference and returns a QueryResponse struct containing query/response metadata and the matching settings. TODO: Copied from QueryDomains.

func (*Client) QuerySmartClassParameter

func (c *Client) QuerySmartClassParameter(ctx context.Context, t *ForemanSmartClassParameter) (QueryResponse, error)

QuerySmartClassParameter queries for a ForemanSmartClassParameter based on the attributes of the supplied ForemanSmartClassParameter reference and returns a QueryResponse struct containing query/response metadata

func (*Client) QuerySmartProxy

func (c *Client) QuerySmartProxy(ctx context.Context, s *ForemanSmartProxy) (QueryResponse, error)

QuerySmartProxy queries for a ForemanSmartProxy based on the attributes of the supplied ForemanSmartProxy reference and returns a QueryResponse struct containing query/response metadata and the matching smart proxy.

func (*Client) QuerySubnet

func (c *Client) QuerySubnet(ctx context.Context, s *ForemanSubnet) (QueryResponse, error)

QuerySubnet queries for a ForemanSubnet based on the attributes of the supplied ForemanSubnet reference and returns a QueryResponse struct containing query/response metadata and the matching subnets

func (*Client) QueryTemplateKind

func (c *Client) QueryTemplateKind(ctx context.Context, t *ForemanTemplateKind) (QueryResponse, error)

QueryTemplateKind queries for a ForemanTemplateKind based on the attributes of the supplied ForemanTemplateKind reference and returns a QueryResponse struct containing query/response metadata and the matching template kinds

func (*Client) QueryUser

func (c *Client) QueryUser(ctx context.Context, s *ForemanUser) (QueryResponse, error)

QueryUser queries for a ForemanUser based on the attributes of the supplied ForemanUser reference and returns a QueryResponse struct containing query/response metadata and the matching subnets

func (*Client) QueryUsergroup

func (c *Client) QueryUsergroup(ctx context.Context, u *ForemanUsergroup) (QueryResponse, error)

QueryUsergroup queries for a ForemanUsergroup based on the attributes of the supplied ForemanUsergroup reference and returns a QueryResponse struct containing query/response metadata and the matching usergroups.

func (*Client) ReadArchitecture

func (c *Client) ReadArchitecture(ctx context.Context, id int) (*ForemanArchitecture, error)

ReadArchitecture reads the attributes of a ForemanArchitecture identified by the supplied ID and returns a ForemanArchitecture reference.

func (*Client) ReadCommonParameter

func (c *Client) ReadCommonParameter(ctx context.Context, d *ForemanCommonParameter, id int) (*ForemanCommonParameter, error)

ReadCommonParameter reads the attributes of a ForemanCommonParameter identified by the supplied ID and returns a ForemanCommonParameter reference.

func (*Client) ReadComputeProfile

func (c *Client) ReadComputeProfile(ctx context.Context, id int) (*ForemanComputeProfile, error)

ReadComputeProfile reads the attributes of a ForemanComputeProfile identified by the supplied ID and returns a ForemanComputeProfile reference.

func (*Client) ReadComputeResource

func (c *Client) ReadComputeResource(ctx context.Context, id int) (*ForemanComputeResource, error)

ReadComputeResource reads the attributes of a ForemanComputeResource identified by the supplied ID and returns a ForemanComputeResource reference.

func (*Client) ReadDefaultTemplate

func (c *Client) ReadDefaultTemplate(ctx context.Context, d *ForemanDefaultTemplate, id int) (*ForemanDefaultTemplate, error)

ReadDefaultTemplate reads the attributes of a ForemanDefaultTemplate identified by the supplied ID and returns a ForemanDefaultTemplate reference.

func (*Client) ReadDomain

func (c *Client) ReadDomain(ctx context.Context, id int) (*ForemanDomain, error)

ReadDomain reads the attributes of a ForemanDomain identified by the supplied ID and returns a ForemanDomain reference.

func (*Client) ReadEnvironment

func (c *Client) ReadEnvironment(ctx context.Context, id int) (*ForemanEnvironment, error)

ReadEnvironment reads the attributes of a ForemanEnvironment identified by the supplied ID and returns a ForemanEnvironment reference.

func (*Client) ReadHTTPProxy

func (c *Client) ReadHTTPProxy(ctx context.Context, id int) (*ForemanHTTPProxy, error)

ReadHTTPProxy reads the attributes of a ForemanHTTPProxy identified by the supplied ID and returns a ForemanHTTPProxy reference.

func (*Client) ReadHost

func (c *Client) ReadHost(ctx context.Context, id int) (*ForemanHost, error)

ReadHost reads the attributes of a ForemanHost identified by the supplied ID and returns a ForemanHost reference.

func (*Client) ReadHostgroup

func (c *Client) ReadHostgroup(ctx context.Context, id int) (*ForemanHostgroup, error)

ReadHostgroup reads the attributes of a ForemanHostgroup identified by the supplied ID and returns a ForemanHostgroup reference.

func (*Client) ReadImage

func (c *Client) ReadImage(ctx context.Context, d *ForemanImage) (*ForemanImage, error)

ReadImage reads the attributes of a ForemanImage identified by the supplied ID and returns a ForemanImage reference.

func (*Client) ReadKatelloContentCredential

func (c *Client) ReadKatelloContentCredential(ctx context.Context, id int) (*ForemanKatelloContentCredential, error)

ReadKatelloContentCredential reads the attributes of a ForemanKatelloContentCredential identified by the supplied ID and returns a ForemanKatelloContentCredential reference.

func (*Client) ReadKatelloProduct

func (c *Client) ReadKatelloProduct(ctx context.Context, id int) (*ForemanKatelloProduct, error)

ReadKatelloProduct reads the attributes of a ForemanKatelloProduct identified by the supplied ID and returns a ForemanKatelloProduct reference.

func (*Client) ReadKatelloRepository

func (c *Client) ReadKatelloRepository(ctx context.Context, id int) (*ForemanKatelloRepository, error)

ReadKatelloRepository reads the attributes of a ForemanKatelloRepository identified by the supplied ID and returns a ForemanKatelloRepository reference.

func (*Client) ReadKatelloSyncPlan

func (c *Client) ReadKatelloSyncPlan(ctx context.Context, id int) (*ForemanKatelloSyncPlan, error)

ReadKatelloSyncPlan reads the attributes of a ForemanKatelloSyncPlan identified by the supplied ID and returns a ForemanKatelloSyncPlan reference.

func (*Client) ReadMedia

func (c *Client) ReadMedia(ctx context.Context, id int) (*ForemanMedia, error)

ReadMedia reads the attributes of a ForemanMedia identified by the supplied ID and returns a ForemanMedia reference.

func (*Client) ReadModel

func (c *Client) ReadModel(ctx context.Context, id int) (*ForemanModel, error)

ReadModel reads the attributes of a ForemanModel identified by the supplied ID and returns a ForemanModel reference.

func (*Client) ReadOperatingSystem

func (c *Client) ReadOperatingSystem(ctx context.Context, id int) (*ForemanOperatingSystem, error)

ReadOperatingSystem reads the attributes of a ForemanOperatingSystem identified by the supplied ID and returns a ForemanOperatingSystem reference.

func (*Client) ReadOverrideValue

func (c *Client) ReadOverrideValue(ctx context.Context, id int, scp_id int) (*ForemanOverrideValue, error)

ReadOverrideValue reads the attributes of a ForemanOverrideValue identified by the supplied ID & SmartParameterID and returns a ForemanOverrideValue reference. NOTE - although override value ids appear to be unique the API requires the smart class parameter id as well.

func (*Client) ReadParameter

func (c *Client) ReadParameter(ctx context.Context, d *ForemanParameter, id int) (*ForemanParameter, error)

ReadParameter reads the attributes of a ForemanParameter identified by the supplied ID and returns a ForemanParameter reference.

func (*Client) ReadPartitionTable

func (c *Client) ReadPartitionTable(ctx context.Context, id int) (*ForemanPartitionTable, error)

ReadPartitionTable reads the attributes of a ForemanPartitionTable identified by the supplied ID and returns a ForemanPartitionTable reference.

func (*Client) ReadProvisioningTemplate

func (c *Client) ReadProvisioningTemplate(ctx context.Context, id int) (*ForemanProvisioningTemplate, error)

ReadProvisioningTemplate reads the attributes of a ForemanProvisioningTemplate identified by the supplied ID and returns a ForemanProvisioningTemplate reference.

func (*Client) ReadPuppetClass

func (c *Client) ReadPuppetClass(ctx context.Context, id int) (*ForemanPuppetClass, error)

ReadPuppetClass reads the attributes of a ForemanPuppetClass identified by the supplied ID and returns a ForemanPuppetClass reference.

func (*Client) ReadSetting added in v0.6.1

func (c *Client) ReadSetting(ctx context.Context, id string) (*ForemanSetting, error)

ReadSetting reads the attributes of a ForemanSetting identified by the supplied ID and returns a ForemanSetting reference.

func (*Client) ReadSmartClassParameter

func (c *Client) ReadSmartClassParameter(ctx context.Context, id int) (*ForemanSmartClassParameter, error)

ReadSmartClassParamter reads the attributes of a ForemanSmartClassParameter identified by the supplied ID and returns a ForemanSmartClassParameter reference.

func (*Client) ReadSmartProxy

func (c *Client) ReadSmartProxy(ctx context.Context, id int) (*ForemanSmartProxy, error)

ReadSmartProxy reads the attributes of a ForemanSmartProxy identified by the supplied ID and returns a ForemanSmartProxy reference.

func (*Client) ReadSubnet

func (c *Client) ReadSubnet(ctx context.Context, id int) (*ForemanSubnet, error)

ReadSubnet reads the attributes of a ForemanSubnet identified by the supplied ID and returns a ForemanSubnet reference.

func (*Client) ReadTemplateKind

func (c *Client) ReadTemplateKind(ctx context.Context, id int) (*ForemanTemplateKind, error)

ReadTemplateKind reads the attributes of a ForemanTemplateKind identified by the supplied ID and returns a ForemanTemplateKind reference.

func (*Client) ReadUser

func (c *Client) ReadUser(ctx context.Context, id int) (*ForemanUser, error)

ReadUser reads the attributes of a ForemanUser identified by the supplied ID and returns a ForemanUser reference.

func (*Client) ReadUsergroup

func (c *Client) ReadUsergroup(ctx context.Context, id int) (*ForemanUsergroup, error)

ReadUsergroup reads the attributes of a ForemanUsergroup identified by the supplied ID and returns a ForemanUsergroup reference.

func (*Client) Send

func (client *Client) Send(request *http.Request) (int, []byte, error)

Send sends an HTTP request generated by Client.NewRequestWithContext() and returns the StatusCode, response. Serves as a facade to the Client's underlying HTTP client.

If an error is encountered when reading the server's response, the returned StatusCode will be -1. If an error is encountered during any step of the the send and response parsing, an empty slice will be returned as the request body.

request

An HTTP request generated by Client.NewRequestWithContext()

func (*Client) SendAndParse

func (client *Client) SendAndParse(req *http.Request, obj interface{}) error

SendAndParse sends an HTTP request generated by Client.NewRequestWithContext() and parses the server's response for errors. If an error is encountered during the sending or response parsing, the function returns an error. Otherwise, the server's response is unmarshalled into the supplied interface (if the interface is not nil).

func (*Client) SendPowerCommand

func (c *Client) SendPowerCommand(ctx context.Context, h *ForemanHost, cmd interface{}, retryCount int) error

SendPowerCommand sends provided Action and State to foreman. This performs an IPMI action against the provided host Expects Power or BMCBoot type struct populated with an action

Example: https://<foreman>/api/hosts/<hostname>/boot

func (*Client) UpdateArchitecture

func (c *Client) UpdateArchitecture(ctx context.Context, a *ForemanArchitecture) (*ForemanArchitecture, error)

UpdateArchitecture updates a ForemanArchitecture's attributes. The architecture with the ID of the supplied ForemanArchitecture will be updated. A new ForemanArchitecture reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateCommonParameter

func (c *Client) UpdateCommonParameter(ctx context.Context, d *ForemanCommonParameter, id int) (*ForemanCommonParameter, error)

UpdateCommonParameter deletes all commonParameters for the subject resource and re-creates them as we look at them differently on either side this is the safest way to reach sync

func (*Client) UpdateComputeProfile added in v0.6.2

func (c *Client) UpdateComputeProfile(ctx context.Context, d *ForemanComputeProfile) (*ForemanComputeProfile, error)

func (*Client) UpdateComputeResource

func (c *Client) UpdateComputeResource(ctx context.Context, d *ForemanComputeResource) (*ForemanComputeResource, error)

UpdateComputeResource updates a ForemanComputeResource's attributes. The computeresource with the ID of the supplied ForemanComputeResource will be updated. A new ForemanComputeResource reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateDefaultTemplate

func (c *Client) UpdateDefaultTemplate(ctx context.Context, d *ForemanDefaultTemplate, id int) (*ForemanDefaultTemplate, error)

UpdateDefaultTemplate deletes all parameters for the subject resource and re-creates them as we look at them differently on either side this is the safest way to reach sync

func (*Client) UpdateDomain

func (c *Client) UpdateDomain(ctx context.Context, d *ForemanDomain, id int) (*ForemanDomain, error)

UpdateDomain updates a ForemanDomain's attributes. The domain with the ID of the supplied ForemanDomain will be updated. A new ForemanDomain reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateEnvironment

func (c *Client) UpdateEnvironment(ctx context.Context, e *ForemanEnvironment) (*ForemanEnvironment, error)

UpdateEnvironment updates a ForemanEnvironment's attributes. The environment with the ID of the supplied ForemanEnvironment will be updated. A new ForemanEnvironment reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateHTTPProxy

func (c *Client) UpdateHTTPProxy(ctx context.Context, s *ForemanHTTPProxy) (*ForemanHTTPProxy, error)

UpdateHTTPProxy updates a ForemanHTTPProxy's attributes. The smart proxy with the ID of the supplied ForemanHTTPProxy will be updated. A new ForemanHTTPProxy reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateHost

func (c *Client) UpdateHost(ctx context.Context, h *ForemanHost, retryCount int) (*ForemanHost, error)

UpdateHost updates a ForemanHost's attributes. The host with the ID of the supplied ForemanHost will be updated. A new ForemanHost reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateHostgroup

func (c *Client) UpdateHostgroup(ctx context.Context, h *ForemanHostgroup) (*ForemanHostgroup, error)

UpdateHostgroup updates a ForemanHostgroup's attributes. The hostgroup with the ID of the supplied ForemanHostgroup will be updated. A new ForemanHostgroup reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateImage

func (c *Client) UpdateImage(ctx context.Context, d *ForemanImage) (*ForemanImage, error)

UpdateImage updates a ForemanImage's attributes. The image with the ID of the supplied ForemanImage will be updated. A new ForemanImage reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateKatelloContentCredential

func (c *Client) UpdateKatelloContentCredential(ctx context.Context, s *ForemanKatelloContentCredential) (*ForemanKatelloContentCredential, error)

UpdateKatelloContentCredential updates a ForemanKatelloContentCredential's attributes. The smart proxy with the ID of the supplied ForemanKatelloContentCredential will be updated. A new ForemanKatelloContentCredential reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateKatelloProduct

func (c *Client) UpdateKatelloProduct(ctx context.Context, p *ForemanKatelloProduct) (*ForemanKatelloProduct, error)

UpdateKatelloProduct updates a ForemanKatelloProduct's attributes. The sync plan with the ID of the supplied ForemanKatelloProduct will be updated. A new ForemanKatelloProduct reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateKatelloRepository

func (c *Client) UpdateKatelloRepository(ctx context.Context, p *ForemanKatelloRepository) (*ForemanKatelloRepository, error)

UpdateKatelloRepository updates a ForemanKatelloRepository's attributes. The sync plan with the ID of the supplied ForemanKatelloRepository will be updated. A new ForemanKatelloRepository reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateKatelloSyncPlan

func (c *Client) UpdateKatelloSyncPlan(ctx context.Context, sp *ForemanKatelloSyncPlan) (*ForemanKatelloSyncPlan, error)

UpdateKatelloSyncPlan updates a ForemanKatelloSyncPlan's attributes. The sync plan with the ID of the supplied ForemanKatelloSyncPlan will be updated. A new ForemanKatelloSyncPlan reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateMedia

func (c *Client) UpdateMedia(ctx context.Context, m *ForemanMedia) (*ForemanMedia, error)

UpdateMedia updates a ForemanMedia's attributes. The media with the ID of the supplied ForemanMedia will be updated. A new ForemanMedia reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateModel

func (c *Client) UpdateModel(ctx context.Context, m *ForemanModel) (*ForemanModel, error)

UpdateModel updates a ForemanModel's attributes. The model with the ID of the supplied ForemanModel will be updated. A new ForemanModel reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateOperatingSystem

func (c *Client) UpdateOperatingSystem(ctx context.Context, o *ForemanOperatingSystem) (*ForemanOperatingSystem, error)

UpdateOperatingSystem updates a ForemanOperatingSystem's attributes. The operating system with the ID of the supplied ForemanOperatingSystem will be updated. A new ForemanOperatingSystem reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateOverrideValue

func (c *Client) UpdateOverrideValue(ctx context.Context, ov *ForemanOverrideValue) (*ForemanOverrideValue, error)

UpdateOverrideValue updates a ForemanOverrideValue's attributes.

func (*Client) UpdateParameter

func (c *Client) UpdateParameter(ctx context.Context, d *ForemanParameter, id int) (*ForemanParameter, error)

UpdateParameter deletes all parameters for the subject resource and re-creates them as we look at them differently on either side this is the safest way to reach sync

func (*Client) UpdatePartitionTable

func (c *Client) UpdatePartitionTable(ctx context.Context, t *ForemanPartitionTable) (*ForemanPartitionTable, error)

UpdatePartitionTable updates a ForemanPartitionTable's attributes. The partition table with the ID of the supplied ForemanPartitionTable will be updated. A new ForemanPartitionTable reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateProvisioningTemplate

func (c *Client) UpdateProvisioningTemplate(ctx context.Context, t *ForemanProvisioningTemplate) (*ForemanProvisioningTemplate, error)

UpdateProvisioningTemplate updates a ForemanProvisioningTemplate's attributes. The template with the ID of the supplied ForemanProvisioningTemplate will be updated. A new ForemanProvisioningTemplate reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateSmartProxy

func (c *Client) UpdateSmartProxy(ctx context.Context, s *ForemanSmartProxy) (*ForemanSmartProxy, error)

UpdateSmartProxy updates a ForemanSmartProxy's attributes. The smart proxy with the ID of the supplied ForemanSmartProxy will be updated. A new ForemanSmartProxy reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateSubnet

func (c *Client) UpdateSubnet(ctx context.Context, s *ForemanSubnet) (*ForemanSubnet, error)

UpdateSubnet updates a ForemanSubnet's attributes. The subnet with the ID of the supplied ForemanSubnet will be updated. A new ForemanSubnet reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, u *ForemanUser) (*ForemanUser, error)

UpdateUser updates a ForemanUser's attributes. The user with the ID of the supplied ForemanUser will be updated. A new ForemanUser reference is returned with the attributes from the result of the update operation.

func (*Client) UpdateUsergroup

func (c *Client) UpdateUsergroup(ctx context.Context, h *ForemanUsergroup) (*ForemanUsergroup, error)

UpdateUsergroup updates a ForemanUsergroup's attributes. The usergroup with the ID of the supplied ForemanUsergroup will be updated. A new ForemanUsergroup reference is returned with the attributes from the result of the update operation.

func (*Client) WrapJSON

func (client *Client) WrapJSON(name interface{}, item interface{}) ([]byte, error)

WrapJSON wraps the given parameters as an object of its own name and marshals it to JSON

func (*Client) WrapJSONWithTaxonomy

func (client *Client) WrapJSONWithTaxonomy(name interface{}, item interface{}) ([]byte, error)

WrapJSONWithTaxonomy wraps the given parameters as an object of its own name, includes additional information for the api call and marshals it to JSON

type ClientConfig

type ClientConfig struct {
	// Whether or not to verify the server's certificate/hostname.  This flag
	// is passed to the TLS config when initializing the REST client for API
	// communication.
	//
	// See 'pkg/crypto/tls/#Config.InsecureSkipVerify' for more information
	TLSInsecureEnabled bool

	// Whether or not the client should try to authenticate to foreman
	// through the HTTP negotiate mechanism.
	NegotiateAuthEnabled bool

	// Information as required by all API calls
	LocationID     int
	OrganizationID int
}

Configurable features to apply the REST client

type ClientCredentials

type ClientCredentials struct {
	Username string
	Password string
}

Credentials used to authenticate the client against the remote server - in this case, the Foreman API

type Domain

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

Domain represents a domain structure inside a ForemanSubnet

type ForemanArchitecture

type ForemanArchitecture struct {
	// Inherits the base object's attributes
	ForemanObject

	// Array of ForemanOperatingSystem IDs associated with this architecture
	OperatingSystemIds []int `json:"operatingsystem_ids"`
}

The ForemanArchitecture API model represents an instruction set architecture (ISA)

func (*ForemanArchitecture) UnmarshalJSON

func (fa *ForemanArchitecture) UnmarshalJSON(b []byte) error

Custom JSON unmarshal function. Unmarshal to the unexported JSON struct and then convert over to a ForemanArchitecture struct.

type ForemanCommonParameter

type ForemanCommonParameter struct {
	// Inherits the base object's attributes
	ForemanObject

	// The CommonParameter we actually send
	Name  string `json:"name"`
	Value string `json:"value"`
}

The ForemanCommonParameter API model represents the commonParameter name. CommonParameters serve as an identification string that defines autonomy, authority, or control for a portion of a network.

type ForemanComputeAttribute added in v0.6.2

type ForemanComputeAttribute struct {
	ForemanObject
	ComputeResourceId int                    `json:"compute_resource_id"`
	VMAttrs           map[string]interface{} `json:"vm_attrs,omitempty"`
}

func (*ForemanComputeAttribute) MarshalJSON added in v0.6.2

func (ca *ForemanComputeAttribute) MarshalJSON() ([]byte, error)

Implement custom Marshal function for ForemanComputeAttribute to convert the internal vm_attrs map from all-string to their matching types.

type ForemanComputeProfile

type ForemanComputeProfile struct {
	ForemanObject
	ComputeAttributes []*ForemanComputeAttribute `json:"compute_attributes,omitempty"`
}

type ForemanComputeResource

type ForemanComputeResource struct {
	// Inherits the base object's attributes
	ForemanObject

	Description string `json:"description"`
	URL         string `json:"url"`
	Name        string `json:"name"`
	Provider    string `json:"provider"`
	DisplayType string `json:"display_type"`
	// VMWare specific
	User       string `json:"user,omitempty"`
	Password   string `json:"password,omitempty"`
	Datacenter string `json:"datacenter,omitempty"`
	Server     string `json:"server,omitempty"`
	// VMWare and Libvirt
	SetConsolePassword bool `json:"set_console_password,omitempty"`
	CachingEnabled     bool `json:"caching_enabled,omitempty"`
}

func (*ForemanComputeResource) UnmarshalJSON

func (fcr *ForemanComputeResource) UnmarshalJSON(b []byte) error

Custom JSON unmarshal function. Unmarshal to the unexported JSON struct and then convert over to a ForemanComputeResource struct.

type ForemanDefaultTemplate

type ForemanDefaultTemplate struct {
	// Inherits the base object's attributes
	ForemanObject

	OperatingSystemId      int `json:"operatingsystem_id"`
	ProvisioningTemplateId int `json:"provisioning_template_id"`
	TemplateKindId         int `json:"template_kind_id"`
}

----------------------------------------------------------------------------- Struct Definition and Helpers ----------------------------------------------------------------------------- The ForemanDefaultTemplate API model represents the parameter name. DefaultTemplates serve as an identification string that defines autonomy, authority, or control for a portion of a network.

type ForemanDomain

type ForemanDomain struct {
	// Inherits the base object's attributes
	ForemanObject

	// Fully qualified domain name
	Fullname string `json:"fullname"`

	// Map of DomainParameters
	DomainParameters []ForemanKVParameter `json:"domain_parameters_attributes,omitempty"`
}

The ForemanDomain API model represents the domain name. Domains serve as an identification string that defines autonomy, authority, or control for a portion of a network.

type ForemanEnvironment

type ForemanEnvironment struct {
	// Inherits the base object's attributes
	ForemanObject
}

The ForemanEnvironment API model represents a puppet environment

type ForemanHTTPProxy

type ForemanHTTPProxy struct {
	// Inherits the base object's attributes
	ForemanObject

	// Uniform resource locator of the proxy (ie: https://server:8008)
	URL string `json:"url"`
}

The ForemanHTTPProxy API model representing a http proxy. Defining HTTP Proxies that exist on your network allows you to perform various actions through those proxies.

type ForemanHost

type ForemanHost struct {
	// Inherits the base object's attributes
	ForemanObject

	// Shortname, FQDN without DomainName.
	// Not provided by the API, only available in templates with embedded Ruby
	Shortname string `json:"-"`

	// Whether or not to rebuild the host on reboot
	Build bool `json:"build"`
	// Current build status
	// From Foreman: BUILT = 0, PENDING = 1, TOKEN_EXPIRED = 2, BUILD_FAILED = 3
	BuildStatus int `json:"build_status"`
	// Current build status label
	BuildStatusLabel string `json:"build_status_label"`
	// Describes the way this host will be provisioned by Foreman
	ProvisionMethod string `json:"provision_method,omitempty"`
	// ID of the domain to assign the host
	DomainId *int `json:"domain_id,omitempty"`
	// Name of the Domain. To substract from the Machine name
	DomainName string `json:"domain_name,omitempty"`
	// ID of the owner user or group to assign the host
	OwnerId *int `json:"owner_id,omitempty"`
	// Type of the owner, either user or group
	OwnerType string `json:"owner_type,omitempty"`
	// ID of the environment to assign the host
	EnvironmentId *int `json:"environment_id,omitempty"`
	// ID of the hostgroup to assign the host
	HostgroupId *int `json:"hostgroup_id,omitempty"`
	// ID of the architecture of this host
	ArchitectureId *int `json:"architecture_id,omitempty"`
	// Name of the architecture of this host
	// ArchitectureName string `json:"architecture_name,omitempty"`
	SubnetId *int `json:"subnet_id,omitempty"`
	// ID of the operating system to put on the host
	OperatingSystemId *int `json:"operatingsystem_id,omitempty"`
	// ID of the medium that should be mounted
	MediumId *int `json:"medium_id,omitempty"`
	// ID of the image that should be cloned for this host
	ImageId *int `json:"image_id,omitempty"`
	// ID of the hardware model
	ModelId *int `json:"model_id,omitempty"`
	// Ptables ID
	PtableId *int `json:"ptable_id,omitempty"`
	// Whether or not to Enable BMC Functionality on this host
	EnableBMC bool `json:"-"`
	// Boolean to track success of BMC Calls
	BMCSuccess bool `json:"-"`
	// Whether or not the host is managed by foreman
	Managed bool `json:"managed"`
	// Additional information about this host
	Comment string `json:"comment"`
	// Nested struct defining any interfaces associated with the Host
	InterfacesAttributes []ForemanInterfacesAttribute `json:"interfaces_attributes,omitempty"`
	// Map of HostParameters
	HostParameters []ForemanKVParameter `json:"host_parameters_attributes,omitempty"`
	// NOTE(ALL): These settings only apply to virtual machines
	// Hypervisor specific map of ComputeAttributes
	ComputeAttributes map[string]interface{} `json:"compute_attributes,omitempty"`
	// ComputeResourceId specifies the Hypervisor to deploy on
	ComputeResourceId *int `json:"compute_resource_id,omitempty"`
	// ComputeProfileId specifies the Attributes via the Profile Id on the Hypervisor
	ComputeProfileId *int `json:"compute_profile_id,omitempty"`
	// IDs of the puppet classes applied to the host
	PuppetClassIds []int `json:"puppet_class_ids,omitempty"`
	// Build token, used by Foreman to provide a phone-home access token
	Token string `json:"token,omitempty"`
	// List of config groups to apply to the hostg
	ConfigGroupIds []int `json:"config_group_ids"`
	// The puppetattributes object is only used for create and update, it's not populated on read, hence the duplication
	PuppetAttributes PuppetAttribute `json:"puppet_attributes"`
	// Default Root Password for this host (on creation)
	RootPassword string `json:"root_pass,omitempty"`
}

The ForemanHost API model represents a host managed by Foreman

type ForemanHostgroup

type ForemanHostgroup struct {
	// Inherits the base object's attributes
	ForemanObject

	// The title is a computed property representing the fullname of the
	// hostgroup.  A hostgroup's title is a path-like string from the head
	// of the hostgroup tree down to this hostgroup.  The title will be
	// in the form of: "<parent 1>/<parent 2>/.../<name>"
	Title string `json:"title"`
	// Default Root Password for this HostGroup
	RootPassword string `json:"root_pass,omitempty"`
	// ID of the architecture associated with this hostgroup
	ArchitectureId int `json:"architecture_id,omitempty"`
	// ID of the compute profile associated with this hostgroup
	ComputeProfileId int `json:"compute_profile_id,omitempty"`
	// List of config groups to apply to the hostgroup
	ConfigGroupIds []int `json:"config_group_ids"`
	// ID of the domain associated with this hostgroup
	DomainId int `json:"domain_id,omitempty"`
	// ID of the environment associated with this hostgroup
	EnvironmentId int `json:"environment_id,omitempty"`
	// ID of the media associated with this hostgroup
	MediumId int `json:"medium_id,omitempty"`
	// ID of the operating system associated with this hostgroup
	OperatingSystemId int `json:"operatingsystem_id,omitempty"`
	// ID of this hostgroup's parent hostgroup
	ParentId int `json:"parent_id,omitempty"`
	// ID of the partition table to use with this hostgroup
	PartitionTableId int `json:"ptable_id,omitempty"`
	// ID of the smart proxy acting as the puppet certificate authority
	// server for the hostgroup
	PuppetCAProxyId int `json:"puppet_ca_proxy_id,omitempty"`
	// IDs of the puppet classes applied to the host group
	PuppetClassIds []int `json:"puppet_class_ids"`
	// ID of the smart proxy acting as the puppet proxy server for the
	// hostgroup
	PuppetProxyId int `json:"puppet_proxy_id,omitempty"`
	// ID of the realm associated with the hostgroup
	RealmId int `json:"realm_id,omitempty"`
	// ID of the subnet associated with the hostgroup
	SubnetId int `json:"subnet_id,omitempty"`
	// Default PXELoader for the hostgroup
	PXELoader string `json:"pxe_loader,omitempty"`
	// ID of the Katello Lifecycle Environment
	LifecycleId int `json:"lifecycle_environment_id,omitempty"`
	// ID of the Katello content view
	ContentViewId int `json:"content_view_id,omitempty"`
	// ID of Smart Proxy serving the content
	ContentSourceId int `json:"content_source_id,omitempty"`
	// Map of HostGroupParameters
	HostGroupParameters []ForemanKVParameter `json:"group_parameters_attributes,omitempty"`
	// The puppetattributes object is only used for create and update, it's not populated on read, hence the duplication
	PuppetAttributes PuppetAttribute `json:"puppet_attributes"`
}

The ForemanHostgroup API model represents a hostgroup. Hostgroups are organized in a tree-like structure and can inherit the values of their parent hostgroups. The relationship is maintained through the parent_id attribute.

When hosts get associated with a hostgroup, it will inherit attributes from the hostgroup. This allows for easy shared configuration of various hosts based on common attributes.

type ForemanImage

type ForemanImage struct {
	ForemanObject

	// UUID of the image. Can be the path to the image on the compute resource e.g.
	UUID string `json:"uuid"`
	// Username used for login on the image
	Username string `json:"username"`
	// Password for the initial user
	Password string `json:"password"`
	// OperatingSystemId of the operating system associated with the image
	OperatingSystemID int `json:"operatingsystem_id"`
	// ComputeResourceId of the resource this image can be cloned on
	ComputeResourceID int `json:"compute_resource_id"`
	// ArchitectureId of the architecture this image works on
	ArchitectureID int `json:"architecture_id"`
	// Does the image support providing user data (e.g. cloud-init)?
	UserData bool `json:"user_data"`
}

func (*ForemanImage) MarshalJSON added in v0.6.2

func (fi *ForemanImage) MarshalJSON() ([]byte, error)

type ForemanInterfacesAttribute

type ForemanInterfacesAttribute struct {
	Id         int    `json:"id,omitempty"`
	SubnetId   int    `json:"subnet_id,omitempty"`
	Identifier string `json:"identifier"`
	Name       string `json:"name"`
	Username   string `json:"username,omitempty"`
	Password   string `json:"password,omitempty"`
	Managed    bool   `json:"managed"`
	Provision  bool   `json:"provision"`
	Virtual    bool   `json:"virtual"`
	Primary    bool   `json:"primary"`
	IP         string `json:"ip"`
	MAC        string `json:"mac"`
	Type       string `json:"type"`
	Provider   string `json:"provider"`

	AttachedDevices string `json:"attached_devices,omitempty"`
	AttachedTo      string `json:"attached_to,omitempty"`

	// NOTE(ALL): These settings only apply to virtual machines
	// ComputeAttributes are hypervisor specific features
	ComputeAttributes map[string]interface{} `json:"compute_attributes,omitempty"`

	// NOTE(ALL): Each of the interfaces receives a unique identifier
	//   on creation. To modify the list of interfaces, the supplied
	//   list to the API does NOT perform a replace operation. Adding new
	//   interfaces to the list is rather trivial and just involves sending the
	//   new values to receive an ID.  When removing one of the combinations from
	//   the set, a secret flag "_destroy" must be supplied as part of that
	//   combination.  This is not documented as part of the Foreman API.  We
	//   omit empty here, because we only want to pass the flag when "_destroy"
	//   is "true" to signal an item removal.
	Destroy bool `json:"_destroy,omitempty"`
}

ForemanInterfacesAttribute representing a hosts defined network interfaces

type ForemanKVParameter

type ForemanKVParameter struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

KVParameters are used in all inline Parameter Maps. i.e. Host, HostGroup

func ToKV

func ToKV(m map[string]interface{}) (ret []ForemanKVParameter)

type ForemanKatelloContentCredential

type ForemanKatelloContentCredential struct {
	// Inherits the base object's attributes
	ForemanObject

	// Public key block in DER encoding
	Content string `json:"content"`
}

ForemanKatelloContentCredential API model representing a content credential. A content credential is used to sign a repository in katello.

type ForemanKatelloProduct

type ForemanKatelloProduct struct {
	// Inherits the base object's attributes
	ForemanObject

	Description string `json:"description"`
	GpgKeyId    int    `json:"gpg_key_id"`
	/* 	SslCaCertId int `json:"ssl_ca_cert_id"`
	   	SslClientCertId int `json:"ssl_client_cert_id"`
	   	SslClientKeyId  int `json:"ssl_client_key_id"` */
	SyncPlanId int    `json:"sync_plan_id"`
	Label      string `json:"label"`
}

ForemanKatelloProduct API model representing a product.

type ForemanKatelloRepository

type ForemanKatelloRepository struct {
	// Inherits the base object's attributes
	ForemanObject

	Description                   string  `json:"description"`
	Label                         string  `json:"label"`
	ProductId                     int     `json:"product_id"`
	Product                       Product `json:"product"`
	ContentType                   string  `json:"content_type"`
	Url                           string  `json:"url"`
	GpgKeyId                      int     `json:"gpg_key_id"`
	Unprotected                   bool    `json:"unprotected"`
	ChecksumType                  string  `json:"checksum_type"`
	DockerUpstreamName            string  `json:"docker_upstream_name"`
	DockerTagsWhitelist           string  `json:"docker_tags_whitelist"`
	DownloadPolicy                string  `json:"download_policy"`
	DownloadConcurrency           int     `json:"download_concurrency"`
	MirrorOnSync                  bool    `json:"mirror_on_sync"`
	VerifySslOnSync               bool    `json:"verify_ssl_on_sync"`
	UpstreamUsername              string  `json:"upstream_username"`
	UpstreamPassword              string  `json:"upstream_password"`
	DebReleases                   string  `json:"deb_releases"`
	DebComponents                 string  `json:"deb_components"`
	DebArchitectures              string  `json:"deb_architectures"`
	IgnoreGlobalProxy             bool    `json:"ignore_global_proxy"`
	IgnorableContent              string  `json:"ignorable_content"`
	AnsibleCollectionRequirements string  `json:"ansible_collection_requirements"`
	HttpProxyPolicy               string  `json:"http_proxy_policy"`
	HttpProxyId                   int     `json:"http_proxy_id"`
}

ForemanKatelloRepository API model representing a repository.

type ForemanKatelloSyncPlan

type ForemanKatelloSyncPlan struct {
	// Inherits the base object's attributes
	ForemanObject

	// must be one of: hourly, daily, weekly, custom cron.
	Interval string `json:"interval"`
	// start datetime of synchronization
	SyncDate string `json:"sync_date"`
	// sync plan description
	Description string `json:"description"`
	// enables or disables synchronization, Must be one of: true, false, 1, 0.
	Enabled bool `json:"enabled"`
	// custom cron logic for sync plan
	CronExpression string `json:"cron_expression"`
}

ForemanKatelloSyncPlan API model representing a sync plan. A sync plan is used to schedule a synchronization of a product in katello

type ForemanMedia

type ForemanMedia struct {
	// Inherits the base object's attributes
	ForemanObject

	// The path to the medium, can be a URL or a valid NFS server (exclusive
	// of the architecture).  For example:
	//
	// http://mirror.centos.org/centos/$version/os/$arch
	//
	// Where $arch will be substituted for the host's actual OS architecture
	// and $version, $major, $minor will be substituted for the version of the
	// operating system.
	//
	// Solaris and Debian media may also use $release.
	Path string `json:"path"`
	// Operating sysem family. Available values: AIX, Altlinux, Archlinux,
	// Coreos, Debian, Freebsd, Gentoo, Junos, NXOS, Redhat, Solaris, Suse,
	// Windows.
	OSFamily string `json:"os_family"`
	// IDs of operating systems associated with this media
	OperatingSystemIds []int `json:"operatingsystem_ids"`
}

The ForemanMedia API model represents a remote installation media.

func (*ForemanMedia) UnmarshalJSON

func (fm *ForemanMedia) UnmarshalJSON(b []byte) error

Implement the Unmarshaler interface

type ForemanModel

type ForemanModel struct {
	// Inherits the base object's attributes
	ForemanObject

	// Additional information about this hardware model
	Info string `json:"info"`
	// Name or class of the hardware vendor
	VendorClass string `json:"vendor_class"`
	// Name of the specific hardware model
	HardwareModel string `json:"hardware_model"`
}

The ForemanModel API model represents a specific vendor hardware model

type ForemanObject

type ForemanObject struct {
	// Unique identifier for this object
	Id int `json:"id"`
	// Human readable name of the API object
	Name string `json:"name"`
	// Timestamp of when the API object was created in the following format:
	// "%Y-%m-%d %H-%M-%S UTC"
	CreatedAt string `json:"created_at"`
	// Timestamp of when the API object was last updated in the following format:
	// "%Y-%m-%d %H-%M-%S UTC"
	UpdatedAt string `json:"updated_at"`
}

Base Foreman API object in the Foreman object model. Every API entity has the following attributes:

type ForemanOperatingSystem

type ForemanOperatingSystem struct {
	// Inherits the base object's attributes
	ForemanObject

	// Title is a computed property by Foreman. The operating system's
	// title is a concatentation of the OS name, major, and minor versions
	// to get a full operating system release.
	Title string `json:"title"`
	// Major release version
	Major string `json:"major"`
	// Minor release version
	Minor string `json:"minor"`
	// Additional information about the operating system
	Description string `json:"description"`
	// Operating sysem family. Available values: AIX, Altlinux, Archlinux,
	// Coreos, Debian, Freebsd, Gentoo, Junos, NXOS, Redhat, Solaris, Suse,
	// Windows.
	Family string `json:"family"`
	// Code name or release name for the specific operating system version
	ReleaseName string `json:"release_name"`
	// Root password hash function to use.  If set, valid values are "MD5",
	// "SHA256", "SHA512", and "Base64"
	PasswordHash string `json:"password_hash"`
	// Provisoning Template Ids
	ProvisioningTemplateIds []int `json:"provisioning_template_ids,omitempty"`
	// Media Ids
	MediumIds []int `json:"medium_ids,omitempty"`
	// Architecture Ids
	ArchitectureIds []int `json:"architecture_ids,omitempty"`
	// Partitiontable Ids
	PartitiontableIds []int `json:"ptable_ids,omitempty"`

	// Map of OperatingSystemParameters
	OperatingSystemParameters []ForemanKVParameter `json:"os_parameters_attributes,omitempty"`
}

The ForemanOperatingSystem API model represents an operating system

func (*ForemanOperatingSystem) UnmarshalJSON

func (o *ForemanOperatingSystem) UnmarshalJSON(b []byte) error

Implement the Unmarshaler interface

type ForemanOverrideValue

type ForemanOverrideValue struct {
	// Inherits the base object's attributes
	ForemanObject

	// The type of match to perform: fqdn, hostgroup, domain or os
	MatchType string
	// The value of requested match
	MatchValue string
	// Wether Foreman omits this parameter from the classification output
	Omit bool `json:"omit"`
	// The ID of the smarts class parameter we are overriding
	SmartClassParameterId int
	// The value of the override - hashes and array must be JSON encoded
	Value string
}

The ForemanPuppetClass API model represents a Puppet class

func (ForemanOverrideValue) MarshalJSON

func (ov ForemanOverrideValue) MarshalJSON() ([]byte, error)

Implement the Marshaler interface

func (*ForemanOverrideValue) UnmarshalJSON

func (ov *ForemanOverrideValue) UnmarshalJSON(b []byte) error

Custom JSON unmarshal function. Unmarshal to the unexported JSON struct and then convert over to a ForemanHost struct.

type ForemanParameter

type ForemanParameter struct {
	// Inherits the base object's attributes
	ForemanObject

	// One of the ID fields should be set
	HostID            int `json:"host_id,omitempty"`
	HostGroupID       int `json:"hostgroup_id,omitempty"`
	DomainID          int `json:"parameter_id,omitempty"`
	OperatingSystemID int `json:"operatingsystem_id,omitempty"`
	SubnetID          int `json:"subnet_id,omitempty"`
	// The Parameter we actually send
	Parameter ForemanKVParameter `json:"parameter"`
}

The ForemanParameter API model represents the parameter name. Parameters serve as an identification string that defines autonomy, authority, or control for a portion of a network.

func (*ForemanParameter) UnmarshalJSON

func (fp *ForemanParameter) UnmarshalJSON(b []byte) error

type ForemanPartitionTable

type ForemanPartitionTable struct {
	// Inherits the base object's attributes
	ForemanObject

	// The script that defines the partition table layout
	Layout string `json:"layout"`
	// Whether or not this partition table is a snippet to be embedded in
	// other partition tables
	Snippet bool `json:"snippet"`
	// Any audit comments to associate with the partition table.
	//
	// The Audit Comment field is saved with the template auditing to document
	// the template changes.
	AuditComment string `json:"audit_comment"`
	// Whether or not this partition table is locked for editing
	Locked bool `json:"locked"`
	// Operating sysem family. Available values: AIX, Altlinux, Archlinux,
	// Coreos, Debian, Freebsd, Gentoo, Junos, NXOS, Redhat, Solaris, Suse,
	// Windows.
	OSFamily string `json:"os_family"`

	// IDs of the operating system this partition table applies
	OperatingSystemIds []int `json:"operatingsystem_ids"`
	// IDs of the hostgroups this partition table applies
	HostgroupIds []int `json:"hostgroup_ids"`
	// IDs of the hosts this partition table applies
	HostIds []int `json:"host_ids"`
}

The FormanPartitionTable API model represents the disk partition layout of the host. The actual meta-script is stored inside of the Layout attribute.

func (*ForemanPartitionTable) UnmarshalJSON

func (ft *ForemanPartitionTable) UnmarshalJSON(b []byte) error

Implement the Unmarshaler interface

type ForemanProvisioningTemplate

type ForemanProvisioningTemplate struct {
	// Inherits the base object's attributes
	ForemanObject

	// The markup and code of the provisioning template
	Template string
	// Whether or not the provisioning template is a snippet to be embedded
	// and used by other templates
	Snippet bool
	// Notes and comments for auditing purposes
	AuditComment string
	// Whether or not the template is locked for editing
	Locked bool
	// ID of the template kind which categorizes the provisioning template.
	// Optional for snippets, otherwise required.
	TemplateKindId int
	// IDs of operating systems associated with this provisioning template
	OperatingSystemIds []int
	// How templates are determined:
	//
	// When editing a template, you must assign a list of operating systems
	// which this template can be used with.  Optionally, you can restrict
	// a template to a list of host groups and/or environments.
	//
	// When a host requests a template, Foreman will select the best match
	// from the available templates of that type in the following order:
	//
	//   1. host group and environment
	//   2. host group only
	//   3. environment only
	//   4. operating system default
	//
	// Template combinations attributes contains an array of hostgroup IDs
	// and environment ID combinations so they can be used in the
	// provisioning template selection described above.
	TemplateCombinationsAttributes []ForemanTemplateCombinationAttribute `json:"template_combinations_attributes"`
}

The ForemanProvisioningTemplate API model represents a provisioning template. Provisioning templates are scripts used to describe how to boostrap and install the operating system on a host.

func (ForemanProvisioningTemplate) MarshalJSON

func (ft ForemanProvisioningTemplate) MarshalJSON() ([]byte, error)

Custom JSON marshal function for provisioning temmplates. The Foreman API expects all parameters to be enclosed in double quotes, with the exception of boolean and slice values.

func (*ForemanProvisioningTemplate) UnmarshalJSON

func (ft *ForemanProvisioningTemplate) UnmarshalJSON(b []byte) error

Custom JSON unmarshal function. Unmarshal to the unexported JSON struct and then convert over to a ForemanProvisioningTemplate struct.

type ForemanPuppetClass

type ForemanPuppetClass struct {
	// Inherits the base object's attributes
	ForemanObject
}

The ForemanPuppetClass API model represents a Puppet class

type ForemanSetting added in v0.6.1

type ForemanSetting struct {
	ForemanObject

	// Settings use strings as IDs
	// Overrides the ForemanObject.Id field
	Id string `json:"id"`

	// full_name field which seems to be empty
	Fullname string `json:"full_name,omitempty"`

	// The value of the setting, can be bool, string or int
	Value interface{} `json:"value"`

	// Default value as bool, string or int
	Default interface{} `json:"default"`

	// Is setting read-only?
	ReadOnly bool `json:"readonly"`

	// Is setting encrypted?
	Encrypted bool `json:"encrypted"`

	// Description of the setting
	Description string `json:"description"`

	// Category of the setting in colon form, e.g. "Setting::Auth"
	Category string `json:"category"`

	// Category of the setting in human readable form, e.g. "Authentication"
	CategoryName string `json:"category_name"`

	// Type of the setting (boolean, string etc.)
	SettingsType string `json:"settings_type"`
}

Represents a setting object in Foreman. Settings use strings as Id values.

type ForemanSmartClassParameter

type ForemanSmartClassParameter struct {
	// Inherits the base object's attributes
	ForemanObject

	// Smart class parameter name
	Parameter string `json:"parameter"`
	// ID of the owning puppet class
	PuppetClassId int `json:"puppetclass_id"`
}

The ForemanSmartClassParameter API model represents a smart class parameter

type ForemanSmartProxy

type ForemanSmartProxy struct {
	// Inherits the base object's attributes
	ForemanObject

	// Uniform resource locator of the proxy (ie: https://server:8008)
	URL string `json:"url"`
}

The ForemanSmartProxy API model representing a proxy server. Smart proxies provide an API for a higher-level orchestration tool. Foreman supports the following smart proxies:

  1. DHCP - ISC DHCP & MS DHCP servers
  2. DNS - bind & MS DNS servers
  3. Puppet >= 0.24.x
  4. Puppet CA
  5. Realm - manage host registration to a realm (eg: FreeIPA)
  6. Templates - Proxy template requests from hosts in isolated networks
  7. TFTP

type ForemanSubnet

type ForemanSubnet struct {
	// Inherits the base object's attributes
	ForemanObject

	// Subnet network (ie: 192.168.100.0)
	Network string `json:"network"`
	// Netmask for this subnet (ie: 255.255.255.0)
	Mask string `json:"mask"`
	// Gateway server to use when connecting/communicating to anything not
	// on the same network
	Gateway string `json:"gateway"`
	// Primary DNS server for this subnet
	DnsPrimary string `json:"dns_primary"`
	// Secondary DNS server for this subnet
	DnsSecondary string `json:"dns_secondary"`
	// IP address auto-suggestion mode for this subnet.  If set, valid values
	// are "DHCP", "Internal DB", and "None".
	Ipam string `json:"ipam"`
	// Starting IP address for IP auto suggestion
	From string `json:"from"`
	// Ending IP address for IP auto suggestion
	To string `json:"to"`
	// Default boot mode for instances assigned to this subnet.  If set, valid
	// values are "Static" and "DHCP".
	BootMode string `json:"boot_mode"`
	// Network CIDR
	NetworkAddress string `json:"network_address"`
	// VLAN id that is in use in the subnet
	VlanID int `json:"vlanid"`
	// Description for the subnet
	Description string `json:"description"`
	// MTU Default for the subnet
	Mtu int `json:"mtu"`
	// Template ID
	TemplateID *int `json:"template_id"`
	// DHCP ID
	DhcpID *int `json:"dhcp_id"`
	// BMC ID
	BmcID *int `json:"bmc_id"`
	// TFTP ID
	TftpID *int `json:"tftp_id"`
	// HTTP Boot ID
	HTTPBootID *int `json:"httpboot_id"`
	// Domain IDs
	DomainIDs []int `json:"domain_ids"`
	// Domains (for internal use)
	Domains []Domain `json:"domains"`
	// Network Type
	NetworkType string `json:"network_type"`
}

The ForemanSubnet API model represents a subnet

type ForemanTemplateCombinationAttribute

type ForemanTemplateCombinationAttribute struct {
	// Unique identifier of the template combination
	Id int `json:"id,omitempty"`
	// Hostgroup ID associated with the template combination
	HostgroupId int `json:"hostgroup_id,omitempty"`
	// Environment ID associated with the template combination
	EnvironmentId int `json:"environment_id,omitempty"`
	// NOTE(ALL): Each of the template combinations receives a unique identifier
	//   on creation. To modify the list of template combinations, the supplied
	//   list to the API does NOT perform a replace operation. Adding new
	//   combinations to the list is rather trivial and just involves sending the
	//   new values to receive an ID.  When removing one of the combinations from
	//   the set, a secret flag "_destroy" must be supplied as part of that
	//   combination.  This is not documented as part of the Foreman API.  We
	//   omit empty here, because we only want to pass the flag when "_destroy"
	//   is "true" to signal an item removal.
	Destroy bool `json:"_destroy,omitempty"`
}

See the comment in ForemanProvisioningTemplate.TemplateCombinationsAttributes

type ForemanTemplateKind

type ForemanTemplateKind struct {
	// Inherits the base object's attributes
	ForemanObject
}

The ForemanTemplateKind API model represents a category of provisioning template. Examples include:

  1. PXELinux
  2. provision
  3. PXEGrub
  4. ZTP

type ForemanUser

type ForemanUser struct {
	// Inherits the base object's attributes
	ForemanObject

	// login name (i.e: username)
	Login string `json:"login"`
	// if user has admin privileges
	Admin bool `json:"admin,omitempty"`

	// "real" firstname of user
	Firstname string `json:"firstname,omitempty"`

	// "real" lastname of user
	Lastname string `json:"lastname,omitempty"`

	// email of user
	Mail string `json:"mail,omitempty"`

	// user description
	Description string `json:"description,omitempty"`

	// user password
	Password string `json:"password,omitempty"`

	// default location for user
	DefaultLocationId int `json:"default_location_id,omitempty"`

	// default organisation for user
	DefaultOrganizationId int `json:"default_organization_id,omitempty"`

	// origin of user authentication
	AuthSourceId int `json:"auth_source_id"`

	// locale setting for user
	Locale string `json:"locale,omitempty"`

	// list of all locations for user
	LocationIds []int `json:"location_ids,omitempty"`

	// list of all organisation for user
	OrganizationIds []int `json:"organization_ids,omitempty"`
}

The ForemanUser API model represents a user.

type ForemanUsergroup

type ForemanUsergroup struct {
	// Inherits the base object's attributes
	ForemanObject

	// enables or disables admin access for group members, Must be one of: true, false, 1, 0.
	Admin bool `json:"admin"`
}

The ForemanUsergroup API model represents a usergroup.

func (ForemanUsergroup) MarshalJSON

func (fh ForemanUsergroup) MarshalJSON() ([]byte, error)

Implement the Marshaler interface

func (*ForemanUsergroup) UnmarshalJSON

func (fh *ForemanUsergroup) UnmarshalJSON(b []byte) error

type HTTPError

type HTTPError struct {
	Endpoint   string
	StatusCode int
	RespBody   string
}

func (HTTPError) Error

func (e HTTPError) Error() string

type Power

type Power struct {
	PowerAction string `json:"power_action,omitempty"`
	Power       bool   `json:"power,omitempty"`
}

Power struct for marshal/unmarshal of power state valid states are on, off, soft, cycle, state `omitempty` lets use the same struct for power operations.Command

type Product

type Product struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type PuppetAttribute added in v0.5.8

type PuppetAttribute struct {
	Puppetclass_ids []int `json:"puppetclass_ids"`
	ConfigGroup_ids []int `json:"config_group_ids"`
}

JSON obect for creating and updating puppetattributes on hosts and hostgroups

type QueryResponse

type QueryResponse struct {
	// Total number of objects of that resource type in Foreman
	Total int `json:"total"`
	// Number of results matching the search criteria
	Subtotal int `json:"subtotal"`
	// Current result page (if using pagination in searches)
	Page int `json:"page"`
	// How many results to display per page (if using pagination in searches)
	PerPage int `json:"per_page"`
	// The search filter string in the form property=value&property=value&...
	Search string `json:"search,omitempty"`
	// Sorting options provided for the search
	Sort QueryResponseSort `json:"sort,omitempty"`
	// Foreman API objects that matched the search criteria for the query.
	Results []interface{} `json:"results"`
}

Base API query response struct. For all "search" API calls (following the format /api/<resource name>), the response will be in the following format.

The Results attribute will be an array of Foreman API objects from the model package that matched the search criteria.

type QueryResponsePuppet

type QueryResponsePuppet struct {
	QueryResponse
	// Foreman API objects that matched the search criteria for the query.
	Results map[string]interface{} `json:"results"`
}

Need a modified version of QueryResponse for the puppet endpoint as the results are wrapped in an additional hash - this may be a Foreman bug

type QueryResponseSort

type QueryResponseSort struct {
	// In which manner to order results (ASC, DESC)
	Order string `json:"order,omitempty"`
	// Which field to order by
	By string `json:"by,omitempty"`
}

Sort options as part of the generic query resposne

type Server

type Server struct {
	// The URL of the API gateway
	URL url.URL
}

Server definition. For this provider, the server represents the Foreman API handler. The client will direct all API requests to this server based on the client and server configuration options.

Jump to

Keyboard shortcuts

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