Documentation ¶
Index ¶
- Variables
- func ExtractStacksInto(r pagination.Page, v interface{}) error
- func List(c *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type Client
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type CreatedStack
- type DeleteResult
- type Environment
- type ErrInvalidDataFormat
- type ErrInvalidEnvironment
- type ErrInvalidTemplateFormatVersion
- type ErrTemplateRequired
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type Stack
- type StackList
- type StackPage
- type TE
- type Template
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdatePatchOptsBuilder
- type UpdateResult
Constants ¶
This section is empty.
Variables ¶
var EnvironmentSections = map[string]bool{ "parameters": true, "parameter_defaults": true, "resource_registry": true, }
EnvironmentSections is a map containing allowed sections in a stack environment file
var TemplateFormatVersions = map[string]bool{ "HeatTemplateFormatVersion": true, "heat_template_version": true, "AWSTemplateFormatVersion": true, }
TemplateFormatVersions is a map containing allowed variations of the template format version Note that this contains the permitted variations of the _keys_ not the values.
Functions ¶
func ExtractStacksInto ¶
func ExtractStacksInto(r pagination.Page, v interface{}) error
func List ¶
func List(c *gcorecloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List all stacks
Types ¶
type Client ¶
Client is an interface that expects a Get method similar to http.Get. This is needed for unit testing, since we can mock an http client. Thus, the client will usually be an http.Client EXCEPT in unit tests.
type CreateOpts ¶
type CreateOpts struct { // The name of the stack. It must start with an alphabetic character. Name string `json:"stack_name" required:"true"` // A structure that contains either the template file or url. Call the // associated methods to extract the information relevant to send in a create request. TemplateOpts *Template `json:"-" required:"true"` // Enables or disables deletion of all stack resources when a stack // creation fails. Default is true, meaning all resources are not deleted when // stack creation fails. DisableRollback *bool `json:"disable_rollback,omitempty"` // A structure that contains details for the environment of the stack. EnvironmentOpts *Environment `json:"-"` // User-defined parameters to pass to the template. Parameters map[string]interface{} `json:"parameters,omitempty"` // The timeout for stack creation in minutes. Timeout int `json:"timeout_mins,omitempty"` // A list of tags to assosciate with the Stack Tags []string `json:"-"` }
CreateOpts is the common options struct used in this package's Create operation.
func (CreateOpts) ToStackCreateMap ¶
func (opts CreateOpts) ToStackCreateMap() (map[string]interface{}, error)
ToStackCreateMap casts a CreateOpts struct to a map.
type CreateOptsBuilder ¶
CreateOptsBuilder is the interface options structs have to satisfy in order to be used in the main Create operation in this package. Since many extensions decorate or modify the common logic, it is useful for them to satisfy a basic interface in order for them to be used.
type CreateResult ¶
type CreateResult struct {
gcorecloud.Result
}
CreateResult represents the result of a Create operation.
func Create ¶
func Create(c *gcorecloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)
Create accepts a CreateOpts struct and creates a new stack using the values provided.
func (CreateResult) Extract ¶
func (r CreateResult) Extract() (*CreatedStack, error)
Extract is a function that accepts a result and extracts a heat stack.
type CreatedStack ¶
type CreatedStack struct { ID string `json:"id"` Links []gcorecloud.Link `json:"links"` }
CreatedStack represents the object extracted from a Create operation.
type DeleteResult ¶
type DeleteResult struct {
gcorecloud.ErrResult
}
DeleteResult represents the result of a Delete operation.
func Delete ¶
func Delete(c *gcorecloud.ServiceClient, stackID string) (r DeleteResult)
Delete deletes a stack based on the stack name and stack ID.
type Environment ¶
type Environment struct {
TE
}
Environment is a structure that represents stack environments
func (*Environment) Validate ¶
func (e *Environment) Validate() error
Validate validates the contents of the Environment
type ErrInvalidDataFormat ¶
type ErrInvalidDataFormat struct {
gcorecloud.BaseError
}
func (ErrInvalidDataFormat) Error ¶
func (e ErrInvalidDataFormat) Error() string
type ErrInvalidEnvironment ¶
type ErrInvalidEnvironment struct { gcorecloud.BaseError Section string }
func (ErrInvalidEnvironment) Error ¶
func (e ErrInvalidEnvironment) Error() string
type ErrInvalidTemplateFormatVersion ¶
type ErrInvalidTemplateFormatVersion struct { gcorecloud.BaseError Version string }
func (ErrInvalidTemplateFormatVersion) Error ¶
func (e ErrInvalidTemplateFormatVersion) Error() string
type ErrTemplateRequired ¶
type ErrTemplateRequired struct {
gcorecloud.BaseError
}
func (ErrTemplateRequired) Error ¶
func (e ErrTemplateRequired) Error() string
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 Heat stack.
func Get ¶
func Get(c *gcorecloud.ServiceClient, id string) (r GetResult)
Get retrieves a specific heat stack.
func (GetResult) ExtractInto ¶
func (r GetResult) ExtractInto(v interface{}) error
type ListOpts ¶
type ListOpts struct { // TenantID is the UUID of the tenant. A tenant is also known as // a project. TenantID string `q:"tenant_id"` // ID filters the stack list by a stack ID ID string `q:"id"` // Status filters the stack list by a status. Status string `q:"status"` // Name filters the stack list by a name. Name string `q:"name"` // Marker is the ID of last-seen item. Marker string `q:"marker"` // Limit is an integer value for the limit of values to return. Limit int `q:"limit"` // SortKey allows you to sort by stack_name, stack_status, creation_time, or // update_time key. SortKey types.SortKey `q:"sort_keys"` // SortDir sets the direction, and is either `asc` or `desc`. SortDir types.SortDir `q:"sort_dir"` // AllTenants is a bool to show all tenants. AllTenants bool `q:"global_tenant"` // ShowDeleted set to `true` to include deleted stacks in the list. ShowDeleted bool `q:"show_deleted"` // ShowNested set to `true` to include nested stacks in the list. ShowNested bool `q:"show_nested"` // Tags lists stacks that contain one or more simple string tags. Tags string `q:"tags"` // TagsAny lists stacks that contain one or more simple string tags. TagsAny string `q:"tags_any"` // NotTags lists stacks that do not contain one or more simple string tags. NotTags string `q:"not_tags"` // NotTagsAny lists stacks that do not contain one or more simple string tags. NotTagsAny string `q:"not_tags_any"` }
ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the network attributes you want to see returned.
func (ListOpts) ToStackListQuery ¶
ToStackListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type Stack ¶
type Stack struct { *StackList Capabilities []string `json:"capabilities"` DisableRollback bool `json:"disable_rollback"` NotificationTopics []string `json:"notification_topics"` TemplateDescription *string `json:"template_description"` TimeoutMinutes int `json:"timeout_mins"` Outputs []map[string]interface{} `json:"outputs"` Parameters map[string]interface{} `json:"parameters"` }
Stack struct
type StackList ¶
type StackList struct { CreationTime time.Time `json:"creation_time"` DeletionTime *time.Time `json:"deletion_time"` UpdatedTime *time.Time `json:"updated_time"` Description string `json:"description"` ID string `json:"id"` Links []gcorecloud.Link `json:"links"` Parent *string `json:"parent"` StackName string `json:"stack_name"` StackOwner *string `json:"stack_owner"` StackStatus string `json:"stack_status"` StackStatusReason *string `json:"stack_status_reason"` StackUserProjectID string `json:"stack_user_project_id"` Tags []string `json:"tags"` }
Stack struct
func ExtractStacks ¶
func ExtractStacks(r pagination.Page) ([]StackList, error)
ExtractStack accepts a Page struct, specifically a StackPage struct, and extracts the elements into a slice of Stack structs. In other words, a generic collection is mapped into a relevant slice.
func ListAll ¶
func ListAll(c *gcorecloud.ServiceClient, opts ListOptsBuilder) ([]StackList, error)
List all stacks
type StackPage ¶
type StackPage struct {
pagination.LinkedPageBase
}
StackPage is the page returned by a pager when traversing over a collection of loadbalancers.
func (StackPage) NextPageURL ¶
NextPageURL is invoked when a paginated collection of loadbalancers 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 TE ¶
type TE struct { // Bin stores the contents of the template or environment. Bin []byte // URL stores the URL of the template. This is allowed to be a 'file://' // for local files. URL string // Parsed contains a parsed version of Bin. Since there are 2 different // fields referring to the same value, you must be careful when accessing // this filed. Parsed map[string]interface{} // Files contains a mapping between the urls in templates to their contents. Files map[string]string // contains filtered or unexported fields }
TE is a base structure for both Template and Environment
func (*TE) Fetch ¶
Fetch fetches the contents of a TE from its URL. Once a TE structure has a URL, call the fetch method to fetch the contents.
type Template ¶
type Template struct {
TE
}
Template is a structure that represents OpenStack Heat templates
type UpdateOpts ¶
type UpdateOpts struct { // A structure that contains either the template file or url. Call the // associated methods to extract the information relevant to send in a create request. TemplateOpts *Template `json:"-"` // A structure that contains details for the environment of the stack. EnvironmentOpts *Environment `json:"-"` // User-defined parameters to pass to the template. Parameters map[string]interface{} `json:"parameters,omitempty"` // The timeout for stack creation in minutes. Timeout int `json:"timeout_mins,omitempty"` // A list of tags to associate with the Stack Tags []string `json:"-"` }
UpdateOpts contains the common options struct used in this package's Update and UpdatePatch operations.
func (UpdateOpts) ToStackUpdateMap ¶
func (opts UpdateOpts) ToStackUpdateMap() (map[string]interface{}, error)
ToStackUpdateMap validates that a template was supplied and calls the toStackUpdateMap private function.
func (UpdateOpts) ToStackUpdatePatchMap ¶
func (opts UpdateOpts) ToStackUpdatePatchMap() (map[string]interface{}, error)
ToStackUpdatePatchMap calls the private function toStackUpdateMap directly.
type UpdateOptsBuilder ¶
UpdateOptsBuilder is the interface options structs have to satisfy in order to be used in the Update operation in this package.
type UpdatePatchOptsBuilder ¶
UpdatePatchOptsBuilder is the interface options structs have to satisfy in order to be used in the UpdatePatch operation in this package
type UpdateResult ¶
type UpdateResult struct {
gcorecloud.ErrResult
}
UpdateResult represents the result of a Update operation.
func Update ¶
func Update(c *gcorecloud.ServiceClient, stackID string, opts UpdateOptsBuilder) (r UpdateResult)
Update accepts an UpdateOpts struct and updates an existing stack using the http PUT verb with the values provided. opts.TemplateOpts is required.
func UpdatePatch ¶
func UpdatePatch(c *gcorecloud.ServiceClient, stackID string, opts UpdatePatchOptsBuilder) (r UpdateResult)
Update accepts an UpdateOpts struct and updates an existing stack using the
http PATCH verb with the values provided. opts.TemplateOpts is not required.