Module: Eaglenube::Synchronizer::AWS::Vpc::VpcSyncMethods
- Includes:
- ApiWrapper::AWS::Vpc, CloudObjectMapper::AWS
- Defined in:
- lib/eaglenube/synchronizer/aws/vpc.rb
Instance Method Summary collapse
- #sync_addtional_attributes(credential, region_code, vpc_id) ⇒ Object
- #sync_resource(credential, region_code) ⇒ Object
Methods included from CloudObjectMapper::AWS
#cloud_obj_mapper, #cloud_obj_mapper_yml, #parse_provider_data
Methods included from ApiWrapper::AWS::Vpc
#describe_vpc_attribute, #describe_vpcs
Instance Method Details
#sync_addtional_attributes(credential, region_code, vpc_id) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/eaglenube/synchronizer/aws/vpc.rb', line 42 def sync_addtional_attributes(credential, region_code, vpc_id) dns_support_attrs = { vpc_id: vpc_id, attribute: "enableDnsSupport" } dns_support = describe_vpc_attribute(credential, region_code, **dns_support_attrs).try(:enable_dns_support).try(:value) dns_hostname_attrs = { vpc_id: vpc_id, attribute: "enableDnsHostnames" } dns_hostname = describe_vpc_attribute(credential, region_code, **dns_hostname_attrs).try(:enable_dns_hostnames).try(:value) [dns_support, dns_hostname] end |
#sync_resource(credential, region_code) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/eaglenube/synchronizer/aws/vpc.rb', line 21 def sync_resource(credential, region_code) remote_vpcs = describe_vpcs(credential, region_code) describe_vpc_attribute_permisssion_error = false remote_vpcs.each do |remote_vpc| , optional_attributes = yield(remote_vpc) dns_support = false dns_hostname = false unless describe_vpc_attribute_permisssion_error begin dns_support, dns_hostname = sync_addtional_attributes(credential, region_code, remote_vpc.vpc_id) rescue Aws::EC2::Errors::UnauthorizedOperation describe_vpc_attribute_permisssion_error = true end end optional_attributes.merge({ dns_support: dns_support, dns_hostname: dns_hostname }) create_or_update(remote_vpc, , **optional_attributes) end end |