diff --git a/setup/azurecmdfiles.wxi b/setup/azurecmdfiles.wxi
index a80793ae1e1d..1057e8bca48b 100644
--- a/setup/azurecmdfiles.wxi
+++ b/setup/azurecmdfiles.wxi
@@ -489,6 +489,9 @@
+
+
+
@@ -498,6 +501,9 @@
+
+
+
@@ -546,6 +552,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1045,6 +1063,12 @@
+
+
+
+
+
+
@@ -1141,9 +1165,6 @@
-
-
-
@@ -1158,12 +1179,18 @@
+
+
+
+
+
+
@@ -1182,6 +1209,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1642,9 +1684,6 @@
-
-
-
@@ -1707,6 +1746,12 @@
+
+
+
+
+
+
@@ -1856,6 +1901,12 @@
+
+
+
+
+
+
@@ -2026,6 +2077,9 @@
+
+
+
@@ -2221,9 +2275,6 @@
-
-
-
@@ -4532,9 +4583,11 @@
+
+
@@ -4551,6 +4604,10 @@
+
+
+
+
@@ -4714,6 +4771,8 @@
+
+
@@ -4746,19 +4805,25 @@
-
+
+
+
+
+
+
+
@@ -4909,7 +4974,6 @@
-
@@ -4930,6 +4994,8 @@
+
+
@@ -4979,6 +5045,8 @@
+
+
@@ -5035,6 +5103,7 @@
+
@@ -5098,7 +5167,6 @@
-
diff --git a/src/Common/Commands.Common/AzurePSCmdlet.cs b/src/Common/Commands.Common/AzurePSCmdlet.cs
index 764ba65e3afd..072925b104fb 100644
--- a/src/Common/Commands.Common/AzurePSCmdlet.cs
+++ b/src/Common/Commands.Common/AzurePSCmdlet.cs
@@ -34,7 +34,7 @@ namespace Microsoft.WindowsAzure.Commands.Utilities.Common
///
public abstract class AzurePSCmdlet : PSCmdlet, IDisposable
{
- private readonly ConcurrentQueue _debugMessages;
+ protected readonly ConcurrentQueue _debugMessages;
private RecordingTracingInterceptor _httpTracingInterceptor;
diff --git a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config
index 92af1cbd0a53..dcb590eed4f2 100644
--- a/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config
+++ b/src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config
@@ -5,7 +5,6 @@
-
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/packages.config b/src/ResourceManager/Automation/Commands.Automation.Test/packages.config
index 3b1da2447b75..66b0181b3895 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/packages.config
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/packages.config
@@ -18,5 +18,4 @@
-
\ No newline at end of file
diff --git a/src/ResourceManager/AzureBatch/Commands.Batch/Properties/Resources.Designer.cs b/src/ResourceManager/AzureBatch/Commands.Batch/Properties/Resources.Designer.cs
index 4de1b59c3c07..3f9edbcd8e80 100644
--- a/src/ResourceManager/AzureBatch/Commands.Batch/Properties/Resources.Designer.cs
+++ b/src/ResourceManager/AzureBatch/Commands.Batch/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.34209
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs
index 86c79b1061f9..b0d2563c5d43 100644
--- a/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AccessTokenExtensions.cs
@@ -1,9 +1,6 @@
-using Microsoft.Azure.Common.Authentication;
-using System;
-using System.Collections.Generic;
+using System;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Microsoft.Azure.Common.Authentication;
namespace Microsoft.Azure.Commands.ResourceManager.Common
{
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs
index c2647a632998..cfdd74df9587 100644
--- a/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs
@@ -12,17 +12,18 @@
// limitations under the License.
// ----------------------------------------------------------------------------------
+using System;
+using System.IO;
using System.Management.Automation;
+using System.Management.Automation.Host;
+using System.Threading;
+using Microsoft.Azure.Commands.ResourceManager.Common.Properties;
using Microsoft.Azure.Common.Authentication;
using Microsoft.Azure.Common.Authentication.Models;
+using Microsoft.Azure.Management.Internal.Resources;
+using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
-using System.IO;
using Newtonsoft.Json;
-using Microsoft.Azure.Commands.ResourceManager.Common.Properties;
-using System;
-using System.Threading;
-using System.Management.Automation.Host;
-using Microsoft.WindowsAzure.Commands.Common;
namespace Microsoft.Azure.Commands.ResourceManager.Common
{
@@ -42,6 +43,14 @@ static AzureRMCmdlet()
}
}
+ public AzureRMCmdlet()
+ {
+ AzureSession.ClientFactory.RemoveHandler(typeof(RPRegistrationDelegatingHandler));
+ AzureSession.ClientFactory.AddHandler(new RPRegistrationDelegatingHandler(
+ () => AzureSession.ClientFactory.CreateClient(DefaultContext, AzureEnvironment.Endpoint.ResourceManager),
+ s => _debugMessages.Enqueue(s)));
+ }
+
///
/// Gets or sets the global profile for ARM cmdlets.
///
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj b/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj
index 0bccb30ae59b..ddd95a47cda3 100644
--- a/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj
@@ -68,10 +68,6 @@
False
..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll
-
- False
- ..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.7-preview\lib\net40\Microsoft.Azure.ResourceManager.dll
-
False
..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll
@@ -142,14 +138,143 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
True
True
Resources.resx
-
+
+
Designer
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/AuthorizationClient.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/AuthorizationClient.cs
new file mode 100644
index 000000000000..4a25ef52c217
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/AuthorizationClient.cs
@@ -0,0 +1,254 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+using System.Net.Http;
+using Hyak.Common;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public partial class AuthorizationClient : ServiceClient, IAuthorizationClient
+ {
+ private string _apiVersion;
+
+ ///
+ /// Gets the API version.
+ ///
+ public string ApiVersion
+ {
+ get { return this._apiVersion; }
+ }
+
+ private Uri _baseUri;
+
+ ///
+ /// Gets the URI used as the base for all cloud service requests.
+ ///
+ public Uri BaseUri
+ {
+ get { return this._baseUri; }
+ }
+
+ private SubscriptionCloudCredentials _credentials;
+
+ ///
+ /// Gets subscription credentials which uniquely identify Microsoft
+ /// Azure subscription. The subscription ID forms part of the URI for
+ /// every service call.
+ ///
+ public SubscriptionCloudCredentials Credentials
+ {
+ get { return this._credentials; }
+ }
+
+ private int _longRunningOperationInitialTimeout;
+
+ ///
+ /// Gets or sets the initial timeout for Long Running Operations.
+ ///
+ public int LongRunningOperationInitialTimeout
+ {
+ get { return this._longRunningOperationInitialTimeout; }
+ set { this._longRunningOperationInitialTimeout = value; }
+ }
+
+ private int _longRunningOperationRetryTimeout;
+
+ ///
+ /// Gets or sets the retry timeout for Long Running Operations.
+ ///
+ public int LongRunningOperationRetryTimeout
+ {
+ get { return this._longRunningOperationRetryTimeout; }
+ set { this._longRunningOperationRetryTimeout = value; }
+ }
+
+ private IManagementLockOperations _managementLocks;
+
+ ///
+ /// Operations for managing locks.
+ ///
+ public virtual IManagementLockOperations ManagementLocks
+ {
+ get { return this._managementLocks; }
+ }
+
+ ///
+ /// Initializes a new instance of the AuthorizationClient class.
+ ///
+ public AuthorizationClient()
+ : base()
+ {
+ this._managementLocks = new ManagementLockOperations(this);
+ this._apiVersion = "2015-01-01";
+ this._longRunningOperationInitialTimeout = -1;
+ this._longRunningOperationRetryTimeout = -1;
+ this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
+ }
+
+ ///
+ /// Initializes a new instance of the AuthorizationClient class.
+ ///
+ ///
+ /// Required. Gets subscription credentials which uniquely identify
+ /// Microsoft Azure subscription. The subscription ID forms part of
+ /// the URI for every service call.
+ ///
+ ///
+ /// Optional. Gets the URI used as the base for all cloud service
+ /// requests.
+ ///
+ public AuthorizationClient(SubscriptionCloudCredentials credentials, Uri baseUri)
+ : this()
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ if (baseUri == null)
+ {
+ throw new ArgumentNullException("baseUri");
+ }
+ this._credentials = credentials;
+ this._baseUri = baseUri;
+
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ ///
+ /// Initializes a new instance of the AuthorizationClient class.
+ ///
+ ///
+ /// Required. Gets subscription credentials which uniquely identify
+ /// Microsoft Azure subscription. The subscription ID forms part of
+ /// the URI for every service call.
+ ///
+ public AuthorizationClient(SubscriptionCloudCredentials credentials)
+ : this()
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ this._credentials = credentials;
+ this._baseUri = new Uri("https://management.azure.com/");
+
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ ///
+ /// Initializes a new instance of the AuthorizationClient class.
+ ///
+ ///
+ /// The Http client
+ ///
+ public AuthorizationClient(HttpClient httpClient)
+ : base(httpClient)
+ {
+ this._managementLocks = new ManagementLockOperations(this);
+ this._apiVersion = "2015-01-01";
+ this._longRunningOperationInitialTimeout = -1;
+ this._longRunningOperationRetryTimeout = -1;
+ this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
+ }
+
+ ///
+ /// Initializes a new instance of the AuthorizationClient class.
+ ///
+ ///
+ /// Required. Gets subscription credentials which uniquely identify
+ /// Microsoft Azure subscription. The subscription ID forms part of
+ /// the URI for every service call.
+ ///
+ ///
+ /// Optional. Gets the URI used as the base for all cloud service
+ /// requests.
+ ///
+ ///
+ /// The Http client
+ ///
+ public AuthorizationClient(SubscriptionCloudCredentials credentials, Uri baseUri, HttpClient httpClient)
+ : this(httpClient)
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ if (baseUri == null)
+ {
+ throw new ArgumentNullException("baseUri");
+ }
+ this._credentials = credentials;
+ this._baseUri = baseUri;
+
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ ///
+ /// Initializes a new instance of the AuthorizationClient class.
+ ///
+ ///
+ /// Required. Gets subscription credentials which uniquely identify
+ /// Microsoft Azure subscription. The subscription ID forms part of
+ /// the URI for every service call.
+ ///
+ ///
+ /// The Http client
+ ///
+ public AuthorizationClient(SubscriptionCloudCredentials credentials, HttpClient httpClient)
+ : this(httpClient)
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ this._credentials = credentials;
+ this._baseUri = new Uri("https://management.azure.com/");
+
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ ///
+ /// Clones properties from current instance to another
+ /// AuthorizationClient instance
+ ///
+ ///
+ /// Instance of AuthorizationClient to clone to
+ ///
+ protected override void Clone(ServiceClient client)
+ {
+ base.Clone(client);
+
+ if (client is AuthorizationClient)
+ {
+ AuthorizationClient clonedClient = ((AuthorizationClient)client);
+
+ clonedClient._credentials = this._credentials;
+ clonedClient._baseUri = this._baseUri;
+ clonedClient._apiVersion = this._apiVersion;
+ clonedClient._longRunningOperationInitialTimeout = this._longRunningOperationInitialTimeout;
+ clonedClient._longRunningOperationRetryTimeout = this._longRunningOperationRetryTimeout;
+
+ clonedClient.Credentials.InitializeServiceClient(clonedClient);
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/AuthorizationClientExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/AuthorizationClientExtensions.cs
new file mode 100644
index 000000000000..a36e7a598a85
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/AuthorizationClientExtensions.cs
@@ -0,0 +1,28 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public static partial class AuthorizationClientExtensions
+ {
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationOperations.cs
new file mode 100644
index 000000000000..873a47a640b8
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationOperations.cs
@@ -0,0 +1,805 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using Hyak.Common;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+using Newtonsoft.Json.Linq;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing deployment operations.
+ ///
+ internal partial class DeploymentOperationOperations : IServiceOperations, IDeploymentOperationOperations
+ {
+ ///
+ /// Initializes a new instance of the DeploymentOperationOperations
+ /// class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ internal DeploymentOperationOperations(ResourceManagementClient client)
+ {
+ this._client = client;
+ }
+
+ private ResourceManagementClient _client;
+
+ ///
+ /// Gets a reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient.
+ ///
+ public ResourceManagementClient Client
+ {
+ get { return this._client; }
+ }
+
+ ///
+ /// Get a list of deployments operations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Operation Id.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Deployment operation.
+ ///
+ public async Task GetAsync(string resourceGroupName, string deploymentName, string operationId, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (deploymentName == null)
+ {
+ throw new ArgumentNullException("deploymentName");
+ }
+ if (operationId == null)
+ {
+ throw new ArgumentNullException("operationId");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ tracingParameters.Add("operationId", operationId);
+ TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/deployments/";
+ url = url + Uri.EscapeDataString(deploymentName);
+ url = url + "/operations/";
+ url = url + Uri.EscapeDataString(operationId);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentOperationsGetResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new DeploymentOperationsGetResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ DeploymentOperation operationInstance = new DeploymentOperation();
+ result.Operation = operationInstance;
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ operationInstance.Id = idInstance;
+ }
+
+ JToken operationIdValue = responseDoc["operationId"];
+ if (operationIdValue != null && operationIdValue.Type != JTokenType.Null)
+ {
+ string operationIdInstance = ((string)operationIdValue);
+ operationInstance.OperationId = operationIdInstance;
+ }
+
+ JToken propertiesValue = responseDoc["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ DeploymentOperationProperties propertiesInstance = new DeploymentOperationProperties();
+ operationInstance.Properties = propertiesInstance;
+
+ JToken provisioningStateValue = propertiesValue["provisioningState"];
+ if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
+ {
+ string provisioningStateInstance = ((string)provisioningStateValue);
+ propertiesInstance.ProvisioningState = provisioningStateInstance;
+ }
+
+ JToken timestampValue = propertiesValue["timestamp"];
+ if (timestampValue != null && timestampValue.Type != JTokenType.Null)
+ {
+ DateTime timestampInstance = ((DateTime)timestampValue);
+ propertiesInstance.Timestamp = timestampInstance;
+ }
+
+ JToken statusCodeValue = propertiesValue["statusCode"];
+ if (statusCodeValue != null && statusCodeValue.Type != JTokenType.Null)
+ {
+ string statusCodeInstance = ((string)statusCodeValue);
+ propertiesInstance.StatusCode = statusCodeInstance;
+ }
+
+ JToken statusMessageValue = propertiesValue["statusMessage"];
+ if (statusMessageValue != null && statusMessageValue.Type != JTokenType.Null)
+ {
+ string statusMessageInstance = statusMessageValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.StatusMessage = statusMessageInstance;
+ }
+
+ JToken targetResourceValue = propertiesValue["targetResource"];
+ if (targetResourceValue != null && targetResourceValue.Type != JTokenType.Null)
+ {
+ TargetResource targetResourceInstance = new TargetResource();
+ propertiesInstance.TargetResource = targetResourceInstance;
+
+ JToken idValue2 = targetResourceValue["id"];
+ if (idValue2 != null && idValue2.Type != JTokenType.Null)
+ {
+ string idInstance2 = ((string)idValue2);
+ targetResourceInstance.Id = idInstance2;
+ }
+
+ JToken resourceNameValue = targetResourceValue["resourceName"];
+ if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
+ {
+ string resourceNameInstance = ((string)resourceNameValue);
+ targetResourceInstance.ResourceName = resourceNameInstance;
+ }
+
+ JToken resourceTypeValue = targetResourceValue["resourceType"];
+ if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance = ((string)resourceTypeValue);
+ targetResourceInstance.ResourceType = resourceTypeInstance;
+ }
+ }
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets a list of deployments operations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Optional. Query parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of deployment operations.
+ ///
+ public async Task ListAsync(string resourceGroupName, string deploymentName, DeploymentOperationsListParameters parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (deploymentName == null)
+ {
+ throw new ArgumentNullException("deploymentName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/deployments/";
+ url = url + Uri.EscapeDataString(deploymentName);
+ url = url + "/operations";
+ List queryParameters = new List();
+ if (parameters != null && parameters.Top != null)
+ {
+ queryParameters.Add("$top=" + Uri.EscapeDataString(parameters.Top.Value.ToString()));
+ }
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentOperationsListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new DeploymentOperationsListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ DeploymentOperation deploymentOperationInstance = new DeploymentOperation();
+ result.Operations.Add(deploymentOperationInstance);
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ deploymentOperationInstance.Id = idInstance;
+ }
+
+ JToken operationIdValue = valueValue["operationId"];
+ if (operationIdValue != null && operationIdValue.Type != JTokenType.Null)
+ {
+ string operationIdInstance = ((string)operationIdValue);
+ deploymentOperationInstance.OperationId = operationIdInstance;
+ }
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ DeploymentOperationProperties propertiesInstance = new DeploymentOperationProperties();
+ deploymentOperationInstance.Properties = propertiesInstance;
+
+ JToken provisioningStateValue = propertiesValue["provisioningState"];
+ if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
+ {
+ string provisioningStateInstance = ((string)provisioningStateValue);
+ propertiesInstance.ProvisioningState = provisioningStateInstance;
+ }
+
+ JToken timestampValue = propertiesValue["timestamp"];
+ if (timestampValue != null && timestampValue.Type != JTokenType.Null)
+ {
+ DateTime timestampInstance = ((DateTime)timestampValue);
+ propertiesInstance.Timestamp = timestampInstance;
+ }
+
+ JToken statusCodeValue = propertiesValue["statusCode"];
+ if (statusCodeValue != null && statusCodeValue.Type != JTokenType.Null)
+ {
+ string statusCodeInstance = ((string)statusCodeValue);
+ propertiesInstance.StatusCode = statusCodeInstance;
+ }
+
+ JToken statusMessageValue = propertiesValue["statusMessage"];
+ if (statusMessageValue != null && statusMessageValue.Type != JTokenType.Null)
+ {
+ string statusMessageInstance = statusMessageValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.StatusMessage = statusMessageInstance;
+ }
+
+ JToken targetResourceValue = propertiesValue["targetResource"];
+ if (targetResourceValue != null && targetResourceValue.Type != JTokenType.Null)
+ {
+ TargetResource targetResourceInstance = new TargetResource();
+ propertiesInstance.TargetResource = targetResourceInstance;
+
+ JToken idValue2 = targetResourceValue["id"];
+ if (idValue2 != null && idValue2.Type != JTokenType.Null)
+ {
+ string idInstance2 = ((string)idValue2);
+ targetResourceInstance.Id = idInstance2;
+ }
+
+ JToken resourceNameValue = targetResourceValue["resourceName"];
+ if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
+ {
+ string resourceNameInstance = ((string)resourceNameValue);
+ targetResourceInstance.ResourceName = resourceNameInstance;
+ }
+
+ JToken resourceTypeValue = targetResourceValue["resourceType"];
+ if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance = ((string)resourceTypeValue);
+ targetResourceInstance.ResourceType = resourceTypeInstance;
+ }
+ }
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets a next list of deployments operations.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of deployment operations.
+ ///
+ public async Task ListNextAsync(string nextLink, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException("nextLink");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextLink", nextLink);
+ TracingAdapter.Enter(invocationId, this, "ListNextAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + nextLink;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentOperationsListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new DeploymentOperationsListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ DeploymentOperation deploymentOperationInstance = new DeploymentOperation();
+ result.Operations.Add(deploymentOperationInstance);
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ deploymentOperationInstance.Id = idInstance;
+ }
+
+ JToken operationIdValue = valueValue["operationId"];
+ if (operationIdValue != null && operationIdValue.Type != JTokenType.Null)
+ {
+ string operationIdInstance = ((string)operationIdValue);
+ deploymentOperationInstance.OperationId = operationIdInstance;
+ }
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ DeploymentOperationProperties propertiesInstance = new DeploymentOperationProperties();
+ deploymentOperationInstance.Properties = propertiesInstance;
+
+ JToken provisioningStateValue = propertiesValue["provisioningState"];
+ if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
+ {
+ string provisioningStateInstance = ((string)provisioningStateValue);
+ propertiesInstance.ProvisioningState = provisioningStateInstance;
+ }
+
+ JToken timestampValue = propertiesValue["timestamp"];
+ if (timestampValue != null && timestampValue.Type != JTokenType.Null)
+ {
+ DateTime timestampInstance = ((DateTime)timestampValue);
+ propertiesInstance.Timestamp = timestampInstance;
+ }
+
+ JToken statusCodeValue = propertiesValue["statusCode"];
+ if (statusCodeValue != null && statusCodeValue.Type != JTokenType.Null)
+ {
+ string statusCodeInstance = ((string)statusCodeValue);
+ propertiesInstance.StatusCode = statusCodeInstance;
+ }
+
+ JToken statusMessageValue = propertiesValue["statusMessage"];
+ if (statusMessageValue != null && statusMessageValue.Type != JTokenType.Null)
+ {
+ string statusMessageInstance = statusMessageValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.StatusMessage = statusMessageInstance;
+ }
+
+ JToken targetResourceValue = propertiesValue["targetResource"];
+ if (targetResourceValue != null && targetResourceValue.Type != JTokenType.Null)
+ {
+ TargetResource targetResourceInstance = new TargetResource();
+ propertiesInstance.TargetResource = targetResourceInstance;
+
+ JToken idValue2 = targetResourceValue["id"];
+ if (idValue2 != null && idValue2.Type != JTokenType.Null)
+ {
+ string idInstance2 = ((string)idValue2);
+ targetResourceInstance.Id = idInstance2;
+ }
+
+ JToken resourceNameValue = targetResourceValue["resourceName"];
+ if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
+ {
+ string resourceNameInstance = ((string)resourceNameValue);
+ targetResourceInstance.ResourceName = resourceNameInstance;
+ }
+
+ JToken resourceTypeValue = targetResourceValue["resourceType"];
+ if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance = ((string)resourceTypeValue);
+ targetResourceInstance.ResourceType = resourceTypeInstance;
+ }
+ }
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationOperationsExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationOperationsExtensions.cs
new file mode 100644
index 000000000000..301cc5d665ee
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationOperationsExtensions.cs
@@ -0,0 +1,180 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public static partial class DeploymentOperationOperationsExtensions
+ {
+ ///
+ /// Get a list of deployments operations.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperationOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Operation Id.
+ ///
+ ///
+ /// Deployment operation.
+ ///
+ public static DeploymentOperationsGetResult Get(this IDeploymentOperationOperations operations, string resourceGroupName, string deploymentName, string operationId)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperationOperations)s).GetAsync(resourceGroupName, deploymentName, operationId);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a list of deployments operations.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperationOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Operation Id.
+ ///
+ ///
+ /// Deployment operation.
+ ///
+ public static Task GetAsync(this IDeploymentOperationOperations operations, string resourceGroupName, string deploymentName, string operationId)
+ {
+ return operations.GetAsync(resourceGroupName, deploymentName, operationId, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a list of deployments operations.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperationOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Optional. Query parameters.
+ ///
+ ///
+ /// List of deployment operations.
+ ///
+ public static DeploymentOperationsListResult List(this IDeploymentOperationOperations operations, string resourceGroupName, string deploymentName, DeploymentOperationsListParameters parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperationOperations)s).ListAsync(resourceGroupName, deploymentName, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a list of deployments operations.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperationOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Optional. Query parameters.
+ ///
+ ///
+ /// List of deployment operations.
+ ///
+ public static Task ListAsync(this IDeploymentOperationOperations operations, string resourceGroupName, string deploymentName, DeploymentOperationsListParameters parameters)
+ {
+ return operations.ListAsync(resourceGroupName, deploymentName, parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a next list of deployments operations.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperationOperations.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of deployment operations.
+ ///
+ public static DeploymentOperationsListResult ListNext(this IDeploymentOperationOperations operations, string nextLink)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperationOperations)s).ListNextAsync(nextLink);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a next list of deployments operations.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperationOperations.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of deployment operations.
+ ///
+ public static Task ListNextAsync(this IDeploymentOperationOperations operations, string nextLink)
+ {
+ return operations.ListNextAsync(nextLink, CancellationToken.None);
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperations.cs
new file mode 100644
index 000000000000..efcb058f5abf
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperations.cs
@@ -0,0 +1,2907 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using Hyak.Common;
+using Hyak.Common.Internals;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+using Newtonsoft.Json.Linq;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing deployments.
+ ///
+ internal partial class DeploymentOperations : IServiceOperations, IDeploymentOperations
+ {
+ ///
+ /// Initializes a new instance of the DeploymentOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ internal DeploymentOperations(ResourceManagementClient client)
+ {
+ this._client = client;
+ }
+
+ private ResourceManagementClient _client;
+
+ ///
+ /// Gets a reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient.
+ ///
+ public ResourceManagementClient Client
+ {
+ get { return this._client; }
+ }
+
+ ///
+ /// Begin deleting deployment.To determine whether the operation has
+ /// finished processing the request, call
+ /// GetLongRunningOperationStatus.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment to be deleted.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response for long running operations.
+ ///
+ public async Task BeginDeletingAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (deploymentName == null)
+ {
+ throw new ArgumentNullException("deploymentName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ TracingAdapter.Enter(invocationId, this, "BeginDeletingAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/deployments/";
+ url = url + Uri.EscapeDataString(deploymentName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Delete;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.Accepted && statusCode != HttpStatusCode.NoContent)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ LongRunningOperationResponse result = null;
+ // Deserialize Response
+ result = new LongRunningOperationResponse();
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("Location"))
+ {
+ result.OperationStatusLink = httpResponse.Headers.GetValues("Location").FirstOrDefault();
+ }
+ if (httpResponse.Headers.Contains("Retry-After"))
+ {
+ result.RetryAfter = int.Parse(httpResponse.Headers.GetValues("Retry-After").FirstOrDefault(), CultureInfo.InvariantCulture);
+ }
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (statusCode == HttpStatusCode.Conflict)
+ {
+ result.Status = OperationStatus.Failed;
+ }
+ if (statusCode == HttpStatusCode.Accepted)
+ {
+ result.Status = OperationStatus.InProgress;
+ }
+ if (statusCode == HttpStatusCode.NoContent)
+ {
+ result.Status = OperationStatus.Succeeded;
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Cancel a currently running template deployment.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public async Task CancelAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (deploymentName == null)
+ {
+ throw new ArgumentNullException("deploymentName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ TracingAdapter.Enter(invocationId, this, "CancelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/deployments/";
+ url = url + Uri.EscapeDataString(deploymentName);
+ url = url + "/cancel";
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Post;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.NoContent)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ AzureOperationResponse result = null;
+ // Deserialize Response
+ result = new AzureOperationResponse();
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Checks whether deployment exists.
+ ///
+ ///
+ /// Required. The name of the resource group to check. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Deployment information.
+ ///
+ public async Task CheckExistenceAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (deploymentName == null)
+ {
+ throw new ArgumentNullException("deploymentName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ TracingAdapter.Enter(invocationId, this, "CheckExistenceAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/deployments/";
+ url = url + Uri.EscapeDataString(deploymentName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Head;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.NoContent && statusCode != HttpStatusCode.NotFound)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentExistsResult result = null;
+ // Deserialize Response
+ result = new DeploymentExistsResult();
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (statusCode == HttpStatusCode.NoContent)
+ {
+ result.Exists = true;
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Create a named template deployment using a template.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Additional parameters supplied to the operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Template deployment operation create result.
+ ///
+ public async Task CreateOrUpdateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (deploymentName == null)
+ {
+ throw new ArgumentNullException("deploymentName");
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException("parameters");
+ }
+ if (parameters.Properties != null)
+ {
+ if (parameters.Properties.ParametersLink != null)
+ {
+ if (parameters.Properties.ParametersLink.Uri == null)
+ {
+ throw new ArgumentNullException("parameters.Properties.ParametersLink.Uri");
+ }
+ }
+ if (parameters.Properties.TemplateLink != null)
+ {
+ if (parameters.Properties.TemplateLink.Uri == null)
+ {
+ throw new ArgumentNullException("parameters.Properties.TemplateLink.Uri");
+ }
+ }
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "CreateOrUpdateAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/deployments/";
+ url = url + Uri.EscapeDataString(deploymentName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Put;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Serialize Request
+ string requestContent = null;
+ JToken requestDoc = null;
+
+ JObject deploymentValue = new JObject();
+ requestDoc = deploymentValue;
+
+ if (parameters.Properties != null)
+ {
+ JObject propertiesValue = new JObject();
+ deploymentValue["properties"] = propertiesValue;
+
+ if (parameters.Properties.Template != null)
+ {
+ propertiesValue["template"] = JObject.Parse(parameters.Properties.Template);
+ }
+
+ if (parameters.Properties.TemplateLink != null)
+ {
+ JObject templateLinkValue = new JObject();
+ propertiesValue["templateLink"] = templateLinkValue;
+
+ templateLinkValue["uri"] = parameters.Properties.TemplateLink.Uri.AbsoluteUri;
+
+ if (parameters.Properties.TemplateLink.ContentVersion != null)
+ {
+ templateLinkValue["contentVersion"] = parameters.Properties.TemplateLink.ContentVersion;
+ }
+ }
+
+ if (parameters.Properties.Parameters != null)
+ {
+ propertiesValue["parameters"] = JObject.Parse(parameters.Properties.Parameters);
+ }
+
+ if (parameters.Properties.ParametersLink != null)
+ {
+ JObject parametersLinkValue = new JObject();
+ propertiesValue["parametersLink"] = parametersLinkValue;
+
+ parametersLinkValue["uri"] = parameters.Properties.ParametersLink.Uri.AbsoluteUri;
+
+ if (parameters.Properties.ParametersLink.ContentVersion != null)
+ {
+ parametersLinkValue["contentVersion"] = parameters.Properties.ParametersLink.ContentVersion;
+ }
+ }
+
+ propertiesValue["mode"] = parameters.Properties.Mode.ToString();
+ }
+
+ requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented);
+ httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
+ httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Created)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentOperationsCreateResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Created)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new DeploymentOperationsCreateResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ DeploymentExtended deploymentInstance = new DeploymentExtended();
+ result.Deployment = deploymentInstance;
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ deploymentInstance.Id = idInstance;
+ }
+
+ JToken nameValue = responseDoc["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ deploymentInstance.Name = nameInstance;
+ }
+
+ JToken propertiesValue2 = responseDoc["properties"];
+ if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null)
+ {
+ DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
+ deploymentInstance.Properties = propertiesInstance;
+
+ JToken provisioningStateValue = propertiesValue2["provisioningState"];
+ if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
+ {
+ string provisioningStateInstance = ((string)provisioningStateValue);
+ propertiesInstance.ProvisioningState = provisioningStateInstance;
+ }
+
+ JToken correlationIdValue = propertiesValue2["correlationId"];
+ if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
+ {
+ string correlationIdInstance = ((string)correlationIdValue);
+ propertiesInstance.CorrelationId = correlationIdInstance;
+ }
+
+ JToken timestampValue = propertiesValue2["timestamp"];
+ if (timestampValue != null && timestampValue.Type != JTokenType.Null)
+ {
+ DateTime timestampInstance = ((DateTime)timestampValue);
+ propertiesInstance.Timestamp = timestampInstance;
+ }
+
+ JToken outputsValue = propertiesValue2["outputs"];
+ if (outputsValue != null && outputsValue.Type != JTokenType.Null)
+ {
+ string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Outputs = outputsInstance;
+ }
+
+ JToken providersArray = propertiesValue2["providers"];
+ if (providersArray != null && providersArray.Type != JTokenType.Null)
+ {
+ foreach (JToken providersValue in ((JArray)providersArray))
+ {
+ Provider providerInstance = new Provider();
+ propertiesInstance.Providers.Add(providerInstance);
+
+ JToken idValue2 = providersValue["id"];
+ if (idValue2 != null && idValue2.Type != JTokenType.Null)
+ {
+ string idInstance2 = ((string)idValue2);
+ providerInstance.Id = idInstance2;
+ }
+
+ JToken namespaceValue = providersValue["namespace"];
+ if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
+ {
+ string namespaceInstance = ((string)namespaceValue);
+ providerInstance.Namespace = namespaceInstance;
+ }
+
+ JToken registrationStateValue = providersValue["registrationState"];
+ if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
+ {
+ string registrationStateInstance = ((string)registrationStateValue);
+ providerInstance.RegistrationState = registrationStateInstance;
+ }
+
+ JToken resourceTypesArray = providersValue["resourceTypes"];
+ if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
+ {
+ ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
+ providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
+
+ JToken resourceTypeValue = resourceTypesValue["resourceType"];
+ if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance = ((string)resourceTypeValue);
+ providerResourceTypeInstance.Name = resourceTypeInstance;
+ }
+
+ JToken locationsArray = resourceTypesValue["locations"];
+ if (locationsArray != null && locationsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken locationsValue in ((JArray)locationsArray))
+ {
+ providerResourceTypeInstance.Locations.Add(((string)locationsValue));
+ }
+ }
+
+ JToken apiVersionsArray = resourceTypesValue["apiVersions"];
+ if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
+ {
+ providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
+ }
+ }
+
+ JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
+ if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
+ {
+ foreach (JProperty property in propertiesSequenceElement)
+ {
+ string propertiesKey = ((string)property.Name);
+ string propertiesValue3 = ((string)property.Value);
+ providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue3);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ JToken dependenciesArray = propertiesValue2["dependencies"];
+ if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
+ {
+ Dependency dependencyInstance = new Dependency();
+ propertiesInstance.Dependencies.Add(dependencyInstance);
+
+ JToken dependsOnArray = dependenciesValue["dependsOn"];
+ if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
+ {
+ BasicDependency basicDependencyInstance = new BasicDependency();
+ dependencyInstance.DependsOn.Add(basicDependencyInstance);
+
+ JToken idValue3 = dependsOnValue["id"];
+ if (idValue3 != null && idValue3.Type != JTokenType.Null)
+ {
+ string idInstance3 = ((string)idValue3);
+ basicDependencyInstance.Id = idInstance3;
+ }
+
+ JToken resourceTypeValue2 = dependsOnValue["resourceType"];
+ if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance2 = ((string)resourceTypeValue2);
+ basicDependencyInstance.ResourceType = resourceTypeInstance2;
+ }
+
+ JToken resourceNameValue = dependsOnValue["resourceName"];
+ if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
+ {
+ string resourceNameInstance = ((string)resourceNameValue);
+ basicDependencyInstance.ResourceName = resourceNameInstance;
+ }
+ }
+ }
+
+ JToken idValue4 = dependenciesValue["id"];
+ if (idValue4 != null && idValue4.Type != JTokenType.Null)
+ {
+ string idInstance4 = ((string)idValue4);
+ dependencyInstance.Id = idInstance4;
+ }
+
+ JToken resourceTypeValue3 = dependenciesValue["resourceType"];
+ if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance3 = ((string)resourceTypeValue3);
+ dependencyInstance.ResourceType = resourceTypeInstance3;
+ }
+
+ JToken resourceNameValue2 = dependenciesValue["resourceName"];
+ if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
+ {
+ string resourceNameInstance2 = ((string)resourceNameValue2);
+ dependencyInstance.ResourceName = resourceNameInstance2;
+ }
+ }
+ }
+
+ JToken templateValue = propertiesValue2["template"];
+ if (templateValue != null && templateValue.Type != JTokenType.Null)
+ {
+ string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Template = templateInstance;
+ }
+
+ JToken templateLinkValue2 = propertiesValue2["templateLink"];
+ if (templateLinkValue2 != null && templateLinkValue2.Type != JTokenType.Null)
+ {
+ TemplateLink templateLinkInstance = new TemplateLink();
+ propertiesInstance.TemplateLink = templateLinkInstance;
+
+ JToken uriValue = templateLinkValue2["uri"];
+ if (uriValue != null && uriValue.Type != JTokenType.Null)
+ {
+ Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
+ templateLinkInstance.Uri = uriInstance;
+ }
+
+ JToken contentVersionValue = templateLinkValue2["contentVersion"];
+ if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
+ {
+ string contentVersionInstance = ((string)contentVersionValue);
+ templateLinkInstance.ContentVersion = contentVersionInstance;
+ }
+ }
+
+ JToken parametersValue = propertiesValue2["parameters"];
+ if (parametersValue != null && parametersValue.Type != JTokenType.Null)
+ {
+ string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Parameters = parametersInstance;
+ }
+
+ JToken parametersLinkValue2 = propertiesValue2["parametersLink"];
+ if (parametersLinkValue2 != null && parametersLinkValue2.Type != JTokenType.Null)
+ {
+ ParametersLink parametersLinkInstance = new ParametersLink();
+ propertiesInstance.ParametersLink = parametersLinkInstance;
+
+ JToken uriValue2 = parametersLinkValue2["uri"];
+ if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
+ {
+ Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
+ parametersLinkInstance.Uri = uriInstance2;
+ }
+
+ JToken contentVersionValue2 = parametersLinkValue2["contentVersion"];
+ if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
+ {
+ string contentVersionInstance2 = ((string)contentVersionValue2);
+ parametersLinkInstance.ContentVersion = contentVersionInstance2;
+ }
+ }
+
+ JToken modeValue = propertiesValue2["mode"];
+ if (modeValue != null && modeValue.Type != JTokenType.Null)
+ {
+ DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
+ propertiesInstance.Mode = modeInstance;
+ }
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Delete deployment and all of its resources.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment to be deleted.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public async Task DeleteAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
+ {
+ ResourceManagementClient client = this.Client;
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ TracingAdapter.Enter(invocationId, this, "DeleteAsync", tracingParameters);
+ }
+
+ cancellationToken.ThrowIfCancellationRequested();
+ LongRunningOperationResponse response = await client.Deployments.BeginDeletingAsync(resourceGroupName, deploymentName, cancellationToken).ConfigureAwait(false);
+ cancellationToken.ThrowIfCancellationRequested();
+ LongRunningOperationResponse result = await client.GetLongRunningOperationStatusAsync(response.OperationStatusLink, cancellationToken).ConfigureAwait(false);
+ int delayInSeconds = response.RetryAfter;
+ if (delayInSeconds == 0)
+ {
+ delayInSeconds = 30;
+ }
+ if (client.LongRunningOperationInitialTimeout >= 0)
+ {
+ delayInSeconds = client.LongRunningOperationInitialTimeout;
+ }
+ while ((result.Status != Microsoft.Azure.OperationStatus.InProgress) == false)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await TaskEx.Delay(delayInSeconds * 1000, cancellationToken).ConfigureAwait(false);
+ cancellationToken.ThrowIfCancellationRequested();
+ result = await client.GetLongRunningOperationStatusAsync(response.OperationStatusLink, cancellationToken).ConfigureAwait(false);
+ delayInSeconds = result.RetryAfter;
+ if (delayInSeconds == 0)
+ {
+ delayInSeconds = 15;
+ }
+ if (client.LongRunningOperationRetryTimeout >= 0)
+ {
+ delayInSeconds = client.LongRunningOperationRetryTimeout;
+ }
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+
+ return result;
+ }
+
+ ///
+ /// Get a deployment.
+ ///
+ ///
+ /// Required. The name of the resource group to get. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Template deployment information.
+ ///
+ public async Task GetAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (deploymentName == null)
+ {
+ throw new ArgumentNullException("deploymentName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/deployments/";
+ url = url + Uri.EscapeDataString(deploymentName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentGetResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new DeploymentGetResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ DeploymentExtended deploymentInstance = new DeploymentExtended();
+ result.Deployment = deploymentInstance;
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ deploymentInstance.Id = idInstance;
+ }
+
+ JToken nameValue = responseDoc["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ deploymentInstance.Name = nameInstance;
+ }
+
+ JToken propertiesValue = responseDoc["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
+ deploymentInstance.Properties = propertiesInstance;
+
+ JToken provisioningStateValue = propertiesValue["provisioningState"];
+ if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
+ {
+ string provisioningStateInstance = ((string)provisioningStateValue);
+ propertiesInstance.ProvisioningState = provisioningStateInstance;
+ }
+
+ JToken correlationIdValue = propertiesValue["correlationId"];
+ if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
+ {
+ string correlationIdInstance = ((string)correlationIdValue);
+ propertiesInstance.CorrelationId = correlationIdInstance;
+ }
+
+ JToken timestampValue = propertiesValue["timestamp"];
+ if (timestampValue != null && timestampValue.Type != JTokenType.Null)
+ {
+ DateTime timestampInstance = ((DateTime)timestampValue);
+ propertiesInstance.Timestamp = timestampInstance;
+ }
+
+ JToken outputsValue = propertiesValue["outputs"];
+ if (outputsValue != null && outputsValue.Type != JTokenType.Null)
+ {
+ string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Outputs = outputsInstance;
+ }
+
+ JToken providersArray = propertiesValue["providers"];
+ if (providersArray != null && providersArray.Type != JTokenType.Null)
+ {
+ foreach (JToken providersValue in ((JArray)providersArray))
+ {
+ Provider providerInstance = new Provider();
+ propertiesInstance.Providers.Add(providerInstance);
+
+ JToken idValue2 = providersValue["id"];
+ if (idValue2 != null && idValue2.Type != JTokenType.Null)
+ {
+ string idInstance2 = ((string)idValue2);
+ providerInstance.Id = idInstance2;
+ }
+
+ JToken namespaceValue = providersValue["namespace"];
+ if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
+ {
+ string namespaceInstance = ((string)namespaceValue);
+ providerInstance.Namespace = namespaceInstance;
+ }
+
+ JToken registrationStateValue = providersValue["registrationState"];
+ if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
+ {
+ string registrationStateInstance = ((string)registrationStateValue);
+ providerInstance.RegistrationState = registrationStateInstance;
+ }
+
+ JToken resourceTypesArray = providersValue["resourceTypes"];
+ if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
+ {
+ ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
+ providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
+
+ JToken resourceTypeValue = resourceTypesValue["resourceType"];
+ if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance = ((string)resourceTypeValue);
+ providerResourceTypeInstance.Name = resourceTypeInstance;
+ }
+
+ JToken locationsArray = resourceTypesValue["locations"];
+ if (locationsArray != null && locationsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken locationsValue in ((JArray)locationsArray))
+ {
+ providerResourceTypeInstance.Locations.Add(((string)locationsValue));
+ }
+ }
+
+ JToken apiVersionsArray = resourceTypesValue["apiVersions"];
+ if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
+ {
+ providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
+ }
+ }
+
+ JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
+ if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
+ {
+ foreach (JProperty property in propertiesSequenceElement)
+ {
+ string propertiesKey = ((string)property.Name);
+ string propertiesValue2 = ((string)property.Value);
+ providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue2);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ JToken dependenciesArray = propertiesValue["dependencies"];
+ if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
+ {
+ Dependency dependencyInstance = new Dependency();
+ propertiesInstance.Dependencies.Add(dependencyInstance);
+
+ JToken dependsOnArray = dependenciesValue["dependsOn"];
+ if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
+ {
+ BasicDependency basicDependencyInstance = new BasicDependency();
+ dependencyInstance.DependsOn.Add(basicDependencyInstance);
+
+ JToken idValue3 = dependsOnValue["id"];
+ if (idValue3 != null && idValue3.Type != JTokenType.Null)
+ {
+ string idInstance3 = ((string)idValue3);
+ basicDependencyInstance.Id = idInstance3;
+ }
+
+ JToken resourceTypeValue2 = dependsOnValue["resourceType"];
+ if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance2 = ((string)resourceTypeValue2);
+ basicDependencyInstance.ResourceType = resourceTypeInstance2;
+ }
+
+ JToken resourceNameValue = dependsOnValue["resourceName"];
+ if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
+ {
+ string resourceNameInstance = ((string)resourceNameValue);
+ basicDependencyInstance.ResourceName = resourceNameInstance;
+ }
+ }
+ }
+
+ JToken idValue4 = dependenciesValue["id"];
+ if (idValue4 != null && idValue4.Type != JTokenType.Null)
+ {
+ string idInstance4 = ((string)idValue4);
+ dependencyInstance.Id = idInstance4;
+ }
+
+ JToken resourceTypeValue3 = dependenciesValue["resourceType"];
+ if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance3 = ((string)resourceTypeValue3);
+ dependencyInstance.ResourceType = resourceTypeInstance3;
+ }
+
+ JToken resourceNameValue2 = dependenciesValue["resourceName"];
+ if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
+ {
+ string resourceNameInstance2 = ((string)resourceNameValue2);
+ dependencyInstance.ResourceName = resourceNameInstance2;
+ }
+ }
+ }
+
+ JToken templateValue = propertiesValue["template"];
+ if (templateValue != null && templateValue.Type != JTokenType.Null)
+ {
+ string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Template = templateInstance;
+ }
+
+ JToken templateLinkValue = propertiesValue["templateLink"];
+ if (templateLinkValue != null && templateLinkValue.Type != JTokenType.Null)
+ {
+ TemplateLink templateLinkInstance = new TemplateLink();
+ propertiesInstance.TemplateLink = templateLinkInstance;
+
+ JToken uriValue = templateLinkValue["uri"];
+ if (uriValue != null && uriValue.Type != JTokenType.Null)
+ {
+ Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
+ templateLinkInstance.Uri = uriInstance;
+ }
+
+ JToken contentVersionValue = templateLinkValue["contentVersion"];
+ if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
+ {
+ string contentVersionInstance = ((string)contentVersionValue);
+ templateLinkInstance.ContentVersion = contentVersionInstance;
+ }
+ }
+
+ JToken parametersValue = propertiesValue["parameters"];
+ if (parametersValue != null && parametersValue.Type != JTokenType.Null)
+ {
+ string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Parameters = parametersInstance;
+ }
+
+ JToken parametersLinkValue = propertiesValue["parametersLink"];
+ if (parametersLinkValue != null && parametersLinkValue.Type != JTokenType.Null)
+ {
+ ParametersLink parametersLinkInstance = new ParametersLink();
+ propertiesInstance.ParametersLink = parametersLinkInstance;
+
+ JToken uriValue2 = parametersLinkValue["uri"];
+ if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
+ {
+ Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
+ parametersLinkInstance.Uri = uriInstance2;
+ }
+
+ JToken contentVersionValue2 = parametersLinkValue["contentVersion"];
+ if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
+ {
+ string contentVersionInstance2 = ((string)contentVersionValue2);
+ parametersLinkInstance.ContentVersion = contentVersionInstance2;
+ }
+ }
+
+ JToken modeValue = propertiesValue["mode"];
+ if (modeValue != null && modeValue.Type != JTokenType.Null)
+ {
+ DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
+ propertiesInstance.Mode = modeInstance;
+ }
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// Required. The name of the resource group to filter by. The name is
+ /// case insensitive.
+ ///
+ ///
+ /// Optional. Query parameters. If null is passed returns all
+ /// deployments.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of deployments.
+ ///
+ public async Task ListAsync(string resourceGroupName, DeploymentListParameters parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/";
+ url = url + "resourcegroups/" + Uri.EscapeDataString(resourceGroupName) + "/";
+ url = url + "deployments/";
+ List queryParameters = new List();
+ List odataFilter = new List();
+ if (parameters != null && parameters.ProvisioningState != null)
+ {
+ odataFilter.Add("provisioningState eq '" + Uri.EscapeDataString(parameters.ProvisioningState) + "'");
+ }
+ if (odataFilter.Count > 0)
+ {
+ queryParameters.Add("$filter=" + string.Join(null, odataFilter));
+ }
+ if (parameters != null && parameters.Top != null)
+ {
+ queryParameters.Add("$top=" + Uri.EscapeDataString(parameters.Top.Value.ToString()));
+ }
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new DeploymentListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ DeploymentExtended deploymentExtendedInstance = new DeploymentExtended();
+ result.Deployments.Add(deploymentExtendedInstance);
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ deploymentExtendedInstance.Id = idInstance;
+ }
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ deploymentExtendedInstance.Name = nameInstance;
+ }
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
+ deploymentExtendedInstance.Properties = propertiesInstance;
+
+ JToken provisioningStateValue = propertiesValue["provisioningState"];
+ if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
+ {
+ string provisioningStateInstance = ((string)provisioningStateValue);
+ propertiesInstance.ProvisioningState = provisioningStateInstance;
+ }
+
+ JToken correlationIdValue = propertiesValue["correlationId"];
+ if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
+ {
+ string correlationIdInstance = ((string)correlationIdValue);
+ propertiesInstance.CorrelationId = correlationIdInstance;
+ }
+
+ JToken timestampValue = propertiesValue["timestamp"];
+ if (timestampValue != null && timestampValue.Type != JTokenType.Null)
+ {
+ DateTime timestampInstance = ((DateTime)timestampValue);
+ propertiesInstance.Timestamp = timestampInstance;
+ }
+
+ JToken outputsValue = propertiesValue["outputs"];
+ if (outputsValue != null && outputsValue.Type != JTokenType.Null)
+ {
+ string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Outputs = outputsInstance;
+ }
+
+ JToken providersArray = propertiesValue["providers"];
+ if (providersArray != null && providersArray.Type != JTokenType.Null)
+ {
+ foreach (JToken providersValue in ((JArray)providersArray))
+ {
+ Provider providerInstance = new Provider();
+ propertiesInstance.Providers.Add(providerInstance);
+
+ JToken idValue2 = providersValue["id"];
+ if (idValue2 != null && idValue2.Type != JTokenType.Null)
+ {
+ string idInstance2 = ((string)idValue2);
+ providerInstance.Id = idInstance2;
+ }
+
+ JToken namespaceValue = providersValue["namespace"];
+ if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
+ {
+ string namespaceInstance = ((string)namespaceValue);
+ providerInstance.Namespace = namespaceInstance;
+ }
+
+ JToken registrationStateValue = providersValue["registrationState"];
+ if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
+ {
+ string registrationStateInstance = ((string)registrationStateValue);
+ providerInstance.RegistrationState = registrationStateInstance;
+ }
+
+ JToken resourceTypesArray = providersValue["resourceTypes"];
+ if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
+ {
+ ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
+ providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
+
+ JToken resourceTypeValue = resourceTypesValue["resourceType"];
+ if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance = ((string)resourceTypeValue);
+ providerResourceTypeInstance.Name = resourceTypeInstance;
+ }
+
+ JToken locationsArray = resourceTypesValue["locations"];
+ if (locationsArray != null && locationsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken locationsValue in ((JArray)locationsArray))
+ {
+ providerResourceTypeInstance.Locations.Add(((string)locationsValue));
+ }
+ }
+
+ JToken apiVersionsArray = resourceTypesValue["apiVersions"];
+ if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
+ {
+ providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
+ }
+ }
+
+ JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
+ if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
+ {
+ foreach (JProperty property in propertiesSequenceElement)
+ {
+ string propertiesKey = ((string)property.Name);
+ string propertiesValue2 = ((string)property.Value);
+ providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue2);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ JToken dependenciesArray = propertiesValue["dependencies"];
+ if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
+ {
+ Dependency dependencyInstance = new Dependency();
+ propertiesInstance.Dependencies.Add(dependencyInstance);
+
+ JToken dependsOnArray = dependenciesValue["dependsOn"];
+ if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
+ {
+ BasicDependency basicDependencyInstance = new BasicDependency();
+ dependencyInstance.DependsOn.Add(basicDependencyInstance);
+
+ JToken idValue3 = dependsOnValue["id"];
+ if (idValue3 != null && idValue3.Type != JTokenType.Null)
+ {
+ string idInstance3 = ((string)idValue3);
+ basicDependencyInstance.Id = idInstance3;
+ }
+
+ JToken resourceTypeValue2 = dependsOnValue["resourceType"];
+ if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance2 = ((string)resourceTypeValue2);
+ basicDependencyInstance.ResourceType = resourceTypeInstance2;
+ }
+
+ JToken resourceNameValue = dependsOnValue["resourceName"];
+ if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
+ {
+ string resourceNameInstance = ((string)resourceNameValue);
+ basicDependencyInstance.ResourceName = resourceNameInstance;
+ }
+ }
+ }
+
+ JToken idValue4 = dependenciesValue["id"];
+ if (idValue4 != null && idValue4.Type != JTokenType.Null)
+ {
+ string idInstance4 = ((string)idValue4);
+ dependencyInstance.Id = idInstance4;
+ }
+
+ JToken resourceTypeValue3 = dependenciesValue["resourceType"];
+ if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance3 = ((string)resourceTypeValue3);
+ dependencyInstance.ResourceType = resourceTypeInstance3;
+ }
+
+ JToken resourceNameValue2 = dependenciesValue["resourceName"];
+ if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
+ {
+ string resourceNameInstance2 = ((string)resourceNameValue2);
+ dependencyInstance.ResourceName = resourceNameInstance2;
+ }
+ }
+ }
+
+ JToken templateValue = propertiesValue["template"];
+ if (templateValue != null && templateValue.Type != JTokenType.Null)
+ {
+ string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Template = templateInstance;
+ }
+
+ JToken templateLinkValue = propertiesValue["templateLink"];
+ if (templateLinkValue != null && templateLinkValue.Type != JTokenType.Null)
+ {
+ TemplateLink templateLinkInstance = new TemplateLink();
+ propertiesInstance.TemplateLink = templateLinkInstance;
+
+ JToken uriValue = templateLinkValue["uri"];
+ if (uriValue != null && uriValue.Type != JTokenType.Null)
+ {
+ Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
+ templateLinkInstance.Uri = uriInstance;
+ }
+
+ JToken contentVersionValue = templateLinkValue["contentVersion"];
+ if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
+ {
+ string contentVersionInstance = ((string)contentVersionValue);
+ templateLinkInstance.ContentVersion = contentVersionInstance;
+ }
+ }
+
+ JToken parametersValue = propertiesValue["parameters"];
+ if (parametersValue != null && parametersValue.Type != JTokenType.Null)
+ {
+ string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Parameters = parametersInstance;
+ }
+
+ JToken parametersLinkValue = propertiesValue["parametersLink"];
+ if (parametersLinkValue != null && parametersLinkValue.Type != JTokenType.Null)
+ {
+ ParametersLink parametersLinkInstance = new ParametersLink();
+ propertiesInstance.ParametersLink = parametersLinkInstance;
+
+ JToken uriValue2 = parametersLinkValue["uri"];
+ if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
+ {
+ Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
+ parametersLinkInstance.Uri = uriInstance2;
+ }
+
+ JToken contentVersionValue2 = parametersLinkValue["contentVersion"];
+ if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
+ {
+ string contentVersionInstance2 = ((string)contentVersionValue2);
+ parametersLinkInstance.ContentVersion = contentVersionInstance2;
+ }
+ }
+
+ JToken modeValue = propertiesValue["mode"];
+ if (modeValue != null && modeValue.Type != JTokenType.Null)
+ {
+ DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
+ propertiesInstance.Mode = modeInstance;
+ }
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of deployments.
+ ///
+ public async Task ListNextAsync(string nextLink, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException("nextLink");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextLink", nextLink);
+ TracingAdapter.Enter(invocationId, this, "ListNextAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + nextLink;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new DeploymentListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ DeploymentExtended deploymentExtendedInstance = new DeploymentExtended();
+ result.Deployments.Add(deploymentExtendedInstance);
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ deploymentExtendedInstance.Id = idInstance;
+ }
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ deploymentExtendedInstance.Name = nameInstance;
+ }
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
+ deploymentExtendedInstance.Properties = propertiesInstance;
+
+ JToken provisioningStateValue = propertiesValue["provisioningState"];
+ if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
+ {
+ string provisioningStateInstance = ((string)provisioningStateValue);
+ propertiesInstance.ProvisioningState = provisioningStateInstance;
+ }
+
+ JToken correlationIdValue = propertiesValue["correlationId"];
+ if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
+ {
+ string correlationIdInstance = ((string)correlationIdValue);
+ propertiesInstance.CorrelationId = correlationIdInstance;
+ }
+
+ JToken timestampValue = propertiesValue["timestamp"];
+ if (timestampValue != null && timestampValue.Type != JTokenType.Null)
+ {
+ DateTime timestampInstance = ((DateTime)timestampValue);
+ propertiesInstance.Timestamp = timestampInstance;
+ }
+
+ JToken outputsValue = propertiesValue["outputs"];
+ if (outputsValue != null && outputsValue.Type != JTokenType.Null)
+ {
+ string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Outputs = outputsInstance;
+ }
+
+ JToken providersArray = propertiesValue["providers"];
+ if (providersArray != null && providersArray.Type != JTokenType.Null)
+ {
+ foreach (JToken providersValue in ((JArray)providersArray))
+ {
+ Provider providerInstance = new Provider();
+ propertiesInstance.Providers.Add(providerInstance);
+
+ JToken idValue2 = providersValue["id"];
+ if (idValue2 != null && idValue2.Type != JTokenType.Null)
+ {
+ string idInstance2 = ((string)idValue2);
+ providerInstance.Id = idInstance2;
+ }
+
+ JToken namespaceValue = providersValue["namespace"];
+ if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
+ {
+ string namespaceInstance = ((string)namespaceValue);
+ providerInstance.Namespace = namespaceInstance;
+ }
+
+ JToken registrationStateValue = providersValue["registrationState"];
+ if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
+ {
+ string registrationStateInstance = ((string)registrationStateValue);
+ providerInstance.RegistrationState = registrationStateInstance;
+ }
+
+ JToken resourceTypesArray = providersValue["resourceTypes"];
+ if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
+ {
+ ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
+ providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
+
+ JToken resourceTypeValue = resourceTypesValue["resourceType"];
+ if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance = ((string)resourceTypeValue);
+ providerResourceTypeInstance.Name = resourceTypeInstance;
+ }
+
+ JToken locationsArray = resourceTypesValue["locations"];
+ if (locationsArray != null && locationsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken locationsValue in ((JArray)locationsArray))
+ {
+ providerResourceTypeInstance.Locations.Add(((string)locationsValue));
+ }
+ }
+
+ JToken apiVersionsArray = resourceTypesValue["apiVersions"];
+ if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
+ {
+ providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
+ }
+ }
+
+ JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
+ if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
+ {
+ foreach (JProperty property in propertiesSequenceElement)
+ {
+ string propertiesKey = ((string)property.Name);
+ string propertiesValue2 = ((string)property.Value);
+ providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue2);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ JToken dependenciesArray = propertiesValue["dependencies"];
+ if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
+ {
+ Dependency dependencyInstance = new Dependency();
+ propertiesInstance.Dependencies.Add(dependencyInstance);
+
+ JToken dependsOnArray = dependenciesValue["dependsOn"];
+ if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
+ {
+ BasicDependency basicDependencyInstance = new BasicDependency();
+ dependencyInstance.DependsOn.Add(basicDependencyInstance);
+
+ JToken idValue3 = dependsOnValue["id"];
+ if (idValue3 != null && idValue3.Type != JTokenType.Null)
+ {
+ string idInstance3 = ((string)idValue3);
+ basicDependencyInstance.Id = idInstance3;
+ }
+
+ JToken resourceTypeValue2 = dependsOnValue["resourceType"];
+ if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance2 = ((string)resourceTypeValue2);
+ basicDependencyInstance.ResourceType = resourceTypeInstance2;
+ }
+
+ JToken resourceNameValue = dependsOnValue["resourceName"];
+ if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
+ {
+ string resourceNameInstance = ((string)resourceNameValue);
+ basicDependencyInstance.ResourceName = resourceNameInstance;
+ }
+ }
+ }
+
+ JToken idValue4 = dependenciesValue["id"];
+ if (idValue4 != null && idValue4.Type != JTokenType.Null)
+ {
+ string idInstance4 = ((string)idValue4);
+ dependencyInstance.Id = idInstance4;
+ }
+
+ JToken resourceTypeValue3 = dependenciesValue["resourceType"];
+ if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance3 = ((string)resourceTypeValue3);
+ dependencyInstance.ResourceType = resourceTypeInstance3;
+ }
+
+ JToken resourceNameValue2 = dependenciesValue["resourceName"];
+ if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
+ {
+ string resourceNameInstance2 = ((string)resourceNameValue2);
+ dependencyInstance.ResourceName = resourceNameInstance2;
+ }
+ }
+ }
+
+ JToken templateValue = propertiesValue["template"];
+ if (templateValue != null && templateValue.Type != JTokenType.Null)
+ {
+ string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Template = templateInstance;
+ }
+
+ JToken templateLinkValue = propertiesValue["templateLink"];
+ if (templateLinkValue != null && templateLinkValue.Type != JTokenType.Null)
+ {
+ TemplateLink templateLinkInstance = new TemplateLink();
+ propertiesInstance.TemplateLink = templateLinkInstance;
+
+ JToken uriValue = templateLinkValue["uri"];
+ if (uriValue != null && uriValue.Type != JTokenType.Null)
+ {
+ Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
+ templateLinkInstance.Uri = uriInstance;
+ }
+
+ JToken contentVersionValue = templateLinkValue["contentVersion"];
+ if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
+ {
+ string contentVersionInstance = ((string)contentVersionValue);
+ templateLinkInstance.ContentVersion = contentVersionInstance;
+ }
+ }
+
+ JToken parametersValue = propertiesValue["parameters"];
+ if (parametersValue != null && parametersValue.Type != JTokenType.Null)
+ {
+ string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Parameters = parametersInstance;
+ }
+
+ JToken parametersLinkValue = propertiesValue["parametersLink"];
+ if (parametersLinkValue != null && parametersLinkValue.Type != JTokenType.Null)
+ {
+ ParametersLink parametersLinkInstance = new ParametersLink();
+ propertiesInstance.ParametersLink = parametersLinkInstance;
+
+ JToken uriValue2 = parametersLinkValue["uri"];
+ if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
+ {
+ Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
+ parametersLinkInstance.Uri = uriInstance2;
+ }
+
+ JToken contentVersionValue2 = parametersLinkValue["contentVersion"];
+ if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
+ {
+ string contentVersionInstance2 = ((string)contentVersionValue2);
+ parametersLinkInstance.ContentVersion = contentVersionInstance2;
+ }
+ }
+
+ JToken modeValue = propertiesValue["mode"];
+ if (modeValue != null && modeValue.Type != JTokenType.Null)
+ {
+ DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
+ propertiesInstance.Mode = modeInstance;
+ }
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Validate a deployment template.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Deployment to validate.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Information from validate template deployment response.
+ ///
+ public async Task ValidateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (deploymentName == null)
+ {
+ throw new ArgumentNullException("deploymentName");
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException("parameters");
+ }
+ if (parameters.Properties != null)
+ {
+ if (parameters.Properties.ParametersLink != null)
+ {
+ if (parameters.Properties.ParametersLink.Uri == null)
+ {
+ throw new ArgumentNullException("parameters.Properties.ParametersLink.Uri");
+ }
+ }
+ if (parameters.Properties.TemplateLink != null)
+ {
+ if (parameters.Properties.TemplateLink.Uri == null)
+ {
+ throw new ArgumentNullException("parameters.Properties.TemplateLink.Uri");
+ }
+ }
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("deploymentName", deploymentName);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "ValidateAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/providers/microsoft.resources/deployments/";
+ url = url + Uri.EscapeDataString(deploymentName);
+ url = url + "/validate";
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-04-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Post;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Serialize Request
+ string requestContent = null;
+ JToken requestDoc = null;
+
+ JObject deploymentValue = new JObject();
+ requestDoc = deploymentValue;
+
+ if (parameters.Properties != null)
+ {
+ JObject propertiesValue = new JObject();
+ deploymentValue["properties"] = propertiesValue;
+
+ if (parameters.Properties.Template != null)
+ {
+ propertiesValue["template"] = JObject.Parse(parameters.Properties.Template);
+ }
+
+ if (parameters.Properties.TemplateLink != null)
+ {
+ JObject templateLinkValue = new JObject();
+ propertiesValue["templateLink"] = templateLinkValue;
+
+ templateLinkValue["uri"] = parameters.Properties.TemplateLink.Uri.AbsoluteUri;
+
+ if (parameters.Properties.TemplateLink.ContentVersion != null)
+ {
+ templateLinkValue["contentVersion"] = parameters.Properties.TemplateLink.ContentVersion;
+ }
+ }
+
+ if (parameters.Properties.Parameters != null)
+ {
+ propertiesValue["parameters"] = JObject.Parse(parameters.Properties.Parameters);
+ }
+
+ if (parameters.Properties.ParametersLink != null)
+ {
+ JObject parametersLinkValue = new JObject();
+ propertiesValue["parametersLink"] = parametersLinkValue;
+
+ parametersLinkValue["uri"] = parameters.Properties.ParametersLink.Uri.AbsoluteUri;
+
+ if (parameters.Properties.ParametersLink.ContentVersion != null)
+ {
+ parametersLinkValue["contentVersion"] = parameters.Properties.ParametersLink.ContentVersion;
+ }
+ }
+
+ propertiesValue["mode"] = parameters.Properties.Mode.ToString();
+ }
+
+ requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented);
+ httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
+ httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.BadRequest)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ DeploymentValidateResponse result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.BadRequest)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new DeploymentValidateResponse();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken errorValue = responseDoc["error"];
+ if (errorValue != null && errorValue.Type != JTokenType.Null)
+ {
+ ResourceManagementErrorWithDetails errorInstance = new ResourceManagementErrorWithDetails();
+ result.Error = errorInstance;
+
+ JToken detailsArray = errorValue["details"];
+ if (detailsArray != null && detailsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken detailsValue in ((JArray)detailsArray))
+ {
+ ResourceManagementError resourceManagementErrorInstance = new ResourceManagementError();
+ errorInstance.Details.Add(resourceManagementErrorInstance);
+
+ JToken codeValue = detailsValue["code"];
+ if (codeValue != null && codeValue.Type != JTokenType.Null)
+ {
+ string codeInstance = ((string)codeValue);
+ resourceManagementErrorInstance.Code = codeInstance;
+ }
+
+ JToken messageValue = detailsValue["message"];
+ if (messageValue != null && messageValue.Type != JTokenType.Null)
+ {
+ string messageInstance = ((string)messageValue);
+ resourceManagementErrorInstance.Message = messageInstance;
+ }
+
+ JToken targetValue = detailsValue["target"];
+ if (targetValue != null && targetValue.Type != JTokenType.Null)
+ {
+ string targetInstance = ((string)targetValue);
+ resourceManagementErrorInstance.Target = targetInstance;
+ }
+ }
+ }
+
+ JToken codeValue2 = errorValue["code"];
+ if (codeValue2 != null && codeValue2.Type != JTokenType.Null)
+ {
+ string codeInstance2 = ((string)codeValue2);
+ errorInstance.Code = codeInstance2;
+ }
+
+ JToken messageValue2 = errorValue["message"];
+ if (messageValue2 != null && messageValue2.Type != JTokenType.Null)
+ {
+ string messageInstance2 = ((string)messageValue2);
+ errorInstance.Message = messageInstance2;
+ }
+
+ JToken targetValue2 = errorValue["target"];
+ if (targetValue2 != null && targetValue2.Type != JTokenType.Null)
+ {
+ string targetInstance2 = ((string)targetValue2);
+ errorInstance.Target = targetInstance2;
+ }
+ }
+
+ JToken propertiesValue2 = responseDoc["properties"];
+ if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null)
+ {
+ DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended();
+ result.Properties = propertiesInstance;
+
+ JToken provisioningStateValue = propertiesValue2["provisioningState"];
+ if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null)
+ {
+ string provisioningStateInstance = ((string)provisioningStateValue);
+ propertiesInstance.ProvisioningState = provisioningStateInstance;
+ }
+
+ JToken correlationIdValue = propertiesValue2["correlationId"];
+ if (correlationIdValue != null && correlationIdValue.Type != JTokenType.Null)
+ {
+ string correlationIdInstance = ((string)correlationIdValue);
+ propertiesInstance.CorrelationId = correlationIdInstance;
+ }
+
+ JToken timestampValue = propertiesValue2["timestamp"];
+ if (timestampValue != null && timestampValue.Type != JTokenType.Null)
+ {
+ DateTime timestampInstance = ((DateTime)timestampValue);
+ propertiesInstance.Timestamp = timestampInstance;
+ }
+
+ JToken outputsValue = propertiesValue2["outputs"];
+ if (outputsValue != null && outputsValue.Type != JTokenType.Null)
+ {
+ string outputsInstance = outputsValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Outputs = outputsInstance;
+ }
+
+ JToken providersArray = propertiesValue2["providers"];
+ if (providersArray != null && providersArray.Type != JTokenType.Null)
+ {
+ foreach (JToken providersValue in ((JArray)providersArray))
+ {
+ Provider providerInstance = new Provider();
+ propertiesInstance.Providers.Add(providerInstance);
+
+ JToken idValue = providersValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ providerInstance.Id = idInstance;
+ }
+
+ JToken namespaceValue = providersValue["namespace"];
+ if (namespaceValue != null && namespaceValue.Type != JTokenType.Null)
+ {
+ string namespaceInstance = ((string)namespaceValue);
+ providerInstance.Namespace = namespaceInstance;
+ }
+
+ JToken registrationStateValue = providersValue["registrationState"];
+ if (registrationStateValue != null && registrationStateValue.Type != JTokenType.Null)
+ {
+ string registrationStateInstance = ((string)registrationStateValue);
+ providerInstance.RegistrationState = registrationStateInstance;
+ }
+
+ JToken resourceTypesArray = providersValue["resourceTypes"];
+ if (resourceTypesArray != null && resourceTypesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken resourceTypesValue in ((JArray)resourceTypesArray))
+ {
+ ProviderResourceType providerResourceTypeInstance = new ProviderResourceType();
+ providerInstance.ResourceTypes.Add(providerResourceTypeInstance);
+
+ JToken resourceTypeValue = resourceTypesValue["resourceType"];
+ if (resourceTypeValue != null && resourceTypeValue.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance = ((string)resourceTypeValue);
+ providerResourceTypeInstance.Name = resourceTypeInstance;
+ }
+
+ JToken locationsArray = resourceTypesValue["locations"];
+ if (locationsArray != null && locationsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken locationsValue in ((JArray)locationsArray))
+ {
+ providerResourceTypeInstance.Locations.Add(((string)locationsValue));
+ }
+ }
+
+ JToken apiVersionsArray = resourceTypesValue["apiVersions"];
+ if (apiVersionsArray != null && apiVersionsArray.Type != JTokenType.Null)
+ {
+ foreach (JToken apiVersionsValue in ((JArray)apiVersionsArray))
+ {
+ providerResourceTypeInstance.ApiVersions.Add(((string)apiVersionsValue));
+ }
+ }
+
+ JToken propertiesSequenceElement = ((JToken)resourceTypesValue["properties"]);
+ if (propertiesSequenceElement != null && propertiesSequenceElement.Type != JTokenType.Null)
+ {
+ foreach (JProperty property in propertiesSequenceElement)
+ {
+ string propertiesKey = ((string)property.Name);
+ string propertiesValue3 = ((string)property.Value);
+ providerResourceTypeInstance.Properties.Add(propertiesKey, propertiesValue3);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ JToken dependenciesArray = propertiesValue2["dependencies"];
+ if (dependenciesArray != null && dependenciesArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependenciesValue in ((JArray)dependenciesArray))
+ {
+ Dependency dependencyInstance = new Dependency();
+ propertiesInstance.Dependencies.Add(dependencyInstance);
+
+ JToken dependsOnArray = dependenciesValue["dependsOn"];
+ if (dependsOnArray != null && dependsOnArray.Type != JTokenType.Null)
+ {
+ foreach (JToken dependsOnValue in ((JArray)dependsOnArray))
+ {
+ BasicDependency basicDependencyInstance = new BasicDependency();
+ dependencyInstance.DependsOn.Add(basicDependencyInstance);
+
+ JToken idValue2 = dependsOnValue["id"];
+ if (idValue2 != null && idValue2.Type != JTokenType.Null)
+ {
+ string idInstance2 = ((string)idValue2);
+ basicDependencyInstance.Id = idInstance2;
+ }
+
+ JToken resourceTypeValue2 = dependsOnValue["resourceType"];
+ if (resourceTypeValue2 != null && resourceTypeValue2.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance2 = ((string)resourceTypeValue2);
+ basicDependencyInstance.ResourceType = resourceTypeInstance2;
+ }
+
+ JToken resourceNameValue = dependsOnValue["resourceName"];
+ if (resourceNameValue != null && resourceNameValue.Type != JTokenType.Null)
+ {
+ string resourceNameInstance = ((string)resourceNameValue);
+ basicDependencyInstance.ResourceName = resourceNameInstance;
+ }
+ }
+ }
+
+ JToken idValue3 = dependenciesValue["id"];
+ if (idValue3 != null && idValue3.Type != JTokenType.Null)
+ {
+ string idInstance3 = ((string)idValue3);
+ dependencyInstance.Id = idInstance3;
+ }
+
+ JToken resourceTypeValue3 = dependenciesValue["resourceType"];
+ if (resourceTypeValue3 != null && resourceTypeValue3.Type != JTokenType.Null)
+ {
+ string resourceTypeInstance3 = ((string)resourceTypeValue3);
+ dependencyInstance.ResourceType = resourceTypeInstance3;
+ }
+
+ JToken resourceNameValue2 = dependenciesValue["resourceName"];
+ if (resourceNameValue2 != null && resourceNameValue2.Type != JTokenType.Null)
+ {
+ string resourceNameInstance2 = ((string)resourceNameValue2);
+ dependencyInstance.ResourceName = resourceNameInstance2;
+ }
+ }
+ }
+
+ JToken templateValue = propertiesValue2["template"];
+ if (templateValue != null && templateValue.Type != JTokenType.Null)
+ {
+ string templateInstance = templateValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Template = templateInstance;
+ }
+
+ JToken templateLinkValue2 = propertiesValue2["templateLink"];
+ if (templateLinkValue2 != null && templateLinkValue2.Type != JTokenType.Null)
+ {
+ TemplateLink templateLinkInstance = new TemplateLink();
+ propertiesInstance.TemplateLink = templateLinkInstance;
+
+ JToken uriValue = templateLinkValue2["uri"];
+ if (uriValue != null && uriValue.Type != JTokenType.Null)
+ {
+ Uri uriInstance = TypeConversion.TryParseUri(((string)uriValue));
+ templateLinkInstance.Uri = uriInstance;
+ }
+
+ JToken contentVersionValue = templateLinkValue2["contentVersion"];
+ if (contentVersionValue != null && contentVersionValue.Type != JTokenType.Null)
+ {
+ string contentVersionInstance = ((string)contentVersionValue);
+ templateLinkInstance.ContentVersion = contentVersionInstance;
+ }
+ }
+
+ JToken parametersValue = propertiesValue2["parameters"];
+ if (parametersValue != null && parametersValue.Type != JTokenType.Null)
+ {
+ string parametersInstance = parametersValue.ToString(Newtonsoft.Json.Formatting.Indented);
+ propertiesInstance.Parameters = parametersInstance;
+ }
+
+ JToken parametersLinkValue2 = propertiesValue2["parametersLink"];
+ if (parametersLinkValue2 != null && parametersLinkValue2.Type != JTokenType.Null)
+ {
+ ParametersLink parametersLinkInstance = new ParametersLink();
+ propertiesInstance.ParametersLink = parametersLinkInstance;
+
+ JToken uriValue2 = parametersLinkValue2["uri"];
+ if (uriValue2 != null && uriValue2.Type != JTokenType.Null)
+ {
+ Uri uriInstance2 = TypeConversion.TryParseUri(((string)uriValue2));
+ parametersLinkInstance.Uri = uriInstance2;
+ }
+
+ JToken contentVersionValue2 = parametersLinkValue2["contentVersion"];
+ if (contentVersionValue2 != null && contentVersionValue2.Type != JTokenType.Null)
+ {
+ string contentVersionInstance2 = ((string)contentVersionValue2);
+ parametersLinkInstance.ContentVersion = contentVersionInstance2;
+ }
+ }
+
+ JToken modeValue = propertiesValue2["mode"];
+ if (modeValue != null && modeValue.Type != JTokenType.Null)
+ {
+ DeploymentMode modeInstance = ((DeploymentMode)Enum.Parse(typeof(DeploymentMode), ((string)modeValue), true));
+ propertiesInstance.Mode = modeInstance;
+ }
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (statusCode == HttpStatusCode.OK)
+ {
+ result.IsValid = true;
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationsExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationsExtensions.cs
new file mode 100644
index 000000000000..663340b361c7
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/DeploymentOperationsExtensions.cs
@@ -0,0 +1,478 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public static partial class DeploymentOperationsExtensions
+ {
+ ///
+ /// Begin deleting deployment.To determine whether the operation has
+ /// finished processing the request, call
+ /// GetLongRunningOperationStatus.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment to be deleted.
+ ///
+ ///
+ /// A standard service response for long running operations.
+ ///
+ public static LongRunningOperationResponse BeginDeleting(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).BeginDeletingAsync(resourceGroupName, deploymentName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Begin deleting deployment.To determine whether the operation has
+ /// finished processing the request, call
+ /// GetLongRunningOperationStatus.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment to be deleted.
+ ///
+ ///
+ /// A standard service response for long running operations.
+ ///
+ public static Task BeginDeletingAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return operations.BeginDeletingAsync(resourceGroupName, deploymentName, CancellationToken.None);
+ }
+
+ ///
+ /// Cancel a currently running template deployment.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static AzureOperationResponse Cancel(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).CancelAsync(resourceGroupName, deploymentName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Cancel a currently running template deployment.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static Task CancelAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return operations.CancelAsync(resourceGroupName, deploymentName, CancellationToken.None);
+ }
+
+ ///
+ /// Checks whether deployment exists.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group to check. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Deployment information.
+ ///
+ public static DeploymentExistsResult CheckExistence(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).CheckExistenceAsync(resourceGroupName, deploymentName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Checks whether deployment exists.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group to check. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Deployment information.
+ ///
+ public static Task CheckExistenceAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return operations.CheckExistenceAsync(resourceGroupName, deploymentName, CancellationToken.None);
+ }
+
+ ///
+ /// Create a named template deployment using a template.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Additional parameters supplied to the operation.
+ ///
+ ///
+ /// Template deployment operation create result.
+ ///
+ public static DeploymentOperationsCreateResult CreateOrUpdate(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, Deployment parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).CreateOrUpdateAsync(resourceGroupName, deploymentName, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create a named template deployment using a template.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Additional parameters supplied to the operation.
+ ///
+ ///
+ /// Template deployment operation create result.
+ ///
+ public static Task CreateOrUpdateAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, Deployment parameters)
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, deploymentName, parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Delete deployment and all of its resources.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment to be deleted.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static AzureOperationResponse Delete(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).DeleteAsync(resourceGroupName, deploymentName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete deployment and all of its resources.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment to be deleted.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static Task DeleteAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return operations.DeleteAsync(resourceGroupName, deploymentName, CancellationToken.None);
+ }
+
+ ///
+ /// Get a deployment.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group to get. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Template deployment information.
+ ///
+ public static DeploymentGetResult Get(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).GetAsync(resourceGroupName, deploymentName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a deployment.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group to get. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Template deployment information.
+ ///
+ public static Task GetAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName)
+ {
+ return operations.GetAsync(resourceGroupName, deploymentName, CancellationToken.None);
+ }
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group to filter by. The name is
+ /// case insensitive.
+ ///
+ ///
+ /// Optional. Query parameters. If null is passed returns all
+ /// deployments.
+ ///
+ ///
+ /// List of deployments.
+ ///
+ public static DeploymentListResult List(this IDeploymentOperations operations, string resourceGroupName, DeploymentListParameters parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).ListAsync(resourceGroupName, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group to filter by. The name is
+ /// case insensitive.
+ ///
+ ///
+ /// Optional. Query parameters. If null is passed returns all
+ /// deployments.
+ ///
+ ///
+ /// List of deployments.
+ ///
+ public static Task ListAsync(this IDeploymentOperations operations, string resourceGroupName, DeploymentListParameters parameters)
+ {
+ return operations.ListAsync(resourceGroupName, parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of deployments.
+ ///
+ public static DeploymentListResult ListNext(this IDeploymentOperations operations, string nextLink)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).ListNextAsync(nextLink);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of deployments.
+ ///
+ public static Task ListNextAsync(this IDeploymentOperations operations, string nextLink)
+ {
+ return operations.ListNextAsync(nextLink, CancellationToken.None);
+ }
+
+ ///
+ /// Validate a deployment template.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Deployment to validate.
+ ///
+ ///
+ /// Information from validate template deployment response.
+ ///
+ public static DeploymentValidateResponse Validate(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, Deployment parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IDeploymentOperations)s).ValidateAsync(resourceGroupName, deploymentName, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Validate a deployment template.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IDeploymentOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. The name of the deployment.
+ ///
+ ///
+ /// Required. Deployment to validate.
+ ///
+ ///
+ /// Information from validate template deployment response.
+ ///
+ public static Task ValidateAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, Deployment parameters)
+ {
+ return operations.ValidateAsync(resourceGroupName, deploymentName, parameters, CancellationToken.None);
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeatureClient.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeatureClient.cs
new file mode 100644
index 000000000000..21726e84eec4
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeatureClient.cs
@@ -0,0 +1,254 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+using System.Net.Http;
+using Hyak.Common;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public partial class FeatureClient : ServiceClient, IFeatureClient
+ {
+ private string _apiVersion;
+
+ ///
+ /// Gets the API version.
+ ///
+ public string ApiVersion
+ {
+ get { return this._apiVersion; }
+ }
+
+ private Uri _baseUri;
+
+ ///
+ /// Gets the URI used as the base for all cloud service requests.
+ ///
+ public Uri BaseUri
+ {
+ get { return this._baseUri; }
+ }
+
+ private SubscriptionCloudCredentials _credentials;
+
+ ///
+ /// Gets subscription credentials which uniquely identify Microsoft
+ /// Azure subscription. The subscription ID forms part of the URI for
+ /// every service call.
+ ///
+ public SubscriptionCloudCredentials Credentials
+ {
+ get { return this._credentials; }
+ }
+
+ private int _longRunningOperationInitialTimeout;
+
+ ///
+ /// Gets or sets the initial timeout for Long Running Operations.
+ ///
+ public int LongRunningOperationInitialTimeout
+ {
+ get { return this._longRunningOperationInitialTimeout; }
+ set { this._longRunningOperationInitialTimeout = value; }
+ }
+
+ private int _longRunningOperationRetryTimeout;
+
+ ///
+ /// Gets or sets the retry timeout for Long Running Operations.
+ ///
+ public int LongRunningOperationRetryTimeout
+ {
+ get { return this._longRunningOperationRetryTimeout; }
+ set { this._longRunningOperationRetryTimeout = value; }
+ }
+
+ private IFeatures _features;
+
+ ///
+ /// Operations for managing preview features.
+ ///
+ public virtual IFeatures Features
+ {
+ get { return this._features; }
+ }
+
+ ///
+ /// Initializes a new instance of the FeatureClient class.
+ ///
+ public FeatureClient()
+ : base()
+ {
+ this._features = new Features(this);
+ this._apiVersion = "2014-08-01-preview";
+ this._longRunningOperationInitialTimeout = -1;
+ this._longRunningOperationRetryTimeout = -1;
+ this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
+ }
+
+ ///
+ /// Initializes a new instance of the FeatureClient class.
+ ///
+ ///
+ /// Required. Gets subscription credentials which uniquely identify
+ /// Microsoft Azure subscription. The subscription ID forms part of
+ /// the URI for every service call.
+ ///
+ ///
+ /// Optional. Gets the URI used as the base for all cloud service
+ /// requests.
+ ///
+ public FeatureClient(SubscriptionCloudCredentials credentials, Uri baseUri)
+ : this()
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ if (baseUri == null)
+ {
+ throw new ArgumentNullException("baseUri");
+ }
+ this._credentials = credentials;
+ this._baseUri = baseUri;
+
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ ///
+ /// Initializes a new instance of the FeatureClient class.
+ ///
+ ///
+ /// Required. Gets subscription credentials which uniquely identify
+ /// Microsoft Azure subscription. The subscription ID forms part of
+ /// the URI for every service call.
+ ///
+ public FeatureClient(SubscriptionCloudCredentials credentials)
+ : this()
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ this._credentials = credentials;
+ this._baseUri = new Uri("https://management.azure.com/");
+
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ ///
+ /// Initializes a new instance of the FeatureClient class.
+ ///
+ ///
+ /// The Http client
+ ///
+ public FeatureClient(HttpClient httpClient)
+ : base(httpClient)
+ {
+ this._features = new Features(this);
+ this._apiVersion = "2014-08-01-preview";
+ this._longRunningOperationInitialTimeout = -1;
+ this._longRunningOperationRetryTimeout = -1;
+ this.HttpClient.Timeout = TimeSpan.FromSeconds(300);
+ }
+
+ ///
+ /// Initializes a new instance of the FeatureClient class.
+ ///
+ ///
+ /// Required. Gets subscription credentials which uniquely identify
+ /// Microsoft Azure subscription. The subscription ID forms part of
+ /// the URI for every service call.
+ ///
+ ///
+ /// Optional. Gets the URI used as the base for all cloud service
+ /// requests.
+ ///
+ ///
+ /// The Http client
+ ///
+ public FeatureClient(SubscriptionCloudCredentials credentials, Uri baseUri, HttpClient httpClient)
+ : this(httpClient)
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ if (baseUri == null)
+ {
+ throw new ArgumentNullException("baseUri");
+ }
+ this._credentials = credentials;
+ this._baseUri = baseUri;
+
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ ///
+ /// Initializes a new instance of the FeatureClient class.
+ ///
+ ///
+ /// Required. Gets subscription credentials which uniquely identify
+ /// Microsoft Azure subscription. The subscription ID forms part of
+ /// the URI for every service call.
+ ///
+ ///
+ /// The Http client
+ ///
+ public FeatureClient(SubscriptionCloudCredentials credentials, HttpClient httpClient)
+ : this(httpClient)
+ {
+ if (credentials == null)
+ {
+ throw new ArgumentNullException("credentials");
+ }
+ this._credentials = credentials;
+ this._baseUri = new Uri("https://management.azure.com/");
+
+ this.Credentials.InitializeServiceClient(this);
+ }
+
+ ///
+ /// Clones properties from current instance to another FeatureClient
+ /// instance
+ ///
+ ///
+ /// Instance of FeatureClient to clone to
+ ///
+ protected override void Clone(ServiceClient client)
+ {
+ base.Clone(client);
+
+ if (client is FeatureClient)
+ {
+ FeatureClient clonedClient = ((FeatureClient)client);
+
+ clonedClient._credentials = this._credentials;
+ clonedClient._baseUri = this._baseUri;
+ clonedClient._apiVersion = this._apiVersion;
+ clonedClient._longRunningOperationInitialTimeout = this._longRunningOperationInitialTimeout;
+ clonedClient._longRunningOperationRetryTimeout = this._longRunningOperationRetryTimeout;
+
+ clonedClient.Credentials.InitializeServiceClient(clonedClient);
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeatureClientExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeatureClientExtensions.cs
new file mode 100644
index 000000000000..2ea760b91aa7
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeatureClientExtensions.cs
@@ -0,0 +1,28 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public static partial class FeatureClientExtensions
+ {
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Features.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Features.cs
new file mode 100644
index 000000000000..69d6b1aa5c98
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Features.cs
@@ -0,0 +1,1186 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+using Hyak.Common;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+using Newtonsoft.Json.Linq;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing preview features.
+ ///
+ internal partial class Features : IServiceOperations, IFeatures
+ {
+ ///
+ /// Initializes a new instance of the Features class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ internal Features(FeatureClient client)
+ {
+ this._client = client;
+ }
+
+ private FeatureClient _client;
+
+ ///
+ /// Gets a reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.FeatureClient.
+ ///
+ public FeatureClient Client
+ {
+ get { return this._client; }
+ }
+
+ ///
+ /// Get all features under the subscription.
+ ///
+ ///
+ /// Required. Namespace of the resource provider.
+ ///
+ ///
+ /// Required. Previewed feature name in the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Previewed feature information.
+ ///
+ public async Task GetAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceProviderNamespace == null)
+ {
+ throw new ArgumentNullException("resourceProviderNamespace");
+ }
+ if (featureName == null)
+ {
+ throw new ArgumentNullException("featureName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace);
+ tracingParameters.Add("featureName", featureName);
+ TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/providers/Microsoft.Features/providers/";
+ url = url + Uri.EscapeDataString(resourceProviderNamespace);
+ url = url + "/features/";
+ url = url + Uri.EscapeDataString(featureName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-08-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ FeatureResponse result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new FeatureResponse();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken nameValue = responseDoc["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ result.Name = nameInstance;
+ }
+
+ JToken propertiesValue = responseDoc["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ FeatureProperties propertiesInstance = new FeatureProperties();
+ result.Properties = propertiesInstance;
+
+ JToken stateValue = propertiesValue["state"];
+ if (stateValue != null && stateValue.Type != JTokenType.Null)
+ {
+ string stateInstance = ((string)stateValue);
+ propertiesInstance.State = stateInstance;
+ }
+ }
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ result.Id = idInstance;
+ }
+
+ JToken typeValue = responseDoc["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ result.Type = typeInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets a list of previewed features of a resource provider.
+ ///
+ ///
+ /// Required. The namespace of the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public async Task ListAsync(string resourceProviderNamespace, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceProviderNamespace == null)
+ {
+ throw new ArgumentNullException("resourceProviderNamespace");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace);
+ TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/providers/Microsoft.Features/providers/";
+ url = url + Uri.EscapeDataString(resourceProviderNamespace);
+ url = url + "/features";
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-08-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ FeatureOperationsListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new FeatureOperationsListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ FeatureResponse featureResponseInstance = new FeatureResponse();
+ result.Features.Add(featureResponseInstance);
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ featureResponseInstance.Name = nameInstance;
+ }
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ FeatureProperties propertiesInstance = new FeatureProperties();
+ featureResponseInstance.Properties = propertiesInstance;
+
+ JToken stateValue = propertiesValue["state"];
+ if (stateValue != null && stateValue.Type != JTokenType.Null)
+ {
+ string stateInstance = ((string)stateValue);
+ propertiesInstance.State = stateInstance;
+ }
+ }
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ featureResponseInstance.Id = idInstance;
+ }
+
+ JToken typeValue = valueValue["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ featureResponseInstance.Type = typeInstance;
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets a list of previewed features for all the providers in the
+ /// current subscription.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public async Task ListAllAsync(CancellationToken cancellationToken)
+ {
+ // Validate
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ TracingAdapter.Enter(invocationId, this, "ListAllAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/providers/Microsoft.Features/features";
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-08-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ FeatureOperationsListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new FeatureOperationsListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ FeatureResponse featureResponseInstance = new FeatureResponse();
+ result.Features.Add(featureResponseInstance);
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ featureResponseInstance.Name = nameInstance;
+ }
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ FeatureProperties propertiesInstance = new FeatureProperties();
+ featureResponseInstance.Properties = propertiesInstance;
+
+ JToken stateValue = propertiesValue["state"];
+ if (stateValue != null && stateValue.Type != JTokenType.Null)
+ {
+ string stateInstance = ((string)stateValue);
+ propertiesInstance.State = stateInstance;
+ }
+ }
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ featureResponseInstance.Id = idInstance;
+ }
+
+ JToken typeValue = valueValue["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ featureResponseInstance.Type = typeInstance;
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets a list of previewed features of a subscription.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public async Task ListAllNextAsync(string nextLink, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException("nextLink");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextLink", nextLink);
+ TracingAdapter.Enter(invocationId, this, "ListAllNextAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + nextLink;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ FeatureOperationsListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new FeatureOperationsListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ FeatureResponse featureResponseInstance = new FeatureResponse();
+ result.Features.Add(featureResponseInstance);
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ featureResponseInstance.Name = nameInstance;
+ }
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ FeatureProperties propertiesInstance = new FeatureProperties();
+ featureResponseInstance.Properties = propertiesInstance;
+
+ JToken stateValue = propertiesValue["state"];
+ if (stateValue != null && stateValue.Type != JTokenType.Null)
+ {
+ string stateInstance = ((string)stateValue);
+ propertiesInstance.State = stateInstance;
+ }
+ }
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ featureResponseInstance.Id = idInstance;
+ }
+
+ JToken typeValue = valueValue["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ featureResponseInstance.Type = typeInstance;
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets a list of previewed features of a resource provider.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public async Task ListNextAsync(string nextLink, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException("nextLink");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextLink", nextLink);
+ TracingAdapter.Enter(invocationId, this, "ListNextAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + nextLink;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ FeatureOperationsListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new FeatureOperationsListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ FeatureResponse featureResponseInstance = new FeatureResponse();
+ result.Features.Add(featureResponseInstance);
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ featureResponseInstance.Name = nameInstance;
+ }
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ FeatureProperties propertiesInstance = new FeatureProperties();
+ featureResponseInstance.Properties = propertiesInstance;
+
+ JToken stateValue = propertiesValue["state"];
+ if (stateValue != null && stateValue.Type != JTokenType.Null)
+ {
+ string stateInstance = ((string)stateValue);
+ propertiesInstance.State = stateInstance;
+ }
+ }
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ featureResponseInstance.Id = idInstance;
+ }
+
+ JToken typeValue = valueValue["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ featureResponseInstance.Type = typeInstance;
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Registers for a previewed feature of a resource provider.
+ ///
+ ///
+ /// Required. Namespace of the resource provider.
+ ///
+ ///
+ /// Required. Previewed feature name in the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Previewed feature information.
+ ///
+ public async Task RegisterAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceProviderNamespace == null)
+ {
+ throw new ArgumentNullException("resourceProviderNamespace");
+ }
+ if (featureName == null)
+ {
+ throw new ArgumentNullException("featureName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace);
+ tracingParameters.Add("featureName", featureName);
+ TracingAdapter.Enter(invocationId, this, "RegisterAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/providers/Microsoft.Features/providers/";
+ url = url + Uri.EscapeDataString(resourceProviderNamespace);
+ url = url + "/features/";
+ url = url + Uri.EscapeDataString(featureName);
+ url = url + "/register";
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2014-08-01-preview");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Post;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ FeatureResponse result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new FeatureResponse();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken nameValue = responseDoc["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ result.Name = nameInstance;
+ }
+
+ JToken propertiesValue = responseDoc["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ FeatureProperties propertiesInstance = new FeatureProperties();
+ result.Properties = propertiesInstance;
+
+ JToken stateValue = propertiesValue["state"];
+ if (stateValue != null && stateValue.Type != JTokenType.Null)
+ {
+ string stateInstance = ((string)stateValue);
+ propertiesInstance.State = stateInstance;
+ }
+ }
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ result.Id = idInstance;
+ }
+
+ JToken typeValue = responseDoc["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ result.Type = typeInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeaturesExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeaturesExtensions.cs
new file mode 100644
index 000000000000..7e6df8bc8625
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/FeaturesExtensions.cs
@@ -0,0 +1,270 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public static partial class FeaturesExtensions
+ {
+ ///
+ /// Get all features under the subscription.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. Namespace of the resource provider.
+ ///
+ ///
+ /// Required. Previewed feature name in the resource provider.
+ ///
+ ///
+ /// Previewed feature information.
+ ///
+ public static FeatureResponse Get(this IFeatures operations, string resourceProviderNamespace, string featureName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IFeatures)s).GetAsync(resourceProviderNamespace, featureName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get all features under the subscription.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. Namespace of the resource provider.
+ ///
+ ///
+ /// Required. Previewed feature name in the resource provider.
+ ///
+ ///
+ /// Previewed feature information.
+ ///
+ public static Task GetAsync(this IFeatures operations, string resourceProviderNamespace, string featureName)
+ {
+ return operations.GetAsync(resourceProviderNamespace, featureName, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a list of previewed features of a resource provider.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. The namespace of the resource provider.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public static FeatureOperationsListResult List(this IFeatures operations, string resourceProviderNamespace)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IFeatures)s).ListAsync(resourceProviderNamespace);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a list of previewed features of a resource provider.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. The namespace of the resource provider.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public static Task ListAsync(this IFeatures operations, string resourceProviderNamespace)
+ {
+ return operations.ListAsync(resourceProviderNamespace, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a list of previewed features for all the providers in the
+ /// current subscription.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public static FeatureOperationsListResult ListAll(this IFeatures operations)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IFeatures)s).ListAllAsync();
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a list of previewed features for all the providers in the
+ /// current subscription.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public static Task ListAllAsync(this IFeatures operations)
+ {
+ return operations.ListAllAsync(CancellationToken.None);
+ }
+
+ ///
+ /// Gets a list of previewed features of a subscription.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public static FeatureOperationsListResult ListAllNext(this IFeatures operations, string nextLink)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IFeatures)s).ListAllNextAsync(nextLink);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a list of previewed features of a subscription.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public static Task ListAllNextAsync(this IFeatures operations, string nextLink)
+ {
+ return operations.ListAllNextAsync(nextLink, CancellationToken.None);
+ }
+
+ ///
+ /// Gets a list of previewed features of a resource provider.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public static FeatureOperationsListResult ListNext(this IFeatures operations, string nextLink)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IFeatures)s).ListNextAsync(nextLink);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a list of previewed features of a resource provider.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ public static Task ListNextAsync(this IFeatures operations, string nextLink)
+ {
+ return operations.ListNextAsync(nextLink, CancellationToken.None);
+ }
+
+ ///
+ /// Registers for a previewed feature of a resource provider.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. Namespace of the resource provider.
+ ///
+ ///
+ /// Required. Previewed feature name in the resource provider.
+ ///
+ ///
+ /// Previewed feature information.
+ ///
+ public static FeatureResponse Register(this IFeatures operations, string resourceProviderNamespace, string featureName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IFeatures)s).RegisterAsync(resourceProviderNamespace, featureName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Registers for a previewed feature of a resource provider.
+ ///
+ ///
+ /// Reference to the Microsoft.Azure.Management.Internal.Resources.IFeatures.
+ ///
+ ///
+ /// Required. Namespace of the resource provider.
+ ///
+ ///
+ /// Required. Previewed feature name in the resource provider.
+ ///
+ ///
+ /// Previewed feature information.
+ ///
+ public static Task RegisterAsync(this IFeatures operations, string resourceProviderNamespace, string featureName)
+ {
+ return operations.RegisterAsync(resourceProviderNamespace, featureName, CancellationToken.None);
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IAuthorizationClient.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IAuthorizationClient.cs
new file mode 100644
index 000000000000..29a694791616
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IAuthorizationClient.cs
@@ -0,0 +1,78 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public partial interface IAuthorizationClient : IDisposable
+ {
+ ///
+ /// Gets the API version.
+ ///
+ string ApiVersion
+ {
+ get;
+ }
+
+ ///
+ /// Gets the URI used as the base for all cloud service requests.
+ ///
+ Uri BaseUri
+ {
+ get;
+ }
+
+ ///
+ /// Gets subscription credentials which uniquely identify Microsoft
+ /// Azure subscription. The subscription ID forms part of the URI for
+ /// every service call.
+ ///
+ SubscriptionCloudCredentials Credentials
+ {
+ get;
+ }
+
+ ///
+ /// Gets or sets the initial timeout for Long Running Operations.
+ ///
+ int LongRunningOperationInitialTimeout
+ {
+ get; set;
+ }
+
+ ///
+ /// Gets or sets the retry timeout for Long Running Operations.
+ ///
+ int LongRunningOperationRetryTimeout
+ {
+ get; set;
+ }
+
+ ///
+ /// Operations for managing locks.
+ ///
+ IManagementLockOperations ManagementLocks
+ {
+ get;
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IDeploymentOperationOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IDeploymentOperationOperations.cs
new file mode 100644
index 000000000000..bdef7da66fd8
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IDeploymentOperationOperations.cs
@@ -0,0 +1,87 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing deployment operations.
+ ///
+ public partial interface IDeploymentOperationOperations
+ {
+ ///
+ /// Get a list of deployments operations.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the deployment.
+ ///
+ ///
+ /// Operation Id.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Deployment operation.
+ ///
+ Task GetAsync(string resourceGroupName, string deploymentName, string operationId, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a list of deployments operations.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the deployment.
+ ///
+ ///
+ /// Query parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of deployment operations.
+ ///
+ Task ListAsync(string resourceGroupName, string deploymentName, DeploymentOperationsListParameters parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a next list of deployments operations.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of deployment operations.
+ ///
+ Task ListNextAsync(string nextLink, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IDeploymentOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IDeploymentOperations.cs
new file mode 100644
index 000000000000..c95feb84533b
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IDeploymentOperations.cs
@@ -0,0 +1,195 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing deployments.
+ ///
+ public partial interface IDeploymentOperations
+ {
+ ///
+ /// Begin deleting deployment.To determine whether the operation has
+ /// finished processing the request, call
+ /// GetLongRunningOperationStatus.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the deployment to be deleted.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response for long running operations.
+ ///
+ Task BeginDeletingAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken);
+
+ ///
+ /// Cancel a currently running template deployment.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the deployment.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task CancelAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken);
+
+ ///
+ /// Checks whether deployment exists.
+ ///
+ ///
+ /// The name of the resource group to check. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// The name of the deployment.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Deployment information.
+ ///
+ Task CheckExistenceAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken);
+
+ ///
+ /// Create a named template deployment using a template.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the deployment.
+ ///
+ ///
+ /// Additional parameters supplied to the operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Template deployment operation create result.
+ ///
+ Task CreateOrUpdateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Delete deployment and all of its resources.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the deployment to be deleted.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task DeleteAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken);
+
+ ///
+ /// Get a deployment.
+ ///
+ ///
+ /// The name of the resource group to get. The name is case insensitive.
+ ///
+ ///
+ /// The name of the deployment.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Template deployment information.
+ ///
+ Task GetAsync(string resourceGroupName, string deploymentName, CancellationToken cancellationToken);
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// The name of the resource group to filter by. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Query parameters. If null is passed returns all deployments.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of deployments.
+ ///
+ Task ListAsync(string resourceGroupName, DeploymentListParameters parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of deployments.
+ ///
+ Task ListNextAsync(string nextLink, CancellationToken cancellationToken);
+
+ ///
+ /// Validate a deployment template.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The name of the deployment.
+ ///
+ ///
+ /// Deployment to validate.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Information from validate template deployment response.
+ ///
+ Task ValidateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IFeatureClient.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IFeatureClient.cs
new file mode 100644
index 000000000000..95049d66b825
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IFeatureClient.cs
@@ -0,0 +1,78 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public partial interface IFeatureClient : IDisposable
+ {
+ ///
+ /// Gets the API version.
+ ///
+ string ApiVersion
+ {
+ get;
+ }
+
+ ///
+ /// Gets the URI used as the base for all cloud service requests.
+ ///
+ Uri BaseUri
+ {
+ get;
+ }
+
+ ///
+ /// Gets subscription credentials which uniquely identify Microsoft
+ /// Azure subscription. The subscription ID forms part of the URI for
+ /// every service call.
+ ///
+ SubscriptionCloudCredentials Credentials
+ {
+ get;
+ }
+
+ ///
+ /// Gets or sets the initial timeout for Long Running Operations.
+ ///
+ int LongRunningOperationInitialTimeout
+ {
+ get; set;
+ }
+
+ ///
+ /// Gets or sets the retry timeout for Long Running Operations.
+ ///
+ int LongRunningOperationRetryTimeout
+ {
+ get; set;
+ }
+
+ ///
+ /// Operations for managing preview features.
+ ///
+ IFeatures Features
+ {
+ get;
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IFeatures.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IFeatures.cs
new file mode 100644
index 000000000000..0043bb23594b
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IFeatures.cs
@@ -0,0 +1,121 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing preview features.
+ ///
+ public partial interface IFeatures
+ {
+ ///
+ /// Get all features under the subscription.
+ ///
+ ///
+ /// Namespace of the resource provider.
+ ///
+ ///
+ /// Previewed feature name in the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Previewed feature information.
+ ///
+ Task GetAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a list of previewed features of a resource provider.
+ ///
+ ///
+ /// The namespace of the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ Task ListAsync(string resourceProviderNamespace, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a list of previewed features for all the providers in the
+ /// current subscription.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ Task ListAllAsync(CancellationToken cancellationToken);
+
+ ///
+ /// Gets a list of previewed features of a subscription.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ Task ListAllNextAsync(string nextLink, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a list of previewed features of a resource provider.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of previewed features.
+ ///
+ Task ListNextAsync(string nextLink, CancellationToken cancellationToken);
+
+ ///
+ /// Registers for a previewed feature of a resource provider.
+ ///
+ ///
+ /// Namespace of the resource provider.
+ ///
+ ///
+ /// Previewed feature name in the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Previewed feature information.
+ ///
+ Task RegisterAsync(string resourceProviderNamespace, string featureName, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IManagementLockOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IManagementLockOperations.cs
new file mode 100644
index 000000000000..0fbfdef68a72
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IManagementLockOperations.cs
@@ -0,0 +1,233 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing locks.
+ ///
+ public partial interface IManagementLockOperations
+ {
+ ///
+ /// Create or update a management lock at the resource group level.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The lock name.
+ ///
+ ///
+ /// The management lock parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ Task CreateOrUpdateAtResourceGroupLevelAsync(string resourceGroupName, string lockName, ManagementLockProperties parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Create or update a management lock at the resource level or any
+ /// level below resource.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// Resource identity.
+ ///
+ ///
+ /// The name of lock.
+ ///
+ ///
+ /// Create or update management lock parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ Task CreateOrUpdateAtResourceLevelAsync(string resourceGroupName, ResourceIdentity identity, string lockName, ManagementLockProperties parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Create or update a management lock at the subscription level.
+ ///
+ ///
+ /// The name of lock.
+ ///
+ ///
+ /// The management lock parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ Task CreateOrUpdateAtSubscriptionLevelAsync(string lockName, ManagementLockProperties parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes the management lock of a resource group.
+ ///
+ ///
+ /// The resource group names.
+ ///
+ ///
+ /// The name of lock.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task DeleteAtResourceGroupLevelAsync(string resourceGroup, string lockName, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes the management lock of a resource or any level below
+ /// resource.
+ ///
+ ///
+ /// The name of the resource group.
+ ///
+ ///
+ /// Resource identity.
+ ///
+ ///
+ /// The name of lock.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task DeleteAtResourceLevelAsync(string resourceGroupName, ResourceIdentity identity, string lockName, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes the management lock of a subscription.
+ ///
+ ///
+ /// The name of lock.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task DeleteAtSubscriptionLevelAsync(string lockName, CancellationToken cancellationToken);
+
+ ///
+ /// Gets the management lock of a scope.
+ ///
+ ///
+ /// Name of the management lock.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ Task GetAsync(string lockName, CancellationToken cancellationToken);
+
+ ///
+ /// Gets all the management locks of a resource group.
+ ///
+ ///
+ /// Resource group name.
+ ///
+ ///
+ /// Query parameters. If empty is passed returns all locks at, above or
+ /// below the resource group.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ Task ListAtResourceGroupLevelAsync(string resourceGroupName, ManagementLockGetQueryParameter parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Gets all the management locks of a resource or any level below
+ /// resource.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Resource identity.
+ ///
+ ///
+ /// Query parameters. If empty is passed returns all locks at or below
+ /// the resource.If atScope() is passed returns all locks at the
+ /// resource level.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ Task ListAtResourceLevelAsync(string resourceGroupName, ResourceIdentity identity, ManagementLockGetQueryParameter parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Gets all the management locks of a subscription.
+ ///
+ ///
+ /// Query parameters. If empty is passed returns all locks at, above or
+ /// below the subscription.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ Task ListAtSubscriptionLevelAsync(ManagementLockGetQueryParameter parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Get a list of management locks at resource level or below.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ Task ListNextAsync(string nextLink, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IProviderOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IProviderOperations.cs
new file mode 100644
index 000000000000..eed72529159f
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IProviderOperations.cs
@@ -0,0 +1,103 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing providers.
+ ///
+ public partial interface IProviderOperations
+ {
+ ///
+ /// Gets a resource provider.
+ ///
+ ///
+ /// Namespace of the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource provider information.
+ ///
+ Task GetAsync(string resourceProviderNamespace, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a list of resource providers.
+ ///
+ ///
+ /// Query parameters. If null is passed returns all deployments.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of resource providers.
+ ///
+ Task ListAsync(ProviderListParameters parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of resource providers.
+ ///
+ Task ListNextAsync(string nextLink, CancellationToken cancellationToken);
+
+ ///
+ /// Registers provider to be used with a subscription.
+ ///
+ ///
+ /// Namespace of the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource provider registration information.
+ ///
+ Task RegisterAsync(string resourceProviderNamespace, CancellationToken cancellationToken);
+
+ ///
+ /// Unregisters provider from a subscription.
+ ///
+ ///
+ /// Namespace of the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource provider registration information.
+ ///
+ Task UnregisterAsync(string resourceProviderNamespace, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IProviderOperationsMetadataOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IProviderOperationsMetadataOperations.cs
new file mode 100644
index 000000000000..6ab1a1fd0316
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IProviderOperationsMetadataOperations.cs
@@ -0,0 +1,58 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for getting provider operations metadata.
+ ///
+ public partial interface IProviderOperationsMetadataOperations
+ {
+ ///
+ /// Gets provider operations metadata
+ ///
+ ///
+ /// Namespace of the resource provider.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Provider operations metadata
+ ///
+ Task GetAsync(string resourceProviderNamespace, CancellationToken cancellationToken);
+
+ ///
+ /// Gets provider operations metadata list
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Provider operations metadata list
+ ///
+ Task ListAsync(CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceGroupOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceGroupOperations.cs
new file mode 100644
index 000000000000..97441cf706cf
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceGroupOperations.cs
@@ -0,0 +1,163 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing resource groups.
+ ///
+ public partial interface IResourceGroupOperations
+ {
+ ///
+ /// Begin deleting resource group.To determine whether the operation
+ /// has finished processing the request, call
+ /// GetLongRunningOperationStatus.
+ ///
+ ///
+ /// The name of the resource group to be deleted. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response for long running operations.
+ ///
+ Task BeginDeletingAsync(string resourceGroupName, CancellationToken cancellationToken);
+
+ ///
+ /// Checks whether resource group exists.
+ ///
+ ///
+ /// The name of the resource group to check. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource group information.
+ ///
+ Task CheckExistenceAsync(string resourceGroupName, CancellationToken cancellationToken);
+
+ ///
+ /// Create a resource group.
+ ///
+ ///
+ /// The name of the resource group to be created or updated.
+ ///
+ ///
+ /// Parameters supplied to the create or update resource group service
+ /// operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource group information.
+ ///
+ Task CreateOrUpdateAsync(string resourceGroupName, ResourceGroup parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Delete resource group and all of its resources.
+ ///
+ ///
+ /// The name of the resource group to be deleted. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task DeleteAsync(string resourceGroupName, CancellationToken cancellationToken);
+
+ ///
+ /// Get a resource group.
+ ///
+ ///
+ /// The name of the resource group to get. The name is case insensitive.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource group information.
+ ///
+ Task GetAsync(string resourceGroupName, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a collection of resource groups.
+ ///
+ ///
+ /// Query parameters. If null is passed returns all resource groups.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of resource groups.
+ ///
+ Task ListAsync(ResourceGroupListParameters parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of resource groups.
+ ///
+ Task ListNextAsync(string nextLink, CancellationToken cancellationToken);
+
+ ///
+ /// Resource groups can be updated through a simple PATCH operation to
+ /// a group address. The format of the request is the same as that for
+ /// creating a resource groups, though if a field is unspecified
+ /// current value will be carried over.
+ ///
+ ///
+ /// The name of the resource group to be created or updated. The name
+ /// is case insensitive.
+ ///
+ ///
+ /// Parameters supplied to the update state resource group service
+ /// operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource group information.
+ ///
+ Task PatchAsync(string resourceGroupName, ResourceGroup parameters, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceManagementClient.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceManagementClient.cs
new file mode 100644
index 000000000000..09fc4399bf29
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceManagementClient.cs
@@ -0,0 +1,154 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public partial interface IResourceManagementClient : IDisposable
+ {
+ ///
+ /// Gets the API version.
+ ///
+ string ApiVersion
+ {
+ get;
+ }
+
+ ///
+ /// Gets the URI used as the base for all cloud service requests.
+ ///
+ Uri BaseUri
+ {
+ get;
+ }
+
+ ///
+ /// Gets subscription credentials which uniquely identify Microsoft
+ /// Azure subscription. The subscription ID forms part of the URI for
+ /// every service call.
+ ///
+ SubscriptionCloudCredentials Credentials
+ {
+ get;
+ }
+
+ ///
+ /// Gets or sets the initial timeout for Long Running Operations.
+ ///
+ int LongRunningOperationInitialTimeout
+ {
+ get; set;
+ }
+
+ ///
+ /// Gets or sets the retry timeout for Long Running Operations.
+ ///
+ int LongRunningOperationRetryTimeout
+ {
+ get; set;
+ }
+
+ ///
+ /// Operations for managing deployment operations.
+ ///
+ IDeploymentOperationOperations DeploymentOperations
+ {
+ get;
+ }
+
+ ///
+ /// Operations for managing deployments.
+ ///
+ IDeploymentOperations Deployments
+ {
+ get;
+ }
+
+ ///
+ /// Operations for managing providers.
+ ///
+ IProviderOperations Providers
+ {
+ get;
+ }
+
+ ///
+ /// Operations for getting provider operations metadata.
+ ///
+ IProviderOperationsMetadataOperations ProviderOperationsMetadata
+ {
+ get;
+ }
+
+ ///
+ /// Operations for managing resource groups.
+ ///
+ IResourceGroupOperations ResourceGroups
+ {
+ get;
+ }
+
+ ///
+ /// Operations for managing resources.
+ ///
+ IResourceOperations Resources
+ {
+ get;
+ }
+
+ ///
+ /// Operations for managing Resource provider operations.
+ ///
+ IResourceProviderOperationDetailsOperations ResourceProviderOperationDetails
+ {
+ get;
+ }
+
+ ///
+ /// Operations for managing tags.
+ ///
+ ITagOperations Tags
+ {
+ get;
+ }
+
+ ///
+ /// The Get Operation Status operation returns the status of the
+ /// specified operation. After calling an asynchronous operation, you
+ /// can call Get Operation Status to determine whether the operation
+ /// has succeeded, failed, or is still in progress.
+ ///
+ ///
+ /// Location value returned by the Begin operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response for long running operations.
+ ///
+ Task GetLongRunningOperationStatusAsync(string operationStatusLink, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceOperations.cs
new file mode 100644
index 000000000000..93a1747a6cb3
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceOperations.cs
@@ -0,0 +1,170 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing resources.
+ ///
+ public partial interface IResourceOperations
+ {
+ ///
+ /// Begin moving resources.To determine whether the operation has
+ /// finished processing the request, call
+ /// GetLongRunningOperationStatus.
+ ///
+ ///
+ /// Source resource group name.
+ ///
+ ///
+ /// move resources' parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response for long running operations.
+ ///
+ Task BeginMovingAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Checks whether resource exists.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Resource identity.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource group information.
+ ///
+ Task CheckExistenceAsync(string resourceGroupName, ResourceIdentity identity, CancellationToken cancellationToken);
+
+ ///
+ /// Create a resource.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Resource identity.
+ ///
+ ///
+ /// Create or update resource parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource information.
+ ///
+ Task CreateOrUpdateAsync(string resourceGroupName, ResourceIdentity identity, GenericResource parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Delete resource and all of its resources.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Resource identity.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task DeleteAsync(string resourceGroupName, ResourceIdentity identity, CancellationToken cancellationToken);
+
+ ///
+ /// Returns a resource belonging to a resource group.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Resource identity.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Resource information.
+ ///
+ Task GetAsync(string resourceGroupName, ResourceIdentity identity, CancellationToken cancellationToken);
+
+ ///
+ /// Get all of the resources under a subscription.
+ ///
+ ///
+ /// Query parameters. If null is passed returns all resource groups.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of resource groups.
+ ///
+ Task ListAsync(ResourceListParameters parameters, CancellationToken cancellationToken);
+
+ ///
+ /// Get a list of deployments.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of resource groups.
+ ///
+ Task ListNextAsync(string nextLink, CancellationToken cancellationToken);
+
+ ///
+ /// Move resources within or across subscriptions.
+ ///
+ ///
+ /// Source resource group name.
+ ///
+ ///
+ /// move resources' parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task MoveResourcesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceProviderOperationDetailsOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceProviderOperationDetailsOperations.cs
new file mode 100644
index 000000000000..ddeda5c8bbe1
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/IResourceProviderOperationDetailsOperations.cs
@@ -0,0 +1,47 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing Resource provider operations.
+ ///
+ public partial interface IResourceProviderOperationDetailsOperations
+ {
+ ///
+ /// Gets a list of resource providers.
+ ///
+ ///
+ /// Resource identity.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of resource provider operations.
+ ///
+ Task ListAsync(ResourceIdentity identity, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ISubscriptionClient.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ISubscriptionClient.cs
new file mode 100644
index 000000000000..3e83097b50b3
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ISubscriptionClient.cs
@@ -0,0 +1,85 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+using Hyak.Common;
+
+namespace Microsoft.Azure.Internal.Subscriptions
+{
+ public partial interface ISubscriptionClient : IDisposable
+ {
+ ///
+ /// Gets the API version.
+ ///
+ string ApiVersion
+ {
+ get;
+ }
+
+ ///
+ /// Gets the URI used as the base for all cloud service requests.
+ ///
+ Uri BaseUri
+ {
+ get;
+ }
+
+ ///
+ /// Credentials used to authenticate requests.
+ ///
+ CloudCredentials Credentials
+ {
+ get; set;
+ }
+
+ ///
+ /// Gets or sets the initial timeout for Long Running Operations.
+ ///
+ int LongRunningOperationInitialTimeout
+ {
+ get; set;
+ }
+
+ ///
+ /// Gets or sets the retry timeout for Long Running Operations.
+ ///
+ int LongRunningOperationRetryTimeout
+ {
+ get; set;
+ }
+
+ ///
+ /// Operations for managing subscriptions.
+ ///
+ ISubscriptionOperations Subscriptions
+ {
+ get;
+ }
+
+ ///
+ /// Operations for managing tenants.
+ ///
+ ITenantOperations Tenants
+ {
+ get;
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ISubscriptionOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ISubscriptionOperations.cs
new file mode 100644
index 000000000000..e5129917b1d8
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ISubscriptionOperations.cs
@@ -0,0 +1,72 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Internal.Subscriptions.Models;
+
+namespace Microsoft.Azure.Internal.Subscriptions
+{
+ ///
+ /// Operations for managing subscriptions.
+ ///
+ public partial interface ISubscriptionOperations
+ {
+ ///
+ /// Gets details about particular subscription.
+ ///
+ ///
+ /// Id of the subscription.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Subscription detailed information.
+ ///
+ Task GetAsync(string subscriptionId, CancellationToken cancellationToken);
+
+ ///
+ /// Gets a list of the subscriptionIds.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Subscription list operation response.
+ ///
+ Task ListAsync(CancellationToken cancellationToken);
+
+ ///
+ /// Gets a list of the subscription locations.
+ ///
+ ///
+ /// Id of the subscription
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Location list operation response.
+ ///
+ Task ListLocationsAsync(string subscriptionId, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ITagOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ITagOperations.cs
new file mode 100644
index 000000000000..dab46e41bc02
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ITagOperations.cs
@@ -0,0 +1,122 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing tags.
+ ///
+ public partial interface ITagOperations
+ {
+ ///
+ /// Create a subscription resource tag.
+ ///
+ ///
+ /// The name of the tag.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Tag information.
+ ///
+ Task CreateOrUpdateAsync(string tagName, CancellationToken cancellationToken);
+
+ ///
+ /// Create a subscription resource tag value.
+ ///
+ ///
+ /// The name of the tag.
+ ///
+ ///
+ /// The value of the tag.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Tag information.
+ ///
+ Task CreateOrUpdateValueAsync(string tagName, string tagValue, CancellationToken cancellationToken);
+
+ ///
+ /// Delete a subscription resource tag.
+ ///
+ ///
+ /// The name of the tag.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task DeleteAsync(string tagName, CancellationToken cancellationToken);
+
+ ///
+ /// Delete a subscription resource tag value.
+ ///
+ ///
+ /// The name of the tag.
+ ///
+ ///
+ /// The value of the tag.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ Task DeleteValueAsync(string tagName, string tagValue, CancellationToken cancellationToken);
+
+ ///
+ /// Get a list of subscription resource tags.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of subscription tags.
+ ///
+ Task ListAsync(CancellationToken cancellationToken);
+
+ ///
+ /// Get a list of tags under a subscription.
+ ///
+ ///
+ /// NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of subscription tags.
+ ///
+ Task ListNextAsync(string nextLink, CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ITenantOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ITenantOperations.cs
new file mode 100644
index 000000000000..4e647b594d33
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ITenantOperations.cs
@@ -0,0 +1,44 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Internal.Subscriptions.Models;
+
+namespace Microsoft.Azure.Internal.Subscriptions
+{
+ ///
+ /// Operations for managing tenants.
+ ///
+ public partial interface ITenantOperations
+ {
+ ///
+ /// Gets a list of the tenantIds.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Tenant Ids information.
+ ///
+ Task ListAsync(CancellationToken cancellationToken);
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ManagementLockOperations.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ManagementLockOperations.cs
new file mode 100644
index 000000000000..63900beea4ca
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ManagementLockOperations.cs
@@ -0,0 +1,2314 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using Hyak.Common;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+using Newtonsoft.Json.Linq;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ ///
+ /// Operations for managing locks.
+ ///
+ internal partial class ManagementLockOperations : IServiceOperations, IManagementLockOperations
+ {
+ ///
+ /// Initializes a new instance of the ManagementLockOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ internal ManagementLockOperations(AuthorizationClient client)
+ {
+ this._client = client;
+ }
+
+ private AuthorizationClient _client;
+
+ ///
+ /// Gets a reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.AuthorizationClient.
+ ///
+ public AuthorizationClient Client
+ {
+ get { return this._client; }
+ }
+
+ ///
+ /// Create or update a management lock at the resource group level.
+ ///
+ ///
+ /// Required. The resource group name.
+ ///
+ ///
+ /// Required. The lock name.
+ ///
+ ///
+ /// Required. The management lock parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public async Task CreateOrUpdateAtResourceGroupLevelAsync(string resourceGroupName, string lockName, ManagementLockProperties parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (lockName == null)
+ {
+ throw new ArgumentNullException("lockName");
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException("parameters");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("lockName", lockName);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "CreateOrUpdateAtResourceGroupLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourceGroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/providers/Microsoft.Authorization/locks/";
+ url = url + Uri.EscapeDataString(lockName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Put;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Serialize Request
+ string requestContent = null;
+ JToken requestDoc = null;
+
+ JObject propertiesValue = new JObject();
+ requestDoc = propertiesValue;
+
+ if (parameters.Level != null)
+ {
+ propertiesValue["level"] = parameters.Level;
+ }
+
+ if (parameters.Notes != null)
+ {
+ propertiesValue["notes"] = parameters.Notes;
+ }
+
+ requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented);
+ httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
+ httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Created)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ ManagementLockReturnResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Created)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new ManagementLockReturnResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ ManagementLockObject managementLockInstance = new ManagementLockObject();
+ result.ManagementLock = managementLockInstance;
+
+ JToken propertiesValue2 = responseDoc["properties"];
+ if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null)
+ {
+ ManagementLockProperties propertiesInstance = new ManagementLockProperties();
+ managementLockInstance.Properties = propertiesInstance;
+
+ JToken levelValue = propertiesValue2["level"];
+ if (levelValue != null && levelValue.Type != JTokenType.Null)
+ {
+ string levelInstance = ((string)levelValue);
+ propertiesInstance.Level = levelInstance;
+ }
+
+ JToken notesValue = propertiesValue2["notes"];
+ if (notesValue != null && notesValue.Type != JTokenType.Null)
+ {
+ string notesInstance = ((string)notesValue);
+ propertiesInstance.Notes = notesInstance;
+ }
+ }
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ managementLockInstance.Id = idInstance;
+ }
+
+ JToken typeValue = responseDoc["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ managementLockInstance.Type = typeInstance;
+ }
+
+ JToken nameValue = responseDoc["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ managementLockInstance.Name = nameInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Create or update a management lock at the resource level or any
+ /// level below resource.
+ ///
+ ///
+ /// Required. The name of the resource group.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Required. Create or update management lock parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public async Task CreateOrUpdateAtResourceLevelAsync(string resourceGroupName, ResourceIdentity identity, string lockName, ManagementLockProperties parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (identity == null)
+ {
+ throw new ArgumentNullException("identity");
+ }
+ if (identity.ResourceName == null)
+ {
+ throw new ArgumentNullException("identity.ResourceName");
+ }
+ if (identity.ResourceProviderApiVersion == null)
+ {
+ throw new ArgumentNullException("identity.ResourceProviderApiVersion");
+ }
+ if (identity.ResourceProviderNamespace == null)
+ {
+ throw new ArgumentNullException("identity.ResourceProviderNamespace");
+ }
+ if (identity.ResourceType == null)
+ {
+ throw new ArgumentNullException("identity.ResourceType");
+ }
+ if (lockName == null)
+ {
+ throw new ArgumentNullException("lockName");
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException("parameters");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("identity", identity);
+ tracingParameters.Add("lockName", lockName);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "CreateOrUpdateAtResourceLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/providers/";
+ url = url + Uri.EscapeDataString(identity.ResourceProviderNamespace);
+ url = url + "/";
+ if (identity.ParentResourcePath != null)
+ {
+ url = url + identity.ParentResourcePath;
+ }
+ url = url + "/";
+ url = url + identity.ResourceType;
+ url = url + "/";
+ url = url + Uri.EscapeDataString(identity.ResourceName);
+ url = url + "/providers/Microsoft.Authorization/locks/";
+ url = url + Uri.EscapeDataString(lockName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Put;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Serialize Request
+ string requestContent = null;
+ JToken requestDoc = null;
+
+ JObject propertiesValue = new JObject();
+ requestDoc = propertiesValue;
+
+ if (parameters.Level != null)
+ {
+ propertiesValue["level"] = parameters.Level;
+ }
+
+ if (parameters.Notes != null)
+ {
+ propertiesValue["notes"] = parameters.Notes;
+ }
+
+ requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented);
+ httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
+ httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Created)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ ManagementLockReturnResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Created)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new ManagementLockReturnResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ ManagementLockObject managementLockInstance = new ManagementLockObject();
+ result.ManagementLock = managementLockInstance;
+
+ JToken propertiesValue2 = responseDoc["properties"];
+ if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null)
+ {
+ ManagementLockProperties propertiesInstance = new ManagementLockProperties();
+ managementLockInstance.Properties = propertiesInstance;
+
+ JToken levelValue = propertiesValue2["level"];
+ if (levelValue != null && levelValue.Type != JTokenType.Null)
+ {
+ string levelInstance = ((string)levelValue);
+ propertiesInstance.Level = levelInstance;
+ }
+
+ JToken notesValue = propertiesValue2["notes"];
+ if (notesValue != null && notesValue.Type != JTokenType.Null)
+ {
+ string notesInstance = ((string)notesValue);
+ propertiesInstance.Notes = notesInstance;
+ }
+ }
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ managementLockInstance.Id = idInstance;
+ }
+
+ JToken typeValue = responseDoc["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ managementLockInstance.Type = typeInstance;
+ }
+
+ JToken nameValue = responseDoc["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ managementLockInstance.Name = nameInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Create or update a management lock at the subscription level.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Required. The management lock parameters.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public async Task CreateOrUpdateAtSubscriptionLevelAsync(string lockName, ManagementLockProperties parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (lockName == null)
+ {
+ throw new ArgumentNullException("lockName");
+ }
+ if (parameters == null)
+ {
+ throw new ArgumentNullException("parameters");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("lockName", lockName);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "CreateOrUpdateAtSubscriptionLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/providers/Microsoft.Authorization/locks/";
+ url = url + Uri.EscapeDataString(lockName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Put;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Serialize Request
+ string requestContent = null;
+ JToken requestDoc = null;
+
+ JObject propertiesValue = new JObject();
+ requestDoc = propertiesValue;
+
+ if (parameters.Level != null)
+ {
+ propertiesValue["level"] = parameters.Level;
+ }
+
+ if (parameters.Notes != null)
+ {
+ propertiesValue["notes"] = parameters.Notes;
+ }
+
+ requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented);
+ httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
+ httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Created)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, requestContent, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ ManagementLockReturnResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.Created)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new ManagementLockReturnResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ ManagementLockObject managementLockInstance = new ManagementLockObject();
+ result.ManagementLock = managementLockInstance;
+
+ JToken propertiesValue2 = responseDoc["properties"];
+ if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null)
+ {
+ ManagementLockProperties propertiesInstance = new ManagementLockProperties();
+ managementLockInstance.Properties = propertiesInstance;
+
+ JToken levelValue = propertiesValue2["level"];
+ if (levelValue != null && levelValue.Type != JTokenType.Null)
+ {
+ string levelInstance = ((string)levelValue);
+ propertiesInstance.Level = levelInstance;
+ }
+
+ JToken notesValue = propertiesValue2["notes"];
+ if (notesValue != null && notesValue.Type != JTokenType.Null)
+ {
+ string notesInstance = ((string)notesValue);
+ propertiesInstance.Notes = notesInstance;
+ }
+ }
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ managementLockInstance.Id = idInstance;
+ }
+
+ JToken typeValue = responseDoc["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ managementLockInstance.Type = typeInstance;
+ }
+
+ JToken nameValue = responseDoc["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ managementLockInstance.Name = nameInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Deletes the management lock of a resource group.
+ ///
+ ///
+ /// Required. The resource group names.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public async Task DeleteAtResourceGroupLevelAsync(string resourceGroup, string lockName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroup == null)
+ {
+ throw new ArgumentNullException("resourceGroup");
+ }
+ if (lockName == null)
+ {
+ throw new ArgumentNullException("lockName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroup", resourceGroup);
+ tracingParameters.Add("lockName", lockName);
+ TracingAdapter.Enter(invocationId, this, "DeleteAtResourceGroupLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourceGroups/";
+ url = url + Uri.EscapeDataString(resourceGroup);
+ url = url + "/providers/Microsoft.Authorization/locks/";
+ url = url + Uri.EscapeDataString(lockName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Delete;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Accepted && statusCode != HttpStatusCode.NoContent)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ AzureOperationResponse result = null;
+ // Deserialize Response
+ result = new AzureOperationResponse();
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Deletes the management lock of a resource or any level below
+ /// resource.
+ ///
+ ///
+ /// Required. The name of the resource group.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public async Task DeleteAtResourceLevelAsync(string resourceGroupName, ResourceIdentity identity, string lockName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (identity == null)
+ {
+ throw new ArgumentNullException("identity");
+ }
+ if (identity.ResourceName == null)
+ {
+ throw new ArgumentNullException("identity.ResourceName");
+ }
+ if (identity.ResourceProviderApiVersion == null)
+ {
+ throw new ArgumentNullException("identity.ResourceProviderApiVersion");
+ }
+ if (identity.ResourceProviderNamespace == null)
+ {
+ throw new ArgumentNullException("identity.ResourceProviderNamespace");
+ }
+ if (identity.ResourceType == null)
+ {
+ throw new ArgumentNullException("identity.ResourceType");
+ }
+ if (lockName == null)
+ {
+ throw new ArgumentNullException("lockName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("identity", identity);
+ tracingParameters.Add("lockName", lockName);
+ TracingAdapter.Enter(invocationId, this, "DeleteAtResourceLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/providers/";
+ url = url + Uri.EscapeDataString(identity.ResourceProviderNamespace);
+ url = url + "/";
+ if (identity.ParentResourcePath != null)
+ {
+ url = url + identity.ParentResourcePath;
+ }
+ url = url + "/";
+ url = url + identity.ResourceType;
+ url = url + "/";
+ url = url + Uri.EscapeDataString(identity.ResourceName);
+ url = url + "/providers/Microsoft.Authorization/locks/";
+ url = url + Uri.EscapeDataString(lockName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Delete;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Accepted && statusCode != HttpStatusCode.NoContent)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ AzureOperationResponse result = null;
+ // Deserialize Response
+ result = new AzureOperationResponse();
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Deletes the management lock of a subscription.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public async Task DeleteAtSubscriptionLevelAsync(string lockName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (lockName == null)
+ {
+ throw new ArgumentNullException("lockName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("lockName", lockName);
+ TracingAdapter.Enter(invocationId, this, "DeleteAtSubscriptionLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/providers/Microsoft.Authorization/locks/";
+ url = url + Uri.EscapeDataString(lockName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Delete;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.Accepted && statusCode != HttpStatusCode.NoContent)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ AzureOperationResponse result = null;
+ // Deserialize Response
+ result = new AzureOperationResponse();
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets the management lock of a scope.
+ ///
+ ///
+ /// Required. Name of the management lock.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public async Task GetAsync(string lockName, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (lockName == null)
+ {
+ throw new ArgumentNullException("lockName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("lockName", lockName);
+ TracingAdapter.Enter(invocationId, this, "GetAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/providers/Microsoft.Authorization/locks/";
+ url = url + Uri.EscapeDataString(lockName);
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK && statusCode != HttpStatusCode.NoContent)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ ManagementLockReturnResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK || statusCode == HttpStatusCode.NoContent)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new ManagementLockReturnResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ ManagementLockObject managementLockInstance = new ManagementLockObject();
+ result.ManagementLock = managementLockInstance;
+
+ JToken propertiesValue = responseDoc["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ ManagementLockProperties propertiesInstance = new ManagementLockProperties();
+ managementLockInstance.Properties = propertiesInstance;
+
+ JToken levelValue = propertiesValue["level"];
+ if (levelValue != null && levelValue.Type != JTokenType.Null)
+ {
+ string levelInstance = ((string)levelValue);
+ propertiesInstance.Level = levelInstance;
+ }
+
+ JToken notesValue = propertiesValue["notes"];
+ if (notesValue != null && notesValue.Type != JTokenType.Null)
+ {
+ string notesInstance = ((string)notesValue);
+ propertiesInstance.Notes = notesInstance;
+ }
+ }
+
+ JToken idValue = responseDoc["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ managementLockInstance.Id = idInstance;
+ }
+
+ JToken typeValue = responseDoc["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ managementLockInstance.Type = typeInstance;
+ }
+
+ JToken nameValue = responseDoc["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ managementLockInstance.Name = nameInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets all the management locks of a resource group.
+ ///
+ ///
+ /// Required. Resource group name.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks
+ /// at, above or below the resource group.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public async Task ListAtResourceGroupLevelAsync(string resourceGroupName, ManagementLockGetQueryParameter parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "ListAtResourceGroupLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourceGroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/providers/Microsoft.Authorization/locks";
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ List odataFilter = new List();
+ if (parameters != null && parameters.AtScope != null)
+ {
+ odataFilter.Add(Uri.EscapeDataString(parameters.AtScope));
+ }
+ if (odataFilter.Count > 0)
+ {
+ queryParameters.Add("$filter=" + string.Join(null, odataFilter));
+ }
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ ManagementLockListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new ManagementLockListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ ManagementLockObject managementLockObjectInstance = new ManagementLockObject();
+ result.Lock.Add(managementLockObjectInstance);
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ ManagementLockProperties propertiesInstance = new ManagementLockProperties();
+ managementLockObjectInstance.Properties = propertiesInstance;
+
+ JToken levelValue = propertiesValue["level"];
+ if (levelValue != null && levelValue.Type != JTokenType.Null)
+ {
+ string levelInstance = ((string)levelValue);
+ propertiesInstance.Level = levelInstance;
+ }
+
+ JToken notesValue = propertiesValue["notes"];
+ if (notesValue != null && notesValue.Type != JTokenType.Null)
+ {
+ string notesInstance = ((string)notesValue);
+ propertiesInstance.Notes = notesInstance;
+ }
+ }
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ managementLockObjectInstance.Id = idInstance;
+ }
+
+ JToken typeValue = valueValue["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ managementLockObjectInstance.Type = typeInstance;
+ }
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ managementLockObjectInstance.Name = nameInstance;
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets all the management locks of a resource or any level below
+ /// resource.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks at
+ /// or below the resource.If atScope() is passed returns all locks at
+ /// the resource level.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public async Task ListAtResourceLevelAsync(string resourceGroupName, ResourceIdentity identity, ManagementLockGetQueryParameter parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (resourceGroupName == null)
+ {
+ throw new ArgumentNullException("resourceGroupName");
+ }
+ if (resourceGroupName != null && resourceGroupName.Length > 1000)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (Regex.IsMatch(resourceGroupName, "^[-\\w\\._]+$") == false)
+ {
+ throw new ArgumentOutOfRangeException("resourceGroupName");
+ }
+ if (identity == null)
+ {
+ throw new ArgumentNullException("identity");
+ }
+ if (identity.ResourceName == null)
+ {
+ throw new ArgumentNullException("identity.ResourceName");
+ }
+ if (identity.ResourceProviderApiVersion == null)
+ {
+ throw new ArgumentNullException("identity.ResourceProviderApiVersion");
+ }
+ if (identity.ResourceProviderNamespace == null)
+ {
+ throw new ArgumentNullException("identity.ResourceProviderNamespace");
+ }
+ if (identity.ResourceType == null)
+ {
+ throw new ArgumentNullException("identity.ResourceType");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("identity", identity);
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "ListAtResourceLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/resourcegroups/";
+ url = url + Uri.EscapeDataString(resourceGroupName);
+ url = url + "/providers/";
+ url = url + Uri.EscapeDataString(identity.ResourceProviderNamespace);
+ url = url + "/";
+ if (identity.ParentResourcePath != null)
+ {
+ url = url + identity.ParentResourcePath;
+ }
+ url = url + "/";
+ url = url + identity.ResourceType;
+ url = url + "/";
+ url = url + Uri.EscapeDataString(identity.ResourceName);
+ url = url + "/providers/Microsoft.Authorization/locks";
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ List odataFilter = new List();
+ if (parameters != null && parameters.AtScope != null)
+ {
+ odataFilter.Add(Uri.EscapeDataString(parameters.AtScope));
+ }
+ if (odataFilter.Count > 0)
+ {
+ queryParameters.Add("$filter=" + string.Join(null, odataFilter));
+ }
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ ManagementLockListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new ManagementLockListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ ManagementLockObject managementLockObjectInstance = new ManagementLockObject();
+ result.Lock.Add(managementLockObjectInstance);
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ ManagementLockProperties propertiesInstance = new ManagementLockProperties();
+ managementLockObjectInstance.Properties = propertiesInstance;
+
+ JToken levelValue = propertiesValue["level"];
+ if (levelValue != null && levelValue.Type != JTokenType.Null)
+ {
+ string levelInstance = ((string)levelValue);
+ propertiesInstance.Level = levelInstance;
+ }
+
+ JToken notesValue = propertiesValue["notes"];
+ if (notesValue != null && notesValue.Type != JTokenType.Null)
+ {
+ string notesInstance = ((string)notesValue);
+ propertiesInstance.Notes = notesInstance;
+ }
+ }
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ managementLockObjectInstance.Id = idInstance;
+ }
+
+ JToken typeValue = valueValue["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ managementLockObjectInstance.Type = typeInstance;
+ }
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ managementLockObjectInstance.Name = nameInstance;
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Gets all the management locks of a subscription.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks
+ /// at, above or below the subscription.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public async Task ListAtSubscriptionLevelAsync(ManagementLockGetQueryParameter parameters, CancellationToken cancellationToken)
+ {
+ // Validate
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("parameters", parameters);
+ TracingAdapter.Enter(invocationId, this, "ListAtSubscriptionLevelAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + "/subscriptions/";
+ if (this.Client.Credentials.SubscriptionId != null)
+ {
+ url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
+ }
+ url = url + "/providers/Microsoft.Authorization/locks";
+ List queryParameters = new List();
+ queryParameters.Add("api-version=2015-01-01");
+ List odataFilter = new List();
+ if (parameters != null && parameters.AtScope != null)
+ {
+ odataFilter.Add(Uri.EscapeDataString(parameters.AtScope));
+ }
+ if (odataFilter.Count > 0)
+ {
+ queryParameters.Add("$filter=" + string.Join(null, odataFilter));
+ }
+ if (queryParameters.Count > 0)
+ {
+ url = url + "?" + string.Join("&", queryParameters);
+ }
+ string baseUrl = this.Client.BaseUri.AbsoluteUri;
+ // Trim '/' character from the end of baseUrl and beginning of url.
+ if (baseUrl[baseUrl.Length - 1] == '/')
+ {
+ baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
+ }
+ if (url[0] == '/')
+ {
+ url = url.Substring(1);
+ }
+ url = baseUrl + "/" + url;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ ManagementLockListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new ManagementLockListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ ManagementLockObject managementLockObjectInstance = new ManagementLockObject();
+ result.Lock.Add(managementLockObjectInstance);
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ ManagementLockProperties propertiesInstance = new ManagementLockProperties();
+ managementLockObjectInstance.Properties = propertiesInstance;
+
+ JToken levelValue = propertiesValue["level"];
+ if (levelValue != null && levelValue.Type != JTokenType.Null)
+ {
+ string levelInstance = ((string)levelValue);
+ propertiesInstance.Level = levelInstance;
+ }
+
+ JToken notesValue = propertiesValue["notes"];
+ if (notesValue != null && notesValue.Type != JTokenType.Null)
+ {
+ string notesInstance = ((string)notesValue);
+ propertiesInstance.Notes = notesInstance;
+ }
+ }
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ managementLockObjectInstance.Id = idInstance;
+ }
+
+ JToken typeValue = valueValue["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ managementLockObjectInstance.Type = typeInstance;
+ }
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ managementLockObjectInstance.Name = nameInstance;
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+
+ ///
+ /// Get a list of management locks at resource level or below.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// Cancellation token.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public async Task ListNextAsync(string nextLink, CancellationToken cancellationToken)
+ {
+ // Validate
+ if (nextLink == null)
+ {
+ throw new ArgumentNullException("nextLink");
+ }
+
+ // Tracing
+ bool shouldTrace = TracingAdapter.IsEnabled;
+ string invocationId = null;
+ if (shouldTrace)
+ {
+ invocationId = TracingAdapter.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextLink", nextLink);
+ TracingAdapter.Enter(invocationId, this, "ListNextAsync", tracingParameters);
+ }
+
+ // Construct URL
+ string url = "";
+ url = url + nextLink;
+ url = url.Replace(" ", "%20");
+
+ // Create HTTP transport objects
+ HttpRequestMessage httpRequest = null;
+ try
+ {
+ httpRequest = new HttpRequestMessage();
+ httpRequest.Method = HttpMethod.Get;
+ httpRequest.RequestUri = new Uri(url);
+
+ // Set Headers
+
+ // Set Credentials
+ cancellationToken.ThrowIfCancellationRequested();
+ await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+
+ // Send Request
+ HttpResponseMessage httpResponse = null;
+ try
+ {
+ if (shouldTrace)
+ {
+ TracingAdapter.SendRequest(invocationId, httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
+ if (shouldTrace)
+ {
+ TracingAdapter.ReceiveResponse(invocationId, httpResponse);
+ }
+ HttpStatusCode statusCode = httpResponse.StatusCode;
+ if (statusCode != HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
+ if (shouldTrace)
+ {
+ TracingAdapter.Error(invocationId, ex);
+ }
+ throw ex;
+ }
+
+ // Create Result
+ ManagementLockListResult result = null;
+ // Deserialize Response
+ if (statusCode == HttpStatusCode.OK)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ result = new ManagementLockListResult();
+ JToken responseDoc = null;
+ if (string.IsNullOrEmpty(responseContent) == false)
+ {
+ responseDoc = JToken.Parse(responseContent);
+ }
+
+ if (responseDoc != null && responseDoc.Type != JTokenType.Null)
+ {
+ JToken valueArray = responseDoc["value"];
+ if (valueArray != null && valueArray.Type != JTokenType.Null)
+ {
+ foreach (JToken valueValue in ((JArray)valueArray))
+ {
+ ManagementLockObject managementLockObjectInstance = new ManagementLockObject();
+ result.Lock.Add(managementLockObjectInstance);
+
+ JToken propertiesValue = valueValue["properties"];
+ if (propertiesValue != null && propertiesValue.Type != JTokenType.Null)
+ {
+ ManagementLockProperties propertiesInstance = new ManagementLockProperties();
+ managementLockObjectInstance.Properties = propertiesInstance;
+
+ JToken levelValue = propertiesValue["level"];
+ if (levelValue != null && levelValue.Type != JTokenType.Null)
+ {
+ string levelInstance = ((string)levelValue);
+ propertiesInstance.Level = levelInstance;
+ }
+
+ JToken notesValue = propertiesValue["notes"];
+ if (notesValue != null && notesValue.Type != JTokenType.Null)
+ {
+ string notesInstance = ((string)notesValue);
+ propertiesInstance.Notes = notesInstance;
+ }
+ }
+
+ JToken idValue = valueValue["id"];
+ if (idValue != null && idValue.Type != JTokenType.Null)
+ {
+ string idInstance = ((string)idValue);
+ managementLockObjectInstance.Id = idInstance;
+ }
+
+ JToken typeValue = valueValue["type"];
+ if (typeValue != null && typeValue.Type != JTokenType.Null)
+ {
+ string typeInstance = ((string)typeValue);
+ managementLockObjectInstance.Type = typeInstance;
+ }
+
+ JToken nameValue = valueValue["name"];
+ if (nameValue != null && nameValue.Type != JTokenType.Null)
+ {
+ string nameInstance = ((string)nameValue);
+ managementLockObjectInstance.Name = nameInstance;
+ }
+ }
+ }
+
+ JToken nextLinkValue = responseDoc["nextLink"];
+ if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null)
+ {
+ string nextLinkInstance = ((string)nextLinkValue);
+ result.NextLink = nextLinkInstance;
+ }
+ }
+
+ }
+ result.StatusCode = statusCode;
+ if (httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+
+ if (shouldTrace)
+ {
+ TracingAdapter.Exit(invocationId, result);
+ }
+ return result;
+ }
+ finally
+ {
+ if (httpResponse != null)
+ {
+ httpResponse.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ if (httpRequest != null)
+ {
+ httpRequest.Dispose();
+ }
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ManagementLockOperationsExtensions.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ManagementLockOperationsExtensions.cs
new file mode 100644
index 000000000000..823618a7ef6a
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/ManagementLockOperationsExtensions.cs
@@ -0,0 +1,566 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Azure.Management.Internal.Resources.Models;
+
+namespace Microsoft.Azure.Management.Internal.Resources
+{
+ public static partial class ManagementLockOperationsExtensions
+ {
+ ///
+ /// Create or update a management lock at the resource group level.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The resource group name.
+ ///
+ ///
+ /// Required. The lock name.
+ ///
+ ///
+ /// Required. The management lock parameters.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public static ManagementLockReturnResult CreateOrUpdateAtResourceGroupLevel(this IManagementLockOperations operations, string resourceGroupName, string lockName, ManagementLockProperties parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).CreateOrUpdateAtResourceGroupLevelAsync(resourceGroupName, lockName, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create or update a management lock at the resource group level.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The resource group name.
+ ///
+ ///
+ /// Required. The lock name.
+ ///
+ ///
+ /// Required. The management lock parameters.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public static Task CreateOrUpdateAtResourceGroupLevelAsync(this IManagementLockOperations operations, string resourceGroupName, string lockName, ManagementLockProperties parameters)
+ {
+ return operations.CreateOrUpdateAtResourceGroupLevelAsync(resourceGroupName, lockName, parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Create or update a management lock at the resource level or any
+ /// level below resource.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of the resource group.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Required. Create or update management lock parameters.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public static ManagementLockReturnResult CreateOrUpdateAtResourceLevel(this IManagementLockOperations operations, string resourceGroupName, ResourceIdentity identity, string lockName, ManagementLockProperties parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).CreateOrUpdateAtResourceLevelAsync(resourceGroupName, identity, lockName, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create or update a management lock at the resource level or any
+ /// level below resource.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of the resource group.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Required. Create or update management lock parameters.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public static Task CreateOrUpdateAtResourceLevelAsync(this IManagementLockOperations operations, string resourceGroupName, ResourceIdentity identity, string lockName, ManagementLockProperties parameters)
+ {
+ return operations.CreateOrUpdateAtResourceLevelAsync(resourceGroupName, identity, lockName, parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Create or update a management lock at the subscription level.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Required. The management lock parameters.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public static ManagementLockReturnResult CreateOrUpdateAtSubscriptionLevel(this IManagementLockOperations operations, string lockName, ManagementLockProperties parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).CreateOrUpdateAtSubscriptionLevelAsync(lockName, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Create or update a management lock at the subscription level.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// Required. The management lock parameters.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public static Task CreateOrUpdateAtSubscriptionLevelAsync(this IManagementLockOperations operations, string lockName, ManagementLockProperties parameters)
+ {
+ return operations.CreateOrUpdateAtSubscriptionLevelAsync(lockName, parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Deletes the management lock of a resource group.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The resource group names.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static AzureOperationResponse DeleteAtResourceGroupLevel(this IManagementLockOperations operations, string resourceGroup, string lockName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).DeleteAtResourceGroupLevelAsync(resourceGroup, lockName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Deletes the management lock of a resource group.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The resource group names.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static Task DeleteAtResourceGroupLevelAsync(this IManagementLockOperations operations, string resourceGroup, string lockName)
+ {
+ return operations.DeleteAtResourceGroupLevelAsync(resourceGroup, lockName, CancellationToken.None);
+ }
+
+ ///
+ /// Deletes the management lock of a resource or any level below
+ /// resource.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of the resource group.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static AzureOperationResponse DeleteAtResourceLevel(this IManagementLockOperations operations, string resourceGroupName, ResourceIdentity identity, string lockName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).DeleteAtResourceLevelAsync(resourceGroupName, identity, lockName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Deletes the management lock of a resource or any level below
+ /// resource.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of the resource group.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static Task DeleteAtResourceLevelAsync(this IManagementLockOperations operations, string resourceGroupName, ResourceIdentity identity, string lockName)
+ {
+ return operations.DeleteAtResourceLevelAsync(resourceGroupName, identity, lockName, CancellationToken.None);
+ }
+
+ ///
+ /// Deletes the management lock of a subscription.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static AzureOperationResponse DeleteAtSubscriptionLevel(this IManagementLockOperations operations, string lockName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).DeleteAtSubscriptionLevelAsync(lockName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Deletes the management lock of a subscription.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of lock.
+ ///
+ ///
+ /// A standard service response including an HTTP status code and
+ /// request ID.
+ ///
+ public static Task DeleteAtSubscriptionLevelAsync(this IManagementLockOperations operations, string lockName)
+ {
+ return operations.DeleteAtSubscriptionLevelAsync(lockName, CancellationToken.None);
+ }
+
+ ///
+ /// Gets the management lock of a scope.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. Name of the management lock.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public static ManagementLockReturnResult Get(this IManagementLockOperations operations, string lockName)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).GetAsync(lockName);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the management lock of a scope.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. Name of the management lock.
+ ///
+ ///
+ /// Management lock information.
+ ///
+ public static Task GetAsync(this IManagementLockOperations operations, string lockName)
+ {
+ return operations.GetAsync(lockName, CancellationToken.None);
+ }
+
+ ///
+ /// Gets all the management locks of a resource group.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. Resource group name.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks
+ /// at, above or below the resource group.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public static ManagementLockListResult ListAtResourceGroupLevel(this IManagementLockOperations operations, string resourceGroupName, ManagementLockGetQueryParameter parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).ListAtResourceGroupLevelAsync(resourceGroupName, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all the management locks of a resource group.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. Resource group name.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks
+ /// at, above or below the resource group.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public static Task ListAtResourceGroupLevelAsync(this IManagementLockOperations operations, string resourceGroupName, ManagementLockGetQueryParameter parameters)
+ {
+ return operations.ListAtResourceGroupLevelAsync(resourceGroupName, parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Gets all the management locks of a resource or any level below
+ /// resource.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks at
+ /// or below the resource.If atScope() is passed returns all locks at
+ /// the resource level.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public static ManagementLockListResult ListAtResourceLevel(this IManagementLockOperations operations, string resourceGroupName, ResourceIdentity identity, ManagementLockGetQueryParameter parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).ListAtResourceLevelAsync(resourceGroupName, identity, parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all the management locks of a resource or any level below
+ /// resource.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. The name of the resource group. The name is case
+ /// insensitive.
+ ///
+ ///
+ /// Required. Resource identity.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks at
+ /// or below the resource.If atScope() is passed returns all locks at
+ /// the resource level.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public static Task ListAtResourceLevelAsync(this IManagementLockOperations operations, string resourceGroupName, ResourceIdentity identity, ManagementLockGetQueryParameter parameters)
+ {
+ return operations.ListAtResourceLevelAsync(resourceGroupName, identity, parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Gets all the management locks of a subscription.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks
+ /// at, above or below the subscription.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public static ManagementLockListResult ListAtSubscriptionLevel(this IManagementLockOperations operations, ManagementLockGetQueryParameter parameters)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).ListAtSubscriptionLevelAsync(parameters);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all the management locks of a subscription.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Optional. Query parameters. If empty is passed returns all locks
+ /// at, above or below the subscription.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public static Task ListAtSubscriptionLevelAsync(this IManagementLockOperations operations, ManagementLockGetQueryParameter parameters)
+ {
+ return operations.ListAtSubscriptionLevelAsync(parameters, CancellationToken.None);
+ }
+
+ ///
+ /// Get a list of management locks at resource level or below.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public static ManagementLockListResult ListNext(this IManagementLockOperations operations, string nextLink)
+ {
+ return Task.Factory.StartNew((object s) =>
+ {
+ return ((IManagementLockOperations)s).ListNextAsync(nextLink);
+ }
+ , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get a list of management locks at resource level or below.
+ ///
+ ///
+ /// Reference to the
+ /// Microsoft.Azure.Management.Internal.Resources.IManagementLockOperations.
+ ///
+ ///
+ /// Required. NextLink from the previous successful call to List
+ /// operation.
+ ///
+ ///
+ /// List of management locks.
+ ///
+ public static Task ListNextAsync(this IManagementLockOperations operations, string nextLink)
+ {
+ return operations.ListNextAsync(nextLink, CancellationToken.None);
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/BasicDependency.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/BasicDependency.cs
new file mode 100644
index 000000000000..9cff5f4e86f6
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/BasicDependency.cs
@@ -0,0 +1,70 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+
+namespace Microsoft.Azure.Management.Internal.Resources.Models
+{
+ ///
+ /// Deployment dependency information.
+ ///
+ public partial class BasicDependency
+ {
+ private string _id;
+
+ ///
+ /// Optional. Gets or sets the ID of the dependency.
+ ///
+ public string Id
+ {
+ get { return this._id; }
+ set { this._id = value; }
+ }
+
+ private string _resourceName;
+
+ ///
+ /// Optional. Gets or sets the dependency resource name.
+ ///
+ public string ResourceName
+ {
+ get { return this._resourceName; }
+ set { this._resourceName = value; }
+ }
+
+ private string _resourceType;
+
+ ///
+ /// Optional. Gets or sets the dependency resource type.
+ ///
+ public string ResourceType
+ {
+ get { return this._resourceType; }
+ set { this._resourceType = value; }
+ }
+
+ ///
+ /// Initializes a new instance of the BasicDependency class.
+ ///
+ public BasicDependency()
+ {
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/Dependency.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/Dependency.cs
new file mode 100644
index 000000000000..bed498b657c9
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/Dependency.cs
@@ -0,0 +1,51 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Collections.Generic;
+using Hyak.Common;
+
+namespace Microsoft.Azure.Management.Internal.Resources.Models
+{
+ ///
+ /// Deployment dependency information.
+ ///
+ public partial class Dependency : BasicDependency
+ {
+ private IList _dependsOn;
+
+ ///
+ /// Optional. Gets the list of dependencies.
+ ///
+ public IList DependsOn
+ {
+ get { return this._dependsOn; }
+ set { this._dependsOn = value; }
+ }
+
+ ///
+ /// Initializes a new instance of the Dependency class.
+ ///
+ public Dependency()
+ {
+ this.DependsOn = new LazyList();
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/Deployment.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/Deployment.cs
new file mode 100644
index 000000000000..a2e4f7add496
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/Deployment.cs
@@ -0,0 +1,48 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+
+namespace Microsoft.Azure.Management.Internal.Resources.Models
+{
+ ///
+ /// Deployment operation parameters.
+ ///
+ public partial class Deployment
+ {
+ private DeploymentProperties _properties;
+
+ ///
+ /// Optional. Gets or sets the deployment properties.
+ ///
+ public DeploymentProperties Properties
+ {
+ get { return this._properties; }
+ set { this._properties = value; }
+ }
+
+ ///
+ /// Initializes a new instance of the Deployment class.
+ ///
+ public Deployment()
+ {
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentExistsResult.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentExistsResult.cs
new file mode 100644
index 000000000000..5606c62c5efb
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentExistsResult.cs
@@ -0,0 +1,49 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+
+namespace Microsoft.Azure.Management.Internal.Resources.Models
+{
+ ///
+ /// Deployment information.
+ ///
+ public partial class DeploymentExistsResult : AzureOperationResponse
+ {
+ private bool _exists;
+
+ ///
+ /// Optional. Gets or sets the value indicating whether the deployment
+ /// exists.
+ ///
+ public bool Exists
+ {
+ get { return this._exists; }
+ set { this._exists = value; }
+ }
+
+ ///
+ /// Initializes a new instance of the DeploymentExistsResult class.
+ ///
+ public DeploymentExistsResult()
+ {
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentExtended.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentExtended.cs
new file mode 100644
index 000000000000..1fd6d6eff509
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentExtended.cs
@@ -0,0 +1,85 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System;
+
+namespace Microsoft.Azure.Management.Internal.Resources.Models
+{
+ ///
+ /// Deployment information.
+ ///
+ public partial class DeploymentExtended
+ {
+ private string _id;
+
+ ///
+ /// Optional. Gets or sets the ID of the deployment.
+ ///
+ public string Id
+ {
+ get { return this._id; }
+ set { this._id = value; }
+ }
+
+ private string _name;
+
+ ///
+ /// Required. Gets or sets the name of the deployment.
+ ///
+ public string Name
+ {
+ get { return this._name; }
+ set { this._name = value; }
+ }
+
+ private DeploymentPropertiesExtended _properties;
+
+ ///
+ /// Optional. Gets or sets deployment properties.
+ ///
+ public DeploymentPropertiesExtended Properties
+ {
+ get { return this._properties; }
+ set { this._properties = value; }
+ }
+
+ ///
+ /// Initializes a new instance of the DeploymentExtended class.
+ ///
+ public DeploymentExtended()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the DeploymentExtended class with
+ /// required arguments.
+ ///
+ public DeploymentExtended(string name)
+ : this()
+ {
+ if (name == null)
+ {
+ throw new ArgumentNullException("name");
+ }
+ this.Name = name;
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentGetResult.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentGetResult.cs
new file mode 100644
index 000000000000..84c68e17ea05
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentGetResult.cs
@@ -0,0 +1,48 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+
+namespace Microsoft.Azure.Management.Internal.Resources.Models
+{
+ ///
+ /// Template deployment information.
+ ///
+ public partial class DeploymentGetResult : AzureOperationResponse
+ {
+ private DeploymentExtended _deployment;
+
+ ///
+ /// Optional. Gets or sets the deployment.
+ ///
+ public DeploymentExtended Deployment
+ {
+ get { return this._deployment; }
+ set { this._deployment = value; }
+ }
+
+ ///
+ /// Initializes a new instance of the DeploymentGetResult class.
+ ///
+ public DeploymentGetResult()
+ {
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentListParameters.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentListParameters.cs
new file mode 100644
index 000000000000..589f2f9d0891
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentListParameters.cs
@@ -0,0 +1,59 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+
+namespace Microsoft.Azure.Management.Internal.Resources.Models
+{
+ ///
+ /// Deployment list operation parameters.
+ ///
+ public partial class DeploymentListParameters
+ {
+ private string _provisioningState;
+
+ ///
+ /// Optional. Get or sets the provisioning state to filer by. Optional.
+ ///
+ public string ProvisioningState
+ {
+ get { return this._provisioningState; }
+ set { this._provisioningState = value; }
+ }
+
+ private int? _top;
+
+ ///
+ /// Optional. Get or sets the number of records to return. Optional.
+ ///
+ public int? Top
+ {
+ get { return this._top; }
+ set { this._top = value; }
+ }
+
+ ///
+ /// Initializes a new instance of the DeploymentListParameters class.
+ ///
+ public DeploymentListParameters()
+ {
+ }
+ }
+}
diff --git a/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentListResult.cs b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentListResult.cs
new file mode 100644
index 000000000000..f67c72aead71
--- /dev/null
+++ b/src/ResourceManager/Common/Commands.ResourceManager.Common/Generated/Models/DeploymentListResult.cs
@@ -0,0 +1,62 @@
+//
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// Warning: This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if the
+// code is regenerated.
+
+using System.Collections.Generic;
+using Hyak.Common;
+
+namespace Microsoft.Azure.Management.Internal.Resources.Models
+{
+ ///
+ /// List of deployments.
+ ///
+ public partial class DeploymentListResult : AzureOperationResponse
+ {
+ private IList _deployments;
+
+ ///