diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs
index 00959d07113a..97083c595945 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs
@@ -40,11 +40,6 @@ public partial interface ISubscriptionClient : System.IDisposable
///
ServiceClientCredentials Credentials { get; }
- ///
- /// Subscription Id.
- ///
- string SubscriptionId { get; set; }
-
///
/// The preferred language for the response.
///
@@ -65,14 +60,29 @@ public partial interface ISubscriptionClient : System.IDisposable
///
- /// Gets the IOperations.
+ /// Gets the ISubscriptionsOperations.
///
- IOperations Operations { get; }
+ ISubscriptionsOperations Subscriptions { get; }
///
- /// Gets the ISubscriptionsOperations.
+ /// Gets the ISubscriptionOperationOperations.
///
- ISubscriptionsOperations Subscriptions { get; }
+ ISubscriptionOperationOperations SubscriptionOperation { get; }
+
+ ///
+ /// Gets the ISubscriptionFactoryOperations.
+ ///
+ ISubscriptionFactoryOperations SubscriptionFactory { get; }
+
+ ///
+ /// Gets the ISubscriptionOperations.
+ ///
+ ISubscriptionOperations SubscriptionOperations { get; }
+
+ ///
+ /// Gets the IOperations.
+ ///
+ IOperations Operations { get; }
///
/// Gets the ITenantsOperations.
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs
new file mode 100644
index 000000000000..a4b1ac267d9a
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionFactoryOperations.cs
@@ -0,0 +1,139 @@
+//
+// 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
+ {
+ ///
+ /// The operation to create a new Azure subscription
+ ///
+ ///
+ /// The name of the Microsoft Customer Agreement billing account for
+ /// which you want to create the subscription.
+ ///
+ ///
+ /// The name of the invoice section in the billing account for which
+ /// you want to create the subscription.
+ ///
+ ///
+ /// 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> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters 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> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to create a new Azure subscription
+ ///
+ ///
+ /// The name of the Microsoft Customer Agreement billing account for
+ /// which you want to create the subscription.
+ ///
+ ///
+ /// The name of the invoice section in the billing account for which
+ /// you want to create the subscription.
+ ///
+ ///
+ /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters 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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs
new file mode 100644
index 000000000000..60e72a69face
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs
@@ -0,0 +1,51 @@
+//
+// 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;
+
+ ///
+ /// SubscriptionOperationOperations operations.
+ ///
+ public partial interface ISubscriptionOperationOperations
+ {
+ ///
+ /// Get the status of the pending Microsoft.Subscription API
+ /// operations.
+ ///
+ ///
+ /// 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> GetWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs
new file mode 100644
index 000000000000..c1650a27a93e
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs
index 287996d867cb..ef734314a95c 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionsOperations.cs
@@ -24,8 +24,11 @@ namespace Microsoft.Azure.Management.Subscription
public partial interface ISubscriptionsOperations
{
///
- /// Cancels the subscription
+ /// The operation to cancel a subscription
///
+ ///
+ /// Subscription Id.
+ ///
///
/// The headers that will be added to request.
///
@@ -41,10 +44,13 @@ public partial interface ISubscriptionsOperations
///
/// Thrown when a required parameter is null
///
- Task> CancelWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> CancelWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Renames the subscription
+ /// The operation to rename a subscription
///
+ ///
+ /// Subscription Id.
+ ///
///
/// Subscription Name
///
@@ -63,7 +69,29 @@ public partial interface ISubscriptionsOperations
///
/// Thrown when a required parameter is null
///
- Task> RenameWithHttpMessagesAsync(SubscriptionName body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> RenameWithHttpMessagesAsync(string subscriptionId, SubscriptionName body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// The operation to enable a subscription
+ ///
+ ///
+ /// Subscription Id.
+ ///
+ ///
+ /// 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> EnableWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Gets all available geo-locations.
///
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/AdPrincipal.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/AdPrincipal.cs
new file mode 100644
index 000000000000..2912f4f6977b
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/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 who’ll get owner access on the new
+ /// subscription.
+ ///
+ 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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/CanceledSubscriptionId.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/CanceledSubscriptionId.cs
index b8d168a9e179..e3ca450ac659 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/CanceledSubscriptionId.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/CanceledSubscriptionId.cs
@@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.Subscription.Models
using System.Linq;
///
- /// Canceled Subscription Id
+ /// The ID of the canceled subscription
///
public partial class CanceledSubscriptionId
{
@@ -29,7 +29,7 @@ public CanceledSubscriptionId()
///
/// Initializes a new instance of the CanceledSubscriptionId class.
///
- /// Canceled Subscription Id
+ /// The ID of the canceled subscription
public CanceledSubscriptionId(string value = default(string))
{
Value = value;
@@ -42,7 +42,7 @@ public CanceledSubscriptionId()
partial void CustomInit();
///
- /// Gets canceled Subscription Id
+ /// Gets the ID of the canceled subscription
///
[JsonProperty(PropertyName = "value")]
public string Value { get; private set; }
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/EnabledSubscriptionId.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/EnabledSubscriptionId.cs
new file mode 100644
index 000000000000..ae845b0d574c
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/EnabledSubscriptionId.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 ID of the subscriptions that is being enabled
+ ///
+ public partial class EnabledSubscriptionId
+ {
+ ///
+ /// Initializes a new instance of the EnabledSubscriptionId class.
+ ///
+ public EnabledSubscriptionId()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the EnabledSubscriptionId class.
+ ///
+ /// The ID of the subscriptions that is being
+ /// enabled
+ public EnabledSubscriptionId(string value = default(string))
+ {
+ Value = value;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the ID of the subscriptions that is being enabled
+ ///
+ [JsonProperty(PropertyName = "value")]
+ public string Value { get; private set; }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernSubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernSubscriptionCreationParameters.cs
new file mode 100644
index 000000000000..19ae62c3a0b9
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernSubscriptionCreationParameters.cs
@@ -0,0 +1,148 @@
+//
+// 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.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ ///
+ /// The parameters required to create a new subscription.
+ ///
+ public partial class ModernSubscriptionCreationParameters
+ {
+ ///
+ /// Initializes a new instance of the
+ /// ModernSubscriptionCreationParameters class.
+ ///
+ public ModernSubscriptionCreationParameters()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the
+ /// ModernSubscriptionCreationParameters class.
+ ///
+ /// The friendly name of the
+ /// subscription.
+ /// The ARM ID of the billing profile
+ /// for which you want to create the subscription.
+ /// The SKU ID of the Azure plan. Azure plan
+ /// determines the pricing and service-level agreement of the
+ /// subscription. Use 001 for Microsoft Azure Plan and 002 for
+ /// Microsoft Azure Plan for DevTest.
+ /// If set, the cost center will show up on
+ /// the Azure usage and charges file.
+ /// If specified, the AD principal will get owner
+ /// access to the subscription, along with the user who is performing
+ /// the create subscription operation
+ /// The identifier of the management
+ /// group to which this subscription will be associated.
+ /// Additional, untyped parameters
+ /// to support custom subscription creation scenarios.
+ public ModernSubscriptionCreationParameters(string displayName, string billingProfileId, string skuId, string costCenter = default(string), AdPrincipal owner = default(AdPrincipal), string managementGroupId = default(string), IDictionary additionalParameters = default(IDictionary))
+ {
+ DisplayName = displayName;
+ BillingProfileId = billingProfileId;
+ SkuId = skuId;
+ CostCenter = costCenter;
+ Owner = owner;
+ ManagementGroupId = managementGroupId;
+ AdditionalParameters = additionalParameters;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets the friendly name of the subscription.
+ ///
+ [JsonProperty(PropertyName = "displayName")]
+ public string DisplayName { get; set; }
+
+ ///
+ /// Gets or sets the ARM ID of the billing profile for which you want
+ /// to create the subscription.
+ ///
+ [JsonProperty(PropertyName = "billingProfileId")]
+ public string BillingProfileId { get; set; }
+
+ ///
+ /// Gets or sets the SKU ID of the Azure plan. Azure plan determines
+ /// the pricing and service-level agreement of the subscription. Use
+ /// 001 for Microsoft Azure Plan and 002 for Microsoft Azure Plan for
+ /// DevTest.
+ ///
+ [JsonProperty(PropertyName = "skuId")]
+ public string SkuId { get; set; }
+
+ ///
+ /// Gets or sets if set, the cost center will show up on the Azure
+ /// usage and charges file.
+ ///
+ [JsonProperty(PropertyName = "costCenter")]
+ public string CostCenter { get; set; }
+
+ ///
+ /// Gets or sets if specified, the AD principal will get owner access
+ /// to the subscription, along with the user who is performing the
+ /// create subscription operation
+ ///
+ [JsonProperty(PropertyName = "owner")]
+ public AdPrincipal Owner { get; set; }
+
+ ///
+ /// Gets or sets the identifier of the management group to which this
+ /// subscription will be associated.
+ ///
+ [JsonProperty(PropertyName = "managementGroupId")]
+ public string ManagementGroupId { get; set; }
+
+ ///
+ /// Gets or sets additional, untyped parameters to support custom
+ /// subscription creation scenarios.
+ ///
+ [JsonProperty(PropertyName = "additionalParameters")]
+ public IDictionary AdditionalParameters { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (DisplayName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName");
+ }
+ if (BillingProfileId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "BillingProfileId");
+ }
+ if (SkuId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "SkuId");
+ }
+ if (Owner != null)
+ {
+ Owner.Validate();
+ }
+ }
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/OfferType.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/OfferType.cs
new file mode 100644
index 000000000000..2bd823ee4517
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/RenamedSubscriptionId.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/RenamedSubscriptionId.cs
index e7fbfa40642c..559ead111a38 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/RenamedSubscriptionId.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/RenamedSubscriptionId.cs
@@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.Subscription.Models
using System.Linq;
///
- /// Renamed Subscription Id
+ /// The ID of the subscriptions that is being renamed
///
public partial class RenamedSubscriptionId
{
@@ -29,7 +29,8 @@ public RenamedSubscriptionId()
///
/// Initializes a new instance of the RenamedSubscriptionId class.
///
- /// Renamed Subscription Id
+ /// The ID of the subscriptions that is being
+ /// renamed
public RenamedSubscriptionId(string value = default(string))
{
Value = value;
@@ -42,7 +43,7 @@ public RenamedSubscriptionId()
partial void CustomInit();
///
- /// Gets renamed Subscription Id
+ /// Gets the ID of the subscriptions that is being renamed
///
[JsonProperty(PropertyName = "value")]
public string Value { get; private set; }
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationParameters.cs
new file mode 100644
index 000000000000..fc5033f6b364
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs
new file mode 100644
index 000000000000..9dc71957da15
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs
@@ -0,0 +1,54 @@
+//
+// 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.
+ /// Use this link to check the status of subscription creation
+ /// operation.
+ 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. Use this link to
+ /// check the status of subscription creation operation.
+ ///
+ [JsonProperty(PropertyName = "subscriptionLink")]
+ public string SubscriptionLink { get; set; }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.cs
new file mode 100644
index 000000000000..fa602c14e1f7
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionHeaders.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 System.Linq;
+
+ ///
+ /// Defines headers for CreateSubscription operation.
+ ///
+ public partial class SubscriptionFactoryCreateSubscriptionHeaders
+ {
+ ///
+ /// Initializes a new instance of the
+ /// SubscriptionFactoryCreateSubscriptionHeaders class.
+ ///
+ public SubscriptionFactoryCreateSubscriptionHeaders()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the
+ /// SubscriptionFactoryCreateSubscriptionHeaders 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 SubscriptionFactoryCreateSubscriptionHeaders(string location = default(string), int? retryAfter = default(int?))
+ {
+ Location = location;
+ RetryAfter = retryAfter;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets GET this URL to retrieve the status of the
+ /// asynchronous operation.
+ ///
+ [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 int? RetryAfter { get; set; }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders.cs
new file mode 100644
index 000000000000..759ff1d79a48
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders.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;
+
+ ///
+ /// Defines headers for CreateSubscriptionInEnrollmentAccount operation.
+ ///
+ public partial class SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders
+ {
+ ///
+ /// Initializes a new instance of the
+ /// SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders
+ /// class.
+ ///
+ public SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the
+ /// 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 SubscriptionFactoryCreateSubscriptionInEnrollmentAccountHeaders(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 GET this URL to retrieve the status of the
+ /// asynchronous operation.
+ ///
+ [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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionName.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionName.cs
index 4a8fe49db82c..ef2ef8349a37 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionName.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionName.cs
@@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.Subscription.Models
using System.Linq;
///
- /// New name of the subscription.
+ /// The new name of the subscription.
///
public partial class SubscriptionName
{
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperation.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperation.cs
new file mode 100644
index 000000000000..89b66c82fd25
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.cs
new file mode 100644
index 000000000000..085c7c436cd7
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.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 System.Linq;
+
+ ///
+ /// Defines headers for Get operation.
+ ///
+ public partial class SubscriptionOperationGetHeaders
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionOperationGetHeaders
+ /// class.
+ ///
+ public SubscriptionOperationGetHeaders()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the SubscriptionOperationGetHeaders
+ /// 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 SubscriptionOperationGetHeaders(string location = default(string), int? retryAfter = default(int?))
+ {
+ 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 int? RetryAfter { get; set; }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationListResult.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationListResult.cs
new file mode 100644
index 000000000000..4dc7600ed0ac
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Operations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Operations.cs
index ff4960eb3750..439f6ee6119b 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Operations.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Operations.cs
@@ -70,7 +70,7 @@ internal Operations(SubscriptionClient client)
///
public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- string apiVersion = "2019-03-01-preview";
+ string apiVersion = "2018-03-01-preview";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs
index 16f4c0d76a48..a6fc1cbcbbd2 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SdkInfo_SubscriptionClient.cs
@@ -19,7 +19,11 @@ public static IEnumerable> ApiInfo_SubscriptionCli
{
return new Tuple[]
{
- new Tuple("Subscription", "Operations", "2019-03-01-preview"),
+ new Tuple("Billing", "SubscriptionFactory", "2018-03-01-preview"),
+ new Tuple("Billing", "SubscriptionFactory", "2018-11-01-preview"),
+ new Tuple("Subscription", "Operations", "2018-03-01-preview"),
+ new Tuple("Subscription", "SubscriptionOperation", "2018-11-01-preview"),
+ new Tuple("Subscription", "SubscriptionOperations", "2018-03-01-preview"),
new Tuple("Subscription", "Subscriptions", "2019-03-01-preview"),
new Tuple("SubscriptionClient", "Subscriptions", "2016-06-01"),
new Tuple("SubscriptionClient", "Tenants", "2016-06-01"),
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs
index a504b0d26672..5f732c5369b0 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs
@@ -46,11 +46,6 @@ public partial class SubscriptionClient : ServiceClient, ISu
///
public ServiceClientCredentials Credentials { get; private set; }
- ///
- /// Subscription Id.
- ///
- public string SubscriptionId { get; set; }
-
///
/// The preferred language for the response.
///
@@ -70,14 +65,29 @@ public partial class SubscriptionClient : ServiceClient, ISu
public bool? GenerateClientRequestId { get; set; }
///
- /// Gets the IOperations.
+ /// Gets the ISubscriptionsOperations.
///
- public virtual IOperations Operations { get; private set; }
+ public virtual ISubscriptionsOperations Subscriptions { get; private set; }
///
- /// Gets the ISubscriptionsOperations.
+ /// Gets the ISubscriptionOperationOperations.
///
- public virtual ISubscriptionsOperations Subscriptions { get; private set; }
+ public virtual ISubscriptionOperationOperations SubscriptionOperation { get; private set; }
+
+ ///
+ /// Gets the ISubscriptionFactoryOperations.
+ ///
+ public virtual ISubscriptionFactoryOperations SubscriptionFactory { get; private set; }
+
+ ///
+ /// Gets the ISubscriptionOperations.
+ ///
+ public virtual ISubscriptionOperations SubscriptionOperations { get; private set; }
+
+ ///
+ /// Gets the IOperations.
+ ///
+ public virtual IOperations Operations { get; private set; }
///
/// Gets the ITenantsOperations.
@@ -325,8 +335,11 @@ public SubscriptionClient(System.Uri baseUri, ServiceClientCredentials credentia
///
private void Initialize()
{
- Operations = new Operations(this);
Subscriptions = new SubscriptionsOperations(this);
+ SubscriptionOperation = new SubscriptionOperationOperations(this);
+ SubscriptionFactory = new SubscriptionFactoryOperations(this);
+ SubscriptionOperations = new SubscriptionOperations(this);
+ Operations = new Operations(this);
Tenants = new TenantsOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
AcceptLanguage = "en-US";
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs
new file mode 100644
index 000000000000..3f038282e47c
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperations.cs
@@ -0,0 +1,524 @@
+//
+// 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; }
+
+ ///
+ /// The operation to create a new Azure subscription
+ ///
+ ///
+ /// The name of the Microsoft Customer Agreement billing account for which you
+ /// want to create the subscription.
+ ///
+ ///
+ /// The name of the invoice section in the billing account for which you want
+ /// to create the subscription.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, 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.
+ ///
+ ///
+ /// 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);
+ }
+
+ ///
+ /// The operation to create a new Azure subscription
+ ///
+ ///
+ /// The name of the Microsoft Customer Agreement billing account for which you
+ /// want to create the subscription.
+ ///
+ ///
+ /// The name of the invoice section in the billing account for which you want
+ /// to create the subscription.
+ ///
+ ///
+ /// 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> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (billingAccountName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName");
+ }
+ if (invoiceSectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName");
+ }
+ if (body == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "body");
+ }
+ if (body != null)
+ {
+ body.Validate();
+ }
+ string apiVersion = "2018-11-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("billingAccountName", billingAccountName);
+ tracingParameters.Add("invoiceSectionName", invoiceSectionName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscription", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString();
+ _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
+ _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
+ 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;
+ }
+
+ ///
+ /// 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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs
new file mode 100644
index 000000000000..edd23ced2cf6
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionFactoryOperationsExtensions.cs
@@ -0,0 +1,209 @@
+//
+// 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
+ {
+ ///
+ /// The operation to create a new Azure subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the Microsoft Customer Agreement billing account for which you
+ /// want to create the subscription.
+ ///
+ ///
+ /// The name of the invoice section in the billing account for which you want
+ /// to create the subscription.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ public static SubscriptionCreationResult CreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body)
+ {
+ return operations.CreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to create a new Azure subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the Microsoft Customer Agreement billing account for which you
+ /// want to create the subscription.
+ ///
+ ///
+ /// The name of the invoice section in the billing account for which you want
+ /// to create the subscription.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, 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 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;
+ }
+ }
+
+ ///
+ /// The operation to create a new Azure subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the Microsoft Customer Agreement billing account for which you
+ /// want to create the subscription.
+ ///
+ ///
+ /// The name of the invoice section in the billing account for which you want
+ /// to create the subscription.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ public static SubscriptionCreationResult BeginCreateSubscription(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body)
+ {
+ return operations.BeginCreateSubscriptionAsync(billingAccountName, invoiceSectionName, body).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to create a new Azure subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the Microsoft Customer Agreement billing account for which you
+ /// want to create the subscription.
+ ///
+ ///
+ /// The name of the invoice section in the billing account for which you want
+ /// to create the subscription.
+ ///
+ ///
+ /// The subscription creation parameters.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginCreateSubscriptionAsync(this ISubscriptionFactoryOperations operations, string billingAccountName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, invoiceSectionName, 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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs
new file mode 100644
index 000000000000..399db7ecfb0c
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs
@@ -0,0 +1,248 @@
+//
+// 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;
+
+ ///
+ /// SubscriptionOperationOperations operations.
+ ///
+ internal partial class SubscriptionOperationOperations : IServiceOperations, ISubscriptionOperationOperations
+ {
+ ///
+ /// Initializes a new instance of the SubscriptionOperationOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal SubscriptionOperationOperations(SubscriptionClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SubscriptionClient
+ ///
+ public SubscriptionClient Client { get; private set; }
+
+ ///
+ /// Get the status of the pending Microsoft.Subscription API operations.
+ ///
+ ///
+ /// The operation ID, which can be found from the Location field in the
+ /// generate recommendation response header.
+ ///
+ ///
+ /// 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> GetWithHttpMessagesAsync(string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (operationId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationId");
+ }
+ string apiVersion = "2018-11-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("operationId", operationId);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ 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(operationId));
+ 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 && (int)_statusCode != 202)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ 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);
+ }
+ _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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperationsExtensions.cs
new file mode 100644
index 000000000000..fc4d21ab0cf1
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperationsExtensions.cs
@@ -0,0 +1,61 @@
+//
+// 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 SubscriptionOperationOperations.
+ ///
+ public static partial class SubscriptionOperationOperationsExtensions
+ {
+ ///
+ /// Get the status of the pending Microsoft.Subscription API operations.
+ ///
+ ///
+ /// 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 SubscriptionCreationResult Get(this ISubscriptionOperationOperations operations, string operationId)
+ {
+ return operations.GetAsync(operationId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get the status of the pending Microsoft.Subscription API operations.
+ ///
+ ///
+ /// 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 GetAsync(this ISubscriptionOperationOperations operations, string operationId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(operationId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs
new file mode 100644
index 000000000000..2b1244325d90
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs
new file mode 100644
index 000000000000..b0704257cd4b
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/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/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs
index 8f016f123676..c5b50d71fd7a 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperations.cs
@@ -51,8 +51,11 @@ internal SubscriptionsOperations(SubscriptionClient client)
public SubscriptionClient Client { get; private set; }
///
- /// Cancels the subscription
+ /// The operation to cancel a subscription
///
+ ///
+ /// Subscription Id.
+ ///
///
/// Headers that will be added to request.
///
@@ -74,11 +77,11 @@ internal SubscriptionsOperations(SubscriptionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> CancelWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CancelWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (subscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId");
}
string apiVersion = "2019-03-01-preview";
// Tracing
@@ -88,6 +91,7 @@ internal SubscriptionsOperations(SubscriptionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("subscriptionId", subscriptionId);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters);
@@ -95,7 +99,7 @@ internal SubscriptionsOperations(SubscriptionClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/cancel").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -222,8 +226,11 @@ internal SubscriptionsOperations(SubscriptionClient client)
}
///
- /// Renames the subscription
+ /// The operation to rename a subscription
///
+ ///
+ /// Subscription Id.
+ ///
///
/// Subscription Name
///
@@ -248,11 +255,11 @@ internal SubscriptionsOperations(SubscriptionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> RenameWithHttpMessagesAsync(SubscriptionName body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> RenameWithHttpMessagesAsync(string subscriptionId, SubscriptionName body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (subscriptionId == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId");
}
if (body == null)
{
@@ -266,6 +273,7 @@ internal SubscriptionsOperations(SubscriptionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("subscriptionId", subscriptionId);
tracingParameters.Add("body", body);
tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -274,7 +282,7 @@ internal SubscriptionsOperations(SubscriptionClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/rename").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -406,6 +414,181 @@ internal SubscriptionsOperations(SubscriptionClient client)
return _result;
}
+ ///
+ /// The operation to enable a subscription
+ ///
+ ///
+ /// Subscription Id.
+ ///
+ ///
+ /// 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> EnableWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (subscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId");
+ }
+ string apiVersion = "2019-03-01-preview";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("subscriptionId", subscriptionId);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Enable", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Subscription/enable").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId));
+ 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;
+ // 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;
+ }
+
///
/// Gets all available geo-locations.
///
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs
index 0fcd278ea724..c403fe1a5aff 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionsOperationsExtensions.cs
@@ -24,62 +24,108 @@ namespace Microsoft.Azure.Management.Subscription
public static partial class SubscriptionsOperationsExtensions
{
///
- /// Cancels the subscription
+ /// The operation to cancel a subscription
///
///
/// The operations group for this extension method.
///
- public static CanceledSubscriptionId Cancel(this ISubscriptionsOperations operations)
+ ///
+ /// Subscription Id.
+ ///
+ public static CanceledSubscriptionId Cancel(this ISubscriptionsOperations operations, string subscriptionId)
{
- return operations.CancelAsync().GetAwaiter().GetResult();
+ return operations.CancelAsync(subscriptionId).GetAwaiter().GetResult();
}
///
- /// Cancels the subscription
+ /// The operation to cancel a subscription
///
///
/// The operations group for this extension method.
///
+ ///
+ /// Subscription Id.
+ ///
///
/// The cancellation token.
///
- public static async Task CancelAsync(this ISubscriptionsOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CancelAsync(this ISubscriptionsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CancelWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CancelWithHttpMessagesAsync(subscriptionId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Renames the subscription
+ /// The operation to rename a subscription
///
///
/// The operations group for this extension method.
///
+ ///
+ /// Subscription Id.
+ ///
///
/// Subscription Name
///
- public static RenamedSubscriptionId Rename(this ISubscriptionsOperations operations, SubscriptionName body)
+ public static RenamedSubscriptionId Rename(this ISubscriptionsOperations operations, string subscriptionId, SubscriptionName body)
{
- return operations.RenameAsync(body).GetAwaiter().GetResult();
+ return operations.RenameAsync(subscriptionId, body).GetAwaiter().GetResult();
}
///
- /// Renames the subscription
+ /// The operation to rename a subscription
///
///
/// The operations group for this extension method.
///
+ ///
+ /// Subscription Id.
+ ///
///
/// Subscription Name
///
///
/// The cancellation token.
///
- public static async Task RenameAsync(this ISubscriptionsOperations operations, SubscriptionName body, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task RenameAsync(this ISubscriptionsOperations operations, string subscriptionId, SubscriptionName body, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.RenameWithHttpMessagesAsync(subscriptionId, body, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// The operation to enable a subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Subscription Id.
+ ///
+ public static EnabledSubscriptionId Enable(this ISubscriptionsOperations operations, string subscriptionId)
+ {
+ return operations.EnableAsync(subscriptionId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// The operation to enable a subscription
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Subscription Id.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task EnableAsync(this ISubscriptionsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.RenameWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.EnableWithHttpMessagesAsync(subscriptionId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}