diff --git a/src/SDKs/Subscription/AzSdk.RP.props b/src/SDKs/Subscription/AzSdk.RP.props
index 39645fa6dc05..85ca755980cd 100644
--- a/src/SDKs/Subscription/AzSdk.RP.props
+++ b/src/SDKs/Subscription/AzSdk.RP.props
@@ -1,7 +1,7 @@
-
+ Billing_2018-03-01-preview;Subscription_2018-03-01-preview;SubscriptionClient_2016-06-01;
$(PackageTags);$(CommonTags);$(AzureApiTag);
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/IOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/IOperations.cs
new file mode 100644
index 000000000000..12c0b63db81d
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/IOperations.cs
@@ -0,0 +1,46 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Operations operations.
+ ///
+ public partial interface IOperations
+ {
+ ///
+ /// Lists all of the available Microsoft.Subscription API operations.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsClient.cs b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionClient.cs
similarity index 71%
rename from src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsClient.cs
rename to src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionClient.cs
index 92ab3cb9fc29..84a2afa3805f 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsClient.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionClient.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,21 +6,19 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using Newtonsoft.Json;
///
- /// Subscription definitions client provides an interface to create, modify
- /// and retrieve azure subscriptions programmatically.
+ /// The subscription client
///
- public partial interface ISubscriptionDefinitionsClient : System.IDisposable
+ public partial interface ISubscriptionClient : System.IDisposable
{
///
/// The base URI of the service.
@@ -41,12 +40,6 @@ public partial interface ISubscriptionDefinitionsClient : System.IDisposable
///
ServiceClientCredentials Credentials { get; }
- ///
- /// Version of the API to be used with the client request. Current
- /// version is 2015-06-01
- ///
- string ApiVersion { get; }
-
///
/// Gets or sets the preferred language for the response.
///
@@ -66,14 +59,29 @@ public partial interface ISubscriptionDefinitionsClient : System.IDisposable
///
- /// Gets the ISubscriptionDefinitionsOperationMetadataOperations.
+ /// Gets the IOperations.
+ ///
+ IOperations Operations { get; }
+
+ ///
+ /// Gets the ISubscriptionOperations.
+ ///
+ ISubscriptionOperations SubscriptionOperations { get; }
+
+ ///
+ /// Gets the ISubscriptionFactoryOperations.
+ ///
+ ISubscriptionFactoryOperations SubscriptionFactory { get; }
+
+ ///
+ /// Gets the ISubscriptionsOperations.
///
- ISubscriptionDefinitionsOperationMetadataOperations SubscriptionDefinitionsOperationMetadata { get; }
+ ISubscriptionsOperations Subscriptions { get; }
///
- /// Gets the ISubscriptionDefinitionsOperations.
+ /// Gets the ITenantsOperations.
///
- ISubscriptionDefinitionsOperations SubscriptionDefinitions { get; }
+ ITenantsOperations Tenants { get; }
}
}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsOperations.cs
deleted file mode 100644
index 726d0a57f637..000000000000
--- a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsOperations.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-
-namespace Microsoft.Azure.Management.Subscription
-{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// SubscriptionDefinitionsOperations operations.
- ///
- public partial interface ISubscriptionDefinitionsOperations
- {
- ///
- /// Create an Azure subscription definition.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The subscription definition creation.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> CreateWithHttpMessagesAsync(string subscriptionDefinitionName, SubscriptionDefinition body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Get an Azure subscription definition.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> GetWithHttpMessagesAsync(string subscriptionDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// List an Azure subscription definition by subscriptionId.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Retrieves the status of the subscription definition PUT operation.
- /// The URI of this API is returned in the Location field of the
- /// response header.
- ///
- ///
- /// The operation ID, which can be found from the Location field in the
- /// generate recommendation response header.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> GetOperationStatusWithHttpMessagesAsync(System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Create an Azure subscription definition.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The subscription definition creation.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> BeginCreateWithHttpMessagesAsync(string subscriptionDefinitionName, SubscriptionDefinition body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// List an Azure subscription definition by subscriptionId.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- }
-}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionFactoryOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionFactoryOperations.cs
new file mode 100644
index 000000000000..c0afa0489690
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionFactoryOperations.cs
@@ -0,0 +1,79 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SubscriptionFactoryOperations operations.
+ ///
+ public partial interface ISubscriptionFactoryOperations
+ {
+ ///
+ /// Creates an Azure subscription
+ ///
+ ///
+ /// The name of the enrollment account to which the subscription will
+ /// be billed.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Creates an Azure subscription
+ ///
+ ///
+ /// The name of the enrollment account to which the subscription will
+ /// be billed.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionOperations.cs
new file mode 100644
index 000000000000..c1650a27a93e
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionOperations.cs
@@ -0,0 +1,47 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SubscriptionOperations operations.
+ ///
+ public partial interface ISubscriptionOperations
+ {
+ ///
+ /// Lists all of the available pending Microsoft.Subscription API
+ /// operations.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionsOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionsOperations.cs
new file mode 100644
index 000000000000..db652373d0ed
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionsOperations.cs
@@ -0,0 +1,117 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SubscriptionsOperations operations.
+ ///
+ public partial interface ISubscriptionsOperations
+ {
+ ///
+ /// Gets all available geo-locations.
+ ///
+ ///
+ /// This operation provides all the locations that are available for
+ /// resource providers; however, each resource provider may support a
+ /// subset of this list.
+ ///
+ ///
+ /// The ID of the target subscription.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets details about a specified subscription.
+ ///
+ ///
+ /// The ID of the target subscription.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets all subscriptions for a tenant.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Gets all subscriptions for a tenant.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsOperationMetadataOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/ITenantsOperations.cs
similarity index 69%
rename from src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsOperationMetadataOperations.cs
rename to src/SDKs/Subscription/Management.Subscription/Generated/ITenantsOperations.cs
index ab22aa41a833..c644814aa156 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/ISubscriptionDefinitionsOperationMetadataOperations.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/ITenantsOperations.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,11 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
@@ -19,12 +19,12 @@ namespace Microsoft.Azure.Management.Subscription
using System.Threading.Tasks;
///
- /// SubscriptionDefinitionsOperationMetadataOperations operations.
+ /// TenantsOperations operations.
///
- public partial interface ISubscriptionDefinitionsOperationMetadataOperations
+ public partial interface ITenantsOperations
{
///
- /// Lists all of the available Microsoft.Subscription API operations.
+ /// Gets the tenants for your account.
///
///
/// The headers that will be added to request.
@@ -32,7 +32,7 @@ public partial interface ISubscriptionDefinitionsOperationMetadataOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -41,9 +41,9 @@ public partial interface ISubscriptionDefinitionsOperationMetadataOperations
///
/// Thrown when a required parameter is null
///
- Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Lists all of the available Microsoft.Subscription API operations.
+ /// Gets the tenants for your account.
///
///
/// The NextLink from the previous successful call to List operation.
@@ -54,7 +54,7 @@ public partial interface ISubscriptionDefinitionsOperationMetadataOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -63,6 +63,6 @@ public partial interface ISubscriptionDefinitionsOperationMetadataOperations
///
/// Thrown when a required parameter is null
///
- Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/AdPrincipal.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/AdPrincipal.cs
new file mode 100644
index 000000000000..0e3f24b26cc3
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/AdPrincipal.cs
@@ -0,0 +1,66 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Active Directory Principal for subscription creation delegated
+ /// permission
+ ///
+ public partial class AdPrincipal
+ {
+ ///
+ /// Initializes a new instance of the AdPrincipal class.
+ ///
+ public AdPrincipal()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the AdPrincipal class.
+ ///
+ /// Object id of the Principal
+ public AdPrincipal(string objectId)
+ {
+ ObjectId = objectId;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets object id of the Principal
+ ///
+ [JsonProperty(PropertyName = "objectId")]
+ public string ObjectId { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (ObjectId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId");
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/ErrorResponse.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/ErrorResponse.cs
index c217b8efbe49..84d7c0e2b89c 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/Models/ErrorResponse.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/ErrorResponse.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,12 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Azure.Management.Subscription;
using Newtonsoft.Json;
using System.Linq;
@@ -24,7 +23,7 @@ public partial class ErrorResponse
///
public ErrorResponse()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/ErrorResponseException.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/ErrorResponseException.cs
index a02648f2b4a3..b2fd7ef8417d 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/Models/ErrorResponseException.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/ErrorResponseException.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,19 +6,17 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Azure.Management.Subscription;
using Microsoft.Rest;
///
/// Exception thrown for an invalid response with ErrorResponse
/// information.
///
- public class ErrorResponseException : RestException
+ public partial class ErrorResponseException : RestException
{
///
/// Gets information about the associated HTTP request.
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/Location.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/Location.cs
new file mode 100644
index 000000000000..da2f8289c695
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/Location.cs
@@ -0,0 +1,94 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Location information.
+ ///
+ public partial class Location
+ {
+ ///
+ /// Initializes a new instance of the Location class.
+ ///
+ public Location()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the Location class.
+ ///
+ /// The fully qualified ID of the location. For
+ /// example,
+ /// /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus.
+ /// The subscription ID.
+ /// The location name.
+ /// The display name of the location.
+ /// The latitude of the location.
+ /// The longitude of the location.
+ public Location(string id = default(string), string subscriptionId = default(string), string name = default(string), string displayName = default(string), string latitude = default(string), string longitude = default(string))
+ {
+ Id = id;
+ SubscriptionId = subscriptionId;
+ Name = name;
+ DisplayName = displayName;
+ Latitude = latitude;
+ Longitude = longitude;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the fully qualified ID of the location. For example,
+ /// /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ ///
+ /// Gets the subscription ID.
+ ///
+ [JsonProperty(PropertyName = "subscriptionId")]
+ public string SubscriptionId { get; private set; }
+
+ ///
+ /// Gets the location name.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets the display name of the location.
+ ///
+ [JsonProperty(PropertyName = "displayName")]
+ public string DisplayName { get; private set; }
+
+ ///
+ /// Gets the latitude of the location.
+ ///
+ [JsonProperty(PropertyName = "latitude")]
+ public string Latitude { get; private set; }
+
+ ///
+ /// Gets the longitude of the location.
+ ///
+ [JsonProperty(PropertyName = "longitude")]
+ public string Longitude { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/OfferType.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/OfferType.cs
new file mode 100644
index 000000000000..2bd823ee4517
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/OfferType.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+
+ ///
+ /// Defines values for OfferType.
+ ///
+ public static class OfferType
+ {
+ public const string MSAZR0017P = "MS-AZR-0017P";
+ public const string MSAZR0148P = "MS-AZR-0148P";
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/Operation.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/Operation.cs
index f5f018a70a09..6ff91e6a10cc 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/Models/Operation.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/Operation.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,12 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Azure.Management.Subscription;
using Newtonsoft.Json;
using System.Linq;
@@ -24,7 +23,7 @@ public partial class Operation
///
public Operation()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/OperationDisplay.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/OperationDisplay.cs
index cda07c244422..2245272581ed 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/Models/OperationDisplay.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/OperationDisplay.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,12 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Azure.Management.Subscription;
using Newtonsoft.Json;
using System.Linq;
@@ -24,7 +23,7 @@ public partial class OperationDisplay
///
public OperationDisplay()
{
- CustomInit();
+ CustomInit();
}
///
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/OperationListResult.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/OperationListResult.cs
new file mode 100644
index 000000000000..22c1beb90f95
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/OperationListResult.cs
@@ -0,0 +1,64 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Result of the request to list operations. It contains a list of
+ /// operations and a URL link to get the next set of results.
+ ///
+ public partial class OperationListResult
+ {
+ ///
+ /// Initializes a new instance of the OperationListResult class.
+ ///
+ public OperationListResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the OperationListResult class.
+ ///
+ /// List of operations.
+ /// URL to get the next set of operation list
+ /// results if there are any.
+ public OperationListResult(IList value = default(IList), string nextLink = default(string))
+ {
+ Value = value;
+ NextLink = nextLink;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets list of operations.
+ ///
+ [JsonProperty(PropertyName = "value")]
+ public IList Value { get; set; }
+
+ ///
+ /// Gets or sets URL to get the next set of operation list results if
+ /// there are any.
+ ///
+ [JsonProperty(PropertyName = "nextLink")]
+ public string NextLink { get; set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/Page.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/Page.cs
index 1410a4ae1f43..b7b259149ab9 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/Models/Page.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/Page.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,12 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Azure.Management.Subscription;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Newtonsoft.Json;
@@ -27,7 +26,7 @@ public class Page : IPage
///
/// Gets the link to the next page.
///
- [JsonProperty("nextLink")]
+ [JsonProperty("")]
public string NextPageLink { get; private set; }
[JsonProperty("value")]
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/Page1.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/Page1.cs
new file mode 100644
index 000000000000..9d88e45ba683
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/Page1.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+
+ ///
+ /// Defines a page in Azure responses.
+ ///
+ /// Type of the page content items
+ [JsonObject]
+ public class Page1 : IPage
+ {
+ ///
+ /// Gets the link to the next page.
+ ///
+ [JsonProperty("nextLink")]
+ public string NextPageLink { get; private set; }
+
+ [JsonProperty("value")]
+ private IList Items{ get; set; }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ public IEnumerator GetEnumerator()
+ {
+ return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator();
+ }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SpendingLimit.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SpendingLimit.cs
new file mode 100644
index 000000000000..b99c7dd697bb
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SpendingLimit.cs
@@ -0,0 +1,66 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Converters;
+ using System.Runtime;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Defines values for SpendingLimit.
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum SpendingLimit
+ {
+ [EnumMember(Value = "On")]
+ On,
+ [EnumMember(Value = "Off")]
+ Off,
+ [EnumMember(Value = "CurrentPeriodOff")]
+ CurrentPeriodOff
+ }
+ internal static class SpendingLimitEnumExtension
+ {
+ internal static string ToSerializedValue(this SpendingLimit? value)
+ {
+ return value == null ? null : ((SpendingLimit)value).ToSerializedValue();
+ }
+
+ internal static string ToSerializedValue(this SpendingLimit value)
+ {
+ switch( value )
+ {
+ case SpendingLimit.On:
+ return "On";
+ case SpendingLimit.Off:
+ return "Off";
+ case SpendingLimit.CurrentPeriodOff:
+ return "CurrentPeriodOff";
+ }
+ return null;
+ }
+
+ internal static SpendingLimit? ParseSpendingLimit(this string value)
+ {
+ switch( value )
+ {
+ case "On":
+ return SpendingLimit.On;
+ case "Off":
+ return SpendingLimit.Off;
+ case "CurrentPeriodOff":
+ return SpendingLimit.CurrentPeriodOff;
+ }
+ return null;
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionCreationParameters.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionCreationParameters.cs
new file mode 100644
index 000000000000..fc5033f6b364
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionCreationParameters.cs
@@ -0,0 +1,95 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// Subscription Creation Parameters required to create a new Azure
+ /// subscription.
+ ///
+ public partial class SubscriptionCreationParameters
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionCreationParameters
+ /// class.
+ ///
+ public SubscriptionCreationParameters()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SubscriptionCreationParameters
+ /// class.
+ ///
+ /// The display name of the
+ /// subscription.
+ /// The list of principals that should be granted
+ /// Owner access on the subscription. Principals should be of type
+ /// User, Service Principal or Security Group.
+ /// The offer type of the subscription. For
+ /// example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P
+ /// (EnterpriseAgreement devTest) are available. Only valid when
+ /// creating a subscription in a enrollment account scope. Possible
+ /// values include: 'MS-AZR-0017P', 'MS-AZR-0148P'
+ /// Additional, untyped parameters
+ /// to support custom subscription creation scenarios.
+ public SubscriptionCreationParameters(string displayName = default(string), IList owners = default(IList), string offerType = default(string), IDictionary additionalParameters = default(IDictionary))
+ {
+ DisplayName = displayName;
+ Owners = owners;
+ OfferType = offerType;
+ AdditionalParameters = additionalParameters;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the display name of the subscription.
+ ///
+ [JsonProperty(PropertyName = "displayName")]
+ public string DisplayName { get; set; }
+
+ ///
+ /// Gets or sets the list of principals that should be granted Owner
+ /// access on the subscription. Principals should be of type User,
+ /// Service Principal or Security Group.
+ ///
+ [JsonProperty(PropertyName = "owners")]
+ public IList Owners { get; set; }
+
+ ///
+ /// Gets or sets the offer type of the subscription. For example,
+ /// MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P
+ /// (EnterpriseAgreement devTest) are available. Only valid when
+ /// creating a subscription in a enrollment account scope. Possible
+ /// values include: 'MS-AZR-0017P', 'MS-AZR-0148P'
+ ///
+ [JsonProperty(PropertyName = "offerType")]
+ public string OfferType { get; set; }
+
+ ///
+ /// Gets or sets additional, untyped parameters to support custom
+ /// subscription creation scenarios.
+ ///
+ [JsonProperty(PropertyName = "additionalParameters")]
+ public IDictionary AdditionalParameters { get; set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionCreationResult.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionCreationResult.cs
new file mode 100644
index 000000000000..5c8020d1452a
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionCreationResult.cs
@@ -0,0 +1,52 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The created subscription object.
+ ///
+ public partial class SubscriptionCreationResult
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionCreationResult class.
+ ///
+ public SubscriptionCreationResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SubscriptionCreationResult class.
+ ///
+ /// The link to the new
+ /// subscription.
+ public SubscriptionCreationResult(string subscriptionLink = default(string))
+ {
+ SubscriptionLink = subscriptionLink;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the link to the new subscription.
+ ///
+ [JsonProperty(PropertyName = "subscriptionLink")]
+ public string SubscriptionLink { get; set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinition.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinition.cs
deleted file mode 100644
index 92f46f6dca1f..000000000000
--- a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinition.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Azure.Management.Subscription;
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Microsoft.Rest.Serialization;
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// The subscription definition used to create the subscription.
- ///
- [Rest.Serialization.JsonTransformation]
- public partial class SubscriptionDefinition : IResource
- {
- ///
- /// Initializes a new instance of the SubscriptionDefinition class.
- ///
- public SubscriptionDefinition()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the SubscriptionDefinition class.
- ///
- /// The resource ID.
- /// The name of the resource.
- /// The type of the resource.
- /// The ID of the subscription.
- /// The display name of the
- /// subscription.
- /// The offer type of the subscription. For
- /// example, MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P
- /// (EnterpriseAgreement devTest) are available.
- /// The etag the subscription definition.
- public SubscriptionDefinition(string id = default(string), string name = default(string), string type = default(string), string subscriptionId = default(string), string subscriptionDisplayName = default(string), string offerType = default(string), string etag = default(string))
- {
- Id = id;
- Name = name;
- Type = type;
- SubscriptionId = subscriptionId;
- SubscriptionDisplayName = subscriptionDisplayName;
- OfferType = offerType;
- Etag = etag;
- CustomInit();
- }
-
- ///
- /// An initialization method that performs custom operations like setting defaults
- ///
- partial void CustomInit();
-
- ///
- /// Gets the resource ID.
- ///
- [JsonProperty(PropertyName = "id")]
- public string Id { get; private set; }
-
- ///
- /// Gets the name of the resource.
- ///
- [JsonProperty(PropertyName = "name")]
- public string Name { get; private set; }
-
- ///
- /// Gets the type of the resource.
- ///
- [JsonProperty(PropertyName = "type")]
- public string Type { get; private set; }
-
- ///
- /// Gets the ID of the subscription.
- ///
- [JsonProperty(PropertyName = "properties.subscriptionId")]
- public string SubscriptionId { get; private set; }
-
- ///
- /// Gets or sets the display name of the subscription.
- ///
- [JsonProperty(PropertyName = "properties.subscriptionDisplayName")]
- public string SubscriptionDisplayName { get; set; }
-
- ///
- /// Gets or sets the offer type of the subscription. For example,
- /// MS-AZR-0017P (EnterpriseAgreement) and MS-AZR-0148P
- /// (EnterpriseAgreement devTest) are available.
- ///
- [JsonProperty(PropertyName = "properties.offerType")]
- public string OfferType { get; set; }
-
- ///
- /// Gets or sets the etag the subscription definition.
- ///
- [JsonProperty(PropertyName = "properties.etag")]
- public string Etag { get; set; }
-
- }
-}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinitionsGetOperationStatusHeaders.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinitionsGetOperationStatusHeaders.cs
deleted file mode 100644
index 1d970c392595..000000000000
--- a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinitionsGetOperationStatusHeaders.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Azure.Management.Subscription;
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// Defines headers for GetOperationStatus operation.
- ///
- public partial class SubscriptionDefinitionsGetOperationStatusHeaders
- {
- ///
- /// Initializes a new instance of the
- /// SubscriptionDefinitionsGetOperationStatusHeaders class.
- ///
- public SubscriptionDefinitionsGetOperationStatusHeaders()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the
- /// SubscriptionDefinitionsGetOperationStatusHeaders class.
- ///
- /// The URL where the status of the asynchronous
- /// operation can be checked.
- /// The amount of delay to use while the
- /// status of the operation is checked. The value is expressed in
- /// seconds.
- public SubscriptionDefinitionsGetOperationStatusHeaders(string location = default(string), string retryAfter = default(string))
- {
- Location = location;
- RetryAfter = retryAfter;
- CustomInit();
- }
-
- ///
- /// An initialization method that performs custom operations like setting defaults
- ///
- partial void CustomInit();
-
- ///
- /// Gets or sets the URL where the status of the asynchronous operation
- /// can be checked.
- ///
- [JsonProperty(PropertyName = "Location")]
- public string Location { get; set; }
-
- ///
- /// Gets or sets the amount of delay to use while the status of the
- /// operation is checked. The value is expressed in seconds.
- ///
- [JsonProperty(PropertyName = "Retry-After")]
- public string RetryAfter { get; set; }
-
- }
-}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinitionsCreateHeaders.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders.cs
similarity index 73%
rename from src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinitionsCreateHeaders.cs
rename to src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders.cs
index e6e5a6964371..759ff1d79a48 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionDefinitionsCreateHeaders.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,39 +6,39 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription.Models
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Azure.Management.Subscription;
using Newtonsoft.Json;
using System.Linq;
///
- /// Defines headers for Create operation.
+ /// Defines headers for CreateSubscriptionInEnrollmentAccount operation.
///
- public partial class SubscriptionDefinitionsCreateHeaders
+ public partial class SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders
{
///
/// Initializes a new instance of the
- /// SubscriptionDefinitionsCreateHeaders class.
+ /// SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders
+ /// class.
///
- public SubscriptionDefinitionsCreateHeaders()
+ public SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders()
{
- CustomInit();
+ CustomInit();
}
///
/// Initializes a new instance of the
- /// SubscriptionDefinitionsCreateHeaders class.
+ /// SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders
+ /// class.
///
/// GET this URL to retrieve the status of the
/// asynchronous operation.
/// The amount of delay to use while the
/// status of the operation is checked. The value is expressed in
/// seconds.
- public SubscriptionDefinitionsCreateHeaders(string location = default(string), string retryAfter = default(string))
+ public SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders(string location = default(string), string retryAfter = default(string))
{
Location = location;
RetryAfter = retryAfter;
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionModel.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionModel.cs
new file mode 100644
index 000000000000..58b6ccf61b5b
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionModel.cs
@@ -0,0 +1,105 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Subscription information.
+ ///
+ public partial class SubscriptionModel
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionModel class.
+ ///
+ public SubscriptionModel()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SubscriptionModel class.
+ ///
+ /// The fully qualified ID for the subscription. For
+ /// example,
+ /// /subscriptions/00000000-0000-0000-0000-000000000000.
+ /// The subscription ID.
+ /// The subscription display name.
+ /// The subscription state. Possible values are
+ /// Enabled, Warned, PastDue, Disabled, and Deleted. Possible values
+ /// include: 'Enabled', 'Warned', 'PastDue', 'Disabled',
+ /// 'Deleted'
+ /// The subscription
+ /// policies.
+ /// The authorization source of the
+ /// request. Valid values are one or more combinations of Legacy,
+ /// RoleBased, Bypassed, Direct and Management. For example, 'Legacy,
+ /// RoleBased'.
+ public SubscriptionModel(string id = default(string), string subscriptionId = default(string), string displayName = default(string), SubscriptionState? state = default(SubscriptionState?), SubscriptionPolicies subscriptionPolicies = default(SubscriptionPolicies), string authorizationSource = default(string))
+ {
+ Id = id;
+ SubscriptionId = subscriptionId;
+ DisplayName = displayName;
+ State = state;
+ SubscriptionPolicies = subscriptionPolicies;
+ AuthorizationSource = authorizationSource;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the fully qualified ID for the subscription. For example,
+ /// /subscriptions/00000000-0000-0000-0000-000000000000.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ ///
+ /// Gets the subscription ID.
+ ///
+ [JsonProperty(PropertyName = "subscriptionId")]
+ public string SubscriptionId { get; private set; }
+
+ ///
+ /// Gets the subscription display name.
+ ///
+ [JsonProperty(PropertyName = "displayName")]
+ public string DisplayName { get; private set; }
+
+ ///
+ /// Gets the subscription state. Possible values are Enabled, Warned,
+ /// PastDue, Disabled, and Deleted. Possible values include: 'Enabled',
+ /// 'Warned', 'PastDue', 'Disabled', 'Deleted'
+ ///
+ [JsonProperty(PropertyName = "state")]
+ public SubscriptionState? State { get; private set; }
+
+ ///
+ /// Gets or sets the subscription policies.
+ ///
+ [JsonProperty(PropertyName = "subscriptionPolicies")]
+ public SubscriptionPolicies SubscriptionPolicies { get; set; }
+
+ ///
+ /// Gets or sets the authorization source of the request. Valid values
+ /// are one or more combinations of Legacy, RoleBased, Bypassed, Direct
+ /// and Management. For example, 'Legacy, RoleBased'.
+ ///
+ [JsonProperty(PropertyName = "authorizationSource")]
+ public string AuthorizationSource { get; set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionOperation.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionOperation.cs
new file mode 100644
index 000000000000..89b66c82fd25
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionOperation.cs
@@ -0,0 +1,68 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// status of the subscription POST operation.
+ ///
+ public partial class SubscriptionOperation
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionOperation class.
+ ///
+ public SubscriptionOperation()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SubscriptionOperation class.
+ ///
+ /// The operation Id.
+ /// Status of the pending subscription
+ /// Status Detail of the pending
+ /// subscription
+ public SubscriptionOperation(string id = default(string), string status = default(string), string statusDetail = default(string))
+ {
+ Id = id;
+ Status = status;
+ StatusDetail = statusDetail;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the operation Id.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ ///
+ /// Gets or sets status of the pending subscription
+ ///
+ [JsonProperty(PropertyName = "status")]
+ public string Status { get; set; }
+
+ ///
+ /// Gets or sets status Detail of the pending subscription
+ ///
+ [JsonProperty(PropertyName = "statusDetail")]
+ public string StatusDetail { get; set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionOperationListResult.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionOperationListResult.cs
new file mode 100644
index 000000000000..4dc7600ed0ac
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionOperationListResult.cs
@@ -0,0 +1,56 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// A list of pending subscription operations.
+ ///
+ public partial class SubscriptionOperationListResult
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionOperationListResult
+ /// class.
+ ///
+ public SubscriptionOperationListResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SubscriptionOperationListResult
+ /// class.
+ ///
+ /// A list of pending
+ /// SubscriptionOperations
+ public SubscriptionOperationListResult(IList value = default(IList))
+ {
+ Value = value;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets a list of pending SubscriptionOperations
+ ///
+ [JsonProperty(PropertyName = "value")]
+ public IList Value { get; set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionPolicies.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionPolicies.cs
new file mode 100644
index 000000000000..78258171c630
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionPolicies.cs
@@ -0,0 +1,75 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Subscription policies.
+ ///
+ public partial class SubscriptionPolicies
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionPolicies class.
+ ///
+ public SubscriptionPolicies()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SubscriptionPolicies class.
+ ///
+ /// The subscription location
+ /// placement ID. The ID indicates which regions are visible for a
+ /// subscription. For example, a subscription with a location placement
+ /// Id of Public_2014-09-01 has access to Azure public regions.
+ /// The subscription quota ID.
+ /// The subscription spending limit.
+ /// Possible values include: 'On', 'Off', 'CurrentPeriodOff'
+ public SubscriptionPolicies(string locationPlacementId = default(string), string quotaId = default(string), SpendingLimit? spendingLimit = default(SpendingLimit?))
+ {
+ LocationPlacementId = locationPlacementId;
+ QuotaId = quotaId;
+ SpendingLimit = spendingLimit;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the subscription location placement ID. The ID indicates which
+ /// regions are visible for a subscription. For example, a subscription
+ /// with a location placement Id of Public_2014-09-01 has access to
+ /// Azure public regions.
+ ///
+ [JsonProperty(PropertyName = "locationPlacementId")]
+ public string LocationPlacementId { get; private set; }
+
+ ///
+ /// Gets the subscription quota ID.
+ ///
+ [JsonProperty(PropertyName = "quotaId")]
+ public string QuotaId { get; private set; }
+
+ ///
+ /// Gets the subscription spending limit. Possible values include:
+ /// 'On', 'Off', 'CurrentPeriodOff'
+ ///
+ [JsonProperty(PropertyName = "spendingLimit")]
+ public SpendingLimit? SpendingLimit { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionState.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionState.cs
new file mode 100644
index 000000000000..155901fb698f
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/SubscriptionState.cs
@@ -0,0 +1,78 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Converters;
+ using System.Runtime;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Defines values for SubscriptionState.
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum SubscriptionState
+ {
+ [EnumMember(Value = "Enabled")]
+ Enabled,
+ [EnumMember(Value = "Warned")]
+ Warned,
+ [EnumMember(Value = "PastDue")]
+ PastDue,
+ [EnumMember(Value = "Disabled")]
+ Disabled,
+ [EnumMember(Value = "Deleted")]
+ Deleted
+ }
+ internal static class SubscriptionStateEnumExtension
+ {
+ internal static string ToSerializedValue(this SubscriptionState? value)
+ {
+ return value == null ? null : ((SubscriptionState)value).ToSerializedValue();
+ }
+
+ internal static string ToSerializedValue(this SubscriptionState value)
+ {
+ switch( value )
+ {
+ case SubscriptionState.Enabled:
+ return "Enabled";
+ case SubscriptionState.Warned:
+ return "Warned";
+ case SubscriptionState.PastDue:
+ return "PastDue";
+ case SubscriptionState.Disabled:
+ return "Disabled";
+ case SubscriptionState.Deleted:
+ return "Deleted";
+ }
+ return null;
+ }
+
+ internal static SubscriptionState? ParseSubscriptionState(this string value)
+ {
+ switch( value )
+ {
+ case "Enabled":
+ return SubscriptionState.Enabled;
+ case "Warned":
+ return SubscriptionState.Warned;
+ case "PastDue":
+ return SubscriptionState.PastDue;
+ case "Disabled":
+ return SubscriptionState.Disabled;
+ case "Deleted":
+ return SubscriptionState.Deleted;
+ }
+ return null;
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Models/TenantIdDescription.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Models/TenantIdDescription.cs
new file mode 100644
index 000000000000..ad20b421ddf6
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Models/TenantIdDescription.cs
@@ -0,0 +1,63 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Tenant Id information.
+ ///
+ public partial class TenantIdDescription
+ {
+ ///
+ /// Initializes a new instance of the TenantIdDescription class.
+ ///
+ public TenantIdDescription()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the TenantIdDescription class.
+ ///
+ /// The fully qualified ID of the tenant. For example,
+ /// /tenants/00000000-0000-0000-0000-000000000000.
+ /// The tenant ID. For example,
+ /// 00000000-0000-0000-0000-000000000000.
+ public TenantIdDescription(string id = default(string), string tenantId = default(string))
+ {
+ Id = id;
+ TenantId = tenantId;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the fully qualified ID of the tenant. For example,
+ /// /tenants/00000000-0000-0000-0000-000000000000.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ ///
+ /// Gets the tenant ID. For example,
+ /// 00000000-0000-0000-0000-000000000000.
+ ///
+ [JsonProperty(PropertyName = "tenantId")]
+ public string TenantId { get; private set; }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/Operations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/Operations.cs
new file mode 100644
index 000000000000..439f6ee6119b
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/Operations.cs
@@ -0,0 +1,214 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Operations operations.
+ ///
+ internal partial class Operations : IServiceOperations, IOperations
+ {
+ ///
+ /// Initializes a new instance of the Operations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal Operations(SubscriptionClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SubscriptionClient
+ ///
+ public SubscriptionClient Client { get; private set; }
+
+ ///
+ /// Lists all of the available Microsoft.Subscription API operations.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ string apiVersion = "2018-03-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/operations").ToString();
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/OperationsExtensions.cs b/src/SDKs/Subscription/Management.Subscription/Generated/OperationsExtensions.cs
new file mode 100644
index 000000000000..32eafb86f429
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/OperationsExtensions.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for Operations.
+ ///
+ public static partial class OperationsExtensions
+ {
+ ///
+ /// Lists all of the available Microsoft.Subscription API operations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static OperationListResult List(this IOperations operations)
+ {
+ return operations.ListAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all of the available Microsoft.Subscription API operations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SdkInfo_SubscriptionClient.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SdkInfo_SubscriptionClient.cs
new file mode 100644
index 000000000000..ec493b172482
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/SdkInfo_SubscriptionClient.cs
@@ -0,0 +1,22 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+internal static partial class SdkInfo
+{
+ public static IEnumerable> ApiInfo_SubscriptionClient
+ {
+ get
+ {
+ return new Tuple[]
+ {
+ new Tuple("Billing", "SubscriptionFactory", "2018-03-01-preview"),
+ new Tuple("Subscription", "Operations", "2018-03-01-preview"),
+ new Tuple("Subscription", "SubscriptionOperations", "2018-03-01-preview"),
+ new Tuple("SubscriptionClient", "Subscriptions", "2016-06-01"),
+ new Tuple("SubscriptionClient", "Tenants", "2016-06-01"),
+ }.AsEnumerable();
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsClient.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionClient.cs
similarity index 75%
rename from src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsClient.cs
rename to src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionClient.cs
index 711a94bf4bc7..ce49c76004a9 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsClient.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionClient.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,11 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Microsoft.Rest.Serialization;
@@ -22,10 +22,9 @@ namespace Microsoft.Azure.Management.Subscription
using System.Net.Http;
///
- /// Subscription definitions client provides an interface to create, modify
- /// and retrieve azure subscriptions programmatically.
+ /// The subscription client
///
- public partial class SubscriptionDefinitionsClient : ServiceClient, ISubscriptionDefinitionsClient, IAzureClient
+ public partial class SubscriptionClient : ServiceClient, ISubscriptionClient, IAzureClient
{
///
/// The base URI of the service.
@@ -47,12 +46,6 @@ public partial class SubscriptionDefinitionsClient : ServiceClient
public ServiceClientCredentials Credentials { get; private set; }
- ///
- /// Version of the API to be used with the client request. Current version is
- /// 2015-06-01
- ///
- public string ApiVersion { get; private set; }
-
///
/// Gets or sets the preferred language for the response.
///
@@ -71,28 +64,43 @@ public partial class SubscriptionDefinitionsClient : ServiceClient
- /// Gets the ISubscriptionDefinitionsOperationMetadataOperations.
+ /// Gets the IOperations.
+ ///
+ public virtual IOperations Operations { get; private set; }
+
+ ///
+ /// Gets the ISubscriptionOperations.
+ ///
+ public virtual ISubscriptionOperations SubscriptionOperations { get; private set; }
+
+ ///
+ /// Gets the ISubscriptionFactoryOperations.
+ ///
+ public virtual ISubscriptionFactoryOperations SubscriptionFactory { get; private set; }
+
+ ///
+ /// Gets the ISubscriptionsOperations.
///
- public virtual ISubscriptionDefinitionsOperationMetadataOperations SubscriptionDefinitionsOperationMetadata { get; private set; }
+ public virtual ISubscriptionsOperations Subscriptions { get; private set; }
///
- /// Gets the ISubscriptionDefinitionsOperations.
+ /// Gets the ITenantsOperations.
///
- public virtual ISubscriptionDefinitionsOperations SubscriptionDefinitions { get; private set; }
+ public virtual ITenantsOperations Tenants { get; private set; }
///
- /// Initializes a new instance of the SubscriptionDefinitionsClient class.
+ /// Initializes a new instance of the SubscriptionClient class.
///
///
/// Optional. The delegating handlers to add to the http client pipeline.
///
- protected SubscriptionDefinitionsClient(params DelegatingHandler[] handlers) : base(handlers)
+ protected SubscriptionClient(params DelegatingHandler[] handlers) : base(handlers)
{
Initialize();
}
///
- /// Initializes a new instance of the SubscriptionDefinitionsClient class.
+ /// Initializes a new instance of the SubscriptionClient class.
///
///
/// Optional. The http client handler used to handle http transport.
@@ -100,13 +108,13 @@ protected SubscriptionDefinitionsClient(params DelegatingHandler[] handlers) : b
///
/// Optional. The delegating handlers to add to the http client pipeline.
///
- protected SubscriptionDefinitionsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
+ protected SubscriptionClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
{
Initialize();
}
///
- /// Initializes a new instance of the SubscriptionDefinitionsClient class.
+ /// Initializes a new instance of the SubscriptionClient class.
///
///
/// Optional. The base URI of the service.
@@ -117,7 +125,7 @@ protected SubscriptionDefinitionsClient(HttpClientHandler rootHandler, params De
///
/// Thrown when a required parameter is null
///
- protected SubscriptionDefinitionsClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
+ protected SubscriptionClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
{
if (baseUri == null)
{
@@ -127,7 +135,7 @@ protected SubscriptionDefinitionsClient(System.Uri baseUri, params DelegatingHan
}
///
- /// Initializes a new instance of the SubscriptionDefinitionsClient class.
+ /// Initializes a new instance of the SubscriptionClient class.
///
///
/// Optional. The base URI of the service.
@@ -141,7 +149,7 @@ protected SubscriptionDefinitionsClient(System.Uri baseUri, params DelegatingHan
///
/// Thrown when a required parameter is null
///
- protected SubscriptionDefinitionsClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ protected SubscriptionClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (baseUri == null)
{
@@ -151,7 +159,7 @@ protected SubscriptionDefinitionsClient(System.Uri baseUri, HttpClientHandler ro
}
///
- /// Initializes a new instance of the SubscriptionDefinitionsClient class.
+ /// Initializes a new instance of the SubscriptionClient class.
///
///
/// Required. Credentials needed for the client to connect to Azure.
@@ -162,7 +170,7 @@ protected SubscriptionDefinitionsClient(System.Uri baseUri, HttpClientHandler ro
///
/// Thrown when a required parameter is null
///
- public SubscriptionDefinitionsClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ public SubscriptionClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
{
if (credentials == null)
{
@@ -176,7 +184,7 @@ public SubscriptionDefinitionsClient(ServiceClientCredentials credentials, param
}
///
- /// Initializes a new instance of the SubscriptionDefinitionsClient class.
+ /// Initializes a new instance of the SubscriptionClient class.
///
///
/// Required. Credentials needed for the client to connect to Azure.
@@ -190,7 +198,7 @@ public SubscriptionDefinitionsClient(ServiceClientCredentials credentials, param
///
/// Thrown when a required parameter is null
///
- public SubscriptionDefinitionsClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ public SubscriptionClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (credentials == null)
{
@@ -204,7 +212,7 @@ public SubscriptionDefinitionsClient(ServiceClientCredentials credentials, HttpC
}
///
- /// Initializes a new instance of the SubscriptionDefinitionsClient class.
+ /// Initializes a new instance of the SubscriptionClient class.
///
///
/// Optional. The base URI of the service.
@@ -218,7 +226,7 @@ public SubscriptionDefinitionsClient(ServiceClientCredentials credentials, HttpC
///
/// Thrown when a required parameter is null
///
- public SubscriptionDefinitionsClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ public SubscriptionClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
{
if (baseUri == null)
{
@@ -237,7 +245,7 @@ public SubscriptionDefinitionsClient(System.Uri baseUri, ServiceClientCredential
}
///
- /// Initializes a new instance of the SubscriptionDefinitionsClient class.
+ /// Initializes a new instance of the SubscriptionClient class.
///
///
/// Optional. The base URI of the service.
@@ -254,7 +262,7 @@ public SubscriptionDefinitionsClient(System.Uri baseUri, ServiceClientCredential
///
/// Thrown when a required parameter is null
///
- public SubscriptionDefinitionsClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ public SubscriptionClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (baseUri == null)
{
@@ -281,10 +289,12 @@ public SubscriptionDefinitionsClient(System.Uri baseUri, ServiceClientCredential
///
private void Initialize()
{
- SubscriptionDefinitionsOperationMetadata = new SubscriptionDefinitionsOperationMetadataOperations(this);
- SubscriptionDefinitions = new SubscriptionDefinitionsOperations(this);
+ Operations = new Operations(this);
+ SubscriptionOperations = new SubscriptionOperations(this);
+ SubscriptionFactory = new SubscriptionFactoryOperations(this);
+ Subscriptions = new SubscriptionsOperations(this);
+ Tenants = new TenantsOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
- ApiVersion = "2017-11-01-preview";
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
@@ -301,7 +311,6 @@ private void Initialize()
new Iso8601TimeSpanConverter()
}
};
- SerializationSettings.Converters.Add(new TransformationJsonConverter());
DeserializationSettings = new JsonSerializerSettings
{
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
@@ -315,7 +324,6 @@ private void Initialize()
}
};
CustomInitialize();
- DeserializationSettings.Converters.Add(new TransformationJsonConverter());
DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
}
}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationsExtensions.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationsExtensions.cs
deleted file mode 100644
index 3f2a325f10fa..000000000000
--- a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationsExtensions.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-
-namespace Microsoft.Azure.Management.Subscription
-{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
- using Microsoft.Rest;
- using Microsoft.Rest.Azure;
- using Models;
- using System.Threading;
- using System.Threading.Tasks;
-
- ///
- /// Extension methods for SubscriptionDefinitionsOperations.
- ///
- public static partial class SubscriptionDefinitionsOperationsExtensions
- {
- ///
- /// Create an Azure subscription definition.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The subscription definition creation.
- ///
- public static SubscriptionDefinition Create(this ISubscriptionDefinitionsOperations operations, string subscriptionDefinitionName, SubscriptionDefinition body)
- {
- return operations.CreateAsync(subscriptionDefinitionName, body).GetAwaiter().GetResult();
- }
-
- ///
- /// Create an Azure subscription definition.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The subscription definition creation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task CreateAsync(this ISubscriptionDefinitionsOperations operations, string subscriptionDefinitionName, SubscriptionDefinition body, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.CreateWithHttpMessagesAsync(subscriptionDefinitionName, body, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get an Azure subscription definition.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- public static SubscriptionDefinition Get(this ISubscriptionDefinitionsOperations operations, string subscriptionDefinitionName)
- {
- return operations.GetAsync(subscriptionDefinitionName).GetAwaiter().GetResult();
- }
-
- ///
- /// Get an Azure subscription definition.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAsync(this ISubscriptionDefinitionsOperations operations, string subscriptionDefinitionName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetWithHttpMessagesAsync(subscriptionDefinitionName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// List an Azure subscription definition by subscriptionId.
- ///
- ///
- /// The operations group for this extension method.
- ///
- public static IPage List(this ISubscriptionDefinitionsOperations operations)
- {
- return operations.ListAsync().GetAwaiter().GetResult();
- }
-
- ///
- /// List an Azure subscription definition by subscriptionId.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task> ListAsync(this ISubscriptionDefinitionsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Retrieves the status of the subscription definition PUT operation. The URI
- /// of this API is returned in the Location field of the response header.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The operation ID, which can be found from the Location field in the
- /// generate recommendation response header.
- ///
- public static SubscriptionDefinition GetOperationStatus(this ISubscriptionDefinitionsOperations operations, System.Guid operationId)
- {
- return operations.GetOperationStatusAsync(operationId).GetAwaiter().GetResult();
- }
-
- ///
- /// Retrieves the status of the subscription definition PUT operation. The URI
- /// of this API is returned in the Location field of the response header.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The operation ID, which can be found from the Location field in the
- /// generate recommendation response header.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetOperationStatusAsync(this ISubscriptionDefinitionsOperations operations, System.Guid operationId, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetOperationStatusWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Create an Azure subscription definition.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The subscription definition creation.
- ///
- public static SubscriptionDefinition BeginCreate(this ISubscriptionDefinitionsOperations operations, string subscriptionDefinitionName, SubscriptionDefinition body)
- {
- return operations.BeginCreateAsync(subscriptionDefinitionName, body).GetAwaiter().GetResult();
- }
-
- ///
- /// Create an Azure subscription definition.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The subscription definition creation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginCreateAsync(this ISubscriptionDefinitionsOperations operations, string subscriptionDefinitionName, SubscriptionDefinition body, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.BeginCreateWithHttpMessagesAsync(subscriptionDefinitionName, body, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// List an Azure subscription definition by subscriptionId.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- public static IPage ListNext(this ISubscriptionDefinitionsOperations operations, string nextPageLink)
- {
- return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
- }
-
- ///
- /// List an Azure subscription definition by subscriptionId.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The NextLink from the previous successful call to List operation.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task> ListNextAsync(this ISubscriptionDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- }
-}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionFactoryOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionFactoryOperations.cs
new file mode 100644
index 000000000000..eb2d38a3a912
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionFactoryOperations.cs
@@ -0,0 +1,280 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SubscriptionFactoryOperations operations.
+ ///
+ internal partial class SubscriptionFactoryOperations : IServiceOperations, ISubscriptionFactoryOperations
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionFactoryOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal SubscriptionFactoryOperations(SubscriptionClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SubscriptionClient
+ ///
+ public SubscriptionClient Client { get; private set; }
+
+ ///
+ /// Creates an Azure subscription
+ ///
+ ///
+ /// The name of the enrollment account to which the subscription will be
+ /// billed.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(enrollmentAccountName, body, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Creates an Azure subscription
+ ///
+ ///
+ /// The name of the enrollment account to which the subscription will be
+ /// billed.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (enrollmentAccountName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "enrollmentAccountName");
+ }
+ if (body == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "body");
+ }
+ string apiVersion = "2018-03-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("enrollmentAccountName", enrollmentAccountName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscriptionInEnrollmentAccount", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountName}/providers/Microsoft.Subscription/createSubscription").ToString();
+ _url = _url.Replace("{enrollmentAccountName}", System.Uri.EscapeDataString(enrollmentAccountName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(body != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionFactoryOperationsExtensions.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionFactoryOperationsExtensions.cs
new file mode 100644
index 000000000000..35565c9e7e3b
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionFactoryOperationsExtensions.cs
@@ -0,0 +1,109 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for SubscriptionFactoryOperations.
+ ///
+ public static partial class SubscriptionFactoryOperationsExtensions
+ {
+ ///
+ /// Creates an Azure subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the enrollment account to which the subscription will be
+ /// billed.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ public static SubscriptionCreationResult CreateSubscriptionInEnrollmentAccount(this ISubscriptionFactoryOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body)
+ {
+ return operations.CreateSubscriptionInEnrollmentAccountAsync(enrollmentAccountName, body).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates an Azure subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the enrollment account to which the subscription will be
+ /// billed.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateSubscriptionInEnrollmentAccountAsync(this ISubscriptionFactoryOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(enrollmentAccountName, body, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates an Azure subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the enrollment account to which the subscription will be
+ /// billed.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ public static SubscriptionCreationResult BeginCreateSubscriptionInEnrollmentAccount(this ISubscriptionFactoryOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body)
+ {
+ return operations.BeginCreateSubscriptionInEnrollmentAccountAsync(enrollmentAccountName, body).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates an Azure subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the enrollment account to which the subscription will be
+ /// billed.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginCreateSubscriptionInEnrollmentAccountAsync(this ISubscriptionFactoryOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(enrollmentAccountName, body, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionOperations.cs
new file mode 100644
index 000000000000..2b1244325d90
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionOperations.cs
@@ -0,0 +1,214 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// SubscriptionOperations operations.
+ ///
+ internal partial class SubscriptionOperations : IServiceOperations, ISubscriptionOperations
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal SubscriptionOperations(SubscriptionClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SubscriptionClient
+ ///
+ public SubscriptionClient Client { get; private set; }
+
+ ///
+ /// Lists all of the available pending Microsoft.Subscription API operations.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ string apiVersion = "2018-03-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/subscriptionOperations").ToString();
+ List _queryParameters = new List();
+ if (apiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionOperationsExtensions.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionOperationsExtensions.cs
new file mode 100644
index 000000000000..b0704257cd4b
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionOperationsExtensions.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for SubscriptionOperations.
+ ///
+ public static partial class SubscriptionOperationsExtensions
+ {
+ ///
+ /// Lists all of the available pending Microsoft.Subscription API operations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static SubscriptionOperationListResult List(this ISubscriptionOperations operations)
+ {
+ return operations.ListAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Lists all of the available pending Microsoft.Subscription API operations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListAsync(this ISubscriptionOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionsOperations.cs
similarity index 61%
rename from src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperations.cs
rename to src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionsOperations.cs
index e781aca4d00b..df94b1e2387c 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperations.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionsOperations.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,11 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
@@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Subscription
using System.Threading.Tasks;
///
- /// SubscriptionDefinitionsOperations operations.
+ /// SubscriptionsOperations operations.
///
- internal partial class SubscriptionDefinitionsOperations : IServiceOperations, ISubscriptionDefinitionsOperations
+ internal partial class SubscriptionsOperations : IServiceOperations, ISubscriptionsOperations
{
///
- /// Initializes a new instance of the SubscriptionDefinitionsOperations class.
+ /// Initializes a new instance of the SubscriptionsOperations class.
///
///
/// Reference to the service client.
@@ -36,7 +36,7 @@ internal partial class SubscriptionDefinitionsOperations : IServiceOperations
/// Thrown when a required parameter is null
///
- internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
+ internal SubscriptionsOperations(SubscriptionClient client)
{
if (client == null)
{
@@ -46,37 +46,20 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
}
///
- /// Gets a reference to the SubscriptionDefinitionsClient
+ /// Gets a reference to the SubscriptionClient
///
- public SubscriptionDefinitionsClient Client { get; private set; }
+ public SubscriptionClient Client { get; private set; }
///
- /// Create an Azure subscription definition.
+ /// Gets all available geo-locations.
///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The subscription definition creation.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> CreateWithHttpMessagesAsync(string subscriptionDefinitionName, SubscriptionDefinition body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send Request
- AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(subscriptionDefinitionName, body, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Get an Azure subscription definition.
- ///
- ///
- /// The name of the Azure subscription definition.
+ ///
+ /// This operation provides all the locations that are available for resource
+ /// providers; however, each resource provider may support a subset of this
+ /// list.
+ ///
+ ///
+ /// The ID of the target subscription.
///
///
/// Headers that will be added to request.
@@ -84,7 +67,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -99,16 +82,13 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string subscriptionDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (subscriptionDefinitionName == null)
+ if (subscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionDefinitionName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId");
}
+ string apiVersion = "2016-06-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -116,18 +96,19 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("subscriptionDefinitionName", subscriptionDefinitionName);
+ tracingParameters.Add("subscriptionId", subscriptionId);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListLocations", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/subscriptionDefinitions/{subscriptionDefinitionName}").ToString();
- _url = _url.Replace("{subscriptionDefinitionName}", System.Uri.EscapeDataString(subscriptionDefinitionName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/locations").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId));
List _queryParameters = new List();
- if (Client.ApiVersion != null)
+ if (apiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -189,13 +170,14 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
@@ -205,174 +187,10 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
- if (_shouldTrace)
- {
- ServiceClientTracing.Error(_invocationId, ex);
- }
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw ex;
- }
- // Create Result
- var _result = new AzureOperationResponse();
- _result.Request = _httpRequest;
- _result.Response = _httpResponse;
- if (_httpResponse.Headers.Contains("x-ms-request-id"))
- {
- _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
- }
- // Deserialize Response
- if ((int)_statusCode == 200)
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- try
- {
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
- }
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// List an Azure subscription definition by subscriptionId.
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// A response object containing the response body and response headers.
- ///
- public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/subscriptionDefinitions").ToString();
- List _queryParameters = new List();
- if (Client.ApiVersion != null)
- {
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
- }
- if (_queryParameters.Count > 0)
- {
- _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
- }
- // Create HTTP transport objects
- var _httpRequest = new HttpRequestMessage();
- HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("GET");
- _httpRequest.RequestUri = new System.Uri(_url);
- // Set Headers
- if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
- {
- _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
- }
- if (Client.AcceptLanguage != null)
- {
- if (_httpRequest.Headers.Contains("accept-language"))
- {
- _httpRequest.Headers.Remove("accept-language");
- }
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
- }
-
-
- if (customHeaders != null)
- {
- foreach(var _header in customHeaders)
- {
- if (_httpRequest.Headers.Contains(_header.Key))
- {
- _httpRequest.Headers.Remove(_header.Key);
- }
- _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
- }
- }
-
- // Serialize Request
- string _requestContent = null;
- // Set Credentials
- if (Client.Credentials != null)
- {
- cancellationToken.ThrowIfCancellationRequested();
- await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- }
- // Send Request
- if (_shouldTrace)
- {
- ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
- }
- cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
- if (_shouldTrace)
- {
- ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
- }
- HttpStatusCode _statusCode = _httpResponse.StatusCode;
- cancellationToken.ThrowIfCancellationRequested();
- string _responseContent = null;
- if ((int)_statusCode != 200)
- {
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
- if (_errorBody != null)
- {
- ex.Body = _errorBody;
- }
- }
- catch (JsonException)
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
- // Ignore the exception
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
- ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
@@ -385,7 +203,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -398,7 +216,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -418,12 +236,10 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
}
///
- /// Retrieves the status of the subscription definition PUT operation. The URI
- /// of this API is returned in the Location field of the response header.
+ /// Gets details about a specified subscription.
///
- ///
- /// The operation ID, which can be found from the Location field in the
- /// generate recommendation response header.
+ ///
+ /// The ID of the target subscription.
///
///
/// Headers that will be added to request.
@@ -446,12 +262,13 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetOperationStatusWithHttpMessagesAsync(System.Guid operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.ApiVersion == null)
+ if (subscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId");
}
+ string apiVersion = "2016-06-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -459,18 +276,19 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("operationId", operationId);
+ tracingParameters.Add("subscriptionId", subscriptionId);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetOperationStatus", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/subscriptionOperations/{operationId}").ToString();
- _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(operationId, Client.SerializationSettings).Trim('"')));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId));
List _queryParameters = new List();
- if (Client.ApiVersion != null)
+ if (apiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -530,7 +348,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 202 && (int)_statusCode != 200)
+ if ((int)_statusCode != 200)
{
var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
@@ -565,7 +383,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -578,7 +396,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -590,19 +408,6 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
- try
- {
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
- }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -611,49 +416,26 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
}
///
- /// Create an Azure subscription definition.
+ /// Gets all subscriptions for a tenant.
///
- ///
- /// The name of the Azure subscription definition.
- ///
- ///
- /// The subscription definition creation.
- ///
///
/// Headers that will be added to request.
///
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
/// Thrown when unable to deserialize the response
///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateWithHttpMessagesAsync(string subscriptionDefinitionName, SubscriptionDefinition body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (subscriptionDefinitionName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionDefinitionName");
- }
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (body == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "body");
- }
+ string apiVersion = "2016-06-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -661,19 +443,17 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("subscriptionDefinitionName", subscriptionDefinitionName);
- tracingParameters.Add("body", body);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/subscriptionDefinitions/{subscriptionDefinitionName}").ToString();
- _url = _url.Replace("{subscriptionDefinitionName}", System.Uri.EscapeDataString(subscriptionDefinitionName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions").ToString();
List _queryParameters = new List();
- if (Client.ApiVersion != null)
+ if (apiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -682,7 +462,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -713,12 +493,6 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
// Serialize Request
string _requestContent = null;
- if(body != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
// Set Credentials
if (Client.Credentials != null)
{
@@ -739,15 +513,16 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200)
{
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
@@ -757,6 +532,10 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
@@ -769,7 +548,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -782,7 +561,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -794,19 +573,6 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
- try
- {
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
- }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -815,7 +581,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
}
///
- /// List an Azure subscription definition by subscriptionId.
+ /// Gets all subscriptions for a tenant.
///
///
/// The NextLink from the previous successful call to List operation.
@@ -826,7 +592,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -841,7 +607,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
@@ -922,13 +688,14 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
@@ -938,6 +705,10 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
@@ -950,7 +721,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -963,7 +734,7 @@ internal SubscriptionDefinitionsOperations(SubscriptionDefinitionsClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionsOperationsExtensions.cs b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionsOperationsExtensions.cs
new file mode 100644
index 000000000000..442d21e3d7ee
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionsOperationsExtensions.cs
@@ -0,0 +1,167 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for SubscriptionsOperations.
+ ///
+ public static partial class SubscriptionsOperationsExtensions
+ {
+ ///
+ /// Gets all available geo-locations.
+ ///
+ ///
+ /// This operation provides all the locations that are available for resource
+ /// providers; however, each resource provider may support a subset of this
+ /// list.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The ID of the target subscription.
+ ///
+ public static IEnumerable ListLocations(this ISubscriptionsOperations operations, string subscriptionId)
+ {
+ return operations.ListLocationsAsync(subscriptionId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all available geo-locations.
+ ///
+ ///
+ /// This operation provides all the locations that are available for resource
+ /// providers; however, each resource provider may support a subset of this
+ /// list.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The ID of the target subscription.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListLocationsAsync(this ISubscriptionsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListLocationsWithHttpMessagesAsync(subscriptionId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets details about a specified subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The ID of the target subscription.
+ ///
+ public static SubscriptionModel Get(this ISubscriptionsOperations operations, string subscriptionId)
+ {
+ return operations.GetAsync(subscriptionId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets details about a specified subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The ID of the target subscription.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this ISubscriptionsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(subscriptionId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets all subscriptions for a tenant.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static IPage List(this ISubscriptionsOperations operations)
+ {
+ return operations.ListAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all subscriptions for a tenant.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this ISubscriptionsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets all subscriptions for a tenant.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this ISubscriptionsOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all subscriptions for a tenant.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this ISubscriptionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationMetadataOperations.cs b/src/SDKs/Subscription/Management.Subscription/Generated/TenantsOperations.cs
similarity index 83%
rename from src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationMetadataOperations.cs
rename to src/SDKs/Subscription/Management.Subscription/Generated/TenantsOperations.cs
index ef407e9b9923..69509b6381d6 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationMetadataOperations.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/TenantsOperations.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,11 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
@@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Subscription
using System.Threading.Tasks;
///
- /// SubscriptionDefinitionsOperationMetadataOperations operations.
+ /// TenantsOperations operations.
///
- internal partial class SubscriptionDefinitionsOperationMetadataOperations : IServiceOperations, ISubscriptionDefinitionsOperationMetadataOperations
+ internal partial class TenantsOperations : IServiceOperations, ITenantsOperations
{
///
- /// Initializes a new instance of the SubscriptionDefinitionsOperationMetadataOperations class.
+ /// Initializes a new instance of the TenantsOperations class.
///
///
/// Reference to the service client.
@@ -36,7 +36,7 @@ internal partial class SubscriptionDefinitionsOperationMetadataOperations : ISer
///
/// Thrown when a required parameter is null
///
- internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefinitionsClient client)
+ internal TenantsOperations(SubscriptionClient client)
{
if (client == null)
{
@@ -46,12 +46,12 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
}
///
- /// Gets a reference to the SubscriptionDefinitionsClient
+ /// Gets a reference to the SubscriptionClient
///
- public SubscriptionDefinitionsClient Client { get; private set; }
+ public SubscriptionClient Client { get; private set; }
///
- /// Lists all of the available Microsoft.Subscription API operations.
+ /// Gets the tenants for your account.
///
///
/// Headers that will be added to request.
@@ -59,27 +59,18 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
/// Thrown when unable to deserialize the response
///
- ///
- /// Thrown when a required parameter is null
- ///
- ///
- /// Thrown when a required parameter is null
- ///
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.ApiVersion == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
+ string apiVersion = "2016-06-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -87,16 +78,17 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/operations").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "tenants").ToString();
List _queryParameters = new List();
- if (Client.ApiVersion != null)
+ if (apiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
if (_queryParameters.Count > 0)
{
@@ -158,13 +150,14 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
@@ -174,6 +167,10 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
@@ -186,7 +183,7 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -199,7 +196,7 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -219,7 +216,7 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
}
///
- /// Lists all of the available Microsoft.Subscription API operations.
+ /// Gets the tenants for your account.
///
///
/// The NextLink from the previous successful call to List operation.
@@ -230,7 +227,7 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -245,7 +242,7 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
@@ -326,13 +323,14 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
@@ -342,6 +340,10 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
}
ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
if (_shouldTrace)
{
ServiceClientTracing.Error(_invocationId, ex);
@@ -354,7 +356,7 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -367,7 +369,7 @@ internal SubscriptionDefinitionsOperationMetadataOperations(SubscriptionDefiniti
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
diff --git a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationMetadataOperationsExtensions.cs b/src/SDKs/Subscription/Management.Subscription/Generated/TenantsOperationsExtensions.cs
similarity index 66%
rename from src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationMetadataOperationsExtensions.cs
rename to src/SDKs/Subscription/Management.Subscription/Generated/TenantsOperationsExtensions.cs
index 5af7feec63b6..36b8f3fbf030 100644
--- a/src/SDKs/Subscription/Management.Subscription/Generated/SubscriptionDefinitionsOperationMetadataOperationsExtensions.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Generated/TenantsOperationsExtensions.cs
@@ -1,3 +1,4 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
@@ -5,11 +6,10 @@
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.Subscription
{
- using Microsoft.Azure;
- using Microsoft.Azure.Management;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
@@ -17,23 +17,23 @@ namespace Microsoft.Azure.Management.Subscription
using System.Threading.Tasks;
///
- /// Extension methods for SubscriptionDefinitionsOperationMetadataOperations.
+ /// Extension methods for TenantsOperations.
///
- public static partial class SubscriptionDefinitionsOperationMetadataOperationsExtensions
+ public static partial class TenantsOperationsExtensions
{
///
- /// Lists all of the available Microsoft.Subscription API operations.
+ /// Gets the tenants for your account.
///
///
/// The operations group for this extension method.
///
- public static IPage List(this ISubscriptionDefinitionsOperationMetadataOperations operations)
+ public static IPage List(this ITenantsOperations operations)
{
return operations.ListAsync().GetAwaiter().GetResult();
}
///
- /// Lists all of the available Microsoft.Subscription API operations.
+ /// Gets the tenants for your account.
///
///
/// The operations group for this extension method.
@@ -41,7 +41,7 @@ public static IPage List(this ISubscriptionDefinitionsOperationMetada
///
/// The cancellation token.
///
- public static async Task> ListAsync(this ISubscriptionDefinitionsOperationMetadataOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListAsync(this ITenantsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
{
@@ -50,7 +50,7 @@ public static IPage List(this ISubscriptionDefinitionsOperationMetada
}
///
- /// Lists all of the available Microsoft.Subscription API operations.
+ /// Gets the tenants for your account.
///
///
/// The operations group for this extension method.
@@ -58,13 +58,13 @@ public static IPage List(this ISubscriptionDefinitionsOperationMetada
///
/// The NextLink from the previous successful call to List operation.
///
- public static IPage ListNext(this ISubscriptionDefinitionsOperationMetadataOperations operations, string nextPageLink)
+ public static IPage ListNext(this ITenantsOperations operations, string nextPageLink)
{
return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
}
///
- /// Lists all of the available Microsoft.Subscription API operations.
+ /// Gets the tenants for your account.
///
///
/// The operations group for this extension method.
@@ -75,7 +75,7 @@ public static IPage ListNext(this ISubscriptionDefinitionsOperationMe
///
/// The cancellation token.
///
- public static async Task> ListNextAsync(this ISubscriptionDefinitionsOperationMetadataOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListNextAsync(this ITenantsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
{
diff --git a/src/SDKs/Subscription/Management.Subscription/Microsoft.Azure.Management.Subscription.csproj b/src/SDKs/Subscription/Management.Subscription/Microsoft.Azure.Management.Subscription.csproj
index 3ddd92944633..182a7d266974 100644
--- a/src/SDKs/Subscription/Management.Subscription/Microsoft.Azure.Management.Subscription.csproj
+++ b/src/SDKs/Subscription/Management.Subscription/Microsoft.Azure.Management.Subscription.csproj
@@ -7,9 +7,9 @@
Microsoft.Azure.Management.Subscription
Provides subscription management capabilities for Microsoft Azure.
Microsoft.Azure.Management.Subscription
- 1.0.0-preview
+ 1.1.0-preview
Microsoft Azure Subscription;subscription definitions;
-
+ 1.1.0-preivew - First Get the enrollmentAccount from Microsoft.Billing and then use post to create a subscription
net452;netstandard1.4
diff --git a/src/SDKs/Subscription/Management.Subscription/Properties/AssemblyInfo.cs b/src/SDKs/Subscription/Management.Subscription/Properties/AssemblyInfo.cs
index 8240d1c2d0eb..a96b17f7627d 100644
--- a/src/SDKs/Subscription/Management.Subscription/Properties/AssemblyInfo.cs
+++ b/src/SDKs/Subscription/Management.Subscription/Properties/AssemblyInfo.cs
@@ -7,8 +7,8 @@
[assembly: AssemblyTitle("Microsoft Azure Subscription Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure subscription operations")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.1.0.0")]
+[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Azure .NET SDK")]
diff --git a/src/SDKs/Subscription/Management.Subscription/generate.ps1 b/src/SDKs/Subscription/Management.Subscription/generate.ps1
new file mode 100644
index 000000000000..dd69e727d68b
--- /dev/null
+++ b/src/SDKs/Subscription/Management.Subscription/generate.ps1
@@ -0,0 +1 @@
+powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File "$(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)\..\..\..\..\tools\generateTool.ps1" -ResourceProvider "subscription/resource-manager" -PowershellInvoker -AutoRestVersion "latest"
\ No newline at end of file
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/CreateSubscriptionDefinition.json b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/CreateSubscriptionDefinition.json
deleted file mode 100644
index dd1432410c35..000000000000
--- a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/CreateSubscriptionDefinition.json
+++ /dev/null
@@ -1,152 +0,0 @@
-{
- "Entries": [
- {
- "RequestUri": "/providers/Microsoft.Subscription/subscriptionDefinitions/MySubDefYYYY11DD2241061935?api-version=2017-11-01-preview",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL3N1YnNjcmlwdGlvbkRlZmluaXRpb25zL015U3ViRGVmWVlZWTExREQyMjQxMDYxOTM1P2FwaS12ZXJzaW9uPTIwMTctMTEtMDEtcHJldmlldw==",
- "RequestMethod": "PUT",
- "RequestBody": "{\r\n \"properties\": {\r\n \"subscriptionDisplayName\": \"MySubDefYYYY11DD2241061935\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n }\r\n}",
- "RequestHeaders": {
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Content-Length": [
- "123"
- ],
- "x-ms-client-request-id": [
- "68faacfb-bf75-496d-bee9-a03d61dcb5ad"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.2115.0",
- "OSName/Windows10Education",
- "OSVersion/6.3.15063",
- "Microsoft.Azure.Management.Subscription.SubscriptionDefinitionsClient/1.0.0.0"
- ]
- },
- "ResponseBody": "\"\"",
- "ResponseHeaders": {
- "Content-Length": [
- "2"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "Retry-After": [
- "60"
- ],
- "x-content-type-options": [
- "nosniff"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-ratelimit-remaining-tenant-writes": [
- "1199"
- ],
- "x-ms-request-id": [
- "875a349c-7257-406a-8424-5644e94e8eb6"
- ],
- "x-ms-correlation-request-id": [
- "875a349c-7257-406a-8424-5644e94e8eb6"
- ],
- "x-ms-routing-request-id": [
- "CENTRALUS:20171120T064205Z:875a349c-7257-406a-8424-5644e94e8eb6"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Mon, 20 Nov 2017 06:42:05 GMT"
- ],
- "Location": [
- "https://api-dogfood.resources.windows-int.net/providers/Microsoft.Subscription/subscriptionOperations/9870eab8-492c-47e8-bd20-313624c71e7a?api-version=2017-11-01-preview"
- ],
- "Server": [
- "Microsoft-IIS/8.5"
- ],
- "X-AspNet-Version": [
- "4.0.30319"
- ],
- "X-Powered-By": [
- "ASP.NET"
- ]
- },
- "StatusCode": 202
- },
- {
- "RequestUri": "/providers/Microsoft.Subscription/subscriptionOperations/9870eab8-492c-47e8-bd20-313624c71e7a?api-version=2017-11-01-preview",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL3N1YnNjcmlwdGlvbk9wZXJhdGlvbnMvOTg3MGVhYjgtNDkyYy00N2U4LWJkMjAtMzEzNjI0YzcxZTdhP2FwaS12ZXJzaW9uPTIwMTctMTEtMDEtcHJldmlldw==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "User-Agent": [
- "FxVersion/4.7.2115.0",
- "OSName/Windows10Education",
- "OSVersion/6.3.15063",
- "Microsoft.Azure.Management.Subscription.SubscriptionDefinitionsClient/1.0.0.0"
- ]
- },
- "ResponseBody": "{\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/MySubDefYYYY11DD2241061935\",\r\n \"name\": \"MySubDefYYYY11DD2241061935\",\r\n \"properties\": {\r\n \"etag\": \"rj7u2g==\",\r\n \"subscriptionDisplayName\": \"MySubDefYYYY11DD2241061935\",\r\n \"subscriptionId\": \"00fd1ef3-328d-4e75-a158-9dd4405585c8\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n}",
- "ResponseHeaders": {
- "Content-Length": [
- "355"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "x-content-type-options": [
- "nosniff"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "14999"
- ],
- "x-ms-request-id": [
- "76b82bae-104b-4139-97a4-3c5864189983"
- ],
- "x-ms-correlation-request-id": [
- "76b82bae-104b-4139-97a4-3c5864189983"
- ],
- "x-ms-routing-request-id": [
- "CENTRALUS:20171120T064236Z:76b82bae-104b-4139-97a4-3c5864189983"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Mon, 20 Nov 2017 06:42:36 GMT"
- ],
- "Server": [
- "Microsoft-IIS/8.5"
- ],
- "X-AspNet-Version": [
- "4.0.30319"
- ],
- "X-Powered-By": [
- "ASP.NET"
- ]
- },
- "StatusCode": 200
- }
- ],
- "Names": {},
- "Variables": {
- "SubscriptionId": "f4b6d4b2-7f09-4856-84f6-b98c14642bf6"
- }
-}
\ No newline at end of file
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/GetSubscriptionDefinition.json b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/GetSubscriptionDefinition.json
deleted file mode 100644
index 7c6e3434eb95..000000000000
--- a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/GetSubscriptionDefinition.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "Entries": [
- {
- "RequestUri": "/providers/Microsoft.Subscription/subscriptionDefinitions/mjf201711161710?api-version=2017-11-01-preview",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL3N1YnNjcmlwdGlvbkRlZmluaXRpb25zL21qZjIwMTcxMTE2MTcxMD9hcGktdmVyc2lvbj0yMDE3LTExLTAxLXByZXZpZXc=",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "x-ms-client-request-id": [
- "8ee3340c-8c4e-4e2f-9eca-1c74902d66ba"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.2115.0",
- "OSName/Windows10Education",
- "OSVersion/6.3.15063",
- "Microsoft.Azure.Management.Subscription.SubscriptionDefinitionsClient/1.0.0.0"
- ]
- },
- "ResponseBody": "{\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/mjf201711161710\",\r\n \"name\": \"mjf201711161710\",\r\n \"properties\": {\r\n \"etag\": \"IVd27g==\",\r\n \"subscriptionDisplayName\": null,\r\n \"subscriptionId\": \"642d5a52-3b2a-44a9-ba0a-0d4b0624ce03\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n}",
- "ResponseHeaders": {
- "Content-Length": [
- "309"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "x-content-type-options": [
- "nosniff"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "14999"
- ],
- "x-ms-request-id": [
- "6d42ef4f-d9f4-49c9-be43-7a2f6a19ac53"
- ],
- "x-ms-correlation-request-id": [
- "6d42ef4f-d9f4-49c9-be43-7a2f6a19ac53"
- ],
- "x-ms-routing-request-id": [
- "CENTRALUS:20171120T061939Z:6d42ef4f-d9f4-49c9-be43-7a2f6a19ac53"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Mon, 20 Nov 2017 06:19:38 GMT"
- ],
- "Server": [
- "Microsoft-IIS/8.5"
- ],
- "X-AspNet-Version": [
- "4.0.30319"
- ],
- "X-Powered-By": [
- "ASP.NET"
- ]
- },
- "StatusCode": 200
- }
- ],
- "Names": {},
- "Variables": {
- "SubscriptionId": "f4b6d4b2-7f09-4856-84f6-b98c14642bf6"
- }
-}
\ No newline at end of file
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/ListSubscriptionDefinitions.json b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/ListSubscriptionDefinitions.json
deleted file mode 100644
index cabaf336ad8e..000000000000
--- a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubTests/ListSubscriptionDefinitions.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
- "Entries": [
- {
- "RequestUri": "/providers/Microsoft.Subscription/subscriptionDefinitions?api-version=2017-11-01-preview",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL3N1YnNjcmlwdGlvbkRlZmluaXRpb25zP2FwaS12ZXJzaW9uPTIwMTctMTEtMDEtcHJldmlldw==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "x-ms-client-request-id": [
- "1ba6c540-ffef-49ce-be4c-8f52ec525902"
- ],
- "accept-language": [
- "en-US"
- ],
- "User-Agent": [
- "FxVersion/4.7.2115.0",
- "OSName/Windows10Education",
- "OSVersion/6.3.15063",
- "Microsoft.Azure.Management.Subscription.SubscriptionDefinitionsClient/1.0.0.0"
- ]
- },
- "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/e2esub2\",\r\n \"name\": \"e2esub2\",\r\n \"properties\": {\r\n \"etag\": \"ysvL8g==\",\r\n \"subscriptionDisplayName\": \"mye2esub2\",\r\n \"subscriptionId\": \"c253def5-8fac-4eb2-a362-5f2ebb6fdffd\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/mjf201711161710\",\r\n \"name\": \"mjf201711161710\",\r\n \"properties\": {\r\n \"etag\": \"IVd27g==\",\r\n \"subscriptionDisplayName\": null,\r\n \"subscriptionId\": \"642d5a52-3b2a-44a9-ba0a-0d4b0624ce03\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/mjf201711172338\",\r\n \"name\": \"mjf201711172338\",\r\n \"properties\": {\r\n \"etag\": \"qP1hfg==\",\r\n \"subscriptionDisplayName\": \"Subat201711172338\",\r\n \"subscriptionId\": \"6f3d8143-c750-4ae1-a075-41781d826f7f\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testName381931c3-00c8-4b3f-8032-7a0846dd0b04\",\r\n \"name\": \"testName381931c3-00c8-4b3f-8032-7a0846dd0b04\",\r\n \"properties\": {\r\n \"etag\": \"jXkT6w==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.737465253908869\",\r\n \"subscriptionId\": \"38e3653b-5714-4a59-b360-cd322a4cd890\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testName68b3315c-4f5f-4be2-accb-0920a4c1a3e3\",\r\n \"name\": \"testName68b3315c-4f5f-4be2-accb-0920a4c1a3e3\",\r\n \"properties\": {\r\n \"etag\": \"KrItDg==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.24450106837065\",\r\n \"subscriptionId\": \"92d45315-d928-4088-83b7-0de23abca2da\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testName751f84bd-3342-4cff-aea0-83cbcd998fd1\",\r\n \"name\": \"testName751f84bd-3342-4cff-aea0-83cbcd998fd1\",\r\n \"properties\": {\r\n \"etag\": \"4rIj9w==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.90029299673638\",\r\n \"subscriptionId\": \"63ffa183-7b93-46c0-bb99-177422e65af9\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testName89c38381-d554-4e4b-8538-31b8ec10a59b\",\r\n \"name\": \"testName89c38381-d554-4e4b-8538-31b8ec10a59b\",\r\n \"properties\": {\r\n \"etag\": \"Zxsq+g==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.501123699127288\",\r\n \"subscriptionId\": \"449d7c52-0402-4e0d-a3fc-f89749f5204f\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testName952ed781-3b48-40e7-b020-302b806ee6b8\",\r\n \"name\": \"testName952ed781-3b48-40e7-b020-302b806ee6b8\",\r\n \"properties\": {\r\n \"etag\": \"+6Ko0w==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.761926330980811\",\r\n \"subscriptionId\": \"366ac49f-5584-44c6-bbe6-11e5bf70120e\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testNamea362c486-7444-40bf-81e9-8754c3b5818a\",\r\n \"name\": \"testNamea362c486-7444-40bf-81e9-8754c3b5818a\",\r\n \"properties\": {\r\n \"etag\": \"/B/T2Q==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.943707362256808\",\r\n \"subscriptionId\": \"592ed9f8-504c-45ee-b6a8-355e6e1dd84f\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testNamea76d6495-e1f1-4071-bdc0-0d67a4f2b1e0\",\r\n \"name\": \"testNamea76d6495-e1f1-4071-bdc0-0d67a4f2b1e0\",\r\n \"properties\": {\r\n \"etag\": \"t+U68A==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.0463042687840314\",\r\n \"subscriptionId\": \"79bc96a4-2945-4f05-96aa-7a6860accdc3\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testNamec3b35379-3a5e-4071-b744-00025cb1c34e\",\r\n \"name\": \"testNamec3b35379-3a5e-4071-b744-00025cb1c34e\",\r\n \"properties\": {\r\n \"etag\": \"058azw==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.581302034473653\",\r\n \"subscriptionId\": \"13df5240-4a74-4e4d-bf69-2334061e018d\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n },\r\n {\r\n \"id\": \"/providers/Microsoft.Subscription/subscriptionDefinitions/testNamee26bcc3e-ddb6-46fb-b477-88b63c56449f\",\r\n \"name\": \"testNamee26bcc3e-ddb6-46fb-b477-88b63c56449f\",\r\n \"properties\": {\r\n \"etag\": \"FEmcTg==\",\r\n \"subscriptionDisplayName\": \"SubscriptionDisplayName0.588057519210529\",\r\n \"subscriptionId\": \"1990fce3-fff9-4407-b677-e3cc375a0740\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n },\r\n \"type\": \"Microsoft.Subscription/subscriptionDefinitions\"\r\n }\r\n ]\r\n}",
- "ResponseHeaders": {
- "Content-Length": [
- "4600"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "x-content-type-options": [
- "nosniff"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "14998"
- ],
- "x-ms-request-id": [
- "3f1d7f0e-a9d4-49f9-b943-f1f233d85e1b"
- ],
- "x-ms-correlation-request-id": [
- "3f1d7f0e-a9d4-49f9-b943-f1f233d85e1b"
- ],
- "x-ms-routing-request-id": [
- "CENTRALUS:20171120T055417Z:3f1d7f0e-a9d4-49f9-b943-f1f233d85e1b"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Mon, 20 Nov 2017 05:54:16 GMT"
- ],
- "Server": [
- "Microsoft-IIS/8.5"
- ],
- "X-AspNet-Version": [
- "4.0.30319"
- ],
- "X-Powered-By": [
- "ASP.NET"
- ]
- },
- "StatusCode": 200
- }
- ],
- "Names": {},
- "Variables": {
- "SubscriptionId": "f4b6d4b2-7f09-4856-84f6-b98c14642bf6"
- }
-}
\ No newline at end of file
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubscriptionCreationTests/CreateSubscription.json b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubscriptionCreationTests/CreateSubscription.json
new file mode 100644
index 000000000000..69207f7f0ce0
--- /dev/null
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SessionRecords/FullDesktop.Tests.LiveSubscriptionCreationTests/CreateSubscription.json
@@ -0,0 +1,224 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "/providers/Microsoft.Billing/enrollmentAccounts/465c11a0-38c3-4ecc-92e9-996c69ae9e76/providers/Microsoft.Subscription/createSubscription?api-version=2018-03-01-preview",
+ "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuQmlsbGluZy9lbnJvbGxtZW50QWNjb3VudHMvNDY1YzExYTAtMzhjMy00ZWNjLTkyZTktOTk2YzY5YWU5ZTc2L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL2NyZWF0ZVN1YnNjcmlwdGlvbj9hcGktdmVyc2lvbj0yMDE4LTAzLTAxLXByZXZpZXc=",
+ "RequestMethod": "POST",
+ "RequestBody": "{\r\n \"displayName\": \"TestSubscription_AzureSDK\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n}",
+ "RequestHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Content-Length": [
+ "82"
+ ],
+ "x-ms-client-request-id": [
+ "6d593227-23f5-475e-8755-65cc19595383"
+ ],
+ "accept-language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.7.2633.0",
+ "OSName/Windows10Enterprise",
+ "OSVersion/6.3.16299",
+ "Microsoft.Azure.Management.Subscription.SubscriptionClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "{}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "2"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Retry-After": [
+ "10"
+ ],
+ "api-supported-versions": [
+ "2018-03-01-preview"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-tenant-writes": [
+ "1199"
+ ],
+ "x-ms-request-id": [
+ "e0fbea32-c0d5-41a6-a01e-f7ad002b0efe"
+ ],
+ "x-ms-correlation-request-id": [
+ "e0fbea32-c0d5-41a6-a01e-f7ad002b0efe"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20180326T222438Z:e0fbea32-c0d5-41a6-a01e-f7ad002b0efe"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 26 Mar 2018 22:24:38 GMT"
+ ],
+ "Location": [
+ "https://api-dogfood.resources.windows-int.net/providers/Microsoft.Subscription/subscriptionOperations/599f8500-c2b8-4b4b-9295-d563e3b554dd?api-version=2018-03-01-preview"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.5"
+ ],
+ "X-AspNet-Version": [
+ "4.0.30319"
+ ],
+ "X-Powered-By": [
+ "ASP.NET"
+ ]
+ },
+ "StatusCode": 202
+ },
+ {
+ "RequestUri": "/providers/Microsoft.Subscription/subscriptionOperations/599f8500-c2b8-4b4b-9295-d563e3b554dd?api-version=2018-03-01-preview",
+ "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL3N1YnNjcmlwdGlvbk9wZXJhdGlvbnMvNTk5Zjg1MDAtYzJiOC00YjRiLTkyOTUtZDU2M2UzYjU1NGRkP2FwaS12ZXJzaW9uPTIwMTgtMDMtMDEtcHJldmlldw==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.7.2633.0",
+ "OSName/Windows10Enterprise",
+ "OSVersion/6.3.16299",
+ "Microsoft.Azure.Management.Subscription.SubscriptionClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"subscriptionLink\": \"/subscriptions/0b32443b-93cf-48f0-b003-7e4d6b968946\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "74"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "api-supported-versions": [
+ "2018-03-01-preview"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-tenant-reads": [
+ "14999"
+ ],
+ "x-ms-request-id": [
+ "99902f9b-a2dd-41a4-b4ee-b5ac2d7d08a5"
+ ],
+ "x-ms-correlation-request-id": [
+ "99902f9b-a2dd-41a4-b4ee-b5ac2d7d08a5"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20180326T222449Z:99902f9b-a2dd-41a4-b4ee-b5ac2d7d08a5"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 26 Mar 2018 22:24:48 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.5"
+ ],
+ "X-AspNet-Version": [
+ "4.0.30319"
+ ],
+ "X-Powered-By": [
+ "ASP.NET"
+ ]
+ },
+ "StatusCode": 200
+ },
+ {
+ "RequestUri": "/providers/Microsoft.Subscription/subscriptionOperations/599f8500-c2b8-4b4b-9295-d563e3b554dd?api-version=2018-03-01-preview",
+ "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL3N1YnNjcmlwdGlvbk9wZXJhdGlvbnMvNTk5Zjg1MDAtYzJiOC00YjRiLTkyOTUtZDU2M2UzYjU1NGRkP2FwaS12ZXJzaW9uPTIwMTgtMDMtMDEtcHJldmlldw==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "User-Agent": [
+ "FxVersion/4.7.2633.0",
+ "OSName/Windows10Enterprise",
+ "OSVersion/6.3.16299",
+ "Microsoft.Azure.Management.Subscription.SubscriptionClient/1.0.0.0"
+ ]
+ },
+ "ResponseBody": "{\r\n \"subscriptionLink\": \"/subscriptions/29165a61-87c6-47fe-adc1-4260ff9420a0\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Length": [
+ "74"
+ ],
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "api-supported-versions": [
+ "2018-03-01-preview"
+ ],
+ "X-Content-Type-Options": [
+ "nosniff"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ],
+ "x-ms-ratelimit-remaining-tenant-reads": [
+ "14998"
+ ],
+ "x-ms-request-id": [
+ "cf90ccc2-7b5f-4afe-8c31-052cf5f5cacf"
+ ],
+ "x-ms-correlation-request-id": [
+ "cf90ccc2-7b5f-4afe-8c31-052cf5f5cacf"
+ ],
+ "x-ms-routing-request-id": [
+ "CENTRALUS:20180326T222449Z:cf90ccc2-7b5f-4afe-8c31-052cf5f5cacf"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 26 Mar 2018 22:24:49 GMT"
+ ],
+ "Server": [
+ "Microsoft-IIS/8.5"
+ ],
+ "X-AspNet-Version": [
+ "4.0.30319"
+ ],
+ "X-Powered-By": [
+ "ASP.NET"
+ ]
+ },
+ "StatusCode": 200
+ }
+ ],
+ "Names": {},
+ "Variables": {
+ "SubscriptionId": "df8cd511-7137-41f2-b2e9-48dc00a0b70f"
+ }
+}
\ No newline at end of file
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SpecTestSupport.Subscription/SubscriptionTestUtilities.cs b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SpecTestSupport.Subscription/SubscriptionTestUtilities.cs
index d061b5aae87c..080225ea3b92 100644
--- a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SpecTestSupport.Subscription/SubscriptionTestUtilities.cs
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SpecTestSupport.Subscription/SubscriptionTestUtilities.cs
@@ -13,10 +13,10 @@ public static class SubscriptionTestUtilities
///
/// the test class
/// A subscription client, created from the current context (environment variables)
- public static SubscriptionDefinitionsClient GetSubscriptionDefinitionClientWithHandler(this TestBase testBase, MockContext context, RecordedDelegatingHandler handler)
+ public static SubscriptionClient GetSubscriptionClientWithHandler(this TestBase testBase, MockContext context, RecordedDelegatingHandler handler)
{
handler.IsPassThrough = true;
- var client = context.GetServiceClient(handlers: handler);
+ var client = context.GetServiceClient(handlers: handler);
return client;
}
}
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SubscriptionCreationTests.ScenarioTests.cs b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SubscriptionCreationTests.ScenarioTests.cs
new file mode 100644
index 000000000000..1e8e280b59c5
--- /dev/null
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SubscriptionCreationTests.ScenarioTests.cs
@@ -0,0 +1,102 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
+using FullDesktop.Tests.Helpers;
+using FullDesktop.Tests.SpecTestSupport.Subscription;
+using Microsoft.Azure.Management.Subscription;
+using Microsoft.Azure.Management.Subscription.Models;
+using Microsoft.Azure.Test.HttpRecorder;
+using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
+using Microsoft.Rest.TransientFaultHandling;
+using Newtonsoft.Json;
+using System;
+using System.Collections;
+using System.Net;
+using System.Reflection;
+using System.Text;
+using Xunit;
+
+namespace FullDesktop.Tests
+{
+ ///
+ /// These tests exercise Microsoft.Subscription/subscriptionDefinitions PUT, GET and LIST
+ /// This api can be used to create, get and list subscriptions.
+ ///
+ /// To run tests, output Test\Windoows\Test Explorer and find these tests in the list. If they don't show up, then double check that the nugets have been installed correctly.
+ /// To Record:
+ /// - use the vs 2017 powershell command prompt
+ /// - run azure-sdk-for-net\tools> Import-Module .\Repo-Tasks.psd1
+ /// - set the following with a tenantId, subscriptionId, and userId
+ /// $env:TEST_CSM_ORGID_AUTHENTICATION = "SubscriptionId=00000000-0000-0000-0000-000000000000;HttpRecorderMode=Record;Environment=Dogfood;UserId=xxxxxxxxxxxxxx@live.com;AADTenant=00000000-0000-0000-0000-000000000000"
+ /// - set the mode as record
+ /// $env:AZURE_TEST_MODE = "Record"
+ /// - set the output directory for where you want to record session files to be placed:
+ /// $Varname="OutputDirectory"
+ /// Set-Item "env:OutputDirectory" "D:\src\xxxxxxxx\azure-sdk-for-net\xxxxxx\SessionRecords"
+ /// - invoke vs: devenv .\Resources.sln
+ ///
+ public class LiveSubscriptionCreationTests : TestBase
+ {
+ public SubscriptionClient GetSubscriptionClient(MockContext context, RecordedDelegatingHandler handler)
+ {
+ handler.IsPassThrough = true;
+ var client = this.GetSubscriptionClientWithHandler(context, handler);
+ if (HttpMockServer.Mode == HttpRecorderMode.Playback)
+ {
+ client.LongRunningOperationRetryTimeout = 0;
+ }
+
+ return client;
+ }
+
+ [Fact]
+ public void CreateSubscription()
+ {
+ var env = new StringBuilder();
+ foreach (DictionaryEntry e in System.Environment.GetEnvironmentVariables())
+ {
+ env = env.Append(e.Key + " " + e.Value + "\r\n");
+ }
+ HttpMockServer.RecordsDirectory = GetSessionsDirectoryPath();
+ var handler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK };
+
+ using (MockContext context = MockContext.Start(this.GetType().FullName))
+ {
+ const string enrollmentAccountName = "465c11a0-38c3-4ecc-92e9-996c69ae9e76";
+ const string offerType = "MS-AZR-0017P";
+ var body = new SubscriptionCreationParameters()
+ {
+ DisplayName = "TestSubscription_AzureSDK",
+ OfferType = offerType
+ };
+ var client = GetSubscriptionClient(context, handler);
+ client.SetRetryPolicy(new RetryPolicy(1));
+ var subscriptionResult = client.SubscriptionFactory.CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(
+ enrollmentAccountName, body).ConfigureAwait(false).GetAwaiter().GetResult();
+
+ Assert.Equal(HttpStatusCode.OK, subscriptionResult.Response.StatusCode);
+ Assert.NotNull(subscriptionResult);
+ Assert.NotNull(subscriptionResult.Body.SubscriptionLink);
+ Assert.StartsWith("/subscriptions", subscriptionResult.Body.SubscriptionLink);
+ }
+ }
+
+ private static bool IsRecordMode()
+ {
+ return Environment.GetEnvironmentVariable("AZURE_TEST_MODE") == "Record";
+ }
+
+ private static string GetSessionsDirectoryPath()
+ {
+ string dir = Environment.GetEnvironmentVariable("OutputDirectory");
+ if (!IsRecordMode())
+ {
+ // get the directory where the dll is being copied from
+ // then cut off the file:/// and change the forward slash to backslahes
+ string temp = Assembly.GetExecutingAssembly().CodeBase.Substring(0, Assembly.GetExecutingAssembly().CodeBase.LastIndexOf('/') + 1) + "SessionRecords";
+ dir = temp.Substring(8).Replace('/', '\\');
+ }
+ return dir;
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SubscriptionDefinitionTests.ScenarioTests.cs b/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SubscriptionDefinitionTests.ScenarioTests.cs
deleted file mode 100644
index 80fe95f583f9..000000000000
--- a/src/SDKs/Subscription/Subscription.Tests/Subscription.FullDesktop.Tests/SubscriptionDefinitionTests.ScenarioTests.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-using FullDesktop.Tests.Helpers;
-using FullDesktop.Tests.SpecTestSupport.Subscription;
-using Microsoft.Azure.Management.Subscription;
-using Microsoft.Azure.Management.Subscription.Models;
-using Microsoft.Azure.Test.HttpRecorder;
-using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
-using Microsoft.Rest.TransientFaultHandling;
-using Newtonsoft.Json;
-using System;
-using System.Collections;
-using System.Net;
-using System.Reflection;
-using System.Text;
-using Xunit;
-
-namespace FullDesktop.Tests
-{
- ///
- /// These tests exercise Microsoft.Subscription/subscriptionDefinitions PUT, GET and LIST
- /// This api can be used to create, get and list subscriptions.
- ///
- /// To run tests, output Test\Windoows\Test Explorer and find these tests in the list. If they don't show up, then double check that the nugets have been installed correctly.
- /// To Record:
- /// - use the vs 2017 powershell command prompt
- /// - run azure-sdk-for-net\tools> Import-Module .\Repo-Tasks.psd1
- /// - set the following with a tenantId, subscriptionId, and userId
- /// $env:TEST_CSM_ORGID_AUTHENTICATION = "SubscriptionId=00000000-0000-0000-0000-000000000000;HttpRecorderMode=Record;Environment=Dogfood;UserId=xxxxxxxxxxxxxx@live.com;AADTenant=00000000-0000-0000-0000-000000000000"
- /// - set the mode as record
- /// $env:AZURE_TEST_MODE = "Record"
- /// - set the name of the subscription definition that you would like to get
- /// $Varname="SubscriptionDefinitionName"
- /// Set-Item "env:SubscriptionDefinitionName" "mySubscriptionDefinitionNameToGet"
- /// - set the output directory for where you want to record session files to be placed:
- /// $Varname="OutputDirectory"
- /// Set-Item "env:OutputDirectory" "D:\src\xxxxxxxx\azure-sdk-for-net\xxxxxx\SessionRecords"
- /// - invoke vs: devenv .\Resources.sln
- ///
- public class LiveSubTests : TestBase
- {
- public SubscriptionDefinitionsClient GetSubscriptionDefinitionClient(MockContext context, RecordedDelegatingHandler handler)
- {
- handler.IsPassThrough = true;
- var client = this.GetSubscriptionDefinitionClientWithHandler(context, handler);
- if (HttpMockServer.Mode == HttpRecorderMode.Playback)
- {
- client.LongRunningOperationRetryTimeout = 0;
- }
-
- return client;
- }
-
- [Fact]
- public void CreateSubscriptionDefinition()
- {
- var env = new StringBuilder();
- foreach (DictionaryEntry e in System.Environment.GetEnvironmentVariables())
- {
- env = env.Append(e.Key + " " + e.Value + "\r\n");
- }
- HttpMockServer.RecordsDirectory = GetSessionsDirectoryPath();
- var handler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK };
-
- using (MockContext context = MockContext.Start(this.GetType().FullName))
- {
- string subscriptionDefinitionName =
- (IsRecordMode())
- ? "MySubDef" + DateTime.Now.ToString("yyyyMMddHHmmssffff")
- : "MySubDefYYYY11DD2241061935";
- const string offerType = "MS-AZR-0017P";
- var body = new SubscriptionDefinition()
- {
- SubscriptionDisplayName = subscriptionDefinitionName,
- OfferType = offerType
- };
- var client = GetSubscriptionDefinitionClient(context, handler);
- client.SetRetryPolicy(new RetryPolicy(1));
- var subscriptionDefinitionResult = client.SubscriptionDefinitions.CreateWithHttpMessagesAsync(subscriptionDefinitionName, body).ConfigureAwait(false).GetAwaiter().GetResult();
-
- Assert.Equal(HttpStatusCode.OK, subscriptionDefinitionResult.Response.StatusCode);
- Assert.NotNull(subscriptionDefinitionResult);
- Assert.Equal(subscriptionDefinitionName, subscriptionDefinitionResult.Body.Name);
- Assert.NotNull(subscriptionDefinitionResult.Body);
- Assert.Equal(offerType, subscriptionDefinitionResult.Body.OfferType);
- Assert.NotNull(subscriptionDefinitionResult.Body.SubscriptionId);
- }
- }
-
- [Fact]
- public void ListSubscriptionDefinitions()
- {
- HttpMockServer.RecordsDirectory = GetSessionsDirectoryPath();
- var handler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK };
-
- using (MockContext context = MockContext.Start(this.GetType().FullName))
- {
- var client = GetSubscriptionDefinitionClient(context, handler);
- client.SetRetryPolicy(new RetryPolicy(1));
- var subscriptionDefinitionResult = client.SubscriptionDefinitions.ListWithHttpMessagesAsync().ConfigureAwait(false).GetAwaiter().GetResult();
- Console.WriteLine("result = " + JsonConvert.SerializeObject(subscriptionDefinitionResult));
- Assert.Equal(HttpStatusCode.OK, subscriptionDefinitionResult.Response.StatusCode);
- Assert.NotNull(subscriptionDefinitionResult);
- }
- }
-
- [Fact]
- public void GetSubscriptionDefinition()
- {
- HttpMockServer.RecordsDirectory = GetSessionsDirectoryPath();
- string subscriptionDefinitionName = Environment.GetEnvironmentVariable("SubscriptionDefinitionName");
- if (string.IsNullOrWhiteSpace(subscriptionDefinitionName))
- {
- subscriptionDefinitionName = "mjf201711161710";
- }
- var handler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK };
-
- using (MockContext context = MockContext.Start(this.GetType().FullName))
- {
- var client = GetSubscriptionDefinitionClient(context, handler);
- client.SetRetryPolicy(new RetryPolicy(1));
- var subscriptionDefinitionResult = client.SubscriptionDefinitions.GetWithHttpMessagesAsync(subscriptionDefinitionName).ConfigureAwait(false).GetAwaiter().GetResult();
-
- Assert.Equal(HttpStatusCode.OK, subscriptionDefinitionResult.Response.StatusCode);
- Assert.NotNull(subscriptionDefinitionResult);
- Assert.NotNull(subscriptionDefinitionResult.Body);
- }
- }
-
- private static bool IsRecordMode()
- {
- return Environment.GetEnvironmentVariable("AZURE_TEST_MODE") == "Record";
- }
-
- private static string GetSessionsDirectoryPath()
- {
- string dir = Environment.GetEnvironmentVariable("OutputDirectory");
- if (!IsRecordMode())
- {
- // get the directory where the dll is being copied from
- // then cut off the file:/// and change the forward slash to backslahes
- string temp = Assembly.GetExecutingAssembly().CodeBase.Substring(0, Assembly.GetExecutingAssembly().CodeBase.LastIndexOf('/') + 1) + "SessionRecords";
- dir = temp.Substring(8).Replace('/', '\\');
- }
- return dir;
- }
- }
-}
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionCreationTests.InMemory.cs b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionCreationTests.InMemory.cs
new file mode 100644
index 000000000000..04472129ed99
--- /dev/null
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionCreationTests.InMemory.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Subscription;
+using Microsoft.Azure.Management.Subscription.Models;
+using Microsoft.Azure.Test;
+using Microsoft.Azure.Test.HttpRecorder;
+using Microsoft.Rest;
+using Microsoft.Rest.Azure.OData;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Xunit;
+
+namespace ResourceGroups.Tests
+{
+ public class InMemorySubscriptionCreationTests
+ {
+ private const string SubscriptionLink = "/subscriptions/0ebc0024-9459-448b-aef4-6617b6f8d217";
+ private const string SubscriptionCreationResult = @"{
+ 'SubscriptionLink': '" + SubscriptionLink + "'}";
+
+ public ISubscriptionClient GetSubscriptionClient(RecordedDelegatingHandler handler, Guid? subscriptionId = null)
+ {
+ TokenCredentials token = subscriptionId.HasValue
+ ? new TokenCredentials(subscriptionId.Value.ToString(), "abc123")
+ : new TokenCredentials("abc123");
+ handler.IsPassThrough = false;
+ var client = new SubscriptionClient(token, handler);
+ HttpMockServer.Mode = HttpRecorderMode.Playback;
+ return client;
+ }
+
+ [Fact]
+ public async Task SubscriptionDefition_ValidateCreate()
+ {
+ var response = new HttpResponseMessage(HttpStatusCode.OK)
+ {
+ Content = new StringContent(SubscriptionCreationResult)
+ };
+ response.Headers.Add("x-ms-request-id", "1");
+ var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
+ var testPrincipal = new AdPrincipal(Guid.NewGuid().ToString());
+ var body = new SubscriptionCreationParameters()
+ {
+ OfferType = "MS-AZR-0017P",
+ DisplayName = "My Azure Subscription Name",
+ Owners = new List () { testPrincipal }
+ };
+ var subscriptionResult = await GetSubscriptionClient(handler)
+ .SubscriptionFactory.CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(Guid.NewGuid().ToString(), body);
+ Assert.NotNull(subscriptionResult);
+ Assert.NotNull(subscriptionResult.Response);
+ Assert.True(subscriptionResult.Response.IsSuccessStatusCode);
+ Assert.Equal(subscriptionResult.Body.SubscriptionLink, SubscriptionLink);
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionDefinitionTests.cs b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionDefinitionTests.cs
deleted file mode 100644
index dc09028c936b..000000000000
--- a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionDefinitionTests.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using Microsoft.Azure.Management.Subscription;
-using Microsoft.Azure.Management.Subscription.Models;
-using Microsoft.Azure.Test;
-using Microsoft.Azure.Test.HttpRecorder;
-using Microsoft.Rest;
-using Microsoft.Rest.Azure.OData;
-using Newtonsoft.Json.Linq;
-using Xunit;
-
-namespace ResourceGroups.Tests
-{
- public class InMemorySubscriptionDefinitionTests
- {
- private const string TestSubscriptionDefinitionName = "MyNewSubscription";
- private readonly Guid _testGroupId = new Guid("d7bd0f12-2920-450e-a54a-4c35d851a3fc");
-
- private const string NextLink =
- "/providers/Microsoft.SubscriptionDefinitions/subscriptionDefinitions?nextPage=aiasdfjlkfi3212asadfdf";
- private const string SubscriptionDefinition01 = @"{
- 'id': '/providers/Microsoft.SubscriptionDefinitions/subscriptionDefinitions/MySubscriptionDefinitionName',
- 'type': 'Microsoft.Subscription.subscriptionDefinitions',
- 'name': 'MySubscriptionDefinitionName',
- 'properties': {
- 'subscriptionId': '0ebc0024-9459-448b-aef4-6617b6f8d217',
- 'subscriptionDisplayName': 'My Azure Subscription Name',
- 'offerType': 'MS-AZR-0017P',
- 'etag': 'somestring'
- }
- }";
-
- public ISubscriptionDefinitionsClient GetSubscriptionDefinitionClient(RecordedDelegatingHandler handler, Guid? subscriptionId = null)
- {
- TokenCredentials token = subscriptionId.HasValue
- ? new TokenCredentials(subscriptionId.Value.ToString(), "abc123")
- : new TokenCredentials("abc123");
- handler.IsPassThrough = false;
- var client = new SubscriptionDefinitionsClient(token, handler);
- HttpMockServer.Mode = HttpRecorderMode.Playback;
- return client;
- }
-
- private void ValidateSubscriptionDefinition01Values(SubscriptionDefinition subscriptionDefinitionResult)
- {
- Assert.NotNull(subscriptionDefinitionResult);
- Assert.Equal("/providers/Microsoft.SubscriptionDefinitions/subscriptionDefinitions/MySubscriptionDefinitionName", subscriptionDefinitionResult.Id);
- Assert.Equal("Microsoft.Subscription.subscriptionDefinitions", subscriptionDefinitionResult.Type);
- Assert.Equal("MySubscriptionDefinitionName", subscriptionDefinitionResult.Name);
- Assert.Equal("0ebc0024-9459-448b-aef4-6617b6f8d217", subscriptionDefinitionResult.SubscriptionId);
- Assert.Equal("My Azure Subscription Name", subscriptionDefinitionResult.SubscriptionDisplayName);
- Assert.Equal("MS-AZR-0017P", subscriptionDefinitionResult.OfferType);
- }
-
- private void ValidateSubscriptionDefinition01InArray(IEnumerable items)
- {
- foreach (var subDef in items)
- {
- ValidateSubscriptionDefinition01Values(subDef);
- }
- }
-
- [Fact]
- public void SubscriptionDefition_ValidateGet()
- {
- var response = new HttpResponseMessage(HttpStatusCode.OK)
- {
- Content = new StringContent(SubscriptionDefinition01)
- };
- response.Headers.Add("x-ms-request-id", "1");
- var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
- var subscriptionDefinitionResult = GetSubscriptionDefinitionClient(handler)
- .SubscriptionDefinitions.Get(TestSubscriptionDefinitionName);
- ValidateSubscriptionDefinition01Values(subscriptionDefinitionResult);
- }
-
- [Fact]
- public void SubscriptionDefition_ValidateCreate()
- {
- var response = new HttpResponseMessage(HttpStatusCode.OK)
- {
- Content = new StringContent(SubscriptionDefinition01)
- };
- response.Headers.Add("x-ms-request-id", "1");
- var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
- var body = new SubscriptionDefinition()
- {
- OfferType = "MS-AZR-0017P",
- SubscriptionDisplayName = "My Azure Subscription Name"
- };
- var subscriptionDefinitionResult = GetSubscriptionDefinitionClient(handler)
- .SubscriptionDefinitions.Create(TestSubscriptionDefinitionName, body);
- ValidateSubscriptionDefinition01Values(subscriptionDefinitionResult);
- }
-
- [Fact]
- public void SubscriptionDefition_ValidateList()
- {
- var response = new HttpResponseMessage(HttpStatusCode.OK)
- {
- Content = new StringContent("{ 'value' : [ " + SubscriptionDefinition01 + " ] }")
- };
- response.Headers.Add("x-ms-request-id", "1");
- var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
- var subscriptionDefinitionResult = GetSubscriptionDefinitionClient(handler)
- .SubscriptionDefinitions.List();
- Assert.NotNull(subscriptionDefinitionResult.FirstOrDefault());
- ValidateSubscriptionDefinition01InArray(subscriptionDefinitionResult);
- }
-
- [Fact]
- public void SubscriptionDefition_ValidateListWithNextLink()
- {
- var response = new HttpResponseMessage(HttpStatusCode.OK)
- {
- Content = new StringContent("{ 'value' : [ " + SubscriptionDefinition01 + " ], 'nextLink': '" + NextLink + "' }")
- };
- response.Headers.Add("x-ms-request-id", "1");
- var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
- var subscriptionDefinitionResult = GetSubscriptionDefinitionClient(handler)
- .SubscriptionDefinitions.List();
- Assert.NotNull(subscriptionDefinitionResult.FirstOrDefault());
- Assert.Equal(NextLink, subscriptionDefinitionResult.NextPageLink);
- ValidateSubscriptionDefinition01InArray(subscriptionDefinitionResult);
- }
- }
-}
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionTests.InMemory.cs b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionTests.InMemory.cs
new file mode 100644
index 000000000000..7d4f58701ebf
--- /dev/null
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/InMemoryTests/SubscriptionTests.InMemory.cs
@@ -0,0 +1,177 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+using Microsoft.Rest;
+using Microsoft.Azure.Test.HttpRecorder;
+using System;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using Xunit;
+using Microsoft.Azure.Management.Subscription;
+using Microsoft.Azure.Management.Subscription.Models;
+
+namespace ResourceGroups.Tests
+{
+ public class InMemorySubscriptionTests
+ {
+ public SubscriptionClient GetSubscriptionClient(RecordedDelegatingHandler handler)
+ {
+ var subscriptionId = Guid.NewGuid().ToString();
+ var token = new TokenCredentials(subscriptionId, "abc123");
+ handler.IsPassThrough = false;
+ var client = new SubscriptionClient(token, handler);
+ HttpMockServer.Mode = HttpRecorderMode.Playback;
+ return client;
+ }
+
+ [Fact]
+ public void ListSubscriptionLocations()
+ {
+ var response = new HttpResponseMessage(HttpStatusCode.OK)
+ {
+ Content = new StringContent(@"{
+ 'value': [{
+ 'id': '/subscriptions/9167af2d-c13e-4d34-9a57-8f37dba6ff31/locations/eastasia',
+ 'name': 'eastasia',
+ 'displayName': 'East Asia',
+ 'longitude': '114.188',
+ 'latitude': '22.267'
+ },
+ {
+ 'id': '/subscriptions/9167af2d-c13e-4d34-9a57-8f37dba6ff31/locations/southeastasia',
+ 'name': 'southeastasia',
+ 'displayName': 'Southeast Asia',
+ 'longitude': '103.833',
+ 'latitude': '1.283'
+ }]
+ }")
+ };
+
+ response.Headers.Add("x-ms-request-id", "1");
+
+ var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
+
+ var client = GetSubscriptionClient(handler);
+
+ string subscriptionId = "9167af2d-c13e-4d34-9a57-8f37dba6ff31";
+
+ var listLocationsResult = client.Subscriptions.ListLocations(subscriptionId);
+
+ // Validate headers
+ Assert.Equal(HttpMethod.Get, handler.Method);
+ Assert.NotNull(handler.RequestHeaders.GetValues("Authorization"));
+
+ // Validate result
+ Assert.NotNull(listLocationsResult);
+ Assert.Equal("/subscriptions/9167af2d-c13e-4d34-9a57-8f37dba6ff31/locations/eastasia", listLocationsResult.FirstOrDefault().Id);
+ Assert.Equal("eastasia", listLocationsResult.FirstOrDefault().Name);
+ Assert.Equal("East Asia", listLocationsResult.FirstOrDefault().DisplayName);
+ Assert.Equal("114.188", listLocationsResult.FirstOrDefault().Longitude);
+ Assert.Equal("22.267", listLocationsResult.FirstOrDefault().Latitude);
+ }
+
+ [Fact]
+ public void ListSubscriptions()
+ {
+ var response = new HttpResponseMessage(HttpStatusCode.OK)
+ {
+ Content = new StringContent(@"{
+ 'value': [{
+ 'id': '/subscriptions/38b598fc-e57a-423f-b2e7-dc0ddb631f1f',
+ 'subscriptionId': '38b598fc-e57a-423f-b2e7-dc0ddb631f1f',
+ 'displayName': 'Visual Studio Ultimate with MSDN',
+ 'state': 'Disabled',
+ 'subscriptionPolicies': {
+ 'locationPlacementId': 'Public_2014-09-01',
+ 'quotaId': 'MSDN_2014-09-01'
+ }
+ },
+ {
+ 'id': '/subscriptions/9167af2d-c13e-4d34-9a57-8f37dba6ff31',
+ 'subscriptionId': '9167af2d-c13e-4d34-9a57-8f37dba6ff31',
+ 'displayName': 'Subscription-1',
+ 'state': 'Enabled',
+ 'subscriptionPolicies': {
+ 'locationPlacementId': 'Internal_2014-09-01',
+ 'quotaId': 'Internal_2014-09-01'
+ }
+ },
+ {
+ 'id': '/subscriptions/78814224-3c2d-4932-9fe3-913da0f278ee',
+ 'subscriptionId': '78814224-3c2d-4932-9fe3-913da0f278ee',
+ 'displayName': 'Cloud Tools Development',
+ 'state': 'Enabled',
+ 'subscriptionPolicies': {
+ 'locationPlacementId': 'Internal_2014-09-01',
+ 'quotaId': 'Internal_2014-09-01'
+ }
+ }]
+ }")
+ };
+
+ response.Headers.Add("x-ms-request-id", "1");
+
+ var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
+
+ var client = GetSubscriptionClient(handler);
+
+ var listSubscriptionsResult = client.Subscriptions.List();
+
+ // Validate headers
+ Assert.Equal(HttpMethod.Get, handler.Method);
+ Assert.NotNull(handler.RequestHeaders.GetValues("Authorization"));
+
+ // Validate result
+ Assert.NotNull(listSubscriptionsResult);
+ Assert.Equal("/subscriptions/38b598fc-e57a-423f-b2e7-dc0ddb631f1f", listSubscriptionsResult.FirstOrDefault().Id);
+ Assert.Equal("38b598fc-e57a-423f-b2e7-dc0ddb631f1f", listSubscriptionsResult.FirstOrDefault().SubscriptionId);
+ Assert.Equal("Visual Studio Ultimate with MSDN", listSubscriptionsResult.FirstOrDefault().DisplayName);
+ Assert.Equal("Disabled", listSubscriptionsResult.FirstOrDefault().State.ToString());
+ Assert.NotNull(listSubscriptionsResult.FirstOrDefault().SubscriptionPolicies);
+ Assert.Equal("Public_2014-09-01", listSubscriptionsResult.FirstOrDefault().SubscriptionPolicies.LocationPlacementId);
+ Assert.Equal("MSDN_2014-09-01", listSubscriptionsResult.FirstOrDefault().SubscriptionPolicies.QuotaId);
+ }
+
+ [Fact]
+ public void GetSubscription()
+ {
+ var response = new HttpResponseMessage(HttpStatusCode.OK)
+ {
+ Content = new StringContent(@"{
+ 'id': '/subscriptions/38b598fc-e57a-423f-b2e7-dc0ddb631f1f',
+ 'subscriptionId': '38b598fc-e57a-423f-b2e7-dc0ddb631f1f',
+ 'displayName': 'Visual Studio Ultimate with MSDN',
+ 'state': 'Disabled',
+ 'subscriptionPolicies': {
+ 'locationPlacementId': 'Public_2014-09-01',
+ 'quotaId': 'MSDN_2014-09-01'
+ }
+ }")
+ };
+
+ response.Headers.Add("x-ms-request-id", "1");
+
+ var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
+
+ var client = GetSubscriptionClient(handler);
+
+ string subscriptionId = "9167af2d-c13e-4d34-9a57-8f37dba6ff31";
+
+ var getSubscriptionResult = client.Subscriptions.Get(subscriptionId);
+
+ // Validate headers
+ Assert.Equal(HttpMethod.Get, handler.Method);
+ Assert.NotNull(handler.RequestHeaders.GetValues("Authorization"));
+
+ // Validate result
+ Assert.NotNull(getSubscriptionResult);
+ Assert.Equal("/subscriptions/38b598fc-e57a-423f-b2e7-dc0ddb631f1f", getSubscriptionResult.Id);
+ Assert.Equal("38b598fc-e57a-423f-b2e7-dc0ddb631f1f", getSubscriptionResult.SubscriptionId);
+ Assert.Equal("Visual Studio Ultimate with MSDN", getSubscriptionResult.DisplayName);
+ Assert.Equal("Disabled", getSubscriptionResult.State.ToString());
+ Assert.NotNull(getSubscriptionResult.SubscriptionPolicies);
+ Assert.Equal("Public_2014-09-01", getSubscriptionResult.SubscriptionPolicies.LocationPlacementId);
+ Assert.Equal("MSDN_2014-09-01", getSubscriptionResult.SubscriptionPolicies.QuotaId);
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/ScenarioTests/SubscriptionTests.ScenarioTests.cs b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/ScenarioTests/SubscriptionTests.ScenarioTests.cs
new file mode 100644
index 000000000000..cb204b0f5a3a
--- /dev/null
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/ScenarioTests/SubscriptionTests.ScenarioTests.cs
@@ -0,0 +1,66 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+
+using System.Linq;
+using System.Net;
+using Microsoft.Azure.Management.Subscription;
+using Microsoft.Azure.Test;
+using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
+using Microsoft.Rest.TransientFaultHandling;
+using Xunit;
+
+namespace ResourceGroups.Tests
+{
+ public class LiveSubscriptionTests : TestBase
+ {
+ public SubscriptionClient GetSubscriptionClient(MockContext context, RecordedDelegatingHandler handler)
+ {
+ handler.IsPassThrough = true;
+ var client = this.GetSubscriptionClientWithHandler(context, handler);
+ return client;
+ }
+
+ [Fact]
+ public void ListSubscriptions()
+ {
+ var handler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK };
+
+ using (MockContext context = MockContext.Start(this.GetType().FullName))
+ {
+ var client = GetSubscriptionClient(context, handler);
+ client.SetRetryPolicy(new RetryPolicy(1));
+
+ var subscriptions = client.Subscriptions.List();
+
+ Assert.NotNull(subscriptions);
+ Assert.NotEqual(0, subscriptions.Count());
+ Assert.NotNull(subscriptions.First().Id);
+ Assert.NotNull(subscriptions.First().SubscriptionId);
+ Assert.NotNull(subscriptions.First().DisplayName);
+ Assert.NotNull(subscriptions.First().State);
+ }
+ }
+
+ [Fact]
+ public void GetSubscriptionDetails()
+ {
+ var handler = new RecordedDelegatingHandler() { StatusCodeToReturn = HttpStatusCode.OK };
+
+ using (MockContext context = MockContext.Start(this.GetType().FullName))
+ {
+ const string subscriptionId = "11e23d44-5f84-4f2f-908f-e3bd3195243d";
+ var client = GetSubscriptionClient(context, handler);
+ //var rmclient = GetResourceManagementClient(context, handler);
+ client.SetRetryPolicy(new RetryPolicy(1));
+
+ var subscriptionDetails = client.Subscriptions.Get(subscriptionId);
+
+ Assert.NotNull(subscriptionDetails);
+ Assert.NotNull(subscriptionDetails.Id);
+ Assert.NotNull(subscriptionDetails.SubscriptionId);
+ Assert.NotNull(subscriptionDetails.DisplayName);
+ Assert.NotNull(subscriptionDetails.State);
+ }
+ }
+ }
+}
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SessionRecords/ResourceGroups.Tests.LiveSubscriptionTests/GetSubscriptionDetails.json b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SessionRecords/ResourceGroups.Tests.LiveSubscriptionTests/GetSubscriptionDetails.json
new file mode 100644
index 000000000000..481db70194ef
--- /dev/null
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SessionRecords/ResourceGroups.Tests.LiveSubscriptionTests/GetSubscriptionDetails.json
@@ -0,0 +1,63 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d?api-version=2016-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMTFlMjNkNDQtNWY4NC00ZjJmLTkwOGYtZTNiZDMxOTUyNDNkP2FwaS12ZXJzaW9uPTIwMTYtMDYtMDE=",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "bca4a7b4-345d-4186-bcea-b4f0bd9bbde6"
+ ],
+ "accept-language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.25009.03",
+ "Microsoft.Azure.Management.ResourceManager.SubscriptionClient/2.0.0-preview"
+ ]
+ },
+ "ResponseBody": "{\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d\",\r\n \"subscriptionId\": \"11e23d44-5f84-4f2f-908f-e3bd3195243d\",\r\n \"displayName\": \"Visual Studio Enterprise\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Public_2014-09-01\",\r\n \"quotaId\": \"MSDN_2014-09-01\",\r\n \"spendingLimit\": \"On\"\r\n },\r\n \"authorizationSource\": \"RoleBased\"\r\n}",
+ "ResponseHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 01 May 2017 20:48:18 GMT"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-ratelimit-remaining-subscription-reads": [
+ "14999"
+ ],
+ "x-ms-request-id": [
+ "c2fba440-ff5a-4439-aaef-50230a841dc2"
+ ],
+ "x-ms-correlation-request-id": [
+ "c2fba440-ff5a-4439-aaef-50230a841dc2"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170501T204819Z:c2fba440-ff5a-4439-aaef-50230a841dc2"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ]
+ },
+ "StatusCode": 200
+ }
+ ],
+ "Names": {},
+ "Variables": {
+ "SubscriptionId": "11e23d44-5f84-4f2f-908f-e3bd3195243d"
+ }
+}
\ No newline at end of file
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SessionRecords/ResourceGroups.Tests.LiveSubscriptionTests/ListSubscriptions.json b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SessionRecords/ResourceGroups.Tests.LiveSubscriptionTests/ListSubscriptions.json
new file mode 100644
index 000000000000..4aea781f00f5
--- /dev/null
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SessionRecords/ResourceGroups.Tests.LiveSubscriptionTests/ListSubscriptions.json
@@ -0,0 +1,66 @@
+{
+ "Entries": [
+ {
+ "RequestUri": "/subscriptions?api-version=2016-06-01",
+ "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnM/YXBpLXZlcnNpb249MjAxNi0wNi0wMQ==",
+ "RequestMethod": "GET",
+ "RequestBody": "",
+ "RequestHeaders": {
+ "x-ms-client-request-id": [
+ "09cbab78-5be1-4e3b-817d-83bda3adbc71"
+ ],
+ "accept-language": [
+ "en-US"
+ ],
+ "User-Agent": [
+ "FxVersion/4.6.25009.03",
+ "Microsoft.Azure.Management.ResourceManager.SubscriptionClient/2.0.0-preview"
+ ]
+ },
+ "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/623d50f1-4fa8-4e46-a967-a9214aed43ab\",\r\n \"subscriptionId\": \"623d50f1-4fa8-4e46-a967-a9214aed43ab\",\r\n \"displayName\": \"CSM Test Environment Services\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Internal_2014-09-01\",\r\n \"quotaId\": \"Internal_2014-09-01\",\r\n \"spendingLimit\": \"Off\"\r\n },\r\n \"authorizationSource\": \"RoleBased\"\r\n },\r\n {\r\n \"id\": \"/subscriptions/11e23d44-5f84-4f2f-908f-e3bd3195243d\",\r\n \"subscriptionId\": \"11e23d44-5f84-4f2f-908f-e3bd3195243d\",\r\n \"displayName\": \"Visual Studio Enterprise\",\r\n \"state\": \"Enabled\",\r\n \"subscriptionPolicies\": {\r\n \"locationPlacementId\": \"Public_2014-09-01\",\r\n \"quotaId\": \"MSDN_2014-09-01\",\r\n \"spendingLimit\": \"On\"\r\n },\r\n \"authorizationSource\": \"RoleBased\"\r\n }\r\n ]\r\n}",
+ "ResponseHeaders": {
+ "Content-Type": [
+ "application/json; charset=utf-8"
+ ],
+ "Expires": [
+ "-1"
+ ],
+ "Cache-Control": [
+ "no-cache"
+ ],
+ "Date": [
+ "Mon, 01 May 2017 20:48:16 GMT"
+ ],
+ "Pragma": [
+ "no-cache"
+ ],
+ "Transfer-Encoding": [
+ "chunked"
+ ],
+ "Vary": [
+ "Accept-Encoding"
+ ],
+ "x-ms-ratelimit-remaining-tenant-reads": [
+ "14997"
+ ],
+ "x-ms-request-id": [
+ "8e1614dd-8c71-45ee-9cdf-a00d157c7141"
+ ],
+ "x-ms-correlation-request-id": [
+ "8e1614dd-8c71-45ee-9cdf-a00d157c7141"
+ ],
+ "x-ms-routing-request-id": [
+ "WESTUS2:20170501T204817Z:8e1614dd-8c71-45ee-9cdf-a00d157c7141"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
+ ]
+ },
+ "StatusCode": 200
+ }
+ ],
+ "Names": {},
+ "Variables": {
+ "SubscriptionId": "11e23d44-5f84-4f2f-908f-e3bd3195243d"
+ }
+}
\ No newline at end of file
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SpecTestSupport.Subscription/SubscriptionTestUtilities.cs b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SpecTestSupport.Subscription/SubscriptionTestUtilities.cs
index b7c748646efb..828f19720c51 100644
--- a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SpecTestSupport.Subscription/SubscriptionTestUtilities.cs
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/SpecTestSupport.Subscription/SubscriptionTestUtilities.cs
@@ -17,10 +17,10 @@ public static class SubscriptionTestUtilities
///
/// the test class
/// A subscription client, created from the current context (environment variables)
- public static SubscriptionDefinitionsClient GetSubscriptionDefinitionClientWithHandler(this TestBase testBase, MockContext context, RecordedDelegatingHandler handler)
+ public static SubscriptionClient GetSubscriptionClientWithHandler(this TestBase testBase, MockContext context, RecordedDelegatingHandler handler)
{
handler.IsPassThrough = true;
- var client = context.GetServiceClient(handlers: handler);
+ var client = context.GetServiceClient(handlers: handler);
return client;
}
}
diff --git a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/Subscription.Netcore.Tests.csproj b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/Subscription.Netcore.Tests.csproj
index a2a9dbfbf47b..d13fab2cca51 100644
--- a/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/Subscription.Netcore.Tests.csproj
+++ b/src/SDKs/Subscription/Subscription.Tests/Subscription.NetCore.Tests/Subscription.Netcore.Tests.csproj
@@ -18,4 +18,12 @@
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
\ No newline at end of file
diff --git a/src/SDKs/_metadata/subscription_resource-manager.txt b/src/SDKs/_metadata/subscription_resource-manager.txt
index 7362e250f4a1..6953d260c333 100644
--- a/src/SDKs/_metadata/subscription_resource-manager.txt
+++ b/src/SDKs/_metadata/subscription_resource-manager.txt
@@ -1,10 +1,17 @@
-2017-11-30 21:45:24 UTC
-
+Executing AutoRest command
+cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/subscription/resource-manager/readme.md --csharp --csharp-sdks-folder=D:\src\mjfrb-azure-sdk-for-net\azure-sdk-for-net\tools\..\src\SDKs\ --version=latest --reflect-api-versions
+2018-03-27 17:46:13 UTC
1) azure-rest-api-specs repository information
-GitHub user: Azure
-Branch: current
-Commit: 9ae8eeaa674385e8b387aceabd79eb00a5279d21
+GitHub fork: Azure
+Branch: master
+Commit: 074577afb7089dd8f2f6f38f630e81ada8ed7788
2) AutoRest information
Requested version: latest
-Bootstrapper version: C:\Users\wilcob\AppData\Roaming\npm `-- autorest@2.0.4210
+Bootstrapper version: C:\Users\jfrable\AppData\Roaming\npm `-- autorest@2.0.4245
+
+
+Latest installed version:
+.\tools\generate.ps1 was invoked by generate.ps1
+
+