foreman

package
v0.0.0-...-c825e14 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

func Int

func Int(v int) *int

Int is a helper routine that allocates a new int value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Stringify

func Stringify(message interface{}) string

Stringify attempts to create a reasonable string representation of types in the GitHub library. It does things like resolve pointers to their values and omits struct fields with nil values.

Types

type BasicAuthTransport

type BasicAuthTransport struct {
	Username string
	Password string

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

BasicAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication with the provided username and password.

func (*BasicAuthTransport) Client

func (t *BasicAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.

func (*BasicAuthTransport) RoundTrip

func (t *BasicAuthTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

type Client

type Client struct {

	// Base URL for API requests. BaseURL should always be specified with
	// a trailing slash.
	BaseURL *url.URL

	// Services used for talking to different parts of the Foreman API.
	Hosts      *HostsService
	Hostgroups *HostgroupsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

type ComputeAttributes

type ComputeAttributes struct {
	CPUs               *int    `json:"cpus,omitempty"`
	Cores              *int    `json:"corespersocket,omitempty"`
	Memory             *int    `json:"memory_mb,omitempty"`
	Cluster            *string `json:"cluster,omitempty"`
	Path               *string `json:"path,omitempty"`
	GuestID            *string `json:"guest_id,omitempty"`
	SCSIControllerType *string `json:"scsi_controller_type,omitempty"`
	HardwareVersion    *string `json:"hardware_version,omitempty"`
	Start              *bool   `json:"start,omitempty"`
}

ComputeAttributes represents the attributes of a host.

type GetOptions

type GetOptions struct {
	Page    int `url:"page,omitempty"`
	PerPage int `url:"per_page,omitempty"`
}

type Host

type Host struct {
	Name                    *string                  `json:"name,omitempty"`
	LocationID              *int                     `json:"location_id,omitempty"`
	OrganizationID          *int                     `json:"organization_id,omitempty"`
	EnvironmentID           *string                  `json:"environment_id,omitempty"`
	IP                      *string                  `json:"ip,omitempty"`
	MAC                     *string                  `json:"mac,omitempty"`
	ArchitectureID          *int                     `json:"architecture_id,omitempty"`
	DomainID                *int                     `json:"domain_id,omitempty"`
	RealmID                 *int                     `json:"realm_id,omitempty"`
	PuppetProxyID           *int                     `json:"puppet_proxy_id,omitempty"`
	PuppetClassIDs          *[]int                   `json:"puppetclass_ids,omitempty"`
	OperatingSystemID       *string                  `json:"operatingsystem_id,omitempty"`
	MediumID                *string                  `json:"medium_id,omitempty"`
	PTableID                *int                     `json:"ptable_id,omitempty"`
	SubnetID                *int                     `json:"subnet_id,omitempty"`
	ComputeResourceID       *int                     `json:"compute_resource_id,omitempty"`
	ModelID                 *int                     `json:"model_id,omitempty"`
	HostGroupID             *int                     `json:"hostgroup_id,omitempty"`
	OwnerID                 *int                     `json:"owner_id,omitempty"`
	OwnerType               *string                  `json:"owner_type,omitempty"`
	PuppetCAProxyID         *int                     `json:"puppet_ca_proxy_id,omitempty"`
	ImageID                 *int                     `json:"image_id,omitempty"`
	HostParameterAttributes *HostParameterAttributes `json:"host_parameter_attributes,omitempty"`
	Build                   *bool                    `json:"build,omitempty"`
	Enabled                 *bool                    `json:"enabled,omitempty"`
	ProvisionMethod         *string                  `json:"provision_method,omitempty"`
	Managed                 *bool                    `json:"managed,omitempty"`
	ProgressReportID        *string                  `json:"progress_report_id,omitempty"`
	Comment                 *string                  `json:"comment,omitempty"`
	Capabilities            *string                  `json:"capabilities,omitempty"`
	ComputeProfileID        *int                     `json:"compute_profile_id,omitempty"`
	RootPassword            *string                  `json:"root_pass,omitempty"`
	InterfaceAttributes     *InterfaceAttributes     `json:"interface_attributes,omitempty"`
	ComputeAttributes       *ComputeAttributes       `json:"compute_attributes,omitempty"`
}

func (Host) String

func (h Host) String() string

type HostGetAllOptions

type HostGetAllOptions struct {
	HostGroupID    int `url:"hostgroup_id,omitempty"`
	LocationID     int `url:"location_id,omitempty"`
	OrganizationID int `url:"organization_id,omitempty"`
	EnvironmentID  int `url:"environment_id,omitempty"`
	Search         int `url:"search,omitempty"`
	Order          int `url:"order,omitempty"`

	GetOptions
}

type HostParameterAttributes

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

HostParameterAttributes represents the Host's parameters.

type Hostgroup

type Hostgroup struct {
	Name              *string `json:"name"`
	ParentID          *int    `json:"parent_id"`
	EnvironmentID     *int    `json:"environment_id"`
	ComputeProfileID  *int    `json:"compute_profile_id"`
	OperatingSystemID *int    `json:"operatingsystem_id"`
	ArchitectureID    *int    `json:"architecture_id"`
	PXELoader         *string `json:"pxe_loader"`
	MediumID          *int    `json:"medium_id"`
	PTableID          *int    `json:"ptable_id"`
	PuppetCAProxyID   *int    `json:"puppet_ca_proxy_id"`
	SubnetID          *int    `json:"subnet_id"`
	DomainID          *int    `json:"domain_id"`
	RealmID           *int    `json:"realm_id"`
	PuppetProxyID     *int    `json:"puppet_proxy_id"`
	RootPassword      *string `json:"root_pass"`
}

func (Hostgroup) String

func (h Hostgroup) String() string

type HostgroupGetAllOptions

type HostgroupGetAllOptions struct {
	PuppetClassID string `url:"puppetclass_id"`
	Search        string `url:"search"`
	Order         string `url:"order"`

	GetOptions
}

type HostgroupsService

type HostgroupsService service

func (*HostgroupsService) Create

func (s *HostgroupsService) Create(ctx context.Context, hostgroup *Hostgroup) (*Hostgroup, *Response, error)

func (*HostgroupsService) Get

func (*HostgroupsService) GetAll

type HostsService

type HostsService service

func (*HostsService) Create

func (s *HostsService) Create(ctx context.Context, host *Host) (*Host, *Response, error)

func (*HostsService) Delete

func (s *HostsService) Delete(ctx context.Context, id string) (*Response, error)

func (*HostsService) Get

func (s *HostsService) Get(ctx context.Context, id string) (*Host, *Response, error)

func (*HostsService) GetAll

func (s *HostsService) GetAll(ctx context.Context, opt *HostGetAllOptions) ([]*Host, *Response, error)

func (*HostsService) Update

func (s *HostsService) Update(ctx context.Context, id string, host *Host) (*Host, *Response, error)

type InterfaceAttributes

type InterfaceAttributes struct {
	MAC               *string            `json:"mac,omitempty"`
	IP                *string            `json:"ip,omitempty"`
	IP6               *string            `json:"ip6,omitempty"`
	Type              *string            `json:"type,omitempty"`
	Name              *string            `json:"name,omitempty"`
	SubnetID          *int               `json:"subnet_id,omitempty"`
	Subnet6ID         *int               `json:"subnet6_id,omitempty"`
	DomainID          *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"`
	Password          *string            `json:"password,omitempty"`
	Provider          *string            `json:"provider,omitempty"`
	Virtual           *bool              `json:"virtual,omitempty"`
	Tag               *string            `json:"tag,omitempty"`
	AttachedTo        *string            `json:"attached_to,omitempty"`
	Mode              *string            `json:"mode,omitempty"`
	AttachedDevices   *[]string          `json:"attached_devices,omitempty"`
	BondOptions       *string            `json:"bond_options,omitempty"`
	ComputeAttributes *ComputeAttributes `json:"compute_attributes,omitempty"`
}

InterfaceAttributes represents the attributes of a hosts' interface(s).

type Response

type Response struct {
	*http.Response
}

Jump to

Keyboard shortcuts

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