Class: Fog::Rackspace::Orchestration::Mock

Inherits:
Service
  • Object
show all
Includes:
MockData
Defined in:
lib/fog/rackspace/orchestration.rb,
lib/fog/rackspace/requests/orchestration/list_resources.rb,
lib/fog/rackspace/requests/orchestration/list_stack_data.rb,
lib/fog/rackspace/requests/orchestration/list_stack_events.rb,
lib/fog/rackspace/requests/orchestration/show_event_details.rb,
lib/fog/rackspace/requests/orchestration/get_stack_template.rb,
lib/fog/rackspace/requests/orchestration/show_resource_data.rb,
lib/fog/rackspace/requests/orchestration/show_stack_details.rb,
lib/fog/rackspace/requests/orchestration/list_resource_types.rb,
lib/fog/rackspace/requests/orchestration/list_resource_events.rb,
lib/fog/rackspace/requests/orchestration/show_resource_template.rb,
lib/fog/rackspace/requests/orchestration/show_resource_metadata.rb

Constant Summary

Constants included from MockData

MockData::NOT_FOUND_ID

Instance Method Summary collapse

Methods included from MockData

#data, ipv4_address, ipv6_address, keep, slice, stringify, uuid, zulu_time

Methods inherited from Service

#authenticate, #endpoint_uri, #region, #request_without_retry, #service_name, #service_net?

Constructor Details

#initialize(options) ⇒ Mock

Returns a new instance of Mock



92
93
94
# File 'lib/fog/rackspace/orchestration.rb', line 92

def initialize(options)
  @rackspace_api_key = options[:rackspace_api_key]
end

Instance Method Details

#get_stack_template(stack) ⇒ Object



15
16
# File 'lib/fog/rackspace/requests/orchestration/get_stack_template.rb', line 15

def get_stack_template(stack)
end

#list_resource_typesObject



15
16
17
18
# File 'lib/fog/rackspace/requests/orchestration/list_resource_types.rb', line 15

def list_resource_types
  resources = self.data[:resource_types].values
  response(:body => { 'resource_types' => resources })
end

#list_resources(stack) ⇒ Object



12
13
14
15
# File 'lib/fog/rackspace/requests/orchestration/list_resources.rb', line 12

def list_resources(stack)
  resources = self.data[:resources].values
  response(:body => { 'resources' => resources })
end

#list_stack_dataObject



15
16
17
18
# File 'lib/fog/rackspace/requests/orchestration/list_stack_data.rb', line 15

def list_stack_data
  stacks = self.data[:stacks].values
  response(:body => { 'stacks' => stacks })
end

#list_stack_eventsObject



12
13
14
15
# File 'lib/fog/rackspace/requests/orchestration/list_stack_events.rb', line 12

def list_stack_events
  events = self.data[:events].values
  response(:body => { 'events' => events })
end

#request(params) ⇒ Object



96
97
98
# File 'lib/fog/rackspace/orchestration.rb', line 96

def request(params)
  Fog::Mock.not_implemented
end

#response(params = {}) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
# File 'lib/fog/rackspace/orchestration.rb', line 100

def response(params={})
  body    = params[:body] || {}
  status  = params[:status] || 200
  headers = params[:headers] || {}

  response = Excon::Response.new(:body => body, :headers => headers, :status => status)
  if params.key?(:expects) && ![*params[:expects]].include?(response.status)
    raise(Excon::Errors.status_error(params, response))
  else response
  end
end

#show_event_details(stack, event) ⇒ Object



15
16
17
18
# File 'lib/fog/rackspace/requests/orchestration/show_event_details.rb', line 15

def show_event_details(stack, event)
  events = self.data[:events].values
  response(:body => { 'events' => events })
end

#show_resource_data(stack_name, stack_id, resource_name) ⇒ Object



15
16
17
18
# File 'lib/fog/rackspace/requests/orchestration/show_resource_data.rb', line 15

def show_resource_data(stack_name, stack_id, resource_name)
  resources = self.data[:resources].values
  response(:body => { 'resources' => resources })
end

#show_resource_metadata(stack, resource_name) ⇒ Object



15
16
17
18
# File 'lib/fog/rackspace/requests/orchestration/show_resource_metadata.rb', line 15

def (stack, resource_name)
  resources = self.data[:resources].values
  response(:body => { 'resources' => resources })
end

#show_resource_template(name) ⇒ Object



15
16
# File 'lib/fog/rackspace/requests/orchestration/show_resource_template.rb', line 15

def show_resource_template(name)
end

#show_stack_details(name, id) ⇒ Object



15
16
17
18
# File 'lib/fog/rackspace/requests/orchestration/show_stack_details.rb', line 15

def show_stack_details(name, id)
  stack = self.data[:stack].values
  response(:body => { 'stack' => stack })
end