foreman

package module
v0.0.0-...-8e6d4ff Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2016 License: BSD-3-Clause Imports: 15 Imported by: 0

README

go-foreman

Implementing the foreman apiin golang.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compute_attributes

type Compute_attributes struct {
	Cpus                 string `json:"cpus,omitempty"`
	Corespersocket       string `json:"corespersocket,omitempty"`
	Start                string `json:"start,omitempty"`
	Cluster              string `json:"cluster,omitempty"`
	Memory_mb            string `json:"memory_mb,omitempty"`
	Guest_id             string `json:"guest_id,omitempty"`
	Resource_pool        string `json:"resource_pool,omitempty"`
	Resource_pool_id     string `json:"resource_pool_id,omitempty"`
	Path                 string `json:"path,omitempty"`
	Scsi_controller_type string `json:"scsi_controller_type,omitempty"`
	Hardware_version     string `json:"hardware_version,omitempty"`

	//This needs to be a struct map or the foreman API will kick back the JSON
	Volumes_attributes_map map[string]Volumes_attributes `json:"volumes_attributes,omitempty"`
}

These are actual compute instance attributes

type Domain

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

Domain definition

type Environment

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

Environment definition

type Foreman

type Foreman struct {
	Hostname string
	Username string

	VerifySSL bool
	Proxy     string
	BaseURL   string
	// contains filtered or unexported fields
}

func Client

func Client(HostName string, UserName string, Password string, Insecure bool, Proxy string) (foreman *Foreman)

func (*Foreman) Create

func (foreman *Foreman) Create(i interface{}) (ret *Host, err error)

func (*Foreman) CreateHost

func (foreman *Foreman) CreateHost(Host *Host) (returnedHost *Host, err error)

func (*Foreman) Delete

func (foreman *Foreman) Delete(endpoint string) (map[string]interface{}, error)

func (*Foreman) DeleteHost

func (foreman *Foreman) DeleteHost(Host *Host) error

func (*Foreman) Get

func (foreman *Foreman) Get(endpoint string) (map[string]interface{}, error)

func (*Foreman) GetHost

func (foreman *Foreman) GetHost(Host *Host) (returnedHost *Host, err error)

func (*Foreman) Post

func (foreman *Foreman) Post(endpoint string, jsonData []byte) (map[string]interface{}, error)

func (*Foreman) UpdateHost

func (foreman *Foreman) UpdateHost(Host *Host) (returnedHost *Host, err error)

type Host

type Host struct {
	Name                string             `json:"name,omitempty"`
	Environment_id      int                `json:"environment_id,omitempty"`
	Organization_id     int                `json:"organization_id,omitempty"`
	Location_id         int                `json:"location_id,omitempty"`
	Ip                  string             `json:"ip,omitempty"`
	Mac                 string             `json:"mac,omitempty"`
	Architecture_id     int                `json:"architecture_id,omitempty"`
	Domain_id           int                `json:"domain_id,omitempty"`
	Realm_id            int                `json:"realm_id,omitempty"`
	Puppet_proxy_id     int                `json:"puppet_proxy_id,omitempty"`
	Puppetclass_ids     []int              `json:"puppetclass_ids,omitempty"`
	Operatingsystem_id  int                `json:"operatingsystem_id,omitempty"`
	Medium_id           int                `json:"medium_id,omitempty"`
	Ptable_id           int                `json:"ptable_id,omitempty"`
	Subnet_id           int                `json:"subnet_id,omitempty"`
	Compute_resource_id int                `json:"compute_resource_id,omitempty"`
	Root_pass           string             `json:"root_pass,omitempty"`
	Model_id            int                `json:"model_id,omitempty"`
	Hostgroup_id        int                `json:"hostgroup_id,omitempty"`
	Puppet_ca_proxy_id  int                `json:"puppet_ca_proxy_id,omitempty"`
	Image_id            int                `json:"image_id,omitempty"`
	Build               bool               `json:"build,omitempty"`
	Enabled             bool               `json:"enabled,omitempty"`
	Provision_method    string             `json:"provision_method,omitempty"`
	Managed             bool               `json:"managed,omitempty"`
	Compute_attributes  Compute_attributes `json:"compute_attributes,omitempty"`
	Owner_id            int                `json:"owner_id,omitempty"`
	Owner_type          string             `json:"owner_type,omitempty"` // must be either User or Usergroup
	Progress_report_id  string             `json:"progress_report_id,omitempty"`
	Comment             string             `json:"comment,omitempty"`
	Capabilities        []interface{}      `json:"capabilities,omitempty"`
	Compute_profile_id  int                `json:"compute_profile_id,omitempty"`
	//mapped struct array for host parameters
	Host_parameters_attributes_map map[string]Params_archetype `json:"host_parameters_attributes,omitempty"`
	//struct array for multiple interfaces
	Interfaces_attributes_array []Interfaces_attributes `json:"interfaces_attributes,omitempty"`
}

This is the main host struct instance that later gets wrapped in reqHost for JSON/foreman API reasons

type HostMap

type HostMap map[string]Host

type Hostgroup

type Hostgroup struct {
	Id                 int    `json:"id,omitempty"`
	Name               string `json:"name,omitempty"`
	Parent_id          int    `json:"parent_id,omitempty"`
	Environment_id     int    `json:"environment_id,omitempty"`
	Operatingsystem_id int    `json:"operatingsystem_id,omitempty"`
	Architecture_id    int    `json:"architecture_id,omitempty"`
	Medium_id          int    `json:"medium_id,omitempty"`
	Ptable_id          int    `json:"ptable_id,omitempty"`
	Puppet_ca_proxy_id int    `json:"puppet_ca_proxy_id,omitempty"`
	Subnet_id          string `json:"subnet_id,omitempty"`
	Domain_id          int    `json:"domain_id,omitempty"`
	Realm_id           int    `json:"realm_id,omitempty"`
	Puppet_proxy_id    int    `json:"puppet_proxy_id,omitempty"`
	Location_ids       []int  `json:"location_ids,omitempty"`
	Organization_ids   []int  `json:"organization_ids,omitempty"`
}

Hostgroup definition

type Ifcompute_attributes

type Ifcompute_attributes struct {
	Network string `json:"network,omitempty"`
	Type    string `json:"type,omitempty"`
}

struct for nested interface compute attributes

type Image

type Image struct {
	Id                  int    `json:"id,omitempty"`
	Name                string `json:"name,omitempty"`
	Username            string `json:"username,omitempty"`
	Uuid                string `json:"uuid,omitempty"`
	Compute_resource_id string `json:"compute_resource_id,omitempty"`
	Architecture_id     string `json:"architecture_id,omitempty"`
	Operatingsystem_id  string `json:"operatingsystem_id,omitempty"`
}

Image definition

type Interfaces_attributes

type Interfaces_attributes struct {
	Mac              string   `json:"mac,omitempty"`
	Ip               string   `json:"ip,omitempty"`
	Type             string   `json:"type,omitempty"`
	Name             string   `json:"name,omitempty"`
	Subnet_id        int      `json:"subnet_id,omitempty"`
	Domain_id        int      `json:"domain_id,omitempty"`
	Identifier       string   `json:"identifier,omitempty"`
	Managed          bool     `json:"managed,omitempty"`
	Primary          bool     `json:"primary,omitempty"`
	Provision        bool     `json:"provision,omitempty"`
	Username         string   `json:"username,omitempty"` //only for bmc
	Password         string   `json:"password,omitempty"` //only for bmc
	Provider         string   `json:"provider,omitempty"` //only accepted IPMI
	Virtual          bool     `json:"virtual,omitempty"`
	Tag              string   `json:"tag,omitempty"`
	Attached_to      string   `json:"attached_to,omitempty"`
	Mode             string   `json:"mode,omitempty"` // with validations
	Attached_devices []string `json:"attached_devices,omitempty"`
	Bond_options     string   `json:"bond_options,omitempty"`
	//These are special attributes for hypervisor like vlan and whatnot
	Compute_attributes Ifcompute_attributes `json:"compute_attributes,omitempty"`
}

interfaces_attributes parameters

type Location

type Location struct {
	Id                   int    `json:"id,omitempty"`
	Name                 string `json:"name,omitempty"`
	Description          string `json:"description,omitempty"`
	User_ids             []int  `json:"user_ids,omitempty"`
	Smart_proxy_ids      []int  `json:"smart_proxy_ids,omitempty"`
	Compute_resource_ids []int  `json:"compute_resource_ids,omitempty"`
	Media_ids            []int  `json:"media_ids,omitempty"`
	Config_template_ids  []int  `json:"config_template_ids,omitempty"`
	Domain_ids           []int  `json:"domain_ids,omitempty"`
	Realm_ids            []int  `json:"realm_ids,omitempty"`
	Hostgroup_ids        []int  `json:"hostgroup_ids,omitempty"`
	Environment_ids      []int  `json:"environment_ids,omitempty"`
	Subnet_ids           []int  `json:"subnet_ids,omitempty"`
}

Location definition

type Media

type Media struct {
	Id   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	Path string `json:"path,omitempty"`
	// Os family valid values: AIX, Altlinux, Archlinux, Coreos, Debian, Freebsd, Gentoo, Junos, Redhat, Solaris, Suse, Windows
	Os_family           string `json:"os_family,omitempty"`
	Operatingsystem_ids []int  `json:"operatingsystem_ids,omitempty"`
	Location_ids        []int  `json:"location_ids,omitempty"`
	Organization_ids    []int  `json:"organization_ids,omitempty"`
}

Media definition

type Operatingsystem

type Operatingsystem struct {
	Id                  int    `json:"id,omitempty"`
	Name                string `json:"name,omitempty"`
	Major               string `json:"major,omitempty"`
	Minor               string `json:"minor,omitempty"`
	Description         string `json:"description,omitempty"`
	Family              string `json:"family,omitempty"`
	Release_name        string `json:"release_name,omitempty"`
	Password_hash       string `json:"password_hash,omitempty"`
	Architecture_ids    []int  `json:"architecture_ids,omitempty"`
	Config_template_ids []int  `json:"config_template_ids,omitempty"`
	Medium_ids          []int  `json:"medium_ids,omitempty"`
	Ptable_ids          []int  `json:"ptable_ids,omitempty"`
}

Operatingsystem definition

type Organization

type Organization struct {
	Id                   int    `json:"id,omitempty"`
	Name                 string `json:"name,omitempty"`
	Description          string `json:"description,omitempty"`
	User_ids             []int  `json:"user_ids,omitempty"`
	Smart_proxy_ids      []int  `json:"smart_proxy_ids,omitempty"`
	Compute_resource_ids []int  `json:"compute_resource_ids,omitempty"`
	Media_ids            []int  `json:"media_ids,omitempty"`
	Config_template_ids  []int  `json:"config_template_ids,omitempty"`
	Domain_ids           []int  `json:"domain_ids,omitempty"`
	Realm_ids            []int  `json:"realm_ids,omitempty"`
	Hostgroup_ids        []int  `json:"hostgroup_ids,omitempty"`
	Environment_ids      []int  `json:"environment_ids,omitempty"`
	Subnet_ids           []int  `json:"subnet_ids,omitempty"`
}

Operatingsystem definition

type Params_archetype

type Params_archetype struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

setup param archetype for host params attributes

type Subnet

type Subnet struct {
	Id               int    `json:"id,omitempty"`
	Name             string `json:"name,omitempty"`
	Network          string `json:"network,omitempty"`
	Mask             string `json:"mask,omitempty"`
	Gateway          string `json:"gateway,omitempty"`
	Dns_primary      string `json:"dns_primary,omitempty"`
	Ipam             string `json:"ipam,omitempty"`
	From             string `json:"from,omitempty"`
	To               string `json:"to,omitempty"`
	Vlanid           string `json:"vlanid,omitempty"`
	Domain_ids       []int  `json:"domain_ids,omitempty"`
	Dhcp_id          int    `json:"dhcp_id,omitempty"`
	Tftp_id          int    `json:"tftp_id,omitempty"`
	Dns_id           int    `json:"dns_id,omitempty"`
	Boot_mode        string `json:"boot_mode,omitempty"`
	Location_ids     []int  `json:"location_ids,omitempty"`
	Organization_ids []int  `json:"organization_ids,omitempty"`
}

Subnet definition

type Volumes_attributes

type Volumes_attributes struct {
	Name    string `json:"name,omitempty"`
	Size_gb int    `json:"size_gb,omitempty"`
	//_delete   string `json:",omitempty"`
	Datastore string `json:"datastore,omitempty"`
}

These are things like which datastore or cluster the virtual disks need to live on

Jump to

Keyboard shortcuts

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