# File lib/fog/openstack/orchestration.rb, line 30 def self.data @data ||= Hash.new do |hash, key| hash[key] = { :stacks => {} } end end
# File lib/fog/openstack/orchestration.rb, line 42 def initialize(options={}) @openstack_username = options[:openstack_username] @openstack_auth_uri = URI.parse(options[:openstack_auth_url]) @current_tenant = options[:openstack_tenant] @auth_token = Fog::Mock.random_base64(64) @auth_token_expiration = (Time.now.utc + 86400).iso8601 management_url = URI.parse(options[:openstack_auth_url]) management_url.port = 8774 management_url.path = '/v1' @openstack_management_url = management_url.to_s identity_public_endpoint = URI.parse(options[:openstack_auth_url]) identity_public_endpoint.port = 5000 @openstack_identity_public_endpoint = identity_public_endpoint.to_s end
# File lib/fog/openstack/requests/orchestration/create_stack.rb, line 33 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
# File lib/fog/openstack/orchestration.rb, line 69 def credentials { :provider => 'openstack', :openstack_auth_url => @openstack_auth_uri.to_s, :openstack_auth_token => @auth_token, :openstack_management_url => @openstack_management_url, :openstack_identity_endpoint => @openstack_identity_public_endpoint } end
# File lib/fog/openstack/orchestration.rb, line 61 def data self.class.data["#{@openstack_username}-#{@current_tenant}"] end
# File lib/fog/openstack/requests/orchestration/delete_stack.rb, line 24 def delete_stack(stack_name, stack_id) self.data[:stacks].delete(stack_id) response = Excon::Response.new response.status = 204 response.body = {} response end
# File lib/fog/openstack/requests/orchestration/list_stacks.rb, line 36 def list_stacks(options = {}) stacks = self.data[:stacks].values Excon::Response.new( :body => { 'stacks' => stacks }, :status => 200 ) end
Generated with the Darkfish Rdoc Generator 2.