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



107
108
109
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 107

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

.id_to_client(type) ⇒ Object



115
116
117
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 115

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

.id_to_type(id) ⇒ Object



111
112
113
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 111

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

.type_to_class(type) ⇒ Object



95
96
97
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 95

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

.type_to_client(type) ⇒ Object



99
100
101
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 99

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



91
92
93
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 91

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

.type_to_lookup_method(type) ⇒ Object



103
104
105
# File 'lib/puppet_x/enterprisemodules/oci/service_info.rb', line 103

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

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

Yields:

  • (entry)


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

def self.with_id_entry(id)
  entry = @information.find { |e| e[OCI_TYPE] == id }
  yield entry if entry
end

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

Yields:

  • (entry)


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

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