Class: Puppet_X::EnterpriseModules::Oci::ServiceInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_x/enterprisemodules/oci/service_info.rb

Overview

Docs rubocop: disable Lint/OrAssignmentToConstant

Class Method Summary collapse

Class Method Details

.id_to_class(id) ⇒ Object



117
118
119
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 117

def self.id_to_class(id)
  with_id_entry(id) { |e| Object.const_get(e[SDK_MODEL]) }
end

.id_to_client(type) ⇒ Object



125
126
127
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 125

def self.id_to_client(type)
  with_id_entry(type) { |e| Object.const_get(e[SDK_CLIENT]) }
end

.id_to_type(id) ⇒ Object



121
122
123
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 121

def self.id_to_type(id)
  with_id_entry(id) { |e| e[PUPPET_TYPE] }
end

.type_to_class(type) ⇒ Object



105
106
107
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 105

def self.type_to_class(type)
  with_type_entry(type) { |e| Object.const_get(e[SDK_MODEL]) }
end

.type_to_client(type) ⇒ Object



109
110
111
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 109

def self.type_to_client(type)
  with_type_entry(type) { |e| Object.const_get(e[SDK_CLIENT]) }
end

.type_to_id(type) ⇒ Object

rubocop: enable Layout/LineLength



101
102
103
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 101

def self.type_to_id(type)
  with_type_entry(type) { |e| e[OCI_TYPE] }
end

.type_to_lookup_method(type) ⇒ Object



113
114
115
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 113

def self.type_to_lookup_method(type)
  with_type_entry(type) { |e| e[LOOKUP_METHOD] }
end

.with_id_entry(id) {|entry| ... } ⇒ Object

Yields:

  • (entry)


136
137
138
139
140
141
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 136

def self.with_id_entry(id)
  entry = @information.find { |e| e[OCI_TYPE] == id }
  fail "Internal error: No information found for #{id}" if entry.nil?

  yield entry
end

.with_type_entry(type) {|entry| ... } ⇒ Object

Yields:

  • (entry)


129
130
131
132
133
134
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 129

def self.with_type_entry(type)
  entry = @information.find { |e| e[PUPPET_TYPE] == type }
  fail "Internal error: No information found for #{type}" if entry.nil?

  yield entry
end