Class: Fog::Brightbox::Compute::ConfigMap
- Inherits:
-
Model
- Object
- Model
- Model
- Fog::Brightbox::Compute::ConfigMap
show all
- Defined in:
- lib/fog/brightbox/models/compute/config_map.rb
Instance Method Summary
collapse
#collection_name, #resource_name
Instance Method Details
#destroy ⇒ Object
36
37
38
39
40
41
|
# File 'lib/fog/brightbox/models/compute/config_map.rb', line 36
def destroy
requires :identity
res = service.delete_config_map(identity)
merge_attributes(res)
true
end
|
#save ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/fog/brightbox/models/compute/config_map.rb', line 12
def save
options = {
name: name
}.delete_if { |_k, v| v.nil? }
payload = JSON.decode(attributes[:data])
res = if persisted?
options[:data] = payload
service.update_config_map(identity, options)
else
raise Fog::Errors::Error, "'data' is required" if data.nil? || data.empty?
options[:data] = payload
service.create_config_map(options)
end
merge_attributes(res)
true
rescue StandardError => e
raise Fog::Errors::Error, e.message
end
|