gophercloud: github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks Index | Files

package stacks

import "github.com/rackspace/gophercloud/openstack/orchestration/v1/stacks"

Package stacks provides operation for working with Heat stacks. A stack is a group of resources (servers, load balancers, databases, and so forth) combined to fulfill a useful purpose. Based on a template, Heat orchestration engine creates an instantiated set of resources (a stack) to run the application framework or component specified (in the template). A stack is a running instance of a template. The result of creating a stack is a deployment of the application framework or component.

Index

Package Files

doc.go environment.go requests.go results.go template.go urls.go utils.go

Variables

var (
    // SortAsc is used to sort a list of stacks in ascending order.
    SortAsc SortDir = "asc"
    // SortDesc is used to sort a list of stacks in descending order.
    SortDesc SortDir = "desc"
    // SortName is used to sort a list of stacks by name.
    SortName SortKey = "name"
    // SortStatus is used to sort a list of stacks by status.
    SortStatus SortKey = "status"
    // SortCreatedAt is used to sort a list of stacks by date created.
    SortCreatedAt SortKey = "created_at"
    // SortUpdatedAt is used to sort a list of stacks by date updated.
    SortUpdatedAt SortKey = "updated_at"
)
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.

func List Uses

func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

List returns a Pager which allows you to iterate over a collection of stacks. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type AbandonResult Uses

type AbandonResult struct {
    gophercloud.Result
}

AbandonResult represents the result of an Abandon operation.

func Abandon Uses

func Abandon(c *gophercloud.ServiceClient, stackName, stackID string) AbandonResult

Abandon deletes the stack with the provided stackName and stackID, but leaves its resources intact, and returns data describing the stack and its resources.

func (AbandonResult) Extract Uses

func (r AbandonResult) Extract() (*AbandonedStack, error)

Extract returns a pointer to an AbandonedStack object and is called after an Abandon operation.

func (AbandonResult) String Uses

func (r AbandonResult) String() (string, error)

String converts an AbandonResult to a string. This is useful to when passing the result of an Abandon operation to an AdoptOpts AdoptStackData field.

type AbandonedStack Uses

type AbandonedStack struct {
    Status             string                 `mapstructure:"status"`
    Name               string                 `mapstructure:"name"`
    Template           map[string]interface{} `mapstructure:"template"`
    Action             string                 `mapstructure:"action"`
    ID                 string                 `mapstructure:"id"`
    Resources          map[string]interface{} `mapstructure:"resources"`
    Files              map[string]string      `mapstructure:"files"`
    StackUserProjectID string                 `mapstructure:"stack_user_project_id"`
    ProjectID          string                 `mapstructure:"project_id"`
    Environment        map[string]interface{} `mapstructure:"environment"`
}

AbandonedStack represents the result of an Abandon operation.

type AdoptOpts Uses

type AdoptOpts struct {
    // (REQUIRED) Existing resources data represented as a string to add to the
    // new stack. Data returned by Abandon could be provided as AdoptsStackData.
    AdoptStackData string
    // (REQUIRED) The name of the stack. It must start with an alphabetic character.
    Name string
    // (REQUIRED) The timeout for stack creation in minutes.
    Timeout int
    // (REQUIRED) 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
    // (DEPRECATED): Please use TemplateOpts for providing the template. If
    // TemplateOpts is provided, TemplateURL will be ignored
    // (OPTIONAL; REQUIRED IF Template IS EMPTY) The URL of the template to instantiate.
    // This value is ignored if Template is supplied inline.
    TemplateURL string
    // (DEPRECATED): Please use TemplateOpts for providing the template. If
    // TemplateOpts is provided, Template will be ignored
    // (OPTIONAL; REQUIRED IF TemplateURL IS EMPTY) A template to instantiate. The value
    // is a stringified version of the JSON/YAML template. Since the template will likely
    // be located in a file, one way to set this variable is by using ioutil.ReadFile:
    // import "io/ioutil"
    // var opts stacks.CreateOpts
    // b, err := ioutil.ReadFile("path/to/you/template/file.json")
    // if err != nil {
    //   // handle error...
    // }
    // opts.Template = string(b)
    Template string
    // (OPTIONAL) 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 Rollback
    // (OPTIONAL) A structure that contains details for the environment of the stack.
    EnvironmentOpts *Environment
    // (DEPRECATED): Please use EnvironmentOpts to provide Environment data
    // (OPTIONAL) A stringified JSON environment for the stack.
    Environment string
    // (DEPRECATED): Files is automatically determined
    // by parsing the template and environment passed as TemplateOpts and
    // EnvironmentOpts respectively.
    // (OPTIONAL) A map that maps file names to file contents. It can also be used
    // to pass provider template contents. Example:
    // Files: `{"myfile": "#!/bin/bash\necho 'Hello world' > /root/testfile.txt"}`
    Files map[string]interface{}
    // (OPTIONAL) User-defined parameters to pass to the template.
    Parameters map[string]string
}

AdoptOpts is the common options struct used in this package's Adopt operation.

func (AdoptOpts) ToStackAdoptMap Uses

func (opts AdoptOpts) ToStackAdoptMap() (map[string]interface{}, error)

ToStackAdoptMap casts a CreateOpts struct to a map.

type AdoptOptsBuilder Uses

type AdoptOptsBuilder interface {
    ToStackAdoptMap() (map[string]interface{}, error)
}

AdoptOptsBuilder is the interface options structs have to satisfy in order to be used in the Adopt function 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 AdoptResult Uses

type AdoptResult struct {
    CreateResult
}

AdoptResult represents the result of an Adopt operation. AdoptResult has the same form as CreateResult.

func Adopt Uses

func Adopt(c *gophercloud.ServiceClient, opts AdoptOptsBuilder) AdoptResult

Adopt accepts an AdoptOpts struct and creates a new stack using the resources from another stack.

type Client Uses

type Client interface {
    Get(string) (*http.Response, error)
}

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 Uses

type CreateOpts struct {
    // (REQUIRED) The name of the stack. It must start with an alphabetic character.
    Name string
    // (REQUIRED) 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
    // (DEPRECATED): Please use TemplateOpts for providing the template. If
    // TemplateOpts is provided, TemplateURL will be ignored
    // (OPTIONAL; REQUIRED IF Template IS EMPTY) The URL of the template to instantiate.
    // This value is ignored if Template is supplied inline.
    TemplateURL string
    // (DEPRECATED): Please use TemplateOpts for providing the template. If
    // TemplateOpts is provided, Template will be ignored
    // (OPTIONAL; REQUIRED IF TemplateURL IS EMPTY) A template to instantiate. The value
    // is a stringified version of the JSON/YAML template. Since the template will likely
    // be located in a file, one way to set this variable is by using ioutil.ReadFile:
    // import "io/ioutil"
    // var opts stacks.CreateOpts
    // b, err := ioutil.ReadFile("path/to/you/template/file.json")
    // if err != nil {
    //   // handle error...
    // }
    // opts.Template = string(b)
    Template string
    // (OPTIONAL) 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 Rollback
    // (OPTIONAL) A structure that contains details for the environment of the stack.
    EnvironmentOpts *Environment
    // (DEPRECATED): Please use EnvironmentOpts to provide Environment data
    // (OPTIONAL) A stringified JSON environment for the stack.
    Environment string
    // (DEPRECATED): Files is automatically determined
    // by parsing the template and environment passed as TemplateOpts and
    // EnvironmentOpts respectively.
    // (OPTIONAL) A map that maps file names to file contents. It can also be used
    // to pass provider template contents. Example:
    // Files: `{"myfile": "#!/bin/bash\necho 'Hello world' > /root/testfile.txt"}`
    Files map[string]interface{}
    // (OPTIONAL) User-defined parameters to pass to the template.
    Parameters map[string]string
    // (OPTIONAL) The timeout for stack creation in minutes.
    Timeout int
    // (OPTIONAL) A list of tags to assosciate with the Stack
    Tags []string
}

CreateOpts is the common options struct used in this package's Create operation.

func (CreateOpts) ToStackCreateMap Uses

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

ToStackCreateMap casts a CreateOpts struct to a map.

type CreateOptsBuilder Uses

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

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 Uses

type CreateResult struct {
    gophercloud.Result
}

CreateResult represents the result of a Create operation.

func Create Uses

func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult

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

func (CreateResult) Extract Uses

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

Extract returns a pointer to a CreatedStack object and is called after a Create operation.

type CreatedStack Uses

type CreatedStack struct {
    ID    string             `mapstructure:"id"`
    Links []gophercloud.Link `mapstructure:"links"`
}

CreatedStack represents the object extracted from a Create operation.

type DeleteResult Uses

type DeleteResult struct {
    gophercloud.ErrResult
}

DeleteResult represents the result of a Delete operation.

func Delete Uses

func Delete(c *gophercloud.ServiceClient, stackName, stackID string) DeleteResult

Delete deletes a stack based on the stack name and stack ID.

type Environment Uses

type Environment struct {
    TE
}

Environment is a structure that represents stack environments

func (*Environment) Validate Uses

func (e *Environment) Validate() error

Validate validates the contents of the Environment

type GetResult Uses

type GetResult struct {
    gophercloud.Result
}

GetResult represents the result of a Get operation.

func Get Uses

func Get(c *gophercloud.ServiceClient, stackName, stackID string) GetResult

Get retreives a stack based on the stack name and stack ID.

func (GetResult) Extract Uses

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

Extract returns a pointer to a RetrievedStack object and is called after a Get operation.

type ListOpts Uses

type ListOpts struct {
    Status  string  `q:"status"`
    Name    string  `q:"name"`
    Marker  string  `q:"marker"`
    Limit   int     `q:"limit"`
    SortKey SortKey `q:"sort_keys"`
    SortDir SortDir `q:"sort_dir"`
}

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. SortKey allows you to sort by a particular network attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToStackListQuery Uses

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

ToStackListQuery formats a ListOpts into a query string.

type ListOptsBuilder Uses

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

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

type ListedStack Uses

type ListedStack struct {
    CreationTime time.Time          `mapstructure:"-"`
    Description  string             `mapstructure:"description"`
    ID           string             `mapstructure:"id"`
    Links        []gophercloud.Link `mapstructure:"links"`
    Name         string             `mapstructure:"stack_name"`
    Status       string             `mapstructure:"stack_status"`
    StatusReason string             `mapstructure:"stack_status_reason"`
    Tags         []string           `mapstructure:"tags"`
    UpdatedTime  time.Time          `mapstructure:"-"`
}

ListedStack represents an element in the slice extracted from a List operation.

func ExtractStacks Uses

func ExtractStacks(page pagination.Page) ([]ListedStack, error)

ExtractStacks extracts and returns a slice of ListedStack. It is used while iterating over a stacks.List call.

type PreviewOpts Uses

type PreviewOpts struct {
    // (REQUIRED) The name of the stack. It must start with an alphabetic character.
    Name string
    // (REQUIRED) The timeout for stack creation in minutes.
    Timeout int
    // (REQUIRED) 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
    // (DEPRECATED): Please use TemplateOpts for providing the template. If
    // TemplateOpts is provided, TemplateURL will be ignored
    // (OPTIONAL; REQUIRED IF Template IS EMPTY) The URL of the template to instantiate.
    // This value is ignored if Template is supplied inline.
    TemplateURL string
    // (DEPRECATED): Please use TemplateOpts for providing the template. If
    // TemplateOpts is provided, Template will be ignored
    // (OPTIONAL; REQUIRED IF TemplateURL IS EMPTY) A template to instantiate. The value
    // is a stringified version of the JSON/YAML template. Since the template will likely
    // be located in a file, one way to set this variable is by using ioutil.ReadFile:
    // import "io/ioutil"
    // var opts stacks.CreateOpts
    // b, err := ioutil.ReadFile("path/to/you/template/file.json")
    // if err != nil {
    //   // handle error...
    // }
    // opts.Template = string(b)
    Template string
    // (OPTIONAL) 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 Rollback
    // (OPTIONAL) A structure that contains details for the environment of the stack.
    EnvironmentOpts *Environment
    // (DEPRECATED): Please use EnvironmentOpts to provide Environment data
    // (OPTIONAL) A stringified JSON environment for the stack.
    Environment string
    // (DEPRECATED): Files is automatically determined
    // by parsing the template and environment passed as TemplateOpts and
    // EnvironmentOpts respectively.
    // (OPTIONAL) A map that maps file names to file contents. It can also be used
    // to pass provider template contents. Example:
    // Files: `{"myfile": "#!/bin/bash\necho 'Hello world' > /root/testfile.txt"}`
    Files map[string]interface{}
    // (OPTIONAL) User-defined parameters to pass to the template.
    Parameters map[string]string
}

PreviewOpts contains the common options struct used in this package's Preview operation.

func (PreviewOpts) ToStackPreviewMap Uses

func (opts PreviewOpts) ToStackPreviewMap() (map[string]interface{}, error)

ToStackPreviewMap casts a PreviewOpts struct to a map.

type PreviewOptsBuilder Uses

type PreviewOptsBuilder interface {
    ToStackPreviewMap() (map[string]interface{}, error)
}

PreviewOptsBuilder is the interface options structs have to satisfy in order to be used in the Preview operation in this package.

type PreviewResult Uses

type PreviewResult struct {
    gophercloud.Result
}

PreviewResult represents the result of a Preview operation.

func Preview Uses

func Preview(c *gophercloud.ServiceClient, opts PreviewOptsBuilder) PreviewResult

Preview accepts a PreviewOptsBuilder interface and creates a preview of a stack using the values provided.

func (PreviewResult) Extract Uses

func (r PreviewResult) Extract() (*PreviewedStack, error)

Extract returns a pointer to a PreviewedStack object and is called after a Preview operation.

type PreviewedStack Uses

type PreviewedStack struct {
    Capabilities        []interface{}      `mapstructure:"capabilities"`
    CreationTime        time.Time          `mapstructure:"-"`
    Description         string             `mapstructure:"description"`
    DisableRollback     bool               `mapstructure:"disable_rollback"`
    ID                  string             `mapstructure:"id"`
    Links               []gophercloud.Link `mapstructure:"links"`
    Name                string             `mapstructure:"stack_name"`
    NotificationTopics  []interface{}      `mapstructure:"notification_topics"`
    Parameters          map[string]string  `mapstructure:"parameters"`
    Resources           []interface{}      `mapstructure:"resources"`
    TemplateDescription string             `mapstructure:"template_description"`
    Timeout             int                `mapstructure:"timeout_mins"`
    UpdatedTime         time.Time          `mapstructure:"-"`
}

PreviewedStack represents the result of a Preview operation.

type RetrievedStack Uses

type RetrievedStack struct {
    Capabilities        []interface{}            `mapstructure:"capabilities"`
    CreationTime        time.Time                `mapstructure:"-"`
    Description         string                   `mapstructure:"description"`
    DisableRollback     bool                     `mapstructure:"disable_rollback"`
    ID                  string                   `mapstructure:"id"`
    Links               []gophercloud.Link       `mapstructure:"links"`
    NotificationTopics  []interface{}            `mapstructure:"notification_topics"`
    Outputs             []map[string]interface{} `mapstructure:"outputs"`
    Parameters          map[string]string        `mapstructure:"parameters"`
    Name                string                   `mapstructure:"stack_name"`
    Status              string                   `mapstructure:"stack_status"`
    StatusReason        string                   `mapstructure:"stack_status_reason"`
    Tags                []string                 `mapstructure:"tags"`
    TemplateDescription string                   `mapstructure:"template_description"`
    Timeout             int                      `mapstructure:"timeout_mins"`
    UpdatedTime         time.Time                `mapstructure:"-"`
}

RetrievedStack represents the object extracted from a Get operation.

type Rollback Uses

type Rollback *bool

Rollback is used to specify whether or not a stack can be rolled back.

var (

    // Disable is used to specify that a stack cannot be rolled back.
    Disable Rollback = &disable

    // Enable is used to specify that a stack can be rolled back.
    Enable Rollback = &enable
)

type SortDir Uses

type SortDir string

SortDir is a type for specifying in which direction to sort a list of stacks.

type SortKey Uses

type SortKey string

SortKey is a type for specifying by which key to sort a list of stacks.

type StackPage Uses

type StackPage struct {
    pagination.SinglePageBase
}

StackPage is a pagination.Pager that is returned from a call to the List function.

func (StackPage) IsEmpty Uses

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

IsEmpty returns true if a ListResult contains no Stacks.

type TE Uses

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 Uses

func (t *TE) Fetch() error

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.

func (*TE) Parse Uses

func (t *TE) Parse() error

Parse will parse the contents and then validate. The contents MUST be either JSON or YAML.

func (*TE) Validate Uses

func (t *TE) Validate() error

Validate validates the contents of TE

type Template Uses

type Template struct {
    TE
}

Template is a structure that represents OpenStack Heat templates

func (*Template) Validate Uses

func (t *Template) Validate() error

Validate validates the contents of the Template

type UpdateOpts Uses

type UpdateOpts struct {
    // (REQUIRED) 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
    // (DEPRECATED): Please use TemplateOpts for providing the template. If
    // TemplateOpts is provided, TemplateURL will be ignored
    // (OPTIONAL; REQUIRED IF Template IS EMPTY) The URL of the template to instantiate.
    // This value is ignored if Template is supplied inline.
    TemplateURL string
    // (DEPRECATED): Please use TemplateOpts for providing the template. If
    // TemplateOpts is provided, Template will be ignored
    // (OPTIONAL; REQUIRED IF TemplateURL IS EMPTY) A template to instantiate. The value
    // is a stringified version of the JSON/YAML template. Since the template will likely
    // be located in a file, one way to set this variable is by using ioutil.ReadFile:
    // import "io/ioutil"
    // var opts stacks.CreateOpts
    // b, err := ioutil.ReadFile("path/to/you/template/file.json")
    // if err != nil {
    //   // handle error...
    // }
    // opts.Template = string(b)
    Template string
    // (OPTIONAL) A structure that contains details for the environment of the stack.
    EnvironmentOpts *Environment
    // (DEPRECATED): Please use EnvironmentOpts to provide Environment data
    // (OPTIONAL) A stringified JSON environment for the stack.
    Environment string
    // (DEPRECATED): Files is automatically determined
    // by parsing the template and environment passed as TemplateOpts and
    // EnvironmentOpts respectively.
    // (OPTIONAL) A map that maps file names to file contents. It can also be used
    // to pass provider template contents. Example:
    // Files: `{"myfile": "#!/bin/bash\necho 'Hello world' > /root/testfile.txt"}`
    Files map[string]interface{}
    // (OPTIONAL) User-defined parameters to pass to the template.
    Parameters map[string]string
    // (OPTIONAL) The timeout for stack creation in minutes.
    Timeout int
    // (OPTIONAL) A list of tags to assosciate with the Stack
    Tags []string
}

UpdateOpts contains the common options struct used in this package's Update operation.

func (UpdateOpts) ToStackUpdateMap Uses

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

ToStackUpdateMap casts a CreateOpts struct to a map.

type UpdateOptsBuilder Uses

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

UpdateOptsBuilder is the interface options structs have to satisfy in order to be used in the Update operation in this package.

type UpdateResult Uses

type UpdateResult struct {
    gophercloud.ErrResult
}

UpdateResult represents the result of a Update operation.

func Update Uses

func Update(c *gophercloud.ServiceClient, stackName, stackID string, opts UpdateOptsBuilder) UpdateResult

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

Package stacks imports 13 packages (graph). Updated 2019-05-10. Refresh now. Tools for package owners.