Class: Puppet_X::EnterpriseModules::Oci::AssociatedProperty
- Inherits:
-
Puppet::Property
- Object
- Puppet::Property
- Puppet_X::EnterpriseModules::Oci::AssociatedProperty
show all
- Extended by:
- Config, Settings
- Includes:
- EasyType, EasyType::ArrayProperty, Config, Settings
- Defined in:
- lib/puppet_x/enterprisemodules/oci/associated_property.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Config
client_for, config_for_settings, default_tenant, determine_setting_for, proxy_config, retry_config, settings_for, tenant_config
Methods included from Settings
configuration, included, read_from_yaml, setting_for, settings, settings_file
Class Method Details
.association(assoc = nil) ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 53
def self.association(assoc = nil)
if assoc
@assoc = assoc
else
@assoc
end
end
|
.association_add ⇒ Object
77
78
79
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 77
def self.association_add
@assoc[association_name][:add]
end
|
.association_from ⇒ Object
65
66
67
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 65
def self.association_from
@assoc[association_name][:from]
end
|
.association_model ⇒ Object
69
70
71
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 69
def self.association_model
@assoc[association_name][:model]
end
|
.association_name ⇒ Object
61
62
63
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 61
def self.association_name
@assoc.keys.first
end
|
.association_remove ⇒ Object
81
82
83
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 81
def self.association_remove
@assoc[association_name][:remove]
end
|
.association_to ⇒ Object
73
74
75
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 73
def self.association_to
@assoc[association_name][:to]
end
|
.client(tenant) ⇒ Object
45
46
47
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 45
def self.client(tenant)
client_for(ServiceInfo.type_to_client(puppet_type), tenant)
end
|
.puppet_type ⇒ Object
49
50
51
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 49
def self.puppet_type
to_s.split('::')[2].downcase.to_sym
end
|
Instance Method Details
#before_destroy ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/puppet_x/enterprisemodules/oci/associated_property.rb', line 22
def before_destroy
first_parameter = client.method("list_#{association_name}s").parameters[0]
case first_parameter
when [:req, :availability_domain]
assoc_data = client.send("list_#{association_name}s",
provider.availability_domain,
provider.compartment_id,
association_from => provider.id).data
when [:req, :compartment_id]
assoc_data = client.send("list_#{association_name}s",
provider.compartment_id,
association_from => provider.id).data
else
fail 'Internal error, we only support compartment or availability_domain as first parameter'
end
assoc_ids = assoc_data.select { |e| ACTIVE_ASSOCIATIONS.include?(e.lifecycle_state) }.collect(&association_to)
assoc_ids.each { |r| remove_record_by_id(r) }
end
|