Sha256: e7ccecc51bd1d49ef85eac1351c14f419422cee069180f35f35787875eb6f4f4

Contents?: true

Size: 1.93 KB

Versions: 17

Compression:

Stored size: 1.93 KB

Contents

module Fog
  module Orchestration
    class OpenStack
      class Real
        # Create a stack.
        #
        # * stack_name [String] Name of the stack to create.
        # * options [Hash]:
        #   * :template_body [String] Structure containing the template body.
        #   or (one of the two Template parameters is required)
        #   * :template_url [String] URL of file containing the template body.
        #   * :disable_rollback [Boolean] Controls rollback on stack creation failure, defaults to false.
        #   * :parameters [Hash] Hash of providers to supply to template
        #   * :timeout_in_minutes [Integer] Minutes to wait before status is set to CREATE_FAILED
        #
        # @see http://docs.amazonwebservices.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html

        def create_stack(stack_name, options = {})
          params = {
            :stack_name => stack_name
          }.merge(options)

          request(
            :expects  => 201,
            :path => 'stacks',
            :method => 'POST',
            :body => Fog::JSON.encode(params)
          )
        end
      end

      class Mock
        def create_stack(stack_name, options = {})
          stack_id = Fog::Mock.random_hex(32)
          stack = self.data[:stacks][stack_id] = {
            'id' => stack_id,
            'stack_name' => stack_name,
            'links' => [],
            'description' => options[:description],
            'stack_status' => 'CREATE_COMPLETE',
            'stack_status_reason' => 'Stack successfully created',
            'creation_time' => Time.now,
            'updated_time' => Time.now
          }

          response = Excon::Response.new
          response.status = 201
          response.body = {
            'id' => stack_id,
            'links'=>[{"href"=>"http://localhost:8004/v1/fake_tenant_id/stacks/#{stack_name}/#{stack_id}", "rel"=>"self"}]}
          response
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/openstack/requests/orchestration/create_stack.rb
fog-1.27.0 lib/fog/openstack/requests/orchestration/create_stack.rb
fog-1.26.0 lib/fog/openstack/requests/orchestration/create_stack.rb
fog-1.25.0 lib/fog/openstack/requests/orchestration/create_stack.rb
nsidc-fog-1.24.1 lib/fog/openstack/requests/orchestration/create_stack.rb
fog-1.24.0 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.11 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.10 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.9 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.8 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.7 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.6 lib/fog/openstack/requests/orchestration/create_stack.rb
fog-1.23.0 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.4 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.3 lib/fog/openstack/requests/orchestration/create_stack.rb
ns-fog-1.22.2 lib/fog/openstack/requests/orchestration/create_stack.rb
fog-1.22.1 lib/fog/openstack/requests/orchestration/create_stack.rb