Documentation
¶
Index ¶
- func CheckResponse(r *http.Response) error
- func Stringify(message interface{}) string
- type Client
- type Dashboard
- type DashboardService
- type DashboardServiceOp
- type ErrorResponse
- type Facts
- type FactsService
- type FactsServiceOp
- type Host
- type HostsService
- type HostsServiceOp
- type ListOptions
- type RequestCompletionCallback
- type Response
- type ResponseMeta
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type Client ¶
type Client struct { BaseURL *url.URL Hosts HostsService Dashboard DashboardService Facts FactsService // contains filtered or unexported fields }
func (*Client) Do ¶
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 will be written to v, without attempting to decode it.
type Dashboard ¶
type Dashboard struct { TotalHosts int `json:"total_hosts"` BadHosts int `json:"bad_hosts"` BadHostsEnabled int `json:"bad_hosts_enabled"` ActiveHosts int `json:"active_hosts"` ActiveHostsOk int `json:"active_hosts_ok"` ActiveHostsOkEnabled int `json:"active_hosts_ok_enabled"` OkHosts int `json:"ok_hosts"` OkHostsEnabled int `json:"ok_hosts_enabled"` OutOfSyncHosts int `json:"out_of_sync_hosts"` OutOfSyncHostsEnabled int `json:"out_of_sync_hosts_enabled"` DisabledHosts int `json:"disabled_hosts"` PendingHosts int `json:"pending_hosts"` PendingHostsEnabled int `json:"pending_hosts_enabled"` GoodHosts int `json:"good_hosts"` GoodHostsEnabled int `json:"good_hosts_enabled"` Percentage int `json:"percentage"` ReportsMissing int `json:"reports_missing"` Glossary struct { TotalHosts string `json:"total_hosts"` BadHosts string `json:"bad_hosts"` BadHostsEnabled string `json:"bad_hosts_enabled"` ActiveHosts string `json:"active_hosts"` ActiveHostsOk string `json:"active_hosts_ok"` ActiveHostsOkEnabled string `json:"active_hosts_ok_enabled"` OkHosts string `json:"ok_hosts"` OkHostsEnabled string `json:"ok_hosts_enabled"` OutOfSyncHosts string `json:"out_of_sync_hosts"` OutOfSyncHostsEnabled string `json:"out_of_sync_hosts_enabled"` DisabledHosts string `json:"disabled_hosts"` PendingHosts string `json:"pending_hosts"` PendingHostsEnabled string `json:"pending_hosts_enabled"` GoodHosts string `json:"good_hosts"` GoodHostsEnabled string `json:"good_hosts_enabled"` Percentage string `json:"percentage"` ReportsMissing string `json:"reports_missing"` } `json:"glossary"` }
type DashboardService ¶
type DashboardServiceOp ¶
type DashboardServiceOp struct {
// contains filtered or unexported fields
}
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message Message string `json:"message"` }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type FactsService ¶
type FactsServiceOp ¶
type FactsServiceOp struct {
// contains filtered or unexported fields
}
func (*FactsServiceOp) Get ¶
func (s *FactsServiceOp) Get(ctx context.Context, hostname string, opt *ListOptions) (Facts, *Response, error)
type Host ¶
type Host struct { IP string `json:"ip"` IP6 interface{} `json:"ip6"` EnvironmentID interface{} `json:"environment_id"` EnvironmentName interface{} `json:"environment_name"` LastReport interface{} `json:"last_report"` Mac interface{} `json:"mac"` RealmID interface{} `json:"realm_id"` RealmName interface{} `json:"realm_name"` SpMac interface{} `json:"sp_mac"` SpIP interface{} `json:"sp_ip"` SpName interface{} `json:"sp_name"` DomainID interface{} `json:"domain_id"` DomainName interface{} `json:"domain_name"` ArchitectureID interface{} `json:"architecture_id"` ArchitectureName interface{} `json:"architecture_name"` OperatingsystemID interface{} `json:"operatingsystem_id"` OperatingsystemName interface{} `json:"operatingsystem_name"` SubnetID interface{} `json:"subnet_id"` SubnetName interface{} `json:"subnet_name"` Subnet6ID interface{} `json:"subnet6_id"` Subnet6Name interface{} `json:"subnet6_name"` SpSubnetID interface{} `json:"sp_subnet_id"` PtableID interface{} `json:"ptable_id"` PtableName interface{} `json:"ptable_name"` MediumID interface{} `json:"medium_id"` MediumName interface{} `json:"medium_name"` Build bool `json:"build"` Comment interface{} `json:"comment"` Disk interface{} `json:"disk"` InstalledAt interface{} `json:"installed_at"` ModelID interface{} `json:"model_id"` HostgroupID interface{} `json:"hostgroup_id"` OwnerID interface{} `json:"owner_id"` OwnerType interface{} `json:"owner_type"` Enabled bool `json:"enabled"` Managed bool `json:"managed"` UseImage interface{} `json:"use_image"` ImageFile string `json:"image_file"` UUID interface{} `json:"uuid"` ComputeResourceID interface{} `json:"compute_resource_id"` ComputeResourceName interface{} `json:"compute_resource_name"` ComputeProfileID interface{} `json:"compute_profile_id"` ComputeProfileName interface{} `json:"compute_profile_name"` Capabilities []string `json:"capabilities"` ProvisionMethod string `json:"provision_method"` Certname string `json:"certname"` ImageID interface{} `json:"image_id"` ImageName interface{} `json:"image_name"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` LastCompile interface{} `json:"last_compile"` GlobalStatus int `json:"global_status"` GlobalStatusLabel string `json:"global_status_label"` OrganizationID interface{} `json:"organization_id"` OrganizationName interface{} `json:"organization_name"` LocationID interface{} `json:"location_id"` LocationName interface{} `json:"location_name"` PuppetStatus int `json:"puppet_status"` ModelName interface{} `json:"model_name"` Name string `json:"name"` ID int `json:"id"` PuppetProxyID interface{} `json:"puppet_proxy_id"` PuppetProxyName interface{} `json:"puppet_proxy_name"` PuppetCaProxyID interface{} `json:"puppet_ca_proxy_id"` PuppetCaProxyName interface{} `json:"puppet_ca_proxy_name"` PuppetProxy interface{} `json:"puppet_proxy"` PuppetCaProxy interface{} `json:"puppet_ca_proxy"` HostgroupName interface{} `json:"hostgroup_name"` HostgroupTitle interface{} `json:"hostgroup_title"` }
type HostsService ¶
type HostsServiceOp ¶
type HostsServiceOp struct {
// contains filtered or unexported fields
}
func (*HostsServiceOp) List ¶
func (s *HostsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Host, *Response, error)
type ListOptions ¶
type ListOptions struct { Page int `json:"page,omitempty"` PerPage int `json:"per_page,omitempty"` EnvironmentID string `json:"environment_id,omitempty"` }
ListOptions
type RequestCompletionCallback ¶
RequestCompletionCallback defines the type of the request callback function
type Response ¶
type Response struct { *http.Response Meta *ResponseMeta }
type ResponseMeta ¶
type Timestamp ¶
Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. All exported methods of time.Time can be called on Timestamp.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.