示例#1
0
        public static async Task <ImmutableArray <DomainId> > CreateDomains(
            this IDomainClient domainClient,
            IEnumerable <string> domainNames,
            Value <bool> gtdEnabled                                  = default,
            Value <SoaId?> soaId                                     = default,
            Value <TemplateId?> templateId                           = default,
            Value <VanityId?> vanityId                               = default,
            Value <TransferAclId?> transferAclId                     = default,
            Value <FolderId> folderId                                = default,
            Value <ImmutableArray <DomainName>?> axfrServer          = default,
            Value <ImmutableArray <DomainName>?> delegateNameServers = default,
            CancellationToken cancellationToken                      = default
            )
        {
            if (domainClient is null)
            {
                throw new ArgumentNullException(nameof(domainClient));
            }
            if (domainNames is null)
            {
                throw new ArgumentNullException(nameof(domainNames));
            }

            var convertedDomainNames = domainNames.Select(dn => DomainName.Parse(dn));

            return(await domainClient.CreateDomains(convertedDomainNames, gtdEnabled, soaId, templateId, vanityId, transferAclId, folderId, axfrServer, delegateNameServers, cancellationToken).ConfigureAwait(false));
        }
示例#2
0
        public static async Task UpdateDomain(
            this IDomainClient domainClient,
            string domainName,
            Value <DomainName> name                                  = default,
            Value <bool> gtdEnabled                                  = default,
            Value <SoaId?> soaId                                     = default,
            Value <TemplateId?> templateId                           = default,
            Value <VanityId?> vanityId                               = default,
            Value <TransferAclId?> transferAclId                     = default,
            Value <FolderId> folderId                                = default,
            Value <ImmutableArray <DomainName>?> axfrServer          = default,
            Value <ImmutableArray <DomainName>?> delegateNameServers = default,
            CancellationToken cancellationToken                      = default
            )
        {
            if (domainClient is null)
            {
                throw new ArgumentNullException(nameof(domainClient));
            }
            if (domainName is null)
            {
                throw new ArgumentNullException(nameof(domainName));
            }

            await domainClient.UpdateDomain(DomainName.Parse(domainName), name, gtdEnabled, soaId, templateId, vanityId, transferAclId, folderId, axfrServer, delegateNameServers, cancellationToken).ConfigureAwait(false);
        }
示例#3
0
        public static async Task DeleteDomain(this IDomainClient domainClient, DomainName domainName, CancellationToken cancellationToken = default)
        {
            if (domainClient is null)
            {
                throw new ArgumentNullException(nameof(domainClient));
            }

            var domain = await domainClient.GetDomain(domainName, cancellationToken).ConfigureAwait(false);

            await domainClient.DeleteDomain(domain.Id, cancellationToken).ConfigureAwait(false);
        }
示例#4
0
        public static async Task <Domain> GetDomain(this IDomainClient domainClient, string domainName, CancellationToken cancellationToken = default)
        {
            if (domainClient is null)
            {
                throw new ArgumentNullException(nameof(domainClient));
            }
            if (domainName is null)
            {
                throw new ArgumentNullException(nameof(domainName));
            }

            return(await domainClient.GetDomain(DomainName.Parse(domainName), cancellationToken).ConfigureAwait(false));
        }
示例#5
0
        public static async Task DeleteDomains(this IDomainClient domainClient, IEnumerable <Domain> domains, CancellationToken cancellationToken = default)
        {
            if (domainClient is null)
            {
                throw new ArgumentNullException(nameof(domainClient));
            }
            if (domains is null)
            {
                throw new ArgumentNullException(nameof(domains));
            }

            var domainIds = domains.Select(d => d.Id);
            await domainClient.DeleteDomains(domainIds, cancellationToken).ConfigureAwait(false);
        }