Class: CloudCostTracker::Coding::Compute::AWS::ServerCodingPolicy
- Inherits:
-
ResourceCodingPolicy
- Object
- ResourceCodingPolicy
- CloudCostTracker::Coding::Compute::AWS::ServerCodingPolicy
- Defined in:
- lib/cloud_cost_tracker/coding/compute/aws/servers.rb
Overview
Implements the logic for attaching billing codes to EC2 servers
Instance Method Summary collapse
-
#code(ec2_server) ⇒ Object
Copies all billing codes from this server’s Security Group.
Methods inherited from ResourceCodingPolicy
Constructor Details
This class inherits a constructor from CloudCostTracker::Coding::ResourceCodingPolicy
Instance Method Details
#code(ec2_server) ⇒ Object
Copies all billing codes from this server’s Security Group
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cloud_cost_tracker/coding/compute/aws/servers.rb', line 9 def code(ec2_server) ec2_server.groups.each do |group_name| group = ec2_server.account_resources('security_groups').find do |g| g.identity == group_name end if group group.billing_codes.each do |billing_code| ec2_server.code(billing_code[0], billing_code[1]) end end end end |