How to use list_query_logging_configs method in localstack

Best Python code snippet using localstack_python

test_aws_hostedzones_client.py

Source:test_aws_hostedzones_client.py Github

copy

Full Screen

...61 }62 boto_mock.list_query_logging_configs = Mock(side_effect=lambda HostedZoneId: values[HostedZoneId])63 assert responses.EXPECTED_LIST_HOSTED_ZONES == AwsHostedZonesClient(boto_mock).list_hosted_zones()64 boto_mock.list_hosted_zones.assert_called_once_with()65 def test_list_query_logging_configs(self) -> None:66 expected_query_log = {67 "QueryLoggingConfigs": [68 {69 "Id": "abcdefgh-1234-5678-90ab-ijklmnopqrst",70 "HostedZoneId": "AAAABBBBCCCCDD",71 "CloudWatchLogsLogGroupArn": "arn:aws:logs:us-east-1:123456789012:\72log-group:/aws/route53/public.aws.scanner.gov.uk.",73 }74 ]75 }76 boto_mock = Mock(list_query_logging_configs=Mock(return_value=expected_query_log))77 assert responses.EXPECTED_QUERY_LOG == AwsHostedZonesClient(boto_mock).list_query_logging_configs(78 "AAAABBBBCCCCDD"79 )80 boto_mock.list_query_logging_configs.assert_called_once_with(HostedZoneId="AAAABBBBCCCCDD")81 def test_list_query_logging_configs_failure(self) -> None:82 boto_mock = Mock(83 list_query_logging_configs=Mock(84 side_effect=client_error(85 "listQueryLoggingConfigs", "QueryLogException", "unable to get the query log config"86 )87 )88 )89 with self.assertRaisesRegex(QueryLogException, "unable to get the query log config"):90 AwsHostedZonesClient(boto_mock).list_query_logging_configs("AAAABBBBCCCCDD")91 def test_create_query_log_config(self) -> None:92 route53_client = Mock(create_query_logging_config=Mock(return_value="expected_query_log"))93 expected_list_query_logging_config = {94 "QueryLoggingConfigs": [95 {96 "Id": "1234567-1234567-1234567-1234567-1234567",97 "HostedZoneId": "AAAABBBBCCCCDD",98 "CloudWatchLogsLogGroupArn": "",99 },100 ],101 "NextToken": "string",102 }103 route53_client.list_query_logging_configs = Mock(104 side_effect=lambda HostedZoneId: expected_list_query_logging_config...

Full Screen

Full Screen

aws_hosted_zones_client.py

Source:aws_hosted_zones_client.py Github

copy

Full Screen

...15 hostedzones = self._route53.list_hosted_zones()["HostedZones"]16 for host in hostedzones:17 zone = route53Type.to_route53Zone(host)18 if not zone.privateZone:19 queryLogConfig = self._route53.list_query_logging_configs(20 HostedZoneId=zone.id.replace("/hostedzone/", "")21 )22 if len(queryLogConfig) > 0 and len(queryLogConfig["QueryLoggingConfigs"]) > 0:23 zone.queryLog = queryLogConfig["QueryLoggingConfigs"][0]["CloudWatchLogsLogGroupArn"]24 public_zones[zone.id] = zone25 return public_zones26 def list_query_logging_configs(self, id: str) -> Any:27 try:28 return self._route53.list_query_logging_configs(HostedZoneId=id)29 except (BotoCoreError, ClientError) as err:30 raise QueryLogException(f"unable to get the query log config: {err}")31 def create_query_logging_config(self, hosted_zone_id: str, cloudwatch_logs_loggrouparn: str) -> Any:32 hosted_zone_query_log = self._route53.list_query_logging_configs(HostedZoneId=hosted_zone_id)33 if (34 len(hosted_zone_query_log["QueryLoggingConfigs"]) == 035 or hosted_zone_query_log["QueryLoggingConfigs"][0]["CloudWatchLogsLogGroupArn"] == ""36 ):37 return self._route53.create_query_logging_config(38 HostedZoneId=hosted_zone_id, CloudWatchLogsLogGroupArn=cloudwatch_logs_loggrouparn39 )40 def delete_query_logging_config(self, hosted_zone_id: str) -> Any:41 queryLoggingConfig = self._route53.list_query_logging_configs(HostedZoneId=hosted_zone_id)42 if len(queryLoggingConfig["QueryLoggingConfigs"]) > 0:43 queryLoggingConfigId = queryLoggingConfig["QueryLoggingConfigs"][0]["Id"]44 self._route53.delete_query_logging_config(Id=queryLoggingConfigId)...

Full Screen

Full Screen

route53.py

Source:route53.py Github

copy

Full Screen

...20 def get_resources(self):21 """22 Fetches resource details.23 """24 query_logging_configs = self.conn.list_query_logging_configs(25 HostedZoneId=self.resource.get("Id")26 ).get("QueryLoggingConfigs")27 resource = {**self.resource, "QueryLoggingConfig": query_logging_configs}28 return resource29def register() -> Any:30 """Register plugin"""...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful