1# -------------------------------------------------------------------------------------------- 2# Copyright (c) Microsoft Corporation. All rights reserved. 3# Licensed under the MIT License. See License.txt in the project root for license information. 4# -------------------------------------------------------------------------------------------- 5 6def build_dns_zone(domain_name, dependencies=None): 7 dependencies = dependencies or [] 8 dns_zone_resource = { 9 "type": "Microsoft.Network/dnszones", 10 "name": domain_name, 11 "apiVersion": "2018-05-01", 12 "location": "global", 13 "dependsOn": dependencies, 14 "properties": { 15 "zoneType": "Public" 16 } 17 } 18 return dns_zone_resource 19 20 21def build_domain(domain_name, local_ip_address, current_time, address1, address2, city, 22 country, postal_code, state, email, fax, job_title, name_first, 23 name_last, name_middle, organization, phone, dns_zone_id, privacy, 24 auto_renew, agreement_keys, tags, dependencies=None): 25 dependencies = dependencies or [] 26 27 contact_info = { 28 'AddressMailing': { 29 'Address1': address1, 30 'Address2': address2, 31 'City': city, 32 'Country': country, 33 'PostalCode': postal_code, 34 'State': state 35 }, 36 'Email': email, 37 'Fax': fax, 38 'JobTitle': job_title, 39 'NameFirst': name_first, 40 'NameLast': name_last, 41 'NameMiddle': name_middle, 42 'Organization': organization, 43 'Phone': phone 44 } 45 46 domain_resource = { 47 "type": "Microsoft.DomainRegistration/domains", 48 "name": domain_name, 49 "apiVersion": "2018-02-01", 50 "location": "global", 51 "dependsOn": dependencies, 52 "tags": tags, 53 "properties": { 54 "consent": { 55 "agreementKeys": agreement_keys, 56 "agreedBy": local_ip_address, 57 "agreedAt": current_time 58 }, 59 "ContactAdmin": contact_info, 60 "ContactBilling": contact_info, 61 "ContactRegistrant": contact_info, 62 "ContactTech": contact_info, 63 "privacy": privacy, 64 "autoRenew": auto_renew, 65 "dnsType": "AzureDns", 66 "targetDnsType": "AzureDns", 67 "dnsZoneId": dns_zone_id 68 }, 69 "resources": [] 70 } 71 return domain_resource 72