public AzureDnsProvider(AzureDnsSettings settings)
        {
            var credentials = AzureHelper.GetAzureCredentials(settings.AzureServicePrincipal, settings.AzureSubscription);

            this.client = new DnsManagementClient(credentials);
            this.client.SubscriptionId = settings.AzureSubscription.SubscriptionId;
            this.settings = settings;
        }
 /// <summary>
 /// The Get Operation Status operation returns the status of the
 /// specified operation. After calling an asynchronous operation, you
 /// can call Get Operation Status to determine whether the operation
 /// has succeeded, failed, or is still in progress.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Dns.IDnsManagementClient.
 /// </param>
 /// <param name='azureAsyncOperation'>
 /// Required. Location value returned by the Begin operation.
 /// </param>
 /// <returns>
 /// The response to a Zone Delete operation.
 /// </returns>
 public static ZoneDeleteResponse GetLongRunningOperationStatus(this IDnsManagementClient operations, string azureAsyncOperation)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IDnsManagementClient)s).GetLongRunningOperationStatusAsync(azureAsyncOperation);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Example #3
0
        public AzureDnsProvider(AzureDnsSettings settings)
        {
            var restClient = AzureHelper.GetRestClient(settings.AzureServicePrincipal, settings.AzureSubscription);


            this.client = new DnsManagementClient(restClient);
            this.client.SubscriptionId = settings.AzureSubscription.SubscriptionId;
            this.settings = settings;
        }
Example #4
0
        public AzureDnsProvider(AzureDnsSettings settings)
        {
            var restClient = AzureHelper.GetRestClient(settings.AzureServicePrincipal, settings.AzureSubscription);

#pragma warning disable DF0020 // Marks undisposed objects assinged to a field, originated in an object creation.
            this.client = new DnsManagementClient(restClient);
#pragma warning restore DF0020 // Marks undisposed objects assinged to a field, originated in an object creation.
            this.client.SubscriptionId = settings.AzureSubscription.SubscriptionId;
            this.settings = settings;
        }
Example #5
0
        private static async Task <ZoneInner> FindDnsZone(IDnsManagementClient client, string identifier)
        {
            var zones = await client.Zones.ListAsync();

            while (zones != null)
            {
                foreach (var zone in zones)
                {
                    if (identifier.EndsWith($".{zone.Name}", StringComparison.OrdinalIgnoreCase) ||
                        identifier.Equals(zone.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        logger.Debug("DNS zone:\n{0}", JsonConvert.SerializeObject(zone, Formatting.Indented));
                        return(zone);
                    }
                }

                zones = string.IsNullOrWhiteSpace(zones.NextPageLink) ?
                        null :
                        await client.Zones.ListNextAsync(zones.NextPageLink);
            }

            throw new CertesCliException(string.Format(Strings.ErrorDnsZoneNotFound, identifier));
        }
Example #6
0
 public DnsClient(IDnsManagementClient managementClient)
 {
     this.DnsManagementClient = managementClient;
 }
 /// <summary>
 /// The Get Operation Status operation returns the status of the
 /// specified operation. After calling an asynchronous operation, you
 /// can call Get Operation Status to determine whether the operation
 /// has succeeded, failed, or is still in progress.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.Dns.IDnsManagementClient.
 /// </param>
 /// <param name='azureAsyncOperation'>
 /// Required. Location value returned by the Begin operation.
 /// </param>
 /// <returns>
 /// The response to a Zone Delete operation.
 /// </returns>
 public static Task <ZoneDeleteResponse> GetLongRunningOperationStatusAsync(this IDnsManagementClient operations, string azureAsyncOperation)
 {
     return(operations.GetLongRunningOperationStatusAsync(azureAsyncOperation, CancellationToken.None));
 }