Class: CloudCostTracker::Coding::Compute::AWS::VolumeCodingPolicy
- Inherits:
-
ResourceCodingPolicy
- Object
- ResourceCodingPolicy
- CloudCostTracker::Coding::Compute::AWS::VolumeCodingPolicy
- Defined in:
- lib/cloud_cost_tracker/coding/compute/aws/volumes.rb
Overview
Implements the logic for attaching billing codes to EBS Volumes
Instance Method Summary collapse
-
#code(ebs_volume) ⇒ Object
Copies all billing codes from any attached instance to this volume.
Methods inherited from ResourceCodingPolicy
Constructor Details
This class inherits a constructor from CloudCostTracker::Coding::ResourceCodingPolicy
Instance Method Details
#code(ebs_volume) ⇒ Object
Copies all billing codes from any attached instance to this volume
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cloud_cost_tracker/coding/compute/aws/volumes.rb', line 9 def code(ebs_volume) if (ebs_volume.state == "in-use") && (ebs_volume.server_id != "") server = ebs_volume.account_resources('servers').find do |server| server.identity == ebs_volume.server_id end if server server.billing_codes.each do |server_code| ebs_volume.code(server_code[0], server_code[1]) end end end end |