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.18.0.20131205181604 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-1.18.0 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-1.17.0 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-1.16.0 lib/fog/rackspace/requests/auto_scale/create_group.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/rackspace/requests/auto_scale/create_group.rb