Documentation ¶
Overview ¶
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 ¶
- Constants
- Variables
- func HandleAbandonSuccessfully(t *testing.T)
- func HandleCreateSuccessfully(t *testing.T, output string)
- func HandleDeleteSuccessfully(t *testing.T)
- func HandleGetSuccessfully(t *testing.T, output string)
- func HandleListSuccessfully(t *testing.T, output string)
- func HandlePreviewSuccessfully(t *testing.T, output string)
- func HandleUpdateSuccessfully(t *testing.T)
- func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
- type AbandonResult
- type AbandonedStack
- type AdoptOpts
- type AdoptOptsBuilder
- type AdoptResult
- type CreateOpts
- type CreateOptsBuilder
- type CreateResult
- type CreatedStack
- type DeleteResult
- type GetResult
- type ListOpts
- type ListOptsBuilder
- type ListedStack
- type PreviewOpts
- type PreviewOptsBuilder
- type PreviewResult
- type PreviewedStack
- type RetrievedStack
- type Rollback
- type SortDir
- type SortKey
- type StackPage
- type UpdateOpts
- type UpdateOptsBuilder
- type UpdateResult
Constants ¶
const AbandonOutput = `` /* 963-byte string literal not displayed */
AbandonOutput represents the response body from an Abandon request.
const CreateOutput = `` /* 261-byte string literal not displayed */
CreateOutput represents the response body from a Create request.
const FullListOutput = `` /* 1095-byte string literal not displayed */
FullListOutput represents the response body from a List request without a marker.
const GetOutput = `` /* 889-byte string literal not displayed */
GetOutput represents the response body from a Get request.
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 AbandonExpected = &AbandonedStack{ Status: "COMPLETE", Name: "postman_stack", Template: map[string]interface{}{ "heat_template_version": "2013-05-23", "description": "Simple template to test heat commands", "parameters": map[string]interface{}{ "flavor": map[string]interface{}{ "default": "m1.tiny", "type": "string", }, }, "resources": map[string]interface{}{ "hello_world": map[string]interface{}{ "type": "OS::Nova::Server", "properties": map[string]interface{}{ "key_name": "heat_key", "flavor": map[string]interface{}{ "get_param": "flavor", }, "image": "ad091b52-742f-469e-8f3c-fd81cadf0743", "user_data": "#!/bin/bash -xv\necho \"hello world\" > /root/hello-world.txt\n", }, }, }, }, Action: "CREATE", ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", Resources: map[string]interface{}{ "hello_world": map[string]interface{}{ "status": "COMPLETE", "name": "hello_world", "resource_id": "8a310d36-46fc-436f-8be4-37a696b8ac63", "action": "CREATE", "type": "OS::Nova::Server", }, }, }
AbandonExpected represents the expected object from an Abandon request.
var CreateExpected = &CreatedStack{ ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", Links: []gophercloud.Link{ gophercloud.Link{ Href: "http://168.28.170.117:8004/v1/98606384f58drad0bhdb7d02779549ac/stacks/stackcreated/16ef0584-4458-41eb-87c8-0dc8d5f66c87", Rel: "self", }, }, }
CreateExpected represents the expected object from a Create request.
var GetExpected = &RetrievedStack{ DisableRollback: true, Description: "Simple template to test heat commands", Parameters: map[string]string{ "flavor": "m1.tiny", "OS::stack_name": "postman_stack", "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87", }, StatusReason: "Stack CREATE completed successfully", Name: "postman_stack", Outputs: []map[string]interface{}{}, CreationTime: time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC), Links: []gophercloud.Link{ gophercloud.Link{ Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", Rel: "self", }, }, Capabilities: []interface{}{}, NotificationTopics: []interface{}{}, Status: "CREATE_COMPLETE", ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", TemplateDescription: "Simple template to test heat commands", }
GetExpected represents the expected object from a Get request.
var ListExpected = []ListedStack{ ListedStack{ Description: "Simple template to test heat commands", Links: []gophercloud.Link{ gophercloud.Link{ Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", Rel: "self", }, }, StatusReason: "Stack CREATE completed successfully", Name: "postman_stack", CreationTime: time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC), Status: "CREATE_COMPLETE", ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", }, ListedStack{ Description: "Simple template to test heat commands", Links: []gophercloud.Link{ gophercloud.Link{ Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/gophercloud-test-stack-2/db6977b2-27aa-4775-9ae7-6213212d4ada", Rel: "self", }, }, StatusReason: "Stack successfully updated", Name: "gophercloud-test-stack-2", CreationTime: time.Date(2014, 12, 11, 17, 39, 16, 0, time.UTC), UpdatedTime: time.Date(2014, 12, 11, 17, 40, 37, 0, time.UTC), Status: "UPDATE_COMPLETE", ID: "db6977b2-27aa-4775-9ae7-6213212d4ada", }, }
ListExpected represents the expected object from a List request.
var PreviewExpected = &PreviewedStack{ DisableRollback: true, Description: "Simple template to test heat commands", Parameters: map[string]string{ "flavor": "m1.tiny", "OS::stack_name": "postman_stack", "OS::stack_id": "16ef0584-4458-41eb-87c8-0dc8d5f66c87", }, StatusReason: "Stack CREATE completed successfully", Name: "postman_stack", CreationTime: time.Date(2015, 2, 3, 20, 7, 39, 0, time.UTC), Links: []gophercloud.Link{ gophercloud.Link{ Href: "http://166.76.160.117:8004/v1/98606384f58d4ad0b3db7d0d779549ac/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87", Rel: "self", }, }, Capabilities: []interface{}{}, NotificationTopics: []interface{}{}, Status: "CREATE_COMPLETE", ID: "16ef0584-4458-41eb-87c8-0dc8d5f66c87", TemplateDescription: "Simple template to test heat commands", }
GetExpected represents the expected object from a Get request.
Functions ¶
func HandleAbandonSuccessfully ¶
HandleAbandonSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87/abandon` on the test handler mux that responds with an `Abandon` response.
func HandleCreateSuccessfully ¶
HandleCreateSuccessfully creates an HTTP handler at `/stacks` on the test handler mux that responds with a `Create` response.
func HandleDeleteSuccessfully ¶
HandleDeleteSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87` on the test handler mux that responds with a `Delete` response.
func HandleGetSuccessfully ¶
HandleGetSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87` on the test handler mux that responds with a `Get` response.
func HandleListSuccessfully ¶
HandleListSuccessfully creates an HTTP handler at `/stacks` on the test handler mux that responds with a `List` response.
func HandlePreviewSuccessfully ¶
HandlePreviewSuccessfully creates an HTTP handler at `/stacks/preview` on the test handler mux that responds with a `Preview` response.
func HandleUpdateSuccessfully ¶
HandleUpdateSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87` on the test handler mux that responds with an `Update` response.
func List ¶
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.
Types ¶
type AbandonResult ¶
type AbandonResult struct {
gophercloud.Result
}
AbandonResult represents the result of an Abandon operation.
func Abandon ¶
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 ¶
func (r AbandonResult) Extract() (*AbandonedStack, error)
Extract returns a pointer to an AbandonedStack object and is called after an Abandon operation.
func (AbandonResult) String ¶
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 ¶
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"` }
AbandonedStack represents the result of an Abandon operation.
type AdoptOpts ¶
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 // (OPTIONAL; REQUIRED IF Template IS EMPTY) The URL of the template to instantiate. // This value is ignored if Template is supplied inline. TemplateURL string // (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 stringified JSON environment for the stack. Environment string // (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 ¶
ToStackAdoptMap casts a CreateOpts struct to a map.
type AdoptOptsBuilder ¶
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 ¶
type AdoptResult struct {
CreateResult
}
AdoptResult represents the result of an Adopt operation. AdoptResult has the same form as CreateResult.
func Adopt ¶
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 CreateOpts ¶
type CreateOpts struct { // (REQUIRED) The name of the stack. It must start with an alphabetic character. Name string // (OPTIONAL; REQUIRED IF Template IS EMPTY) The URL of the template to instantiate. // This value is ignored if Template is supplied inline. TemplateURL string // (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 stringified JSON environment for the stack. Environment string // (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 }
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 {
gophercloud.Result
}
CreateResult represents the result of a Create operation.
func Create ¶
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 ¶
func (r CreateResult) Extract() (*CreatedStack, error)
Extract returns a pointer to a CreatedStack object and is called after a Create operation.
type CreatedStack ¶
type CreatedStack struct { ID string `mapstructure:"id"` Links []gophercloud.Link `mapstructure:"links"` }
CreatedStack represents the object extracted from a Create operation.
type DeleteResult ¶
type DeleteResult struct {
gophercloud.ErrResult
}
DeleteResult represents the result of a Delete operation.
func Delete ¶
func Delete(c *gophercloud.ServiceClient, stackName, stackID string) DeleteResult
Delete deletes a stack based on the stack name and stack ID.
type GetResult ¶
type GetResult struct {
gophercloud.Result
}
GetResult represents the result of a Get operation.
func Get ¶
func Get(c *gophercloud.ServiceClient, stackName, stackID string) GetResult
Get retreives a stack based on the stack name and stack ID.
func (GetResult) Extract ¶
func (r GetResult) Extract() (*RetrievedStack, error)
Extract returns a pointer to a RetrievedStack object and is called after a Get operation.
type ListOpts ¶
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 ¶
ToStackListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.
type ListedStack ¶
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"` UpdatedTime time.Time `mapstructure:"-"` }
ListedStack represents an element in the slice extracted from a List operation.
func ExtractStacks ¶
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 ¶
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 // (OPTIONAL; REQUIRED IF Template IS EMPTY) The URL of the template to instantiate. // This value is ignored if Template is supplied inline. TemplateURL string // (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 stringified JSON environment for the stack. Environment string // (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 ¶
func (opts PreviewOpts) ToStackPreviewMap() (map[string]interface{}, error)
ToStackPreviewMap casts a PreviewOpts struct to a map.
type PreviewOptsBuilder ¶
PreviewOptsBuilder is the interface options structs have to satisfy in order to be used in the Preview operation in this package.
type PreviewResult ¶
type PreviewResult struct {
gophercloud.Result
}
PreviewResult represents the result of a Preview operation.
func Preview ¶
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 ¶
func (r PreviewResult) Extract() (*PreviewedStack, error)
Extract returns a pointer to a PreviewedStack object and is called after a Preview operation.
type PreviewedStack ¶
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 []map[string]interface{} `mapstructure:"resources"` Status string `mapstructure:"stack_status"` StatusReason string `mapstructure:"stack_status_reason"` TemplateDescription string `mapstructure:"template_description"` Timeout int `mapstructure:"timeout_mins"` UpdatedTime time.Time `mapstructure:"-"` }
PreviewedStack represents the result of a Preview operation.
type RetrievedStack ¶
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"` 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 ¶
type Rollback *bool
Rollback is used to specify whether or not a stack can be rolled back.
type SortDir ¶
type SortDir string
SortDir is a type for specifying in which direction to sort a list of stacks.
type SortKey ¶
type SortKey string
SortKey is a type for specifying by which key to sort a list of stacks.
type StackPage ¶
type StackPage struct {
pagination.SinglePageBase
}
StackPage is a pagination.Pager that is returned from a call to the List function.
type UpdateOpts ¶
type UpdateOpts struct { // (OPTIONAL; REQUIRED IF Template IS EMPTY) The URL of the template to instantiate. // This value is ignored if Template is supplied inline. TemplateURL string // (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 stringified JSON environment for the stack. Environment string // (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 }
UpdateOpts contains the common options struct used in this package's Update operation.
func (UpdateOpts) ToStackUpdateMap ¶
func (opts UpdateOpts) ToStackUpdateMap() (map[string]interface{}, error)
ToStackUpdateMap casts a CreateOpts struct to a map.
type UpdateOptsBuilder ¶
UpdateOptsBuilder is the interface options structs have to satisfy in order to be used in the Update operation in this package.
type UpdateResult ¶
type UpdateResult struct {
gophercloud.ErrResult
}
UpdateResult represents the result of a Update operation.
func Update ¶
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.