Beispiel #1
0
 internal ARecord(IPv4 value, DnsRecordId id, DomainName name, DomainId sourceId, TimeToLive ttl, bool monitor, bool failover, bool failed, bool dynamicDns, RecordSource source, string?password, GlobalTrafficDirectorLocation?gtdLocation) : base(id, name, source, sourceId, ttl, gtdLocation)
 {
     Target = value;
     IsDynamicDnsEnabled       = dynamicDns;
     DynamicDnsPassword        = password;
     IsSystemMonitoringEnabled = monitor;
     IsFailoverEnabled         = failover;
     IsInFailedState           = failed;
 }
Beispiel #2
0
 public ARecord(IPv4 target, DnsRecordId id, DomainName name, DomainId parentDomainId, TimeToLive timeToLive, RecordSource recordSource = default, bool isDynamicDnsEnabled = false, string?dynamicDnsPassword = null, GlobalTrafficDirectorLocation?globalTrafficDirectorLocation = null, bool isSystemMonitoringEnabled = false, bool isFailoverEnabled = false, bool isInFailedState = false) : base(id, name, parentDomainId, timeToLive, recordSource, globalTrafficDirectorLocation)
 {
     Target = target;
     IsDynamicDnsEnabled       = isDynamicDnsEnabled;
     DynamicDnsPassword        = dynamicDnsPassword;
     IsSystemMonitoringEnabled = isSystemMonitoringEnabled;
     IsFailoverEnabled         = isFailoverEnabled;
     IsInFailedState           = isInFailedState;
 }
Beispiel #3
0
        public DnsRecords CreateARecord(DomainName name, IPv4 target, TimeToLive timeToLive, string?dynamicDnsPassword = null, GlobalTrafficDirectorLocation globalTrafficDirectorLocation = default, bool isSystemMonitoringEnabled = false, bool isFailoverEnabled = false)
        {
            if (!name.IsSubdomainOf(ParentDomain))
            {
                throw new ArgumentException($"The specified domain `{name}` is not a subdomain of the parent `{ParentDomain}`", nameof(name));
            }

            return(AddCreate(new
            {
                type = "A",
                name = name.WithoutParent(ParentDomain),
                value = target,
                ttl = timeToLive,
                dynamicDns = dynamicDnsPassword != null,
                password = dynamicDnsPassword,
                gtdLocation = globalTrafficDirectorLocation,
                monitor = isSystemMonitoringEnabled,
                failover = isFailoverEnabled
            }));
        }
Beispiel #4
0
 internal ANameRecord(string value, DnsRecordId id, DomainName name, RecordSource source, DomainId sourceId, TimeToLive ttl, GlobalTrafficDirectorLocation?gtdLocation) : base(id, name, source, sourceId, ttl, gtdLocation)
 {
     if (DomainName.TryParse(value, out var domainName))
     {
         TargetDomain          = domainName;
         TargetDomainWasRooted = value.EndsWith(".", StringComparison.OrdinalIgnoreCase);
     }
     else if (IPv4.TryParse(value, out var ipv4))
     {
         TargetIPv4 = ipv4;
     }
     else if (IPv6.TryParse(value, out var ipv6))
     {
         TargetIpv6 = ipv6;
     }
     else
     {
         throw new FormatException($"Unrecognised value for an ANAME record: `{value}`. Expecting a domain name, IPv4 or IPv6 address.");
     }
 }
Beispiel #5
0
        public async Task CreateARecord(DomainId parentDomainId, DomainName name, IPv4 target, TimeToLive timeToLive, string?dynamicDnsPassword = null, GlobalTrafficDirectorLocation globalTrafficDirectorLocation = default, bool isSystemMonitoringEnabled = false, bool isFailoverEnabled = false, CancellationToken cancellationToken = default)
        {
            var parentDomain = await DomainCache.EnsureAndGet(parentDomainId, cancellationToken).ConfigureAwait(false);

            if (!name.IsSubdomainOf(parentDomain))
            {
                throw new ArgumentException($"The specified domain `{name}` is not a subdomain of the parent `{parentDomain}`", nameof(name));
            }

            await Post($"dns/managed/{parentDomainId}/records", new
            {
                type        = "A",
                name        = name.WithoutParent(parentDomain),
                value       = target,
                ttl         = timeToLive,
                dynamicDns  = dynamicDnsPassword != null,
                password    = dynamicDnsPassword,
                gtdLocation = globalTrafficDirectorLocation,
                monitor     = isSystemMonitoringEnabled,
                failover    = isFailoverEnabled
            }, cancellationToken).ConfigureAwait(false);
        }
Beispiel #6
0
 public ANameRecord(IPv4 targetIPv4, DnsRecordId id, DomainName name, DomainId parentDomainId, TimeToLive timeToLive, RecordSource recordSource = default, GlobalTrafficDirectorLocation?globalTrafficDirectorLocation = null) : base(id, name, parentDomainId, timeToLive, recordSource, globalTrafficDirectorLocation)
 {
     TargetIPv4 = targetIPv4;
 }
Beispiel #7
0
 public NameServer(DomainName fqdn, IPv4 ipv4, IPv6 ipv6)
 {
     FullyQualifiedDomainName = fqdn;
     IPv4 = ipv4;
     IPv6 = ipv6;
 }