Class: Fog::Rackspace::AutoScale::Real
- Defined in:
- lib/fog/rackspace/auto_scale.rb,
lib/fog/rackspace/requests/auto_scale/get_group.rb,
lib/fog/rackspace/requests/auto_scale/get_policy.rb,
lib/fog/rackspace/requests/auto_scale/get_webhook.rb,
lib/fog/rackspace/requests/auto_scale/list_groups.rb,
lib/fog/rackspace/requests/auto_scale/create_group.rb,
lib/fog/rackspace/requests/auto_scale/delete_group.rb,
lib/fog/rackspace/requests/auto_scale/create_policy.rb,
lib/fog/rackspace/requests/auto_scale/delete_policy.rb,
lib/fog/rackspace/requests/auto_scale/list_policies.rb,
lib/fog/rackspace/requests/auto_scale/list_webhooks.rb,
lib/fog/rackspace/requests/auto_scale/update_policy.rb,
lib/fog/rackspace/requests/auto_scale/create_webhook.rb,
lib/fog/rackspace/requests/auto_scale/delete_webhook.rb,
lib/fog/rackspace/requests/auto_scale/execute_policy.rb,
lib/fog/rackspace/requests/auto_scale/update_webhook.rb,
lib/fog/rackspace/requests/auto_scale/get_group_state.rb,
lib/fog/rackspace/requests/auto_scale/get_group_config.rb,
lib/fog/rackspace/requests/auto_scale/get_launch_config.rb,
lib/fog/rackspace/requests/auto_scale/pause_group_state.rb,
lib/fog/rackspace/requests/auto_scale/resume_group_state.rb,
lib/fog/rackspace/requests/auto_scale/update_group_config.rb,
lib/fog/rackspace/requests/auto_scale/update_launch_config.rb,
lib/fog/rackspace/requests/auto_scale/execute_anonymous_webhook.rb
Instance Method Summary collapse
- #authenticate(options = {}) ⇒ Object
- #create_group(launch_config, group_config, policies) ⇒ Object
- #create_policy(group_id, options) ⇒ Object
- #create_webhook(group_id, policy_id, options) ⇒ Object
- #delete_group(group_id) ⇒ Object
- #delete_policy(group_id, policy_id) ⇒ Object
- #delete_webhook(group_id, policy_id, webhook_id) ⇒ Object
- #endpoint_uri(service_endpoint_url = nil) ⇒ Object
- #execute_anonymous_webhook(capability_version, capability_hash) ⇒ Object
- #execute_policy(group_id, policy_id) ⇒ Object
- #get_group(group_id) ⇒ Object
- #get_group_config(group_id) ⇒ Object
- #get_group_state(group_id) ⇒ Object
- #get_launch_config(group_id) ⇒ Object
- #get_policy(group_id, policy_id) ⇒ Object
- #get_webhook(group_id, policy_id, webhook_id) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
-
#list_groups ⇒ Excon::Response
Retrieves a list of images.
- #list_policies(group_id) ⇒ Object
- #list_webhooks(group_id, policy_id) ⇒ Object
- #pause_group_state(group_id) ⇒ Object
- #region ⇒ Object
- #request(params, parse_json = true, &block) ⇒ Object
- #request_id_header ⇒ Object
- #resume_group_state(group_id) ⇒ Object
- #service_name ⇒ Object
- #update_group_config(group_id, options) ⇒ Object
- #update_launch_config(group_id, options) ⇒ Object
- #update_policy(group_id, policy_id, options) ⇒ Object
- #update_webhook(group_id, policy_id, webhook_id, options) ⇒ Object
Methods inherited from Service
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
92 93 94 95 96 97 98 99 100 |
# File 'lib/fog/rackspace/auto_scale.rb', line 92 def initialize( = {}) @options = @options[:connection_options] ||= {} @options[:persistent] ||= false authenticate @connection = Fog::Connection.new(endpoint_uri.to_s, @options[:persistent], @options[:connection_options]) end |
Instance Method Details
#authenticate(options = {}) ⇒ Object
118 119 120 |
# File 'lib/fog/rackspace/auto_scale.rb', line 118 def authenticate(={}) super(([:rackspace_username, :rackspace_api_key, :rackspace_auth_url, :connection_options])) end |
#create_group(launch_config, group_config, policies) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fog/rackspace/requests/auto_scale/create_group.rb', line 6 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 |
#create_policy(group_id, options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fog/rackspace/requests/auto_scale/create_policy.rb', line 5 def create_policy(group_id, ) data = [] request( :method => 'POST', :body => Fog::JSON.encode(data), :path => "groups/#{group_id}/policies", :expects => 201 ) end |
#create_webhook(group_id, policy_id, options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fog/rackspace/requests/auto_scale/create_webhook.rb', line 5 def create_webhook(group_id, policy_id, ) body = [] request( :method => 'POST', :body => Fog::JSON.encode(body), :path => "groups/#{group_id}/policies/#{policy_id}/webhooks", :expects => 201 ) end |
#delete_group(group_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/auto_scale/delete_group.rb', line 6 def delete_group(group_id) request( :expects => [204], :method => 'DELETE', :path => "groups/#{group_id}" ) end |
#delete_policy(group_id, policy_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/auto_scale/delete_policy.rb', line 6 def delete_policy(group_id, policy_id) request( :expects => [204], :method => 'DELETE', :path => "groups/#{group_id}/policies/#{policy_id}" ) end |
#delete_webhook(group_id, policy_id, webhook_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/auto_scale/delete_webhook.rb', line 6 def delete_webhook(group_id, policy_id, webhook_id) request( :expects => [204], :method => 'DELETE', :path => "groups/#{group_id}/policies/#{policy_id}/webhooks/#{webhook_id}" ) end |
#endpoint_uri(service_endpoint_url = nil) ⇒ Object
114 115 116 |
# File 'lib/fog/rackspace/auto_scale.rb', line 114 def endpoint_uri(service_endpoint_url=nil) @uri = super(@options[:rackspace_auto_scale_url], :rackspace_auto_scale_url) end |
#execute_anonymous_webhook(capability_version, capability_hash) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/auto_scale/execute_anonymous_webhook.rb', line 6 def execute_anonymous_webhook(capability_version, capability_hash) request( :expects => [202], :method => 'POST', :path => "execute/#{capability_version}/#{capability_hash}" ) end |
#execute_policy(group_id, policy_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/auto_scale/execute_policy.rb', line 6 def execute_policy(group_id, policy_id) request( :expects => [202], :method => 'POST', :path => "groups/#{group_id}/policies/#{policy_id}/execute" ) end |
#get_group(group_id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/auto_scale/get_group.rb', line 7 def get_group(group_id) request( :expects => [200], :method => 'GET', :path => "groups/#{group_id}" ) end |
#get_group_config(group_id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/auto_scale/get_group_config.rb', line 7 def get_group_config(group_id) request( :expects => [200], :method => 'GET', :path => "groups/#{group_id}/config" ) end |
#get_group_state(group_id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/auto_scale/get_group_state.rb', line 7 def get_group_state(group_id) request( :expects => [200], :method => 'GET', :path => "groups/#{group_id}/state" ) end |
#get_launch_config(group_id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/auto_scale/get_launch_config.rb', line 7 def get_launch_config(group_id) request( :expects => [200], :method => 'GET', :path => "groups/#{group_id}/launch" ) end |
#get_policy(group_id, policy_id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/auto_scale/get_policy.rb', line 7 def get_policy(group_id, policy_id) request( :expects => [200], :method => 'GET', :path => "groups/#{group_id}/policies/#{policy_id}" ) end |
#get_webhook(group_id, policy_id, webhook_id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/auto_scale/get_webhook.rb', line 7 def get_webhook(group_id, policy_id, webhook_id) request( :expects => [200], :method => 'GET', :path => "groups/#{group_id}/policies/#{policy_id}/webhooks/#{webhook_id}" ) end |
#list_groups ⇒ Excon::Response
Retrieves a list of images
19 20 21 22 23 24 25 |
# File 'lib/fog/rackspace/requests/auto_scale/list_groups.rb', line 19 def list_groups request( :expects => [200], :method => 'GET', :path => 'groups' ) end |
#list_policies(group_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/auto_scale/list_policies.rb', line 6 def list_policies(group_id) request( :expects => [200], :method => 'GET', :path => "groups/#{group_id}/policies" ) end |
#list_webhooks(group_id, policy_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/auto_scale/list_webhooks.rb', line 6 def list_webhooks(group_id, policy_id) request( :expects => [200], :method => 'GET', :path => "groups/#{group_id}/policies/#{policy_id}/webhooks" ) end |
#pause_group_state(group_id) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fog/rackspace/requests/auto_scale/pause_group_state.rb', line 6 def pause_group_state(group_id) Fog::Real.not_implemented # request( # :expects => [204], # :method => 'POST', # :path => 'groups/#{group_id}/pause' # ) end |
#region ⇒ Object
130 131 132 |
# File 'lib/fog/rackspace/auto_scale.rb', line 130 def region @options[:rackspace_region] end |
#request(params, parse_json = true, &block) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/fog/rackspace/auto_scale.rb', line 102 def request(params, parse_json = true, &block) super(params, parse_json, &block) rescue Excon::Errors::NotFound => error raise NotFound.slurp(error, self) rescue Excon::Errors::BadRequest => error raise BadRequest.slurp(error, self) rescue Excon::Errors::InternalServerError => error raise InternalServerError.slurp(error, self) rescue Excon::Errors::HTTPStatusError => error raise ServiceError.slurp(error, self) end |
#request_id_header ⇒ Object
126 127 128 |
# File 'lib/fog/rackspace/auto_scale.rb', line 126 def request_id_header "x-response-id" end |
#resume_group_state(group_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/rackspace/requests/auto_scale/resume_group_state.rb', line 6 def resume_group_state(group_id) request( :expects => [204], :method => 'POST', :path => "groups/#{group_id}/resume" ) end |
#service_name ⇒ Object
122 123 124 |
# File 'lib/fog/rackspace/auto_scale.rb', line 122 def service_name :autoscale end |
#update_group_config(group_id, options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/rackspace/requests/auto_scale/update_group_config.rb', line 6 def update_group_config(group_id, ) body = request( :expects => [204], :method => 'PUT', :path => "groups/#{group_id}/config", :body => Fog::JSON.encode(body) ) end |
#update_launch_config(group_id, options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/rackspace/requests/auto_scale/update_launch_config.rb', line 6 def update_launch_config(group_id, ) body = request( :expects => [204], :method => 'PUT', :path => "groups/#{group_id}/launch", :body => Fog::JSON.encode(body) ) end |
#update_policy(group_id, policy_id, options) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/rackspace/requests/auto_scale/update_policy.rb', line 6 def update_policy(group_id, policy_id, ) request( :expects => [204], :method => 'PUT', :path => "groups/#{group_id}/policies/#{policy_id}", :body => Fog::JSON.encode() ) end |
#update_webhook(group_id, policy_id, webhook_id, options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/rackspace/requests/auto_scale/update_webhook.rb', line 6 def update_webhook(group_id, policy_id, webhook_id, ) body = request( :expects => [204], :method => 'PUT', :path => "groups/#{group_id}/policies/#{policy_id}/webhooks/#{webhook_id}", :body => Fog::JSON.encode(body) ) end |