Sha256: 9c9897d55820a57b81a96734f13a4ee7dca60668c5759abbb5cda4b8c224e43c

Contents?: true

Size: 1.64 KB

Versions: 38

Compression:

Stored size: 1.64 KB

Contents

module Fog
  module Rackspace
    class AutoScale
      class Real

        def create_group(launch_config, group_config, policies)

          body = {
            'launchConfiguration' => launch_config,
            'groupConfiguration' => group_config,
            'scalingPolicies' => policies
          }

          request(
            :expects => [201],
            :method => 'POST',
            :path => 'groups',
            :body => Fog::JSON.encode(body)
          )
        end
      end

      class Mock
        def create_group(launch_config, group_config, policies)
          
          group_id = Fog::Rackspace::MockData.uuid

          # Construct group structure
          group = {
            'launchConfiguration' => launch_config,
            'groupConfiguration' => group_config,
            'scalingPolicies' => policies,
            'id' => group_id
          } 

          # Add links for HTTP response
          group['scalingPolicies'][0]['links'] = [
            {
              "href" => "https://ord.autoscale.api.rackspacecloud.com/v1.0/829409/groups/6791761b-821a-4d07-820d-0b2afc7dd7f6/policies/dceb14ac-b2b3-4f06-aac9-a5b6cd5d40e1/",
              "rel" => "self"
            }
          ]

          group['links'] = [
            {
              "href" => "https://ord.autoscale.api.rackspacecloud.com/v1.0/829409/groups/6791761b-821a-4d07-820d-0b2afc7dd7f6/",
              "rel" => "self"
            }
          ]

          # Save for future use
          self.data[:autoscale_groups][group_id] = group

          # Response
          body = {'group' => group}
          response(:body => body)
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
fog-maestrodev-1.20.0.20140305101839 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-1.20.0 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-1.19.0 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/rackspace/requests/auto_scale/create_group.rb