Documentation
¶
Index ¶
- func ExtractAutomationsInto(r pagination.Page, v any) error
- func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type Automation
- type AutomationPage
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type DeleteResult
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractAutomationsInto ¶
func ExtractAutomationsInto(r pagination.Page, v any) 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 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"`
// RepositoryAuthenticationEnabled is set to true when a repository_credentials
// is set
RepositoryAuthenticationEnabled bool `json:"repository_authentication_enabled"`
// 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]any `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) 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"`
// RepositoryCredentials credentials needed to access the repository.
// e.g.: git token or ssh key
RepositoryCredentials string `json:"repository_credentials,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]any `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]any, error)
ToAutomationCreateMap 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
}
CreateResult represents the result of a create operation. Call its Extract method to interpret it as an Automation.
func Create ¶
func Create(ctx context.Context, c *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
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 ¶
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.
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 (GetResult) Extract ¶
func (r GetResult) Extract() (*Automation, error)
Extract is a function that accepts a result and extracts an automation resource.
func (GetResult) ExtractInto ¶
type ListOpts ¶
ListOpts allows the listing of paginated collections through the API. Page and PerPage are used for pagination.
func (ListOpts) ToAutomationListQuery ¶
ToAutomationListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
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"`
// RepositoryCredentials credentials needed to access the repository.
// e.g.: git token or ssh key
RepositoryCredentials *string `json:"repository_credentials,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]any `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]any, error)
ToAutomationUpdateMap builds a request body from UpdateOpts.
type UpdateOptsBuilder ¶
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 ¶
func Update(ctx context.Context, c *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)
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.