Exemplo n.º 1
0
 def test_default_tls_version_on_domain_name(self):
     injector = InjectDefaults(tls_version='TLS_1_2')
     domain_name = models.DomainName(resource_name='my_domain_name',
                                     domain_name='example.com',
                                     protocol=models.APIType.HTTP,
                                     certificate_arn='myarn',
                                     api_mapping=models.APIMapping(
                                         resource_name='mymapping',
                                         mount_path='(none)',
                                         api_gateway_stage='api'))
     config = Config.create()
     injector.handle(config, domain_name)
     assert domain_name.tls_version == models.TLSVersion.TLS_1_2
Exemplo n.º 2
0
    def _create_domain_name_model(
            self,
            protocol,  # type: models.APIType
            data,  # type: StrMapAny
            endpoint_type,  # type: str
            api_mapping  # type: models.APIMapping
    ):
        # type: (...) -> models.DomainName
        default_name = 'api_gateway_custom_domain'
        resource_name_map = {
            'HTTP': default_name,
            'WEBSOCKET': 'websocket_api_custom_domain'
        }  # type: Dict[str, str]

        domain_name = models.DomainName(
            protocol=protocol,
            resource_name=resource_name_map.get(protocol.value, default_name),
            domain_name=data['domain_name'],
            tls_version=models.TLSVersion.create(data.get('tls_version', '')),
            certificate_arn=data['certificate_arn'],
            tags=data.get('tags'),
            api_mapping=api_mapping)
        return domain_name