Class: Fog::Introspection::HuaweiCloud::Real
- Inherits:
-
Object
- Object
- Fog::Introspection::HuaweiCloud::Real
- Includes:
- HuaweiCloud::Core
- Defined in:
- lib/fog/introspection/huaweicloud.rb,
lib/fog/introspection/huaweicloud/requests/get_rules.rb,
lib/fog/introspection/huaweicloud/requests/list_rules.rb,
lib/fog/introspection/huaweicloud/requests/create_rules.rb,
lib/fog/introspection/huaweicloud/requests/delete_rules.rb,
lib/fog/introspection/huaweicloud/requests/delete_rules_all.rb,
lib/fog/introspection/huaweicloud/requests/get_introspection.rb,
lib/fog/introspection/huaweicloud/requests/abort_introspection.rb,
lib/fog/introspection/huaweicloud/requests/create_introspection.rb,
lib/fog/introspection/huaweicloud/requests/get_introspection_details.rb
Class Method Summary collapse
Instance Method Summary collapse
- #abort_introspection(node_id) ⇒ Object
- #create_introspection(node_id, options = {}) ⇒ Object
- #create_rules(attributes) ⇒ Object
- #delete_rules(rule_id) ⇒ Object
- #delete_rules_all ⇒ Object
- #get_introspection(node_id) ⇒ Object
- #get_introspection_details(node_id) ⇒ Object
- #get_rules(rule_id) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_rules ⇒ Object
- #set_api_path ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/fog/introspection/huaweicloud.rb', line 80 def initialize( = {}) initialize_identity @huaweicloud_service_type = [:huaweicloud_service_type] || ['baremetal-introspection'] @huaweicloud_service_name = [:huaweicloud_service_name] @connection_options = [:connection_options] || {} authenticate set_api_path @persistent = [:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end |
Class Method Details
.not_found_class ⇒ Object
76 77 78 |
# File 'lib/fog/introspection/huaweicloud.rb', line 76 def self.not_found_class Fog::Introspection::HuaweiCloud::NotFound end |
Instance Method Details
#abort_introspection(node_id) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/fog/introspection/huaweicloud/requests/abort_introspection.rb', line 5 def abort_introspection(node_id) request( :body => "", :expects => 202, :method => "POST", :path => "introspection/#{node_id}/abort" ) end |
#create_introspection(node_id, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fog/introspection/huaweicloud/requests/create_introspection.rb', line 5 def create_introspection(node_id, = {}) if data = { 'new_ipmi_username' => [:new_ipmi_username], 'new_ipmi_password' => [:new_ipmi_password] } body = Fog::JSON.encode(data) else body = "" end request( :body => body, :expects => 202, :method => "POST", :path => "introspection/#{node_id}" ) end |
#create_rules(attributes) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fog/introspection/huaweicloud/requests/create_rules.rb', line 5 def create_rules(attributes) attributes_valid = [ :actions, :conditions, :uuid, :description ] # Filter only allowed creation attributes data = attributes.select do |key, _| attributes_valid.include?(key.to_sym) end request( :body => Fog::JSON.encode(data), :expects => 200, :method => "POST", :path => "rules" ) end |
#delete_rules(rule_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/introspection/huaweicloud/requests/delete_rules.rb', line 5 def delete_rules(rule_id) request( :expects => 204, :method => "DELETE", :path => "rules/#{rule_id}" ) end |
#delete_rules_all ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/introspection/huaweicloud/requests/delete_rules_all.rb', line 5 def delete_rules_all request( :expects => 204, :method => "DELETE", :path => "rules" ) end |
#get_introspection(node_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/introspection/huaweicloud/requests/get_introspection.rb', line 5 def get_introspection(node_id) request( :expects => 200, :method => "GET", :path => "introspection/#{node_id}" ) end |
#get_introspection_details(node_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/introspection/huaweicloud/requests/get_introspection_details.rb', line 5 def get_introspection_details(node_id) request( :expects => 200, :method => 'GET', :path => "introspection/#{node_id}/data" ) end |
#get_rules(rule_id) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/introspection/huaweicloud/requests/get_rules.rb', line 5 def get_rules(rule_id) request( :expects => 200, :method => 'GET', :path => "rules/#{rule_id}" ) end |
#list_rules ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fog/introspection/huaweicloud/requests/list_rules.rb', line 5 def list_rules request( :expects => 200, :method => 'GET', :path => "rules" ) end |
#set_api_path ⇒ Object
95 96 97 98 99 |
# File 'lib/fog/introspection/huaweicloud.rb', line 95 def set_api_path unless @path.match(SUPPORTED_VERSIONS) @path = "/v1" end end |