func Adopt(c *gophercloud.ServiceClient, opts AdoptOptsBuilder) AdoptResult {
	var res AdoptResult
	reqBody, err := opts.ToStackAdoptMap()
	if err != nil {
		res.Err = err
		return res
	}
	_, res.Err = c.Request("POST", adoptURL(c), gophercloud.RequestOpts{
		JSONBody:     &reqBody,
		JSONResponse: &res.Body,
		OkCodes:      []int{201},
	})
	return res
}
Adopt accepts an AdoptOpts struct and creates a new stack using the resources
from another stack.
package stacks
import (
	"errors"
	"github.com/rackspace/gophercloud"
	"github.com/rackspace/gophercloud/pagination"
)
type Rollback *bool
var (
	disable = true
	Disable Rollback = &disable
	enable           = false
	Enable Rollback = &enable
)
type CreateOptsBuilder interface {
	ToStackCreateMap() (map[string]interface{}, error)
}
type CreateOpts struct {
	Name string
	TemplateURL string
	Template string
	DisableRollback Rollback
	Environment string
	Files map[string]interface{}
	Parameters map[string]string
	Timeout int
}
func (opts CreateOpts) ToStackCreateMap() (map[string]interface{}, error) {
	s := make(map[string]interface{})
	if opts.Name == "" {
		return s, errors.New("Required field 'Name' not provided.")
	}
	s["stack_name"] = opts.Name
	if opts.Template != "" {
		s["template"] = opts.Template
	} else if opts.TemplateURL != "" {
		s["template_url"] = opts.TemplateURL
	} else {
		return s, errors.New("Either Template or TemplateURL must be provided.")
	}
	if opts.DisableRollback != nil {
		s["disable_rollback"] = &opts.DisableRollback
	}
	if opts.Environment != "" {
		s["environment"] = opts.Environment
	}
	if opts.Files != nil {
		s["files"] = opts.Files
	}
	if opts.Parameters != nil {
		s["parameters"] = opts.Parameters
	}
	if opts.Timeout != 0 {
		s["timeout_mins"] = opts.Timeout
	}
	return s, nil
}
func Create(c *gophercloud.ServiceClient, opts CreateOptsBuilder) CreateResult {
	var res CreateResult
	reqBody, err := opts.ToStackCreateMap()
	if err != nil {
		res.Err = err
		return res
	}
	_, res.Err = c.Request("POST", createURL(c), gophercloud.RequestOpts{
		JSONBody:     &reqBody,
		JSONResponse: &res.Body,
		OkCodes:      []int{201},
	})
	return res
}
type AdoptOptsBuilder interface {
	ToStackAdoptMap() (map[string]interface{}, error)
}
type AdoptOpts struct {
	AdoptStackData string
	Name string
	Timeout int
	TemplateURL string
	Template string
	DisableRollback Rollback
	Environment string
	Files map[string]interface{}
	Parameters map[string]string
}
func (opts AdoptOpts) ToStackAdoptMap() (map[string]interface{}, error) {
	s := make(map[string]interface{})
	if opts.Name == "" {
		return s, errors.New("Required field 'Name' not provided.")
	}
	s["stack_name"] = opts.Name
	if opts.Template != "" {
		s["template"] = opts.Template
	} else if opts.TemplateURL != "" {
		s["template_url"] = opts.TemplateURL
	} else {
		return s, errors.New("Either Template or TemplateURL must be provided.")
	}
	if opts.AdoptStackData == "" {
		return s, errors.New("Required field 'AdoptStackData' not provided.")
	}
	s["adopt_stack_data"] = opts.AdoptStackData
	if opts.DisableRollback != nil {
		s["disable_rollback"] = &opts.DisableRollback
	}
	if opts.Environment != "" {
		s["environment"] = opts.Environment
	}
	if opts.Files != nil {
		s["files"] = opts.Files
	}
	if opts.Parameters != nil {
		s["parameters"] = opts.Parameters
	}
	if opts.Timeout == 0 {
		return nil, errors.New("Required field 'Timeout' not provided.")
	}
	s["timeout_mins"] = opts.Timeout
	return map[string]interface{}{"stack": s}, nil
}