Class: CloudCostTracker::Coding::Compute::AWS::AccountCodingPolicy
- Inherits:
-
AccountCodingPolicy
- Object
- AccountCodingPolicy
- CloudCostTracker::Coding::Compute::AWS::AccountCodingPolicy
- Defined in:
- lib/cloud_cost_tracker/coding/compute/aws/account_coding_policy.rb
Overview
Implements the logic for attaching billing codes to all resources in a single AWS EC2 account, and defines the default order in which EC2 resources get coded.
Instance Method Summary collapse
-
#attach_account_codes(resource) ⇒ Object
Translates all AWS Tags into Billing Codes.
-
#priority_classes ⇒ Array <Class>
Defines the order in which EC2 resources are coded.
Methods inherited from AccountCodingPolicy
Constructor Details
This class inherits a constructor from CloudCostTracker::Coding::AccountCodingPolicy
Instance Method Details
#attach_account_codes(resource) ⇒ Object
Translates all AWS Tags into Billing Codes
26 27 28 29 30 31 32 |
# File 'lib/cloud_cost_tracker/coding/compute/aws/account_coding_policy.rb', line 26 def attach_account_codes(resource) if resource.respond_to?(:tags) and resource. resource..each do |key, value| resource.code(key, value) end end end |
#priority_classes ⇒ Array <Class>
Defines the order in which EC2 resources are coded.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cloud_cost_tracker/coding/compute/aws/account_coding_policy.rb', line 13 def priority_classes [ Fog::Compute::AWS::Tag, Fog::Compute::AWS::SecurityGroup, Fog::Compute::AWS::KeyPair, Fog::Compute::AWS::Server, # pulls codes from security group Fog::Compute::AWS::Volume, # pulls codes from server Fog::Compute::AWS::Snapshot, # pulls codes from volume Fog::Compute::AWS::Address, ] end |