How to use the octodns.provider.route53.Route53Provider function in octodns

To help you get started, we’ve selected a few octodns examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github github / octodns / tests / test_octodns_provider_route53.py View on Github external
def test_semicolon_fixup(self):
        provider = Route53Provider('test', 'abc', '123')

        self.assertEquals({
            'type': 'TXT',
            'ttl': 30,
            'values': [
                'abcd\\; ef\\;g',
                'hij\\; klm\\;n',
            ],
        }, provider._data_for_quoted({
            'ResourceRecords': [{
                'Value': '"abcd; ef;g"',
            }, {
                'Value': '"hij\\; klm\\;n"',
            }],
            'TTL': 30,
            'Type': 'TXT',
github github / octodns / tests / test_octodns_provider_route53.py View on Github external
def _get_test_plan(self, max_changes):

        provider = Route53Provider('test', 'abc', '123', max_changes)

        # Use the stubber
        stubber = Stubber(provider._conn)
        stubber.activate()

        got = Zone('unit.tests.', [])

        list_hosted_zones_resp = {
            'HostedZones': [],
            'Marker': 'm',
            'IsTruncated': False,
            'MaxItems': '100',
        }
        stubber.add_response('list_hosted_zones', list_hosted_zones_resp,
                             {})
github github / octodns / tests / test_octodns_provider_route53.py View on Github external
}}),
        ('_srv._tcp', {'ttl': 66, 'type': 'SRV', 'value': {
            'priority': 10,
            'weight': 20,
            'port': 30,
            'target': 'cname.unit.tests.'
        }}),
        ('',
         {'ttl': 67, 'type': 'NS', 'values': ['8.2.3.4.', '9.2.3.4.']}),
        ('sub',
         {'ttl': 68, 'type': 'NS', 'values': ['5.2.3.4.', '6.2.3.4.']}),
    ):
        record = Record.new(expected, name, data)
        expected.add_record(record)

    caller_ref = '{}:A:1324'.format(Route53Provider.HEALTH_CHECK_VERSION)
    health_checks = [{
        'Id': '42',
        'CallerReference': caller_ref,
        'HealthCheckConfig': {
            'Type': 'HTTPS',
            'FullyQualifiedDomainName': 'unit.tests',
            'IPAddress': '4.2.3.4',
        },
        'HealthCheckVersion': 2,
    }, {
        'Id': 'ignored-also',
        'CallerReference': 'something-else',
        'HealthCheckConfig': {
            'Type': 'HTTPS',
            'FullyQualifiedDomainName': 'unit.tests',
            'IPAddress': '5.2.3.4',
github github / octodns / tests / test_octodns_provider_route53.py View on Github external
def _get_stubbed_provider(self):
        provider = Route53Provider('test', 'abc', '123')

        # Use the stubber
        stubber = Stubber(provider._conn)
        stubber.activate()

        return (provider, stubber)
github github / octodns / octodns / provider / route53.py View on Github external
def __init__(self, id, access_key_id, secret_access_key, max_changes=1000,
                 client_max_attempts=None, *args, **kwargs):
        self.max_changes = max_changes
        self.log = logging.getLogger('Route53Provider[{}]'.format(id))
        self.log.debug('__init__: id=%s, access_key_id=%s, '
                       'secret_access_key=***', id, access_key_id)
        super(Route53Provider, self).__init__(id, *args, **kwargs)

        config = None
        if client_max_attempts is not None:
            self.log.info('__init__: setting max_attempts to %d',
                          client_max_attempts)
            config = Config(retries={'max_attempts': client_max_attempts})

        self._conn = client('route53', aws_access_key_id=access_key_id,
                            aws_secret_access_key=secret_access_key,
                            config=config)

        self._r53_zones = None
        self._r53_rrsets = {}
        self._health_checks = None