/// <summary> /// Initializes a new instance of the DomainPatchResource class. /// </summary> /// <param name="contactAdmin">Administrative contact.</param> /// <param name="contactBilling">Billing contact.</param> /// <param name="contactRegistrant">Registrant contact.</param> /// <param name="contactTech">Technical contact.</param> /// <param name="consent">Legal agreement consent.</param> /// <param name="kind">Kind of resource.</param> /// <param name="registrationStatus">Domain registration status. /// Possible values include: 'Active', 'Awaiting', 'Cancelled', /// 'Confiscated', 'Disabled', 'Excluded', 'Expired', 'Failed', 'Held', /// 'Locked', 'Parked', 'Pending', 'Reserved', 'Reverted', 'Suspended', /// 'Transferred', 'Unknown', 'Unlocked', 'Unparked', 'Updated', /// 'JsonConverterFailed'</param> /// <param name="provisioningState">Domain provisioning state. Possible /// values include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', /// 'Deleting'</param> /// <param name="nameServers">Name servers.</param> /// <param name="privacy"><code>true</code> if domain /// privacy is enabled for this domain; otherwise, /// <code>false</code>.</param> /// <param name="createdTime">Domain creation timestamp.</param> /// <param name="expirationTime">Domain expiration timestamp.</param> /// <param name="lastRenewedTime">Timestamp when the domain was renewed /// last time.</param> /// <param name="autoRenew"><code>true</code> if the domain /// should be automatically renewed; otherwise, /// <code>false</code>.</param> /// <param /// name="readyForDnsRecordManagement"><code>true</code> if /// Azure can assign this domain to App Service apps; otherwise, /// <code>false</code>. This value will be /// <code>true</code> if domain registration status is /// active and /// it is hosted on name servers Azure has programmatic access /// to.</param> /// <param name="managedHostNames">All hostnames derived from the /// domain and assigned to Azure resources.</param> /// <param name="domainNotRenewableReasons">Reasons why domain is not /// renewable.</param> /// <param name="dnsType">Current DNS type. Possible values include: /// 'AzureDns', 'DefaultDomainRegistrarDns'</param> /// <param name="dnsZoneId">Azure DNS Zone to use</param> /// <param name="targetDnsType">Target DNS type (would be used for /// migration). Possible values include: 'AzureDns', /// 'DefaultDomainRegistrarDns'</param> public DomainPatchResource(Contact contactAdmin, Contact contactBilling, Contact contactRegistrant, Contact contactTech, DomainPurchaseConsent consent, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), DomainStatus?registrationStatus = default(DomainStatus?), ProvisioningState?provisioningState = default(ProvisioningState?), IList <string> nameServers = default(IList <string>), bool?privacy = default(bool?), System.DateTime?createdTime = default(System.DateTime?), System.DateTime?expirationTime = default(System.DateTime?), System.DateTime?lastRenewedTime = default(System.DateTime?), bool?autoRenew = default(bool?), bool?readyForDnsRecordManagement = default(bool?), IList <HostName> managedHostNames = default(IList <HostName>), IList <DomainNotRenewableReasons1> domainNotRenewableReasons = default(IList <DomainNotRenewableReasons1>), DnsType?dnsType = default(DnsType?), string dnsZoneId = default(string), DnsType?targetDnsType = default(DnsType?), string authCode = default(string)) : base(id, name, type, kind) { ContactAdmin = contactAdmin; ContactBilling = contactBilling; ContactRegistrant = contactRegistrant; ContactTech = contactTech; RegistrationStatus = registrationStatus; ProvisioningState = provisioningState; NameServers = nameServers; Privacy = privacy; CreatedTime = createdTime; ExpirationTime = expirationTime; LastRenewedTime = lastRenewedTime; AutoRenew = autoRenew; ReadyForDnsRecordManagement = readyForDnsRecordManagement; ManagedHostNames = managedHostNames; Consent = consent; DomainNotRenewableReasons = domainNotRenewableReasons; DnsType = dnsType; DnsZoneId = dnsZoneId; TargetDnsType = targetDnsType; AuthCode = authCode; CustomInit(); }
internal AppServiceDomainData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string kind, ContactInformation contactAdmin, ContactInformation contactBilling, ContactInformation contactRegistrant, ContactInformation contactTech, DomainStatus?registrationStatus, ProvisioningState?provisioningState, IReadOnlyList <string> nameServers, bool?privacy, DateTimeOffset?createdTime, DateTimeOffset?expirationTime, DateTimeOffset?lastRenewedTime, bool?autoRenew, bool?readyForDnsRecordManagement, IReadOnlyList <HostName> managedHostNames, DomainPurchaseConsent consent, IReadOnlyList <AppServiceDomainPropertiesDomainNotRenewableReasonsItem> domainNotRenewableReasons, DnsType?dnsType, string dnsZoneId, DnsType?targetDnsType, string authCode) : base(id, name, type, systemData, tags, location, kind) { ContactAdmin = contactAdmin; ContactBilling = contactBilling; ContactRegistrant = contactRegistrant; ContactTech = contactTech; RegistrationStatus = registrationStatus; ProvisioningState = provisioningState; NameServers = nameServers; Privacy = privacy; CreatedTime = createdTime; ExpirationTime = expirationTime; LastRenewedTime = lastRenewedTime; AutoRenew = autoRenew; ReadyForDnsRecordManagement = readyForDnsRecordManagement; ManagedHostNames = managedHostNames; Consent = consent; DomainNotRenewableReasons = domainNotRenewableReasons; DnsType = dnsType; DnsZoneId = dnsZoneId; TargetDnsType = targetDnsType; AuthCode = authCode; }
/// <summary> /// Read a resource record. /// </summary> /// <returns> /// A <see cref="ResourceRecord"/> or <b>null</b> if no more /// resource records are available. /// </returns> /// <remarks> /// Processes the "$ORIGIN" and "$TTL" specials that define the /// <see cref="Origin"/> and a default time-to-live respectively. /// <para> /// A domain name can be "@" to refer to the <see cref="Origin"/>. /// A missing domain name will use the previous record's domain name. /// </para> /// <para> /// Defaults the <see cref="ResourceRecord.Class"/> to <see cref="DnsClass.IN"/>. /// Defaults the <see cref="ResourceRecord.TTL"/> to either the "$TTL" or /// the <see cref="ResourceRecord.DefaultTTL"/>. /// </para> /// </remarks> public ResourceRecord ReadResourceRecord() { DomainName domainName = defaultDomainName; DnsClass klass = DnsClass.IN; TimeSpan? ttl = defaultTTL; DnsType? type = null; while (!type.HasValue) { var token = ReadToken(ignoreEscape: true); if (token == "") { return(null); } // Domain names and directives must be at the start of a line. if (tokenStartsNewLine) { switch (token) { case "$ORIGIN": Origin = ReadDomainName(); break; case "$TTL": defaultTTL = ttl = ReadTimeSpan32(); break; case "@": domainName = Origin; defaultDomainName = domainName; break; default: domainName = MakeAbsoluteDomainName(token); defaultDomainName = domainName; break; } continue; } // Is TTL? if (token.All(c => Char.IsDigit(c))) { ttl = TimeSpan.FromSeconds(uint.Parse(token)); continue; } // Is TYPE? if (token.StartsWith("TYPE")) { type = (DnsType)ushort.Parse(token.Substring(4), CultureInfo.InvariantCulture); continue; } if (token.ToLowerInvariant() != "any" && Enum.TryParse <DnsType>(token, out DnsType t)) { type = t; continue; } // Is CLASS? if (token.StartsWith("CLASS")) { klass = (DnsClass)ushort.Parse(token.Substring(5), CultureInfo.InvariantCulture); continue; } if (Enum.TryParse <DnsClass>(token, out DnsClass k)) { klass = k; continue; } throw new InvalidDataException($"Unknown token '{token}', expected a Class, Type or TTL."); } if (domainName == null) { throw new InvalidDataException("Missing resource record name."); } // Create the specific resource record based on the type. var resource = ResourceRegistry.Create(type.Value); resource.Name = domainName; resource.Type = type.Value; resource.Class = klass; if (ttl.HasValue) { resource.TTL = ttl.Value; } // Read the specific properties of the resource record. resource.ReadData(this); return(resource); }
internal static string ToSerializedValue(this DnsType?value) { return(value == null ? null : ((DnsType)value).ToSerializedValue()); }