How to use get_private_dns_management_client method in lisa

Best Python code snippet using lisa_python

common.py

Source:common.py Github

copy

Full Screen

...434 )435 log.debug(f"delete private endpoints: {private_endpoint_name}")436 except Exception:437 log.debug(f"not find private endpoints: {private_endpoint_name}")438def get_private_dns_management_client(439 platform: "AzurePlatform",440) -> PrivateDnsManagementClient:441 return PrivateDnsManagementClient(442 credential=platform.credential,443 subscription_id=platform.subscription_id,444 )445def create_update_private_zones(446 platform: "AzurePlatform",447 resource_group_name: str,448 log: Logger,449 private_zone_name: str = "privatelink.file.core.windows.net",450 private_zone_location: str = "global",451) -> Any:452 private_dns_client = get_private_dns_management_client(platform)453 private_zones = private_dns_client.private_zones.begin_create_or_update(454 resource_group_name=resource_group_name,455 private_zone_name=private_zone_name,456 parameters=PrivateZone(location=private_zone_location), # or Private457 )458 log.debug(f"create private zone: {private_zone_name}")459 result = private_zones.result()460 return result.id461def delete_private_zones(462 platform: "AzurePlatform",463 resource_group_name: str,464 log: Logger,465 private_zone_name: str = "privatelink.file.core.windows.net",466) -> None:467 private_dns_client = get_private_dns_management_client(platform)468 try:469 private_dns_client.private_zones.get(470 resource_group_name=resource_group_name,471 private_zone_name=private_zone_name,472 )473 log.debug(f"found private zone: {private_zone_name}")474 timer = create_timer()475 while timer.elapsed(False) < 60:476 try:477 private_dns_client.private_zones.begin_delete(478 resource_group_name=resource_group_name,479 private_zone_name=private_zone_name,480 )481 log.debug(f"delete private zone: {private_zone_name}")482 break483 except Exception as identifier:484 if (485 "Can not delete resource before nested resources are deleted"486 in str(identifier)487 ):488 sleep(1)489 continue490 except Exception:491 log.debug(f"not find private zone: {private_zone_name}")492def create_update_record_sets(493 platform: "AzurePlatform",494 resource_group_name: str,495 ipv4_address: str,496 log: Logger,497 private_zone_name: str = "privatelink.file.core.windows.net",498 relative_record_set_name: str = "privatelink",499 record_type: str = "A",500) -> None:501 private_dns_client = get_private_dns_management_client(platform)502 private_dns_client.record_sets.create_or_update(503 resource_group_name=resource_group_name,504 private_zone_name=private_zone_name,505 relative_record_set_name=relative_record_set_name,506 record_type=record_type,507 parameters=RecordSet(ttl=10, a_records=[ARecord(ipv4_address=ipv4_address)]),508 )509 log.debug(f"create record sets: {relative_record_set_name}")510def delete_record_sets(511 platform: "AzurePlatform",512 resource_group_name: str,513 log: Logger,514 private_zone_name: str = "privatelink.file.core.windows.net",515 relative_record_set_name: str = "privatelink",516 record_type: str = "A",517) -> None:518 private_dns_client = get_private_dns_management_client(platform)519 try:520 private_dns_client.record_sets.get(521 resource_group_name=resource_group_name,522 private_zone_name=private_zone_name,523 relative_record_set_name=relative_record_set_name,524 record_type=record_type,525 )526 log.debug(f"found record sets: {relative_record_set_name}")527 private_dns_client.record_sets.delete(528 resource_group_name=resource_group_name,529 private_zone_name=private_zone_name,530 relative_record_set_name=relative_record_set_name,531 record_type=record_type,532 )533 log.debug(f"delete record sets: {relative_record_set_name}")534 except Exception:535 log.debug(f"not find record sets: {relative_record_set_name}")536def create_update_virtual_network_links(537 platform: "AzurePlatform",538 resource_group_name: str,539 virtual_network_resource_id: str,540 log: Logger,541 private_zone_name: str = "privatelink.file.core.windows.net",542 virtual_network_link_name: str = "vnetlink",543 registration_enabled: bool = False,544 virtual_network_link_location: str = "global",545) -> None:546 private_dns_client = get_private_dns_management_client(platform)547 private_dns_client.virtual_network_links.begin_create_or_update(548 resource_group_name=resource_group_name,549 private_zone_name=private_zone_name,550 virtual_network_link_name=virtual_network_link_name,551 parameters=VirtualNetworkLink(552 registration_enabled=registration_enabled,553 location=virtual_network_link_location,554 virtual_network=SubResource(id=virtual_network_resource_id),555 ),556 )557 log.debug(f"create virtual network link: {virtual_network_link_name}")558def delete_virtual_network_links(559 platform: "AzurePlatform",560 resource_group_name: str,561 log: Logger,562 private_zone_name: str = "privatelink.file.core.windows.net",563 virtual_network_link_name: str = "vnetlink",564) -> None:565 private_dns_client = get_private_dns_management_client(platform)566 try:567 private_dns_client.virtual_network_links.get(568 resource_group_name=resource_group_name,569 private_zone_name=private_zone_name,570 virtual_network_link_name=virtual_network_link_name,571 )572 log.debug(f"find virtual network link: {virtual_network_link_name}")573 private_dns_client.virtual_network_links.begin_delete(574 resource_group_name=resource_group_name,575 private_zone_name=private_zone_name,576 virtual_network_link_name=virtual_network_link_name,577 )578 log.debug(f"delete virtual network link: {virtual_network_link_name}")579 except Exception:...

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 lisa 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