Class: Fog::HuaweiCloud::Planning::Real
- Inherits:
-
Object
- Object
- Fog::HuaweiCloud::Planning::Real
- Includes:
- Core
- Defined in:
- lib/fog/planning/huaweicloud.rb,
lib/fog/planning/huaweicloud/requests/get_plan.rb,
lib/fog/planning/huaweicloud/requests/list_plans.rb,
lib/fog/planning/huaweicloud/requests/list_roles.rb,
lib/fog/planning/huaweicloud/requests/patch_plan.rb,
lib/fog/planning/huaweicloud/requests/create_plan.rb,
lib/fog/planning/huaweicloud/requests/delete_plan.rb,
lib/fog/planning/huaweicloud/requests/add_role_to_plan.rb,
lib/fog/planning/huaweicloud/requests/get_plan_templates.rb,
lib/fog/planning/huaweicloud/requests/remove_role_from_plan.rb
Instance Method Summary collapse
- #add_role_to_plan(plan_uuid, role_uuid) ⇒ Object
- #create_plan(parameters) ⇒ Object
- #delete_plan(plan_uuid) ⇒ Object
- #get_plan(plan_uuid) ⇒ Object
- #get_plan_templates(plan_uuid) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
NOTE: uncommenting this should be treated as api-change! def self.not_found_class Fog::Planning::HuaweiCloud::NotFound end.
- #list_plans(options = {}) ⇒ Object
- #list_roles(options = {}) ⇒ Object
- #patch_plan(plan_uuid, parameters) ⇒ Object
- #remove_role_from_plan(plan_uuid, role_uuid) ⇒ Object
- #set_api_path ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
NOTE: uncommenting this should be treated as api-change! def self.not_found_class
Fog::Planning::HuaweiCloud::NotFound
end
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/fog/planning/huaweicloud.rb', line 105 def initialize( = {}) initialize_identity @huaweicloud_service_type = [:huaweicloud_service_type] || ['management'] # currently Tuskar is configured as 'management' service in Keystone @huaweicloud_service_name = [:huaweicloud_service_name] @huaweicloud_endpoint_type = [:huaweicloud_endpoint_type] || 'adminURL' @connection_options = [:connection_options] || {} authenticate set_api_path @persistent = [:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end |
Instance Method Details
#add_role_to_plan(plan_uuid, role_uuid) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/planning/huaweicloud/requests/add_role_to_plan.rb', line 5 def add_role_to_plan(plan_uuid, role_uuid) request( :expects => [201], :method => 'POST', :path => "plans/#{plan_uuid}/roles", :body => Fog::JSON.encode('uuid' => role_uuid) ) end |
#create_plan(parameters) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/planning/huaweicloud/requests/create_plan.rb', line 5 def create_plan(parameters) request( :expects => [201], :method => 'POST', :path => "plans", :body => Fog::JSON.encode(parameters) ) end |
#delete_plan(plan_uuid) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/planning/huaweicloud/requests/delete_plan.rb', line 5 def delete_plan(plan_uuid) request( :expects => [204], :method => 'DELETE', :path => "plans/#{plan_uuid}" ) end |
#get_plan(plan_uuid) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/planning/huaweicloud/requests/get_plan.rb', line 5 def get_plan(plan_uuid) request( :expects => [200, 204], :method => 'GET', :path => "plans/#{plan_uuid}" ) end |
#get_plan_templates(plan_uuid) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/planning/huaweicloud/requests/get_plan_templates.rb', line 5 def get_plan_templates(plan_uuid) request( :expects => [200, 204], :method => 'GET', :path => "plans/#{plan_uuid}/templates" ) end |
#list_plans(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/planning/huaweicloud/requests/list_plans.rb', line 5 def list_plans( = {}) request( :expects => [200, 204], :method => 'GET', :path => 'plans', :query => ) end |
#list_roles(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/planning/huaweicloud/requests/list_roles.rb', line 5 def list_roles( = {}) request( :expects => [200, 204], :method => 'GET', :path => 'roles', :query => ) end |
#patch_plan(plan_uuid, parameters) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/planning/huaweicloud/requests/patch_plan.rb', line 5 def patch_plan(plan_uuid, parameters) request( :expects => [201], :method => 'PATCH', :path => "plans/#{plan_uuid}", :body => Fog::JSON.encode(parameters) ) end |
#remove_role_from_plan(plan_uuid, role_uuid) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/planning/huaweicloud/requests/remove_role_from_plan.rb', line 5 def remove_role_from_plan(plan_uuid, role_uuid) request( :expects => [200], :method => 'DELETE', :path => "plans/#{plan_uuid}/roles/#{role_uuid}" ) end |
#set_api_path ⇒ Object
121 122 123 124 125 |
# File 'lib/fog/planning/huaweicloud.rb', line 121 def set_api_path unless @path.match(SUPPORTED_VERSIONS) @path = "/v2" end end |