automations

package
v0.0.0-...-e39ec87 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAutomationsInto

func ExtractAutomationsInto(r pagination.Page, v interface{}) error

func List

List returns a Pager which allows you to iterate over a collection of automations. It accepts a ListOpts struct.

Types

type Automation

type Automation struct {
	// An automation ID
	ID string `json:"-"`

	// Human-readable name for the automation. Might not be unique.
	Name string `json:"name"`

	// A valid URL to the automation repository.
	Repository string `json:"repository"`

	// The repository revision.
	RepositoryRevision string `json:"repository_revision"`

	// The parent Openstack project ID.
	ProjectID string `json:"project_id"`

	// The automation timeout in seconds.
	Timeout int `json:"timeout"`

	// The automation tags. Doesn't work yet.
	Tags map[string]string `json:"tags"`

	// The date, when the automation was created.
	CreatedAt time.Time `json:"-"`

	// The date, when the automation was updated.
	UpdatedAt time.Time `json:"-"`

	// The type of the automation. Can be Script or Chef.
	Type string `json:"type"`

	// An ordered list of Chef roles and/or recipes that are run in the exact
	// order.
	RunList []string `json:"run_list"`

	// A map of Chef cookbook attributes.
	ChefAttributes map[string]interface{} `json:"chef_attributes"`

	// The automation log level. Doesn't work yet.
	LogLevel string `json:"log_level"`

	// An enabled debug mode will not delete the temporary working directory
	// on the instance when the automation job exists
	Debug bool `json:"debug"`

	// The Chef version to run the cookbook.
	ChefVersion string `json:"chef_version"`

	// The Script path.
	Path string `json:"path"`

	// The Script arguments list.
	Arguments []string `json:"arguments"`

	// The Script environment map.
	Environment map[string]string `json:"environment"`
}

Automation represents a Lyra Automation.

func ExtractAutomations

func ExtractAutomations(r pagination.Page) ([]Automation, error)

ExtractAutomations accepts a Page struct, specifically an AutomationPage struct, and extracts the elements into a slice of Automation structs. In other words, a generic collection is mapped into a relevant slice.

func (*Automation) MarshalJSON

func (r *Automation) MarshalJSON() ([]byte, error)

func (*Automation) UnmarshalJSON

func (r *Automation) UnmarshalJSON(b []byte) error

type AutomationPage

type AutomationPage struct {
	pagination.MarkerPageBase
}

AutomationPage is the page returned by a pager when traversing over a collection of automations.

func (AutomationPage) IsEmpty

func (r AutomationPage) IsEmpty() (bool, error)

IsEmpty checks whether an AutomationPage struct is empty.

func (AutomationPage) LastMarker

func (r AutomationPage) LastMarker() (string, error)

LastMarker returns the next page in a ListResult.

func (AutomationPage) NextPageURL

func (r AutomationPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of automations 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 CreateOpts

type CreateOpts struct {
	Name       string `json:"name" required:"true"`
	Repository string `json:"repository" required:"true"`
	// RepositoryRevision defaults to master, when Type is Chef
	RepositoryRevision string `json:"repository_revision,omitempty"`
	// Timeout defaults to 3600. Must be within 1-86400
	Timeout int `json:"timeout,omitempty"`
	// Tags don't work
	Tags map[string]string `json:"tags,omitempty"`
	Type string            `json:"type" required:"true"`

	// RunList is required only, when Type is Chef
	RunList []string `json:"run_list,omitempty"`
	// ChefAttributes can be set only, when Type is Chef
	ChefAttributes map[string]interface{} `json:"chef_attributes,omitempty"`
	LogLevel       string                 `json:"log_level,omitempty"`
	// Debug can be set only, when Type is Chef
	Debug bool `json:"debug,omitempty"`
	// ChefVersion can be set only, when Type is Chef
	ChefVersion string `json:"chef_version,omitempty"`

	// Path is required only, when Type is Script
	Path string `json:"path,omitempty"`
	// Path can be set only, when Type is Script
	Arguments []string `json:"arguments,omitempty"`
	// Environment can be set only, when Type is Script
	Environment map[string]string `json:"environment,omitempty"`
}

CreateOpts represents the attributes used when creating a new automation.

func (CreateOpts) ToAutomationCreateMap

func (opts CreateOpts) ToAutomationCreateMap() (map[string]interface{}, error)

ToAutomationCreateMap builds a request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToAutomationCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult represents the result of a create operation. Call its Extract method to interpret it as an Automation.

func Create

Create accepts a CreateOpts struct and creates a new automation using the values provided.

func (CreateResult) Extract

func (r CreateResult) Extract() (*Automation, error)

Extract is a function that accepts a result and extracts an automation resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

type DeleteResult

type DeleteResult struct {
	gophercloud.ErrResult
}

DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Delete

func Delete(c *gophercloud.ServiceClient, id string) (r DeleteResult)

Delete accepts a unique ID and deletes the automation associated with it.

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 an Automation.

func Get

func Get(c *gophercloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific automation based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*Automation, error)

Extract is a function that accepts a result and extracts an automation resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

type ListOpts

type ListOpts struct {
	Page    int `q:"page"`
	PerPage int `q:"per_page"`
}

ListOpts allows the listing of paginated collections through the API. Page and PerPage are used for pagination.

func (ListOpts) ToAutomationListQuery

func (opts ListOpts) ToAutomationListQuery() (string, error)

ToAutomationListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToAutomationListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

type UpdateOpts

type UpdateOpts struct {
	Name       string `json:"name,omitempty"`
	Repository string `json:"repository,omitempty"`
	// Repository revision can be unset to empty only for Script Type
	RepositoryRevision *string `json:"repository_revision,omitempty"`
	// Timeout defaults to 3600. Must be within 1-86400
	Timeout int `json:"timeout,omitempty"`
	// Tags don't work
	Tags map[string]string `json:"tags,omitempty"`

	// Chef
	RunList        []string               `json:"run_list,omitempty"`
	ChefAttributes map[string]interface{} `json:"chef_attributes,omitempty"`
	LogLevel       *string                `json:"log_level,omitempty"`
	Debug          *bool                  `json:"debug,omitempty"`
	ChefVersion    *string                `json:"chef_version,omitempty"`

	// Script
	Path        *string           `json:"path,omitempty"`
	Arguments   []string          `json:"arguments,omitempty"`
	Environment map[string]string `json:"environment,omitempty"`
}

UpdateOpts represents the attributes used when updating an existing automation.

func (UpdateOpts) ToAutomationUpdateMap

func (opts UpdateOpts) ToAutomationUpdateMap() (map[string]interface{}, error)

ToAutomationUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToAutomationUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult represents the result of an update operation. Call its Extract method to interpret it as an Automation.

func Update

Update accepts a UpdateOpts struct and updates an existing automation using the values provided.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*Automation, error)

Extract is a function that accepts a result and extracts an automation resource.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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