Module: Puppet_X::EnterpriseModules::Oci::ModelAdditions

Defined in:
lib/puppet_x/enterprisemodules/oci/model_additions.rb

Overview

Docs

Instance Method Summary collapse

Instance Method Details

#compartment?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/puppet_x/enterprisemodules/oci/model_additions.rb', line 12

def compartment?
  id_type == :compartment || id_type == :tenancy
end

#id_typeObject



8
9
10
# File 'lib/puppet_x/enterprisemodules/oci/model_additions.rb', line 8

def id_type
  id.scan(/ocid1\.(\w*)\./).first.first.to_sym
end

#present?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
# File 'lib/puppet_x/enterprisemodules/oci/model_additions.rb', line 31

def present?
  return true unless respond_to?(:lifecycle_state)

  %w[PROVISIONING SCALING AVAILABLE RUNNING ACTIVE ATTACHED ATTACHING ENABLED].include?(lifecycle_state)
end

#puppet_nameObject

The name puppet uses



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet_x/enterprisemodules/oci/model_additions.rb', line 19

def puppet_name
  if respond_to?(:name)
    name
  elsif respond_to?(:display_name)
    display_name
  elsif respond_to?(:hostname)
    hostname
  else
    'unknown name'
  end
end