From 02ba94b7900506442fa39d61081910d07c894008 Mon Sep 17 00:00:00 2001
From: navysingla <47647464+navysingla@users.noreply.github.com>
Date: Thu, 20 Aug 2020 16:09:07 -0700
Subject: [PATCH 1/3] SDK from new version
---
.../subscription_resource-manager.txt | 4 +-
.../AzSdk.RP.props | 2 +-
.../src/Generated/ISubscriptionClient.cs | 5 -
.../ISubscriptionOperationOperations.cs | 51 ---
.../src/Generated/ISubscriptionOperations.cs | 116 +----
...CreationResult.cs => ErrorResponseBody.cs} | 26 +-
.../Models/ErrorResponseBodyException.cs | 62 +++
...ModernCspSubscriptionCreationParameters.cs | 94 ----
.../ModernSubscriptionCreationParameters.cs | 134 ------
.../src/Generated/Models/ProvisioningState.cs | 23 +
.../Generated/Models/PutAliasListResult.cs | 62 +++
.../{AdPrincipal.cs => PutAliasRequest.cs} | 30 +-
.../Models/PutAliasRequestProperties.cs | 106 +++++
.../src/Generated/Models/PutAliasResponse.cs | 78 ++++
.../Models/PutAliasResponseProperties.cs | 62 +++
...ubscriptionCreateCspSubscriptionHeaders.cs | 66 ---
.../SubscriptionCreateSubscriptionHeaders.cs | 66 ---
...eSubscriptionInEnrollmentAccountHeaders.cs | 66 ---
.../Models/SubscriptionCreationParameters.cs | 103 -----
.../Models/SubscriptionOperationGetHeaders.cs | 66 ---
.../Models/{OfferType.cs => Workload.cs} | 8 +-
.../src/Generated/Operations.cs | 2 +-
.../Generated/SdkInfo_SubscriptionClient.cs | 8 +-
.../src/Generated/SubscriptionClient.cs | 6 -
.../SubscriptionOperationOperations.cs | 248 ----------
...bscriptionOperationOperationsExtensions.cs | 61 ---
.../src/Generated/SubscriptionOperations.cs | 430 +++++++++---------
.../SubscriptionOperationsExtensions.cs | 219 ++-------
...osoft.Azure.Management.Subscription.csproj | 10 +-
.../src/Properties/AssemblyInfo.cs | 2 +-
...SubscriptionCreationTests.ScenarioTests.cs | 21 +-
.../SubscriptionCreationTests.InMemory.cs | 17 +-
32 files changed, 739 insertions(+), 1515 deletions(-)
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs
rename sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/{SubscriptionCreationResult.cs => ErrorResponseBody.cs} (51%)
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBodyException.cs
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernSubscriptionCreationParameters.cs
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ProvisioningState.cs
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasListResult.cs
rename sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/{AdPrincipal.cs => PutAliasRequest.cs} (58%)
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequestProperties.cs
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponse.cs
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponseProperties.cs
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateCspSubscriptionHeaders.cs
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionHeaders.cs
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.cs
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationParameters.cs
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.cs
rename sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/{OfferType.cs => Workload.cs} (71%)
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs
delete mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperationsExtensions.cs
diff --git a/eng/mgmt/mgmtmetadata/subscription_resource-manager.txt b/eng/mgmt/mgmtmetadata/subscription_resource-manager.txt
index 69655a24eb9de..ea504c28b4ee5 100644
--- a/eng/mgmt/mgmtmetadata/subscription_resource-manager.txt
+++ b/eng/mgmt/mgmtmetadata/subscription_resource-manager.txt
@@ -4,11 +4,11 @@ Commencing code generation
Generating CSharp code
Executing AutoRest command
cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/subscription/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\github2\sdk
-2020-05-11 20:30:58 UTC
+2020-08-20 21:22:36 UTC
Azure-rest-api-specs repository information
GitHub fork: Azure
Branch: master
-Commit: 3e8fb815e2e4f149fbfcdaab64efc4d45dcc0690
+Commit: a7ca142c3f0f290fdda778f26f4f1fab65f71cf9
AutoRest information
Requested version: v2
Bootstrapper version: autorest@2.0.4413
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/AzSdk.RP.props b/sdk/subscription/Microsoft.Azure.Management.Subscription/AzSdk.RP.props
index 02f19795bf77c..97e65966a558b 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/AzSdk.RP.props
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/AzSdk.RP.props
@@ -1,7 +1,7 @@
- Subscription_2019-10-01-preview;SubscriptionClient_2016-06-01;
+ Subscription_2020-09-01;SubscriptionClient_2016-06-01;
$(PackageTags);$(CommonTags);$(AzureApiTag);
\ No newline at end of file
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 458711a49ef84..04ad72e34bcff 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs
@@ -74,11 +74,6 @@ public partial interface ISubscriptionClient : System.IDisposable
///
ISubscriptionOperations Subscription { get; }
- ///
- /// Gets the ISubscriptionOperationOperations.
- ///
- ISubscriptionOperationOperations SubscriptionOperation { get; }
-
///
/// Gets the IOperations.
///
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs
deleted file mode 100644
index 60e72a69facea..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperationOperations.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription
-{
- using Microsoft.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
index 6262a787e85bd..17f00e639df99 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs
@@ -23,32 +23,6 @@ namespace Microsoft.Azure.Management.Subscription
///
public partial interface ISubscriptionOperations
{
- ///
- /// 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 cancel a subscription
///
@@ -119,22 +93,12 @@ public partial interface ISubscriptionOperations
///
Task> EnableWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// The operation to create a new WebDirect or EA Azure subscription.
+ /// Create Alias Subscription.
///
- ///
- /// The name of the Microsoft Customer Agreement billing account for
- /// which you want to create the subscription.
- ///
- ///
- /// The name of the billing profile in the 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.
+ ///
+ /// Alias Name
///
///
- /// The subscription creation parameters.
///
///
/// The headers that will be added to request.
@@ -142,7 +106,7 @@ public partial interface ISubscriptionOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -151,19 +115,12 @@ public partial interface ISubscriptionOperations
///
/// Thrown when a required parameter is null
///
- Task> CreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> CreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// The operation to create a new CSP subscription.
+ /// Get Alias Subscription.
///
- ///
- /// The name of the Microsoft Customer Agreement billing account for
- /// which you want to create the subscription.
- ///
- ///
- /// The name of the customer.
- ///
- ///
- /// The subscription creation parameters.
+ ///
+ /// Alias Name
///
///
/// The headers that will be added to request.
@@ -171,7 +128,7 @@ public partial interface ISubscriptionOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -180,16 +137,12 @@ public partial interface ISubscriptionOperations
///
/// Thrown when a required parameter is null
///
- Task> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> GetAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// Creates an Azure subscription
+ /// Delete Alias.
///
- ///
- /// The name of the enrollment account to which the subscription will
- /// be billed.
- ///
- ///
- /// The subscription creation parameters.
+ ///
+ /// Alias Name
///
///
/// The headers that will be added to request.
@@ -197,41 +150,23 @@ public partial interface ISubscriptionOperations
///
/// 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));
+ Task DeleteAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// The operation to create a new WebDirect or EA Azure subscription.
+ /// Get Alias Subscription.
///
- ///
- /// The name of the Microsoft Customer Agreement billing account for
- /// which you want to create the subscription.
- ///
- ///
- /// The name of the billing profile in the 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
///
///
@@ -240,19 +175,14 @@ public partial interface ISubscriptionOperations
///
/// Thrown when a required parameter is null
///
- Task> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> ListAliasWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
- /// The operation to create a new CSP subscription.
+ /// Create Alias Subscription.
///
- ///
- /// The name of the Microsoft Customer Agreement billing account for
- /// which you want to create the subscription.
- ///
- ///
- /// The name of the customer.
+ ///
+ /// Alias Name
///
///
- /// The subscription creation parameters.
///
///
/// The headers that will be added to request.
@@ -260,7 +190,7 @@ public partial interface ISubscriptionOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -269,6 +199,6 @@ public partial interface ISubscriptionOperations
///
/// Thrown when a required parameter is null
///
- Task> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ Task> BeginCreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs
similarity index 51%
rename from sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs
rename to sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs
index 9dc71957da15b..6675e261bc186 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationResult.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBody.cs
@@ -14,27 +14,26 @@ namespace Microsoft.Azure.Management.Subscription.Models
using System.Linq;
///
- /// The created subscription object.
+ /// Error response indicates that the service is not able to process the
+ /// incoming request. The reason is provided in the error message.
///
- public partial class SubscriptionCreationResult
+ public partial class ErrorResponseBody
{
///
- /// Initializes a new instance of the SubscriptionCreationResult class.
+ /// Initializes a new instance of the ErrorResponseBody class.
///
- public SubscriptionCreationResult()
+ public ErrorResponseBody()
{
CustomInit();
}
///
- /// Initializes a new instance of the SubscriptionCreationResult class.
+ /// Initializes a new instance of the ErrorResponseBody class.
///
- /// The link to the new subscription.
- /// Use this link to check the status of subscription creation
- /// operation.
- public SubscriptionCreationResult(string subscriptionLink = default(string))
+ /// The details of the error.
+ public ErrorResponseBody(ErrorResponse error = default(ErrorResponse))
{
- SubscriptionLink = subscriptionLink;
+ Error = error;
CustomInit();
}
@@ -44,11 +43,10 @@ public SubscriptionCreationResult()
partial void CustomInit();
///
- /// Gets or sets the link to the new subscription. Use this link to
- /// check the status of subscription creation operation.
+ /// Gets or sets the details of the error.
///
- [JsonProperty(PropertyName = "subscriptionLink")]
- public string SubscriptionLink { get; set; }
+ [JsonProperty(PropertyName = "error")]
+ public ErrorResponse Error { get; set; }
}
}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBodyException.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBodyException.cs
new file mode 100644
index 0000000000000..4acfe243feb92
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ErrorResponseBodyException.cs
@@ -0,0 +1,62 @@
+//
+// 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;
+
+ ///
+ /// Exception thrown for an invalid response with ErrorResponseBody
+ /// information.
+ ///
+ public partial class ErrorResponseBodyException : RestException
+ {
+ ///
+ /// Gets information about the associated HTTP request.
+ ///
+ public HttpRequestMessageWrapper Request { get; set; }
+
+ ///
+ /// Gets information about the associated HTTP response.
+ ///
+ public HttpResponseMessageWrapper Response { get; set; }
+
+ ///
+ /// Gets or sets the body object.
+ ///
+ public ErrorResponseBody Body { get; set; }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseBodyException class.
+ ///
+ public ErrorResponseBodyException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseBodyException class.
+ ///
+ /// The exception message.
+ public ErrorResponseBodyException(string message)
+ : this(message, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseBodyException class.
+ ///
+ /// The exception message.
+ /// Inner exception.
+ public ErrorResponseBodyException(string message, System.Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs
deleted file mode 100644
index 18cc8a881237c..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernCspSubscriptionCreationParameters.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using Microsoft.Rest;
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// The parameters required to create a new CSP subscription.
- ///
- public partial class ModernCspSubscriptionCreationParameters
- {
- ///
- /// Initializes a new instance of the
- /// ModernCspSubscriptionCreationParameters class.
- ///
- public ModernCspSubscriptionCreationParameters()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the
- /// ModernCspSubscriptionCreationParameters class.
- ///
- /// The friendly name of 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.
- /// Reseller ID, basically MPN Id.
- public ModernCspSubscriptionCreationParameters(string displayName, string skuId, string resellerId = default(string))
- {
- DisplayName = displayName;
- SkuId = skuId;
- ResellerId = resellerId;
- 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 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 reseller ID, basically MPN Id.
- ///
- [JsonProperty(PropertyName = "resellerId")]
- public string ResellerId { get; set; }
-
- ///
- /// Validate the object.
- ///
- ///
- /// Thrown if validation fails
- ///
- public virtual void Validate()
- {
- if (DisplayName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName");
- }
- if (SkuId == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "SkuId");
- }
- }
- }
-}
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
deleted file mode 100644
index 01edbf8c386c9..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ModernSubscriptionCreationParameters.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using Microsoft.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 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 skuId, string costCenter = default(string), AdPrincipal owner = default(AdPrincipal), string managementGroupId = default(string), IDictionary additionalParameters = default(IDictionary))
- {
- DisplayName = displayName;
- 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 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 (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/ProvisioningState.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ProvisioningState.cs
new file mode 100644
index 0000000000000..b2f569f18ef67
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/ProvisioningState.cs
@@ -0,0 +1,23 @@
+//
+// 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 ProvisioningState.
+ ///
+ public static class ProvisioningState
+ {
+ public const string Accepted = "Accepted";
+ public const string Succeeded = "Succeeded";
+ public const string Failed = "Failed";
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasListResult.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasListResult.cs
new file mode 100644
index 0000000000000..043dfbff2ba38
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasListResult.cs
@@ -0,0 +1,62 @@
+//
+// 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;
+
+ ///
+ /// The list of aliases.
+ ///
+ public partial class PutAliasListResult
+ {
+ ///
+ /// Initializes a new instance of the PutAliasListResult class.
+ ///
+ public PutAliasListResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the PutAliasListResult class.
+ ///
+ /// The list of alias.
+ /// The link (url) to the next page of
+ /// results.
+ public PutAliasListResult(IList value = default(IList), string nextLink = default(string))
+ {
+ Value = value;
+ NextLink = nextLink;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets the list of alias.
+ ///
+ [JsonProperty(PropertyName = "value")]
+ public IList Value { get; private set; }
+
+ ///
+ /// Gets the link (url) to the next page of results.
+ ///
+ [JsonProperty(PropertyName = "nextLink")]
+ public string NextLink { get; private set; }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/AdPrincipal.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs
similarity index 58%
rename from sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/AdPrincipal.cs
rename to sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs
index 2912f4f6977b5..2c40b6041cc22 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/AdPrincipal.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs
@@ -10,31 +10,29 @@
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.
+ /// The parameters required to create a new subscription.
///
- public partial class AdPrincipal
+ public partial class PutAliasRequest
{
///
- /// Initializes a new instance of the AdPrincipal class.
+ /// Initializes a new instance of the PutAliasRequest class.
///
- public AdPrincipal()
+ public PutAliasRequest()
{
CustomInit();
}
///
- /// Initializes a new instance of the AdPrincipal class.
+ /// Initializes a new instance of the PutAliasRequest class.
///
- /// Object id of the Principal
- public AdPrincipal(string objectId)
+ /// Put alias request properties.
+ public PutAliasRequest(PutAliasRequestProperties properties = default(PutAliasRequestProperties))
{
- ObjectId = objectId;
+ Properties = properties;
CustomInit();
}
@@ -44,22 +42,22 @@ public AdPrincipal(string objectId)
partial void CustomInit();
///
- /// Gets or sets object id of the Principal
+ /// Gets or sets put alias request properties.
///
- [JsonProperty(PropertyName = "objectId")]
- public string ObjectId { get; set; }
+ [JsonProperty(PropertyName = "properties")]
+ public PutAliasRequestProperties Properties { get; set; }
///
/// Validate the object.
///
- ///
+ ///
/// Thrown if validation fails
///
public virtual void Validate()
{
- if (ObjectId == null)
+ if (Properties != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId");
+ Properties.Validate();
}
}
}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequestProperties.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequestProperties.cs
new file mode 100644
index 0000000000000..9e68dca5f3124
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequestProperties.cs
@@ -0,0 +1,106 @@
+//
+// 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;
+
+ ///
+ /// Put subscription properties.
+ ///
+ public partial class PutAliasRequestProperties
+ {
+ ///
+ /// Initializes a new instance of the PutAliasRequestProperties class.
+ ///
+ public PutAliasRequestProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the PutAliasRequestProperties class.
+ ///
+ /// The friendly name of the
+ /// subscription.
+ /// The workload type of the subscription. It
+ /// can be either Production or DevTest. Possible values include:
+ /// 'Production', 'DevTest'
+ /// Determines whether subscription is
+ /// fieldLed, partnerLed or LegacyEA
+ /// This parameter can be used to create
+ /// alias for existing subscription Id
+ public PutAliasRequestProperties(string displayName, string workload, string billingScope, string subscriptionId = default(string))
+ {
+ DisplayName = displayName;
+ Workload = workload;
+ BillingScope = billingScope;
+ SubscriptionId = subscriptionId;
+ 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 workload type of the subscription. It can be
+ /// either Production or DevTest. Possible values include:
+ /// 'Production', 'DevTest'
+ ///
+ [JsonProperty(PropertyName = "workload")]
+ public string Workload { get; set; }
+
+ ///
+ /// Gets or sets determines whether subscription is fieldLed,
+ /// partnerLed or LegacyEA
+ ///
+ [JsonProperty(PropertyName = "billingScope")]
+ public string BillingScope { get; set; }
+
+ ///
+ /// Gets or sets this parameter can be used to create alias for
+ /// existing subscription Id
+ ///
+ [JsonProperty(PropertyName = "subscriptionId")]
+ public string SubscriptionId { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (DisplayName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName");
+ }
+ if (Workload == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Workload");
+ }
+ if (BillingScope == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "BillingScope");
+ }
+ }
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponse.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponse.cs
new file mode 100644
index 0000000000000..4c0baaeb7dd2f
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponse.cs
@@ -0,0 +1,78 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.Subscription.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Subscription Information with the alias.
+ ///
+ public partial class PutAliasResponse : IResource
+ {
+ ///
+ /// Initializes a new instance of the PutAliasResponse class.
+ ///
+ public PutAliasResponse()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the PutAliasResponse class.
+ ///
+ /// Fully qualified ID for the alias resource.
+ /// Alias ID.
+ /// Resource type,
+ /// Microsoft.Subscription/aliases.
+ /// Put Alias response properties.
+ public PutAliasResponse(string id = default(string), string name = default(string), string type = default(string), PutAliasResponseProperties properties = default(PutAliasResponseProperties))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ Properties = properties;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets fully qualified ID for the alias resource.
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; private set; }
+
+ ///
+ /// Gets alias ID.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; private set; }
+
+ ///
+ /// Gets resource type, Microsoft.Subscription/aliases.
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; private set; }
+
+ ///
+ /// Gets or sets put Alias response properties.
+ ///
+ [JsonProperty(PropertyName = "properties")]
+ public PutAliasResponseProperties Properties { get; set; }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponseProperties.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponseProperties.cs
new file mode 100644
index 0000000000000..180d517ee36e6
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasResponseProperties.cs
@@ -0,0 +1,62 @@
+//
+// 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;
+
+ ///
+ /// Put subscription creation result properties.
+ ///
+ public partial class PutAliasResponseProperties
+ {
+ ///
+ /// Initializes a new instance of the PutAliasResponseProperties class.
+ ///
+ public PutAliasResponseProperties()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the PutAliasResponseProperties class.
+ ///
+ /// Newly created subscription Id.
+ /// The provisioning state of the
+ /// resource. Possible values include: 'Accepted', 'Succeeded',
+ /// 'Failed'
+ public PutAliasResponseProperties(string subscriptionId = default(string), string provisioningState = default(string))
+ {
+ SubscriptionId = subscriptionId;
+ ProvisioningState = provisioningState;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets newly created subscription Id.
+ ///
+ [JsonProperty(PropertyName = "subscriptionId")]
+ public string SubscriptionId { get; private set; }
+
+ ///
+ /// Gets or sets the provisioning state of the resource. Possible
+ /// values include: 'Accepted', 'Succeeded', 'Failed'
+ ///
+ [JsonProperty(PropertyName = "provisioningState")]
+ public string ProvisioningState { get; set; }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateCspSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateCspSubscriptionHeaders.cs
deleted file mode 100644
index 0270e18a4e5bd..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateCspSubscriptionHeaders.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// Defines headers for CreateCspSubscription operation.
- ///
- public partial class SubscriptionCreateCspSubscriptionHeaders
- {
- ///
- /// Initializes a new instance of the
- /// SubscriptionCreateCspSubscriptionHeaders class.
- ///
- public SubscriptionCreateCspSubscriptionHeaders()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the
- /// SubscriptionCreateCspSubscriptionHeaders 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 SubscriptionCreateCspSubscriptionHeaders(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/SubscriptionCreateSubscriptionHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionHeaders.cs
deleted file mode 100644
index a8230f26ada1e..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionHeaders.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// Defines headers for CreateSubscription operation.
- ///
- public partial class SubscriptionCreateSubscriptionHeaders
- {
- ///
- /// Initializes a new instance of the
- /// SubscriptionCreateSubscriptionHeaders class.
- ///
- public SubscriptionCreateSubscriptionHeaders()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the
- /// SubscriptionCreateSubscriptionHeaders 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 SubscriptionCreateSubscriptionHeaders(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/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.cs
deleted file mode 100644
index 98a127191fdd1..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreateSubscriptionInEnrollmentAccountHeaders.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using Newtonsoft.Json;
- using System.Linq;
-
- ///
- /// Defines headers for CreateSubscriptionInEnrollmentAccount operation.
- ///
- public partial class SubscriptionCreateSubscriptionInEnrollmentAccountHeaders
- {
- ///
- /// Initializes a new instance of the
- /// SubscriptionCreateSubscriptionInEnrollmentAccountHeaders class.
- ///
- public SubscriptionCreateSubscriptionInEnrollmentAccountHeaders()
- {
- CustomInit();
- }
-
- ///
- /// Initializes a new instance of the
- /// SubscriptionCreateSubscriptionInEnrollmentAccountHeaders 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 SubscriptionCreateSubscriptionInEnrollmentAccountHeaders(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/SubscriptionCreationParameters.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationParameters.cs
deleted file mode 100644
index 77e251905e919..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionCreationParameters.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using 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 Management Group Id.
- /// 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), string managementGroupId = default(string), IList owners = default(IList), string offerType = default(string), IDictionary additionalParameters = default(IDictionary))
- {
- DisplayName = displayName;
- ManagementGroupId = managementGroupId;
- 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 Management Group Id.
- ///
- [JsonProperty(PropertyName = "managementGroupId")]
- public string ManagementGroupId { 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/SubscriptionOperationGetHeaders.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.cs
deleted file mode 100644
index 085c7c436cd7e..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/SubscriptionOperationGetHeaders.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription.Models
-{
- using 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/OfferType.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/Workload.cs
similarity index 71%
rename from sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/OfferType.cs
rename to sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/Workload.cs
index 2bd823ee45177..f232ea9e3f531 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/OfferType.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/Workload.cs
@@ -12,11 +12,11 @@ namespace Microsoft.Azure.Management.Subscription.Models
{
///
- /// Defines values for OfferType.
+ /// Defines values for Workload.
///
- public static class OfferType
+ public static class Workload
{
- public const string MSAZR0017P = "MS-AZR-0017P";
- public const string MSAZR0148P = "MS-AZR-0148P";
+ public const string Production = "Production";
+ public const string DevTest = "DevTest";
}
}
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 bd904a5a50b47..4bfea45641e4e 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-10-01-preview";
+ string apiVersion = "2020-09-01";
// 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 5475c2a1f7e99..744568f51395e 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,10 +19,8 @@ public static IEnumerable> ApiInfo_SubscriptionCli
{
return new Tuple[]
{
- new Tuple("Billing", "Subscription", "2019-10-01-preview"),
- new Tuple("Subscription", "Operations", "2019-10-01-preview"),
- new Tuple("Subscription", "Subscription", "2019-10-01-preview"),
- new Tuple("Subscription", "SubscriptionOperation", "2019-10-01-preview"),
+ new Tuple("Subscription", "Operations", "2020-09-01"),
+ new Tuple("Subscription", "Subscription", "2020-09-01"),
new Tuple("SubscriptionClient", "Subscriptions", "2016-06-01"),
new Tuple("SubscriptionClient", "Tenants", "2016-06-01"),
}.AsEnumerable();
@@ -34,7 +32,7 @@ public static IEnumerable> ApiInfo_SubscriptionCli
public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/subscription/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\github2\\sdk";
public static readonly String GithubForkName = "Azure";
public static readonly String GithubBranchName = "master";
- public static readonly String GithubCommidId = "3e8fb815e2e4f149fbfcdaab64efc4d45dcc0690";
+ public static readonly String GithubCommidId = "a7ca142c3f0f290fdda778f26f4f1fab65f71cf9";
public static readonly String CodeGenerationErrors = "";
public static readonly String GithubRepoName = "azure-rest-api-specs";
// END: Code Generation Metadata Section
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 60aa98563e27f..cef2770bd358a 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs
@@ -79,11 +79,6 @@ public partial class SubscriptionClient : ServiceClient, ISu
///
public virtual ISubscriptionOperations Subscription { get; private set; }
- ///
- /// Gets the ISubscriptionOperationOperations.
- ///
- public virtual ISubscriptionOperationOperations SubscriptionOperation { get; private set; }
-
///
/// Gets the IOperations.
///
@@ -333,7 +328,6 @@ private void Initialize()
Subscriptions = new SubscriptionsOperations(this);
Tenants = new TenantsOperations(this);
Subscription = new SubscriptionOperations(this);
- SubscriptionOperation = new SubscriptionOperationOperations(this);
Operations = new Operations(this);
BaseUri = new System.Uri("https://management.azure.com");
AcceptLanguage = "en-US";
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs
deleted file mode 100644
index e48ccc38acaee..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperations.cs
+++ /dev/null
@@ -1,248 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription
-{
- using Microsoft.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 = "2019-10-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
deleted file mode 100644
index fc4d21ab0cf19..0000000000000
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationOperationsExtensions.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for
-// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is
-// regenerated.
-//
-
-namespace Microsoft.Azure.Management.Subscription
-{
- using Microsoft.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
index 90f8202d53108..e931a84504b84 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs
@@ -50,29 +50,6 @@ internal SubscriptionOperations(SubscriptionClient client)
///
public SubscriptionClient Client { get; private set; }
- ///
- /// Creates an Azure subscription
- ///
- ///
- /// The name of the enrollment account to which the subscription will be
- /// billed.
- ///
- ///
- /// The subscription creation parameters.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(string enrollmentAccountName, SubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(enrollmentAccountName, body, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
///
/// The operation to cancel a subscription
///
@@ -106,7 +83,7 @@ internal SubscriptionOperations(SubscriptionClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId");
}
- string apiVersion = "2019-10-01-preview";
+ string apiVersion = "2020-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -288,7 +265,7 @@ internal SubscriptionOperations(SubscriptionClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "body");
}
- string apiVersion = "2019-10-01-preview";
+ string apiVersion = "2020-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -470,7 +447,7 @@ internal SubscriptionOperations(SubscriptionClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId");
}
- string apiVersion = "2019-10-01-preview";
+ string apiVersion = "2020-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -613,48 +590,12 @@ internal SubscriptionOperations(SubscriptionClient client)
}
///
- /// The operation to create a new WebDirect or EA Azure subscription.
- ///
- ///
- /// The name of the Microsoft Customer Agreement billing account for which you
- /// want to create the subscription.
- ///
- ///
- /// The name of the billing profile in the 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 billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send request
- AzureOperationResponse _response = await BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// The operation to create a new CSP subscription.
+ /// Create Alias Subscription.
///
- ///
- /// The name of the Microsoft Customer Agreement billing account for which you
- /// want to create the subscription.
- ///
- ///
- /// The name of the customer.
+ ///
+ /// Alias Name
///
///
- /// The subscription creation parameters.
///
///
/// The headers that will be added to request.
@@ -662,22 +603,18 @@ internal SubscriptionOperations(SubscriptionClient client)
///
/// The cancellation token.
///
- public async Task> CreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- // Send request
- AzureOperationResponse _response = await BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ // Send Request
+ AzureOperationResponse _response = await BeginCreateAliasWithHttpMessagesAsync(aliasName, body, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Creates an Azure subscription
+ /// Get Alias Subscription.
///
- ///
- /// The name of the enrollment account to which the subscription will be
- /// billed.
- ///
- ///
- /// The subscription creation parameters.
+ ///
+ /// Alias Name
///
///
/// Headers that will be added to request.
@@ -685,7 +622,7 @@ internal SubscriptionOperations(SubscriptionClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -700,17 +637,13 @@ internal SubscriptionOperations(SubscriptionClient client)
///
/// 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))
+ public async Task> GetAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (enrollmentAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "enrollmentAccountName");
- }
- if (body == null)
+ if (aliasName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "body");
+ throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
}
- string apiVersion = "2019-10-01-preview";
+ string apiVersion = "2020-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -718,16 +651,15 @@ internal SubscriptionOperations(SubscriptionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("enrollmentAccountName", enrollmentAccountName);
+ tracingParameters.Add("aliasName", aliasName);
tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("body", body);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscriptionInEnrollmentAccount", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "GetAlias", 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));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString();
+ _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -740,7 +672,7 @@ internal SubscriptionOperations(SubscriptionClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -771,12 +703,6 @@ internal SubscriptionOperations(SubscriptionClient client)
// Serialize Request
string _requestContent = null;
- if(body != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
// Set Credentials
if (Client.Credentials != null)
{
@@ -797,13 +723,13 @@ internal SubscriptionOperations(SubscriptionClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200)
{
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new ErrorResponseBodyException(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);
+ ErrorResponseBody _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
@@ -827,7 +753,7 @@ internal SubscriptionOperations(SubscriptionClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -840,7 +766,7 @@ internal SubscriptionOperations(SubscriptionClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -852,19 +778,6 @@ internal SubscriptionOperations(SubscriptionClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
- try
- {
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
- }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -873,22 +786,10 @@ internal SubscriptionOperations(SubscriptionClient client)
}
///
- /// The operation to create a new WebDirect or EA Azure subscription.
+ /// Delete Alias.
///
- ///
- /// The name of the Microsoft Customer Agreement billing account for which you
- /// want to create the subscription.
- ///
- ///
- /// The name of the billing profile in the 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.
+ ///
+ /// Alias Name
///
///
/// Headers that will be added to request.
@@ -896,12 +797,9 @@ internal SubscriptionOperations(SubscriptionClient client)
///
/// 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
///
@@ -911,29 +809,157 @@ internal SubscriptionOperations(SubscriptionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateSubscriptionWithHttpMessagesAsync(string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task DeleteAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (billingAccountName == null)
+ if (aliasName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
}
- if (billingProfileName == null)
+ string apiVersion = "2020-09-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "billingProfileName");
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("aliasName", aliasName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "DeleteAlias", tracingParameters);
}
- if (invoiceSectionName == null)
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString();
+ _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
+ List _queryParameters = new List();
+ if (apiVersion != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "invoiceSectionName");
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion)));
}
- if (body == null)
+ if (_queryParameters.Count > 0)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "body");
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
- if (body != null)
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
- body.Validate();
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- string apiVersion = "2019-10-01-preview";
+ 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 != 204)
+ {
+ var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponseBody _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();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// 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> ListAliasWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ string apiVersion = "2020-09-01";
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -941,20 +967,13 @@ internal SubscriptionOperations(SubscriptionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountName", billingAccountName);
- tracingParameters.Add("billingProfileName", billingProfileName);
- tracingParameters.Add("invoiceSectionName", invoiceSectionName);
tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("body", body);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateSubscription", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListAlias", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription").ToString();
- _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
- _url = _url.Replace("{billingProfileName}", System.Uri.EscapeDataString(billingProfileName));
- _url = _url.Replace("{invoiceSectionName}", System.Uri.EscapeDataString(invoiceSectionName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases").ToString();
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -967,7 +986,7 @@ internal SubscriptionOperations(SubscriptionClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -998,12 +1017,6 @@ internal SubscriptionOperations(SubscriptionClient client)
// Serialize Request
string _requestContent = null;
- if(body != null)
- {
- _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
- _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
- _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
- }
// Set Credentials
if (Client.Credentials != null)
{
@@ -1024,13 +1037,13 @@ internal SubscriptionOperations(SubscriptionClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200)
{
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new ErrorResponseBodyException(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);
+ ErrorResponseBody _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
@@ -1054,7 +1067,7 @@ internal SubscriptionOperations(SubscriptionClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1067,7 +1080,7 @@ internal SubscriptionOperations(SubscriptionClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -1079,19 +1092,6 @@ internal SubscriptionOperations(SubscriptionClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
- try
- {
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
- }
- catch (JsonException ex)
- {
- _httpRequest.Dispose();
- if (_httpResponse != null)
- {
- _httpResponse.Dispose();
- }
- throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
- }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -1100,17 +1100,12 @@ internal SubscriptionOperations(SubscriptionClient client)
}
///
- /// The operation to create a new CSP subscription.
+ /// Create Alias Subscription.
///
- ///
- /// The name of the Microsoft Customer Agreement billing account for which you
- /// want to create the subscription.
- ///
- ///
- /// The name of the customer.
+ ///
+ /// Alias Name
///
///
- /// The subscription creation parameters.
///
///
/// Headers that will be added to request.
@@ -1118,7 +1113,7 @@ internal SubscriptionOperations(SubscriptionClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1133,15 +1128,11 @@ internal SubscriptionOperations(SubscriptionClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateCspSubscriptionWithHttpMessagesAsync(string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginCreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (billingAccountName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "billingAccountName");
- }
- if (customerName == null)
+ if (aliasName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "customerName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
}
if (body == null)
{
@@ -1159,18 +1150,16 @@ internal SubscriptionOperations(SubscriptionClient client)
{
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("billingAccountName", billingAccountName);
- tracingParameters.Add("customerName", customerName);
- tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("aliasName", aliasName);
tracingParameters.Add("body", body);
+ tracingParameters.Add("apiVersion", apiVersion);
tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateCspSubscription", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginCreateAlias", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Subscription/createSubscription").ToString();
- _url = _url.Replace("{billingAccountName}", System.Uri.EscapeDataString(billingAccountName));
- _url = _url.Replace("{customerName}", System.Uri.EscapeDataString(customerName));
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString();
+ _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
List _queryParameters = new List();
if (apiVersion != null)
{
@@ -1183,7 +1172,7 @@ internal SubscriptionOperations(SubscriptionClient client)
// Create HTTP transport objects
var _httpRequest = new HttpRequestMessage();
HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.Method = new HttpMethod("PUT");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
@@ -1240,13 +1229,13 @@ internal SubscriptionOperations(SubscriptionClient client)
HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
- if ((int)_statusCode != 200 && (int)_statusCode != 202)
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
{
- var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new ErrorResponseBodyException(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);
+ ErrorResponseBody _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
ex.Body = _errorBody;
@@ -1270,7 +1259,7 @@ internal SubscriptionOperations(SubscriptionClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1283,7 +1272,7 @@ internal SubscriptionOperations(SubscriptionClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
catch (JsonException ex)
{
@@ -1295,18 +1284,23 @@ internal SubscriptionOperations(SubscriptionClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
- try
- {
- _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
- }
- catch (JsonException ex)
+ // Deserialize Response
+ if ((int)_statusCode == 201)
{
- _httpRequest.Dispose();
- if (_httpResponse != null)
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
{
- _httpResponse.Dispose();
+ _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);
}
- throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
}
if (_shouldTrace)
{
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs
index 1011107cc48fa..987eceeeef01e 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs
@@ -21,48 +21,6 @@ namespace Microsoft.Azure.Management.Subscription
///
public static partial class SubscriptionOperationsExtensions
{
- ///
- /// 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 ISubscriptionOperations 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 ISubscriptionOperations 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 cancel a subscription
///
@@ -172,254 +130,169 @@ public static EnabledSubscriptionId Enable(this ISubscriptionOperations operatio
}
///
- /// The operation to create a new WebDirect or EA Azure subscription.
+ /// Create Alias 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 billing profile in the 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.
+ ///
+ /// Alias Name
///
///
- /// The subscription creation parameters.
///
- public static SubscriptionCreationResult CreateSubscription(this ISubscriptionOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body)
+ public static PutAliasResponse CreateAlias(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body)
{
- return operations.CreateSubscriptionAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult();
+ return operations.CreateAliasAsync(aliasName, body).GetAwaiter().GetResult();
}
///
- /// The operation to create a new WebDirect or EA Azure subscription.
+ /// Create Alias 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 billing profile in the 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.
+ ///
+ /// Alias Name
///
///
- /// The subscription creation parameters.
///
///
/// The cancellation token.
///
- public static async Task CreateSubscriptionAsync(this ISubscriptionOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateAliasAsync(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateSubscriptionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateAliasWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// The operation to create a new CSP subscription.
+ /// Get Alias 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 customer.
+ ///
+ /// Alias Name
///
- ///
- /// The subscription creation parameters.
- ///
- public static SubscriptionCreationResult CreateCspSubscription(this ISubscriptionOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body)
+ public static PutAliasResponse GetAlias(this ISubscriptionOperations operations, string aliasName)
{
- return operations.CreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult();
+ return operations.GetAliasAsync(aliasName).GetAwaiter().GetResult();
}
///
- /// The operation to create a new CSP subscription.
+ /// Get Alias 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 customer.
- ///
- ///
- /// The subscription creation parameters.
+ ///
+ /// Alias Name
///
///
/// The cancellation token.
///
- public static async Task CreateCspSubscriptionAsync(this ISubscriptionOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAliasAsync(this ISubscriptionOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetAliasWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// Creates an Azure subscription
+ /// Delete Alias.
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the enrollment account to which the subscription will be
- /// billed.
- ///
- ///
- /// The subscription creation parameters.
+ ///
+ /// Alias Name
///
- public static SubscriptionCreationResult BeginCreateSubscriptionInEnrollmentAccount(this ISubscriptionOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body)
+ public static void DeleteAlias(this ISubscriptionOperations operations, string aliasName)
{
- return operations.BeginCreateSubscriptionInEnrollmentAccountAsync(enrollmentAccountName, body).GetAwaiter().GetResult();
+ operations.DeleteAliasAsync(aliasName).GetAwaiter().GetResult();
}
///
- /// Creates an Azure subscription
+ /// Delete Alias.
///
///
/// The operations group for this extension method.
///
- ///
- /// The name of the enrollment account to which the subscription will be
- /// billed.
- ///
- ///
- /// The subscription creation parameters.
+ ///
+ /// Alias Name
///
///
/// The cancellation token.
///
- public static async Task BeginCreateSubscriptionInEnrollmentAccountAsync(this ISubscriptionOperations operations, string enrollmentAccountName, SubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAliasAsync(this ISubscriptionOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginCreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(enrollmentAccountName, body, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
+ (await operations.DeleteAliasWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
- /// The operation to create a new WebDirect or EA Azure subscription.
+ /// Get Alias 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 billing profile in the 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 ISubscriptionOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body)
+ public static PutAliasListResult ListAlias(this ISubscriptionOperations operations)
{
- return operations.BeginCreateSubscriptionAsync(billingAccountName, billingProfileName, invoiceSectionName, body).GetAwaiter().GetResult();
+ return operations.ListAliasAsync().GetAwaiter().GetResult();
}
///
- /// The operation to create a new WebDirect or EA Azure subscription.
+ /// Get Alias 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 billing profile in the 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 ISubscriptionOperations operations, string billingAccountName, string billingProfileName, string invoiceSectionName, ModernSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task ListAliasAsync(this ISubscriptionOperations operations, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginCreateSubscriptionWithHttpMessagesAsync(billingAccountName, billingProfileName, invoiceSectionName, body, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListAliasWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
///
- /// The operation to create a new CSP subscription.
+ /// Create Alias 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 customer.
+ ///
+ /// Alias Name
///
///
- /// The subscription creation parameters.
///
- public static SubscriptionCreationResult BeginCreateCspSubscription(this ISubscriptionOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body)
+ public static PutAliasResponse BeginCreateAlias(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body)
{
- return operations.BeginCreateCspSubscriptionAsync(billingAccountName, customerName, body).GetAwaiter().GetResult();
+ return operations.BeginCreateAliasAsync(aliasName, body).GetAwaiter().GetResult();
}
///
- /// The operation to create a new CSP subscription.
+ /// Create Alias 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 customer.
+ ///
+ /// Alias Name
///
///
- /// The subscription creation parameters.
///
///
/// The cancellation token.
///
- public static async Task BeginCreateCspSubscriptionAsync(this ISubscriptionOperations operations, string billingAccountName, string customerName, ModernCspSubscriptionCreationParameters body, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginCreateAliasAsync(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.BeginCreateCspSubscriptionWithHttpMessagesAsync(billingAccountName, customerName, body, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.BeginCreateAliasWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Microsoft.Azure.Management.Subscription.csproj b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Microsoft.Azure.Management.Subscription.csproj
index 61ce6c5ca3c35..b0240a3983832 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Microsoft.Azure.Management.Subscription.csproj
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Microsoft.Azure.Management.Subscription.csproj
@@ -7,15 +7,15 @@
Microsoft.Azure.Management.Subscription
Provides subscription management capabilities for Microsoft Azure.
Microsoft.Azure.Management.Subscription
- 1.1.4-preview
- Microsoft Azure Subscription;
+ 1.1.5
+ Microsoft Alias Subscription;
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Properties/AssemblyInfo.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Properties/AssemblyInfo.cs
index aac99b572b969..69d82f19b19d7 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Properties/AssemblyInfo.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@
[assembly: AssemblyDescription("Provides Microsoft Azure subscription operations")]
[assembly: AssemblyVersion("1.1.0.0")]
-[assembly: AssemblyFileVersion("1.1.4.0")]
+[assembly: AssemblyFileVersion("1.1.5.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Azure .NET SDK")]
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SubscriptionCreationTests.ScenarioTests.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SubscriptionCreationTests.ScenarioTests.cs
index 4622d908a8cc8..fd2b869783de5 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SubscriptionCreationTests.ScenarioTests.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SubscriptionCreationTests.ScenarioTests.cs
@@ -62,22 +62,25 @@ public void CreateSubscription()
using (MockContext context = MockContext.Start(this.GetType().FullName))
{
- const string enrollmentAccountName = "465c11a0-38c3-4ecc-92e9-996c69ae9e76";
- const string offerType = "MS-AZR-0017P";
- var body = new SubscriptionCreationParameters()
+ const string aliasName = "TestAlias";
+ var putAliasRequest = new PutAliasRequest()
{
- DisplayName = "TestSubscription_AzureSDK",
- OfferType = offerType
+ Properties = new PutAliasRequestProperties()
+ {
+ DisplayName = "TestSub",
+ Workload = Workload.Production,
+ BillingScope = ""
+ }
};
+
var client = GetSubscriptionClient(context, handler);
client.SetRetryPolicy(new RetryPolicy(1));
- var subscriptionResult = client.Subscription.CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(
- enrollmentAccountName, body).ConfigureAwait(false).GetAwaiter().GetResult();
+ var subscriptionResult = client.Subscription.CreateAliasWithHttpMessagesAsync(
+ aliasName, putAliasRequest).ConfigureAwait(false).GetAwaiter().GetResult();
Assert.Equal(HttpStatusCode.OK, subscriptionResult.Response.StatusCode);
Assert.NotNull(subscriptionResult);
- Assert.NotNull(subscriptionResult.Body.SubscriptionLink);
- Assert.StartsWith("/subscriptions", subscriptionResult.Body.SubscriptionLink);
+ Assert.NotNull(subscriptionResult.Body.Properties.SubscriptionId);
}
}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/NetCore/InMemoryTests/SubscriptionCreationTests.InMemory.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/NetCore/InMemoryTests/SubscriptionCreationTests.InMemory.cs
index b6dbfceac02f5..f2093d74660cc 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/NetCore/InMemoryTests/SubscriptionCreationTests.InMemory.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/NetCore/InMemoryTests/SubscriptionCreationTests.InMemory.cs
@@ -45,19 +45,22 @@ public async Task SubscriptionDefition_ValidateCreate()
};
response.Headers.Add("x-ms-request-id", "1");
var handler = new RecordedDelegatingHandler(response) { StatusCodeToReturn = HttpStatusCode.OK };
- var testPrincipal = new AdPrincipal(Guid.NewGuid().ToString());
- var body = new SubscriptionCreationParameters()
+
+ var putAliasRequest = new PutAliasRequest()
{
- OfferType = "MS-AZR-0017P",
- DisplayName = "My Azure Subscription Name",
- Owners = new List () { testPrincipal }
+ Properties = new PutAliasRequestProperties()
+ {
+ DisplayName = "TestSub",
+ Workload = Workload.Production,
+ BillingScope = ""
+ }
};
+
var subscriptionResult = await GetSubscriptionClient(handler)
- .Subscription.CreateSubscriptionInEnrollmentAccountWithHttpMessagesAsync(Guid.NewGuid().ToString(), body);
+ .Subscription.CreateAliasWithHttpMessagesAsync(Guid.NewGuid().ToString(), putAliasRequest);
Assert.NotNull(subscriptionResult);
Assert.NotNull(subscriptionResult.Response);
Assert.True(subscriptionResult.Response.IsSuccessStatusCode);
- Assert.Equal(subscriptionResult.Body.SubscriptionLink, SubscriptionLink);
}
}
}
From 71517886625f5daeddba56bb0dd48fffaf753c75 Mon Sep 17 00:00:00 2001
From: navysingla <47647464+navysingla@users.noreply.github.com>
Date: Fri, 21 Aug 2020 10:46:08 -0700
Subject: [PATCH 2/3] Updated
---
.../subscription_resource-manager.txt | 4 +-
.../src/Generated/AliasOperations.cs | 774 ++++++++++++++++++
.../Generated/AliasOperationsExtensions.cs | 194 +++++
.../src/Generated/IAliasOperations.cs | 135 +++
.../src/Generated/ISubscriptionClient.cs | 5 +
.../src/Generated/ISubscriptionOperations.cs | 108 ---
.../src/Generated/Models/PutAliasRequest.cs | 9 +-
.../Generated/SdkInfo_SubscriptionClient.cs | 3 +-
.../src/Generated/SubscriptionClient.cs | 6 +
.../src/Generated/SubscriptionOperations.cs | 720 ----------------
.../SubscriptionOperationsExtensions.cs | 169 ----
11 files changed, 1125 insertions(+), 1002 deletions(-)
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/AliasOperations.cs
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/AliasOperationsExtensions.cs
create mode 100644 sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/IAliasOperations.cs
diff --git a/eng/mgmt/mgmtmetadata/subscription_resource-manager.txt b/eng/mgmt/mgmtmetadata/subscription_resource-manager.txt
index ea504c28b4ee5..3b0a49567cb6c 100644
--- a/eng/mgmt/mgmtmetadata/subscription_resource-manager.txt
+++ b/eng/mgmt/mgmtmetadata/subscription_resource-manager.txt
@@ -4,11 +4,11 @@ Commencing code generation
Generating CSharp code
Executing AutoRest command
cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/subscription/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\github2\sdk
-2020-08-20 21:22:36 UTC
+2020-08-21 17:43:07 UTC
Azure-rest-api-specs repository information
GitHub fork: Azure
Branch: master
-Commit: a7ca142c3f0f290fdda778f26f4f1fab65f71cf9
+Commit: 1d90950c9db002ca44a56873c5a2ea3c96f533f8
AutoRest information
Requested version: v2
Bootstrapper version: autorest@2.0.4413
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/AliasOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/AliasOperations.cs
new file mode 100644
index 0000000000000..da4174675671c
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/AliasOperations.cs
@@ -0,0 +1,774 @@
+//
+// 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;
+
+ ///
+ /// AliasOperations operations.
+ ///
+ internal partial class AliasOperations : IServiceOperations, IAliasOperations
+ {
+ ///
+ /// Initializes a new instance of the AliasOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal AliasOperations(SubscriptionClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SubscriptionClient
+ ///
+ public SubscriptionClient Client { get; private set; }
+
+ ///
+ /// Create Alias Subscription.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public async Task> CreateWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send Request
+ AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(aliasName, body, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ /// 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 aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (aliasName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
+ }
+ string apiVersion = "2020-09-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("aliasName", aliasName);
+ 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/aliases/{aliasName}").ToString();
+ _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
+ 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 ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponseBody _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;
+ }
+
+ ///
+ /// Delete Alias.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// 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 DeleteWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (aliasName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
+ }
+ string apiVersion = "2020-09-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("aliasName", aliasName);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString();
+ _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
+ 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("DELETE");
+ _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 != 204)
+ {
+ var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponseBody _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();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// 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 = "2020-09-01";
+ // 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/aliases").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 ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponseBody _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;
+ }
+
+ ///
+ /// Create Alias Subscription.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> BeginCreateWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (aliasName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
+ }
+ if (body == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "body");
+ }
+ if (body != null)
+ {
+ body.Validate();
+ }
+ string apiVersion = "2020-09-01";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("aliasName", aliasName);
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("apiVersion", apiVersion);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString();
+ _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
+ 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("PUT");
+ _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 != 201)
+ {
+ var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponseBody _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);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _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/AliasOperationsExtensions.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/AliasOperationsExtensions.cs
new file mode 100644
index 0000000000000..fee4b4322264a
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/AliasOperationsExtensions.cs
@@ -0,0 +1,194 @@
+//
+// 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 AliasOperations.
+ ///
+ public static partial class AliasOperationsExtensions
+ {
+ ///
+ /// Create Alias Subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ ///
+ public static PutAliasResponse Create(this IAliasOperations operations, string aliasName, PutAliasRequest body)
+ {
+ return operations.CreateAsync(aliasName, body).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create Alias Subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateAsync(this IAliasOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Alias Name
+ ///
+ public static PutAliasResponse Get(this IAliasOperations operations, string aliasName)
+ {
+ return operations.GetAsync(aliasName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IAliasOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete Alias.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Alias Name
+ ///
+ public static void Delete(this IAliasOperations operations, string aliasName)
+ {
+ operations.DeleteAsync(aliasName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete Alias.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IAliasOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ public static PutAliasListResult List(this IAliasOperations operations)
+ {
+ return operations.ListAsync().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListAsync(this IAliasOperations operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Create Alias Subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ ///
+ public static PutAliasResponse BeginCreate(this IAliasOperations operations, string aliasName, PutAliasRequest body)
+ {
+ return operations.BeginCreateAsync(aliasName, body).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create Alias Subscription.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task BeginCreateAsync(this IAliasOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.BeginCreateWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/IAliasOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/IAliasOperations.cs
new file mode 100644
index 0000000000000..cfa5b22423757
--- /dev/null
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/IAliasOperations.cs
@@ -0,0 +1,135 @@
+//
+// 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;
+
+ ///
+ /// AliasOperations operations.
+ ///
+ public partial interface IAliasOperations
+ {
+ ///
+ /// Create Alias Subscription.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ /// 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 aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Delete Alias.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Get Alias Subscription.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Create Alias Subscription.
+ ///
+ ///
+ /// Alias Name
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> BeginCreateWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
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 04ad72e34bcff..7bbd5b6ec5205 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionClient.cs
@@ -79,5 +79,10 @@ public partial interface ISubscriptionClient : System.IDisposable
///
IOperations Operations { get; }
+ ///
+ /// Gets the IAliasOperations.
+ ///
+ IAliasOperations Alias { get; }
+
}
}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs
index 17f00e639df99..6c2d5c395ffb5 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/ISubscriptionOperations.cs
@@ -92,113 +92,5 @@ public partial interface ISubscriptionOperations
/// Thrown when a required parameter is null
///
Task> EnableWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Create Alias Subscription.
- ///
- ///
- /// Alias Name
- ///
- ///
- ///
- ///
- /// 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> CreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Get Alias Subscription.
- ///
- ///
- /// Alias Name
- ///
- ///
- /// 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> GetAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Delete Alias.
- ///
- ///
- /// Alias Name
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task DeleteAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Get Alias Subscription.
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// Thrown when unable to deserialize the response
- ///
- ///
- /// Thrown when a required parameter is null
- ///
- Task> ListAliasWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
- ///
- /// Create Alias Subscription.
- ///
- ///
- /// Alias Name
- ///
- ///
- ///
- ///
- /// 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> BeginCreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs
index 2c40b6041cc22..99fff5b00c3ce 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/Models/PutAliasRequest.cs
@@ -10,6 +10,7 @@
namespace Microsoft.Azure.Management.Subscription.Models
{
+ using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
@@ -30,7 +31,7 @@ public PutAliasRequest()
/// Initializes a new instance of the PutAliasRequest class.
///
/// Put alias request properties.
- public PutAliasRequest(PutAliasRequestProperties properties = default(PutAliasRequestProperties))
+ public PutAliasRequest(PutAliasRequestProperties properties)
{
Properties = properties;
CustomInit();
@@ -50,11 +51,15 @@ public PutAliasRequest()
///
/// Validate the object.
///
- ///
+ ///
/// Thrown if validation fails
///
public virtual void Validate()
{
+ if (Properties == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "Properties");
+ }
if (Properties != null)
{
Properties.Validate();
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 744568f51395e..4a3cae8899950 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,6 +19,7 @@ public static IEnumerable> ApiInfo_SubscriptionCli
{
return new Tuple[]
{
+ new Tuple("Subscription", "Alias", "2020-09-01"),
new Tuple("Subscription", "Operations", "2020-09-01"),
new Tuple("Subscription", "Subscription", "2020-09-01"),
new Tuple("SubscriptionClient", "Subscriptions", "2016-06-01"),
@@ -32,7 +33,7 @@ public static IEnumerable> ApiInfo_SubscriptionCli
public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/subscription/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\github2\\sdk";
public static readonly String GithubForkName = "Azure";
public static readonly String GithubBranchName = "master";
- public static readonly String GithubCommidId = "a7ca142c3f0f290fdda778f26f4f1fab65f71cf9";
+ public static readonly String GithubCommidId = "1d90950c9db002ca44a56873c5a2ea3c96f533f8";
public static readonly String CodeGenerationErrors = "";
public static readonly String GithubRepoName = "azure-rest-api-specs";
// END: Code Generation Metadata Section
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 cef2770bd358a..9507c44960605 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionClient.cs
@@ -84,6 +84,11 @@ public partial class SubscriptionClient : ServiceClient, ISu
///
public virtual IOperations Operations { get; private set; }
+ ///
+ /// Gets the IAliasOperations.
+ ///
+ public virtual IAliasOperations Alias { get; private set; }
+
///
/// Initializes a new instance of the SubscriptionClient class.
///
@@ -329,6 +334,7 @@ private void Initialize()
Tenants = new TenantsOperations(this);
Subscription = new SubscriptionOperations(this);
Operations = new Operations(this);
+ Alias = new AliasOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs
index e931a84504b84..b597649f41b4b 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperations.cs
@@ -589,725 +589,5 @@ internal SubscriptionOperations(SubscriptionClient client)
return _result;
}
- ///
- /// Create Alias Subscription.
- ///
- ///
- /// Alias Name
- ///
- ///
- ///
- ///
- /// The headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- public async Task> CreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- // Send Request
- AzureOperationResponse _response = await BeginCreateAliasWithHttpMessagesAsync(aliasName, body, customHeaders, cancellationToken).ConfigureAwait(false);
- return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
- }
-
- ///
- /// Get Alias Subscription.
- ///
- ///
- /// Alias Name
- ///
- ///
- /// 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> GetAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (aliasName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
- }
- string apiVersion = "2020-09-01";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("aliasName", aliasName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "GetAlias", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString();
- _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
- 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 ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponseBody _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;
- }
-
- ///
- /// Delete Alias.
- ///
- ///
- /// Alias Name
- ///
- ///
- /// Headers that will be added to request.
- ///
- ///
- /// The cancellation token.
- ///
- ///
- /// Thrown when the operation returned an invalid status code
- ///
- ///
- /// 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 DeleteAliasWithHttpMessagesAsync(string aliasName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (aliasName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
- }
- string apiVersion = "2020-09-01";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("aliasName", aliasName);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "DeleteAlias", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString();
- _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
- 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("DELETE");
- _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 != 204)
- {
- var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponseBody _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();
- }
- if (_shouldTrace)
- {
- ServiceClientTracing.Exit(_invocationId, _result);
- }
- return _result;
- }
-
- ///
- /// Get Alias Subscription.
- ///
- ///
- /// 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> ListAliasWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- string apiVersion = "2020-09-01";
- // 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, "ListAlias", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases").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 ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponseBody _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;
- }
-
- ///
- /// Create Alias Subscription.
- ///
- ///
- /// Alias Name
- ///
- ///
- ///
- ///
- /// 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> BeginCreateAliasWithHttpMessagesAsync(string aliasName, PutAliasRequest body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
- {
- if (aliasName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "aliasName");
- }
- if (body == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "body");
- }
- if (body != null)
- {
- body.Validate();
- }
- string apiVersion = "2019-10-01-preview";
- // Tracing
- bool _shouldTrace = ServiceClientTracing.IsEnabled;
- string _invocationId = null;
- if (_shouldTrace)
- {
- _invocationId = ServiceClientTracing.NextInvocationId.ToString();
- Dictionary tracingParameters = new Dictionary();
- tracingParameters.Add("aliasName", aliasName);
- tracingParameters.Add("body", body);
- tracingParameters.Add("apiVersion", apiVersion);
- tracingParameters.Add("cancellationToken", cancellationToken);
- ServiceClientTracing.Enter(_invocationId, this, "BeginCreateAlias", tracingParameters);
- }
- // Construct URL
- var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Subscription/aliases/{aliasName}").ToString();
- _url = _url.Replace("{aliasName}", System.Uri.EscapeDataString(aliasName));
- 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("PUT");
- _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 != 201)
- {
- var ex = new ErrorResponseBodyException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- try
- {
- _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- ErrorResponseBody _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);
- }
- }
- // Deserialize Response
- if ((int)_statusCode == 201)
- {
- _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
index 987eceeeef01e..5239957135423 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/src/Generated/SubscriptionOperationsExtensions.cs
@@ -129,174 +129,5 @@ public static EnabledSubscriptionId Enable(this ISubscriptionOperations operatio
}
}
- ///
- /// Create Alias Subscription.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Alias Name
- ///
- ///
- ///
- public static PutAliasResponse CreateAlias(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body)
- {
- return operations.CreateAliasAsync(aliasName, body).GetAwaiter().GetResult();
- }
-
- ///
- /// Create Alias Subscription.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Alias Name
- ///
- ///
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task CreateAliasAsync(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.CreateAliasWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Get Alias Subscription.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Alias Name
- ///
- public static PutAliasResponse GetAlias(this ISubscriptionOperations operations, string aliasName)
- {
- return operations.GetAliasAsync(aliasName).GetAwaiter().GetResult();
- }
-
- ///
- /// Get Alias Subscription.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Alias Name
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task GetAliasAsync(this ISubscriptionOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.GetAliasWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Delete Alias.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Alias Name
- ///
- public static void DeleteAlias(this ISubscriptionOperations operations, string aliasName)
- {
- operations.DeleteAliasAsync(aliasName).GetAwaiter().GetResult();
- }
-
- ///
- /// Delete Alias.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Alias Name
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task DeleteAliasAsync(this ISubscriptionOperations operations, string aliasName, CancellationToken cancellationToken = default(CancellationToken))
- {
- (await operations.DeleteAliasWithHttpMessagesAsync(aliasName, null, cancellationToken).ConfigureAwait(false)).Dispose();
- }
-
- ///
- /// Get Alias Subscription.
- ///
- ///
- /// The operations group for this extension method.
- ///
- public static PutAliasListResult ListAlias(this ISubscriptionOperations operations)
- {
- return operations.ListAliasAsync().GetAwaiter().GetResult();
- }
-
- ///
- /// Get Alias Subscription.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task ListAliasAsync(this ISubscriptionOperations operations, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.ListAliasWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
- ///
- /// Create Alias Subscription.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Alias Name
- ///
- ///
- ///
- public static PutAliasResponse BeginCreateAlias(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body)
- {
- return operations.BeginCreateAliasAsync(aliasName, body).GetAwaiter().GetResult();
- }
-
- ///
- /// Create Alias Subscription.
- ///
- ///
- /// The operations group for this extension method.
- ///
- ///
- /// Alias Name
- ///
- ///
- ///
- ///
- /// The cancellation token.
- ///
- public static async Task BeginCreateAliasAsync(this ISubscriptionOperations operations, string aliasName, PutAliasRequest body, CancellationToken cancellationToken = default(CancellationToken))
- {
- using (var _result = await operations.BeginCreateAliasWithHttpMessagesAsync(aliasName, body, null, cancellationToken).ConfigureAwait(false))
- {
- return _result.Body;
- }
- }
-
}
}
From 64aa2bc11b623c2659cf7ac39db42b2699673bf0 Mon Sep 17 00:00:00 2001
From: navysingla <47647464+navysingla@users.noreply.github.com>
Date: Fri, 21 Aug 2020 16:52:54 -0700
Subject: [PATCH 3/3] updated
---
.../CreateSubscription.json | 196 +++---------------
...SubscriptionCreationTests.ScenarioTests.cs | 6 +-
.../SubscriptionCreationTests.InMemory.cs | 2 +-
3 files changed, 36 insertions(+), 168 deletions(-)
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SessionRecords/FullDesktop.Tests.LiveSubscriptionCreationTests/CreateSubscription.json b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SessionRecords/FullDesktop.Tests.LiveSubscriptionCreationTests/CreateSubscription.json
index 402e05e9452b6..653735c0961cd 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SessionRecords/FullDesktop.Tests.LiveSubscriptionCreationTests/CreateSubscription.json
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SessionRecords/FullDesktop.Tests.LiveSubscriptionCreationTests/CreateSubscription.json
@@ -1,224 +1,92 @@
{
"Entries": [
{
- "RequestUri": "/providers/Microsoft.Billing/enrollmentAccounts/465c11a0-38c3-4ecc-92e9-996c69ae9e76/providers/Microsoft.Subscription/createSubscription?api-version=2019-10-01-preview",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuQmlsbGluZy9lbnJvbGxtZW50QWNjb3VudHMvNDY1YzExYTAtMzhjMy00ZWNjLTkyZTktOTk2YzY5YWU5ZTc2L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL2NyZWF0ZVN1YnNjcmlwdGlvbj9hcGktdmVyc2lvbj0yMDE4LTAzLTAxLXByZXZpZXc=",
- "RequestMethod": "POST",
- "RequestBody": "{\r\n \"displayName\": \"TestSubscription_AzureSDK\",\r\n \"offerType\": \"MS-AZR-0017P\"\r\n}",
+ "RequestUri": "/providers/Microsoft.Subscription/aliases/navyprod1?api-version=2019-10-01-preview",
+ "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL2FsaWFzZXMvbmF2eXByb2QxP2FwaS12ZXJzaW9uPTIwMTktMTAtMDEtcHJldmlldw==",
+ "RequestMethod": "PUT",
+ "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"TestSub\",\r\n \"workload\": \"Production\",\r\n \"billingScope\": \"/providers/Microsoft.Billing/billingAccounts/4756419/enrollmentAccounts/224190\"\r\n }\r\n}",
"RequestHeaders": {
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Content-Length": [
- "82"
- ],
"x-ms-client-request-id": [
- "6d593227-23f5-475e-8755-65cc19595383"
+ "fdb31790-2774-4a6a-99e5-0a57e637dde4"
],
"accept-language": [
"en-US"
],
"User-Agent": [
- "FxVersion/4.7.2633.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.16299",
- "Microsoft.Azure.Management.Subscription.SubscriptionClient/1.0.0.0"
- ]
- },
- "ResponseBody": "{}",
- "ResponseHeaders": {
- "Content-Length": [
- "2"
+ "FxVersion/4.8.4200.0",
+ "OSName/Windows",
+ "OSVersion/10.0.19041.0",
+ "Microsoft.Azure.Management.Subscription.SubscriptionClient/1.1.5.0"
],
"Content-Type": [
"application/json; charset=utf-8"
],
- "Expires": [
- "-1"
- ],
+ "Content-Length": [
+ "192"
+ ]
+ },
+ "ResponseHeaders": {
"Pragma": [
"no-cache"
],
- "Retry-After": [
- "10"
- ],
- "api-supported-versions": [
- "2019-10-01-preview"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
+ "Vary": [
+ "Accept-Encoding"
],
"x-ms-ratelimit-remaining-tenant-writes": [
"1199"
],
- "x-ms-request-id": [
- "e0fbea32-c0d5-41a6-a01e-f7ad002b0efe"
- ],
"x-ms-correlation-request-id": [
- "e0fbea32-c0d5-41a6-a01e-f7ad002b0efe"
- ],
- "x-ms-routing-request-id": [
- "CENTRALUS:20180326T222438Z:e0fbea32-c0d5-41a6-a01e-f7ad002b0efe"
+ "41584aee-ca09-4640-8f8a-aff8d3da94fb"
],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Mon, 26 Mar 2018 22:24:38 GMT"
- ],
- "Location": [
- "https://api-dogfood.resources.windows-int.net/providers/Microsoft.Subscription/subscriptionOperations/599f8500-c2b8-4b4b-9295-d563e3b554dd?api-version=2019-10-01-preview"
- ],
- "Server": [
- "Microsoft-IIS/8.5"
+ "request-id": [
+ "41584aee-ca09-4640-8f8a-aff8d3da94fb"
],
- "X-AspNet-Version": [
- "4.0.30319"
- ],
- "X-Powered-By": [
- "ASP.NET"
- ]
- },
- "StatusCode": 202
- },
- {
- "RequestUri": "/providers/Microsoft.Subscription/subscriptionOperations/599f8500-c2b8-4b4b-9295-d563e3b554dd?api-version=2019-10-01-preview",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL3N1YnNjcmlwdGlvbk9wZXJhdGlvbnMvNTk5Zjg1MDAtYzJiOC00YjRiLTkyOTUtZDU2M2UzYjU1NGRkP2FwaS12ZXJzaW9uPTIwMTgtMDMtMDEtcHJldmlldw==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "User-Agent": [
- "FxVersion/4.7.2633.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.16299",
- "Microsoft.Azure.Management.Subscription.SubscriptionClient/1.0.0.0"
- ]
- },
- "ResponseBody": "{\r\n \"subscriptionLink\": \"/subscriptions/0b32443b-93cf-48f0-b003-7e4d6b968946\"\r\n}",
- "ResponseHeaders": {
- "Content-Length": [
- "74"
- ],
- "Content-Type": [
- "application/json; charset=utf-8"
- ],
- "Expires": [
- "-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "api-supported-versions": [
- "2019-10-01-preview"
+ "x-gsm": [
+ "1.0.0.0"
],
"X-Content-Type-Options": [
"nosniff"
],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "14999"
- ],
"x-ms-request-id": [
- "99902f9b-a2dd-41a4-b4ee-b5ac2d7d08a5"
- ],
- "x-ms-correlation-request-id": [
- "99902f9b-a2dd-41a4-b4ee-b5ac2d7d08a5"
+ "41584aee-ca09-4640-8f8a-aff8d3da94fb"
],
"x-ms-routing-request-id": [
- "CENTRALUS:20180326T222449Z:99902f9b-a2dd-41a4-b4ee-b5ac2d7d08a5"
+ "WESTUS:20200821T234350Z:41584aee-ca09-4640-8f8a-aff8d3da94fb"
+ ],
+ "Strict-Transport-Security": [
+ "max-age=31536000; includeSubDomains"
],
"Cache-Control": [
"no-cache"
],
"Date": [
- "Mon, 26 Mar 2018 22:24:48 GMT"
+ "Fri, 21 Aug 2020 23:43:50 GMT"
],
"Server": [
- "Microsoft-IIS/8.5"
+ "Microsoft-IIS/10.0"
],
"X-AspNet-Version": [
"4.0.30319"
],
"X-Powered-By": [
"ASP.NET"
- ]
- },
- "StatusCode": 200
- },
- {
- "RequestUri": "/providers/Microsoft.Subscription/subscriptionOperations/599f8500-c2b8-4b4b-9295-d563e3b554dd?api-version=2019-10-01-preview",
- "EncodedRequestUri": "L3Byb3ZpZGVycy9NaWNyb3NvZnQuU3Vic2NyaXB0aW9uL3N1YnNjcmlwdGlvbk9wZXJhdGlvbnMvNTk5Zjg1MDAtYzJiOC00YjRiLTkyOTUtZDU2M2UzYjU1NGRkP2FwaS12ZXJzaW9uPTIwMTgtMDMtMDEtcHJldmlldw==",
- "RequestMethod": "GET",
- "RequestBody": "",
- "RequestHeaders": {
- "User-Agent": [
- "FxVersion/4.7.2633.0",
- "OSName/Windows10Enterprise",
- "OSVersion/6.3.16299",
- "Microsoft.Azure.Management.Subscription.SubscriptionClient/1.0.0.0"
- ]
- },
- "ResponseBody": "{\r\n \"subscriptionLink\": \"/subscriptions/29165a61-87c6-47fe-adc1-4260ff9420a0\"\r\n}",
- "ResponseHeaders": {
+ ],
"Content-Length": [
- "74"
+ "222"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
- ],
- "Pragma": [
- "no-cache"
- ],
- "api-supported-versions": [
- "2019-10-01-preview"
- ],
- "X-Content-Type-Options": [
- "nosniff"
- ],
- "Strict-Transport-Security": [
- "max-age=31536000; includeSubDomains"
- ],
- "x-ms-ratelimit-remaining-tenant-reads": [
- "14998"
- ],
- "x-ms-request-id": [
- "cf90ccc2-7b5f-4afe-8c31-052cf5f5cacf"
- ],
- "x-ms-correlation-request-id": [
- "cf90ccc2-7b5f-4afe-8c31-052cf5f5cacf"
- ],
- "x-ms-routing-request-id": [
- "CENTRALUS:20180326T222449Z:cf90ccc2-7b5f-4afe-8c31-052cf5f5cacf"
- ],
- "Cache-Control": [
- "no-cache"
- ],
- "Date": [
- "Mon, 26 Mar 2018 22:24:49 GMT"
- ],
- "Server": [
- "Microsoft-IIS/8.5"
- ],
- "X-AspNet-Version": [
- "4.0.30319"
- ],
- "X-Powered-By": [
- "ASP.NET"
]
},
+ "ResponseBody": "{\r\n \"id\": \"/providers/Microsoft.Subscription/aliases/navyprod1\",\r\n \"name\": \"navyprod1\",\r\n \"type\": \"Microsoft.Subscription/aliases\",\r\n \"properties\": {\r\n \"subscriptionId\": \"cef41c82-c4f0-48ae-a336-2ec44ec4375a\",\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}",
"StatusCode": 200
}
],
"Names": {},
"Variables": {
- "SubscriptionId": "df8cd511-7137-41f2-b2e9-48dc00a0b70f"
+ "SubscriptionId": "5b47c35e-863f-4c66-ba9f-52b9d0ced037"
}
}
\ No newline at end of file
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SubscriptionCreationTests.ScenarioTests.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SubscriptionCreationTests.ScenarioTests.cs
index fd2b869783de5..e9205ee9b1e3e 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SubscriptionCreationTests.ScenarioTests.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/FullDesktop/SubscriptionCreationTests.ScenarioTests.cs
@@ -62,20 +62,20 @@ public void CreateSubscription()
using (MockContext context = MockContext.Start(this.GetType().FullName))
{
- const string aliasName = "TestAlias";
+ const string aliasName = "navyprod1";
var putAliasRequest = new PutAliasRequest()
{
Properties = new PutAliasRequestProperties()
{
DisplayName = "TestSub",
Workload = Workload.Production,
- BillingScope = ""
+ BillingScope = "/providers/Microsoft.Billing/billingAccounts/4756419/enrollmentAccounts/224190"
}
};
var client = GetSubscriptionClient(context, handler);
client.SetRetryPolicy(new RetryPolicy(1));
- var subscriptionResult = client.Subscription.CreateAliasWithHttpMessagesAsync(
+ var subscriptionResult = client.Alias.CreateWithHttpMessagesAsync(
aliasName, putAliasRequest).ConfigureAwait(false).GetAwaiter().GetResult();
Assert.Equal(HttpStatusCode.OK, subscriptionResult.Response.StatusCode);
diff --git a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/NetCore/InMemoryTests/SubscriptionCreationTests.InMemory.cs b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/NetCore/InMemoryTests/SubscriptionCreationTests.InMemory.cs
index f2093d74660cc..db4dfe2fe17d0 100644
--- a/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/NetCore/InMemoryTests/SubscriptionCreationTests.InMemory.cs
+++ b/sdk/subscription/Microsoft.Azure.Management.Subscription/tests/NetCore/InMemoryTests/SubscriptionCreationTests.InMemory.cs
@@ -57,7 +57,7 @@ public async Task SubscriptionDefition_ValidateCreate()
};
var subscriptionResult = await GetSubscriptionClient(handler)
- .Subscription.CreateAliasWithHttpMessagesAsync(Guid.NewGuid().ToString(), putAliasRequest);
+ .Alias.CreateWithHttpMessagesAsync(Guid.NewGuid().ToString(), putAliasRequest);
Assert.NotNull(subscriptionResult);
Assert.NotNull(subscriptionResult.Response);
Assert.True(subscriptionResult.Response.IsSuccessStatusCode);