Class: Fog::OpenStack::Introspection::Real

Inherits:
Object
  • Object
show all
Includes:
Core
Defined in:
lib/fog/openstack/introspection.rb,
lib/fog/openstack/introspection/requests/get_rules.rb,
lib/fog/openstack/introspection/requests/list_rules.rb,
lib/fog/openstack/introspection/requests/create_rules.rb,
lib/fog/openstack/introspection/requests/delete_rules.rb,
lib/fog/openstack/introspection/requests/delete_rules_all.rb,
lib/fog/openstack/introspection/requests/get_introspection.rb,
lib/fog/openstack/introspection/requests/abort_introspection.rb,
lib/fog/openstack/introspection/requests/create_introspection.rb,
lib/fog/openstack/introspection/requests/get_introspection_details.rb

Instance Attribute Summary

Attributes included from Core

#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_application_credential_id, #openstack_application_credential_secret, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_api_version, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Core

#credentials, #initialize, #reload

Class Method Details

.not_found_classObject



75
76
77
# File 'lib/fog/openstack/introspection.rb', line 75

def self.not_found_class
  Fog::OpenStack::Introspection::NotFound
end

Instance Method Details

#abort_introspection(node_id) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/fog/openstack/introspection/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/openstack/introspection/requests/create_introspection.rb', line 5

def create_introspection(node_id, options = {})
  if options
    data = {
      'new_ipmi_username' => options[:new_ipmi_username],
      'new_ipmi_password' => options[: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/openstack/introspection/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

#default_path_prefixObject



79
80
81
# File 'lib/fog/openstack/introspection.rb', line 79

def default_path_prefix
  'v1'
end

#default_service_typeObject



83
84
85
# File 'lib/fog/openstack/introspection.rb', line 83

def default_service_type
  %w[baremetal-introspection]
end

#delete_rules(rule_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/fog/openstack/introspection/requests/delete_rules.rb', line 5

def delete_rules(rule_id)
  request(
    :expects => 204,
    :method  => "DELETE",
    :path    => "rules/#{rule_id}"
  )
end

#delete_rules_allObject



5
6
7
8
9
10
11
# File 'lib/fog/openstack/introspection/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/openstack/introspection/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/openstack/introspection/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/openstack/introspection/requests/get_rules.rb', line 5

def get_rules(rule_id)
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "rules/#{rule_id}"
  )
end

#list_rulesObject



5
6
7
8
9
10
11
# File 'lib/fog/openstack/introspection/requests/list_rules.rb', line 5

def list_rules
  request(
    :expects => 200,
    :method  => 'GET',
    :path    => "rules"
  )
end