Documentation ¶
Index ¶
- func ExtractJobsInto(r pagination.Page, v interface{}) error
- func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type GetLogHeader
- type GetLogResult
- type GetResult
- type Job
- type JobPage
- type ListOpts
- type ListOptsBuilder
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractJobsInto ¶
func ExtractJobsInto(r pagination.Page, v interface{}) error
func List ¶
func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns a Pager which allows you to iterate over a collection of jobs. It accepts a ListOpts struct, which allows you to filter the returned collection for greater efficiency.
Types ¶
type CreateOpts ¶
type CreateOpts struct { // To represents the AgentID To string `json:"to" required:"true"` // 1-86400 Timeout int `json:"timeout" required:"true"` // agent can be: chef (zero), execute (script, tarball) Agent string `json:"agent" required:"true"` // action can be: script, zero, tarball Action string `json:"action" required:"true"` Payload string `json:"payload" required:"true"` }
CreateOpts represents the attributes used when creating a new job.
func (CreateOpts) ToJobCreateMap ¶
func (opts CreateOpts) ToJobCreateMap() (map[string]interface{}, error)
ToJobCreateMap builds a request body from CreateOpts.
type CreateOptsBuilder ¶
CreateOptsBuilder allows extensions to add additional parameters to the Create request.
type CreateResult ¶
type CreateResult struct {
// contains filtered or unexported fields
}
InitResult represents the result of a create operation. Call its Extract method to interpret it as a Job.
func Create ¶
func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and creates a new job using the values provided.
func (CreateResult) Extract ¶
Extract is a function that accepts a result and extracts a job resource.
func (CreateResult) ExtractInto ¶
func (r CreateResult) ExtractInto(v interface{}) error
type GetLogHeader ¶
type GetLogHeader struct {
ContentType string `json:"Content-Type"`
}
GetLogHeader represents the headers returned in the response from a GetLog request.
type GetLogResult ¶
type GetLogResult struct { gophercloud.HeaderResult Body io.ReadCloser }
InitResult represents the result of a get job log operation. Call its ExtractHeaders method to interpret it as an job log response headers or ExtractContent method to interpret it as a response content.
func GetLog ¶
func GetLog(c *gophercloud.ServiceClient, id string) (r GetLogResult)
GetLog retrieves a log for a Job ID.
func (*GetLogResult) ExtractContent ¶
func (r *GetLogResult) ExtractContent() ([]byte, error)
ExtractContent is a function that takes a GetLogResult's io.Reader body and reads all available data into a slice of bytes. Please be aware that due the nature of io.Reader is forward-only - meaning that it can only be read once and not rewound. You can recreate a reader from the output of this function by using bytes.NewReader(initBytes)
func (GetLogResult) ExtractHeaders ¶
func (r GetLogResult) ExtractHeaders() (*GetLogHeader, error)
Extract will return a struct of headers returned from a call to GetLog.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult represents the result of a get operation. Call its Extract method to interpret it as a Job.
func Get ¶
func Get(c *gophercloud.ServiceClient, id string) (r GetResult)
Get retrieves a specific job based on its unique ID.
func (GetResult) ExtractInto ¶
func (r GetResult) ExtractInto(v interface{}) error
type Job ¶
type Job struct { Version int `json:"version"` Sender string `json:"sender"` // RequestID represents the JobID RequestID string `json:"request_id"` // To represents the AgentID To string `json:"to"` Timeout int `json:"timeout"` // agent can be: chef (zero), execute (script, tarball) Agent string `json:"agent"` // action can be: script, zero, tarball Action string `json:"action"` Payload string `json:"payload"` // Status can be: queued, executing, failed, complete Status string `json:"status"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` Project string `json:"project"` User User `json:"user"` }
Job represents an Arc Job.
func ExtractJobs ¶
func ExtractJobs(r pagination.Page) ([]Job, error)
ExtractJobs accepts a Page struct, specifically a JobPage struct, and extracts the elements into a slice of Job structs. In other words, a generic collection is mapped into a relevant slice.
func (*Job) MarshalJSON ¶
func (*Job) UnmarshalJSON ¶
type JobPage ¶
type JobPage struct {
pagination.MarkerPageBase
}
JobPage is the page returned by a pager when traversing over a collection of jobs.
func (JobPage) LastMarker ¶
LastMarker returns the next page in a ListResult.
func (JobPage) NextPageURL ¶
NextPageURL is invoked when a paginated collection of jobs has reached the end of a page and the pager seeks to traverse over a new one. In order to do this, it needs to construct the next page's URL.
type ListOpts ¶
type ListOpts struct { Page int `q:"page"` PerPage int `q:"per_page"` AgentID string `q:"agent_id"` }
ListOpts allows the filtering of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the job attributes you want to see returned. Page and PerPage are used for pagination.
func (ListOpts) ToJobListQuery ¶
ToJobListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.