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

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

Overview

Docs

Class Method Summary collapse

Class Method Details

.id_to_class(id) ⇒ Object



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

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

.id_to_type(id) ⇒ Object



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

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

.type_to_class(type) ⇒ Object



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

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

.type_to_client(type) ⇒ Object



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

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



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

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

.type_to_lookup_method(type) ⇒ Object



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

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

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

Yields:

  • (entry)


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

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)


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

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