Exemple #1
0
        public async Task GetSubscriptionDetails()
        {
            var subscriptionDetails = (await SubscriptionsOperations.GetAsync(TestEnvironment.SubscriptionId)).Value;

            Assert.NotNull(subscriptionDetails);
            Assert.NotNull(subscriptionDetails.Id);
            Assert.NotNull(subscriptionDetails.SubscriptionId);
            Assert.NotNull(subscriptionDetails.DisplayName);
            Assert.NotNull(subscriptionDetails.State);
            Assert.NotNull(subscriptionDetails.Tags);
        }
Exemple #2
0
        public async Task ListSubscriptions()
        {
            var subscriptions = await SubscriptionsOperations.ListAsync().ToEnumerableAsync();

            Assert.NotNull(subscriptions);
            Assert.IsNotEmpty(subscriptions);
            Assert.NotNull(subscriptions.First().Id);
            Assert.NotNull(subscriptions.First().SubscriptionId);
            Assert.NotNull(subscriptions.First().DisplayName);
            Assert.NotNull(subscriptions.First().State);
        }
Exemple #3
0
 public static SubscriptionsOperations GetSubscriptionClient(this ClientFactory factory)
 {
     if (subscriptionClient == null)
     {
         lock (subscriptionClientLock)
         {
             if (subscriptionClient == null)
             {
                 subscriptionClient = new ResourcesManagementClient(Guid.NewGuid().ToString(), new DefaultAzureCredential()).Subscriptions;
             }
         }
     }
     return(subscriptionClient);
 }
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Operations = new Operations(this);
     Namespaces = new NamespacesOperations(this);
     DisasterRecoveryConfigs = new DisasterRecoveryConfigsOperations(this);
     MigrationConfigs        = new MigrationConfigsOperations(this);
     Queues                           = new QueuesOperations(this);
     Topics                           = new TopicsOperations(this);
     Subscriptions                    = new SubscriptionsOperations(this);
     Rules                            = new RulesOperations(this);
     Regions                          = new RegionsOperations(this);
     PremiumMessagingRegions          = new PremiumMessagingRegionsOperations(this);
     EventHubs                        = new EventHubsOperations(this);
     BaseUri                          = new System.Uri("https://management.azure.com");
     ApiVersion                       = "2017-04-01";
     AcceptLanguage                   = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
Exemple #5
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Operations              = new Operations(this);
     Subscriptions           = new SubscriptionsOperations(this);
     AcquiredPlans           = new AcquiredPlansOperations(this);
     DelegatedProviders      = new DelegatedProvidersOperations(this);
     DelegatedProviderOffers = new DelegatedProviderOffersOperations(this);
     DirectoryTenants        = new DirectoryTenantsOperations(this);
     Locations        = new LocationsOperations(this);
     Offers           = new OffersOperations(this);
     OfferDelegations = new OfferDelegationsOperations(this);
     Plans            = new PlansOperations(this);
     Quotas           = new QuotasOperations(this);
     BaseUri          = new System.Uri("https://adminmanagement.local.azurestack.external");
     ApiVersion       = "2015-11-01";
     AcceptLanguage   = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Subscriptions          = new SubscriptionsOperations(this);
     SubscriptionOperation  = new SubscriptionOperationOperations(this);
     SubscriptionFactory    = new SubscriptionFactoryOperations(this);
     SubscriptionOperations = new SubscriptionOperations(this);
     Operations             = new Operations(this);
     Tenants        = new TenantsOperations(this);
     BaseUri        = new System.Uri("https://management.azure.com");
     AcceptLanguage = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }