コード例 #1
0
 def __init__(self, routes=None):
     super(GatewayVpcAttachment,
           self).__init__(client=connection.VPCConnectionClient().client())
     self.vpn_type = 'ipsec.1'
     if self.is_vpn_gateway():
         self.attachment_function = self.client.attach_vpn_gateway
         self.attachment_args = dict(vpn_gateway_id=self.source_resource_id,
                                     vpc_id=self.target_resource_id)
         self.detachment_function = self.client.detach_vpn_gateway
         self.detachment_args = dict(vpn_gateway_id=self.source_resource_id,
                                     vpc_id=self.target_resource_id)
         self.source_get_all_handler = {
             'function':
             self.client.get_all_vpn_gateways,
             'argument':
             '{0}_ids'.format(constants.VPN_GATEWAY['AWS_RESOURCE_TYPE'])
         }
     else:
         self.attachment_function = self.client.attach_internet_gateway
         self.attachment_args = dict(
             internet_gateway_id=self.source_resource_id,
             vpc_id=self.target_resource_id)
         self.detachment_function = self.client.detach_internet_gateway
         self.detachment_args = dict(
             internet_gateway_id=self.source_resource_id,
             vpc_id=self.target_resource_id)
         self.source_get_all_handler = {
             'function':
             self.client.get_all_internet_gateways,
             'argument':
             '{0}_ids'.format(
                 constants.INTERNET_GATEWAY['AWS_RESOURCE_TYPE'])
         }
コード例 #2
0
ファイル: vpc.py プロジェクト: isaac-s/cloudify-aws-plugin
 def __init__(self, target_account_id=None, routes=None, client=None):
     super(VpcPeeringConnection, self).__init__(
         client=connection.VPCConnectionClient().client()
     )
     self.not_found_error = 'InvalidVpcPeeringConnectionId.NotFound'
     self.resource_id = None
     self.target_account_id = target_account_id \
         if target_account_id else None
     self.routes = routes
     self.source_vpc_id = \
         ctx.source.instance.runtime_properties.get('vpc_id')
     self.target_vpc_id = \
         ctx.target.instance.runtime_properties.get(
             constants.EXTERNAL_RESOURCE_ID
         )
     self.source_route_table_id =\
         ctx.source.instance.runtime_properties.get(
             constants.EXTERNAL_RESOURCE_ID
         )
     self.source_vpc_peering_connection_id = \
         self.get_vpc_peering_connection_id(
             ctx.source.instance,
             self.source_vpc_id,
             'vpc_id')
     self.target_vpc_peering_connection_id = \
         self.get_vpc_peering_connection_id(
             ctx.target.instance,
             self.target_vpc_id,
             'vpc_peer_id')
     self.source_get_all_handler = {
         'function': self.client.get_all_route_tables,
         'argument':
         '{0}_ids'.format(constants.ROUTE_TABLE['AWS_RESOURCE_TYPE'])
     }
コード例 #3
0
ファイル: dhcp.py プロジェクト: isaac-s/cloudify-aws-plugin
 def __init__(self):
     super(DhcpAssociation,
           self).__init__(client=connection.VPCConnectionClient().client())
     self.source_get_all_handler = {
         'function':
         self.client.get_all_dhcp_options,
         'argument':
         '{0}_ids'.format(constants.DHCP_OPTIONS['AWS_RESOURCE_TYPE'])
     }
コード例 #4
0
 def __init__(self, destination_cidr_block=None):
     super(RouteTableGatewayAssociation,
           self).__init__(client=connection.VPCConnectionClient().client())
     self.source_get_all_handler = {
         'function':
         self.client.get_all_route_tables,
         'argument':
         '{0}_ids'.format(constants.ROUTE_TABLE['AWS_RESOURCE_TYPE'])
     }
     self.destination_cidr_block = destination_cidr_block
コード例 #5
0
 def __init__(self):
     super(Subnet, self).__init__(
         constants.SUBNET['AWS_RESOURCE_TYPE'],
         constants.SUBNET['REQUIRED_PROPERTIES'],
         client=connection.VPCConnectionClient().client()
     )
     self.not_found_error = constants.SUBNET['NOT_FOUND_ERROR']
     self.get_all_handler = {
         'function': self.client.get_all_subnets,
         'argument': '{0}_ids'.format(constants.SUBNET['AWS_RESOURCE_TYPE'])
     }
コード例 #6
0
ファイル: vpc.py プロジェクト: isaac-s/cloudify-aws-plugin
 def __init__(self):
     super(Vpc, self).__init__(
         constants.VPC['AWS_RESOURCE_TYPE'],
         constants.VPC['REQUIRED_PROPERTIES'],
         client=connection.VPCConnectionClient().client(),
         resource_states=constants.VPC['STATES']
     )
     self.not_found_error = constants.VPC['NOT_FOUND_ERROR']
     self.get_all_handler = {
         'function': self.client.get_all_vpcs,
         'argument': '{0}_ids'.format(constants.VPC['AWS_RESOURCE_TYPE'])
     }
コード例 #7
0
 def __init__(self):
     super(RouteTableSubnetAssociation,
           self).__init__(client=connection.VPCConnectionClient().client())
     self.association_id = \
         ctx.source.instance.runtime_properties.get(
             'association_id', None)
     self.source_get_all_handler = {
         'function':
         self.client.get_all_route_tables,
         'argument':
         '{0}_ids'.format(constants.ROUTE_TABLE['AWS_RESOURCE_TYPE'])
     }
コード例 #8
0
 def __init__(self):
     super(CustomerGateway,
           self).__init__(constants.CUSTOMER_GATEWAY['AWS_RESOURCE_TYPE'],
                          constants.CUSTOMER_GATEWAY['REQUIRED_PROPERTIES'],
                          client=connection.VPCConnectionClient().client())
     self.not_found_error = constants.CUSTOMER_GATEWAY['NOT_FOUND_ERROR']
     self.get_all_handler = {
         'function':
         self.client.get_all_customer_gateways,
         'argument':
         '{0}_ids'.format(constants.CUSTOMER_GATEWAY['AWS_RESOURCE_TYPE'])
     }
コード例 #9
0
 def __init__(self):
     super(NetworkAclSubnetAssociation,
           self).__init__(client=connection.VPCConnectionClient().client())
     self.association_id = \
         ctx.source.instance.runtime_properties\
         .get('association_id', None)\
         if ctx.source.instance.runtime_properties\
         .get('association_id', None)\
         else {}
     self.source_get_all_handler = {
         'function':
         self.client.get_all_network_acls,
         'argument':
         '{0}_ids'.format(constants.NETWORK_ACL['AWS_RESOURCE_TYPE'])
     }
コード例 #10
0
 def __init__(self, routes=None):
     super(RouteTable,
           self).__init__(constants.ROUTE_TABLE['AWS_RESOURCE_TYPE'],
                          constants.ROUTE_TABLE['REQUIRED_PROPERTIES'],
                          client=connection.VPCConnectionClient().client())
     self.not_found_error = constants.ROUTE_TABLE['NOT_FOUND_ERROR']
     self.get_all_handler = {
         'function':
         self.client.get_all_route_tables,
         'argument':
         '{0}_ids'.format(constants.ROUTE_TABLE['AWS_RESOURCE_TYPE'])
     }
     self.routes = \
         ctx.instance.runtime_properties.get('routes') \
         if 'routes' \
         in ctx.instance.runtime_properties.keys() else routes
コード例 #11
0
 def __init__(self, routes=None):
     super(VpnConnection,
           self).__init__(client=connection.VPCConnectionClient().client())
     self.vpn_type = ctx.source.node.properties['type']
     self.routes = \
         routes if routes else \
         ctx.source.instance.runtime_properties.get('routes', None)
     self.vpn_connection_id = \
         ctx.source.instance.runtime_properties.get(
             'vpn_connection') if 'vpn_connection' in \
         ctx.source.instance.runtime_properties.keys() else None
     self.source_get_all_handler = {
         'function':
         self.client.get_all_customer_gateways,
         'argument':
         '{0}_ids'.format(constants.CUSTOMER_GATEWAY['AWS_RESOURCE_TYPE'])
     }
コード例 #12
0
ファイル: vpc.py プロジェクト: isaac-s/cloudify-aws-plugin
def accept_vpc_peering_connection(args=None, **_):
    target_aws_config = ctx.target.node.properties['aws_config']
    client = \
        connection.VPCConnectionClient().client(aws_config=target_aws_config)
    return VpcPeeringConnection(client=client).accept_vpc_peering_connection(
        args)