Ejemplo n.º 1
0
 /// <inheritdoc/>
 public Task <CloudFlareResponse <IReadOnlyList <DnsRecord> > > GetDnsRecordsAsync(
     IdentifierTag zoneId,
     CancellationToken cancellationToken,
     DnsRecordGetParameters parameters = null,
     CloudFlareAuth auth = null)
 {
     return(_client.GetDnsRecordsAsync(zoneId, cancellationToken, auth ?? _auth, parameters));
 }
        /// <summary>
        /// Gets the zones for the subscription.
        /// </summary>
        /// <seealso href="https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records"/>
        public static Task <IEnumerable <DnsRecord> > GetAllDnsRecordsAsync(
            this IDnsRecordClient client,
            IdentifierTag zoneId,
            DnsRecordGetParameters parameters = null)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (zoneId == null)
            {
                throw new ArgumentNullException(nameof(zoneId));
            }

            return(client.GetAllDnsRecordsAsync(zoneId, CancellationToken.None, parameters));
        }
        /// <summary>
        /// Gets the zones for the subscription.
        /// </summary>
        /// <seealso href="https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records"/>
        public static Task <CloudFlareResponse <IReadOnlyList <DnsRecord> > > GetDnsRecordsAsync(
            this IDnsRecordClient client,
            IdentifierTag zoneId,
            DnsRecordGetParameters parameters = null)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            if (zoneId == null)
            {
                throw new ArgumentNullException(nameof(zoneId));
            }

            return(client.GetDnsRecordsAsync(zoneId, CancellationToken.None, parameters));
        }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        public Task <IEnumerable <DnsRecord> > GetAllDnsRecordsAsync(
            IdentifierTag zoneId,
            CancellationToken cancellationToken,
            DnsRecordGetParameters parameters = null,
            CloudFlareAuth auth = null)
        {
            if (zoneId == null)
            {
                throw new ArgumentNullException(nameof(zoneId));
            }

            return(GetAllPagedResultsAsync <DnsRecord, DnsRecordGetParameters, DnsRecordOrderTypes>(
                       (ct, a, p) => _client.GetDnsRecordsAsync(zoneId, ct, a, p),
                       cancellationToken,
                       auth ?? _auth,
                       100,
                       parameters));
        }
        /// <summary>
        /// Gets the DNS records for the zone with the specified <paramref name="zoneId"/>.
        /// </summary>
        /// <seealso href="https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records"/>
        public static Task <CloudFlareResponse <IReadOnlyList <DnsRecord> > > GetDnsRecordsAsync(
            this HttpClient client,
            IdentifierTag zoneId,
            CancellationToken cancellationToken,
            CloudFlareAuth auth,
            DnsRecordGetParameters parameters = null)
        {
            if (zoneId == null)
            {
                throw new ArgumentNullException(nameof(zoneId));
            }

            Uri uri = new Uri(CloudFlareConstants.BaseUri, $"zones/{zoneId}/dns_records");

            if (parameters != null)
            {
                uri = new UriBuilder(uri)
                {
                    Query = parameters.ToQuery()
                }.Uri;
            }

            return(client.GetCloudFlareResponseAsync <IReadOnlyList <DnsRecord> >(uri, auth, cancellationToken));
        }