diff --git a/build.proj b/build.proj index f212e5d0de196..c7c8f8b0e315d 100644 --- a/build.proj +++ b/build.proj @@ -74,8 +74,7 @@ - - + @@ -116,16 +115,15 @@ Properties="Configuration=Net45-$(Configuration);Platform=Any CPU;$(_ExtraPropertyList)" Targets="Build" Condition=" '$(Scope)' == 'Authentication' or '$(Scope)' == 'All' " /> - + - + Targets="Build" /> @@ -209,6 +207,8 @@ + + diff --git a/src/Common/Common.csproj b/src/Common/Common.csproj index dfb9748eac0dd..575103e310ddb 100644 --- a/src/Common/Common.csproj +++ b/src/Common/Common.csproj @@ -27,6 +27,9 @@ + + + diff --git a/src/Common/Microsoft.Azure.Common.nuget.proj b/src/Common/Microsoft.Azure.Common.nuget.proj index d65c237802f47..ab1d123aaab40 100644 --- a/src/Common/Microsoft.Azure.Common.nuget.proj +++ b/src/Common/Microsoft.Azure.Common.nuget.proj @@ -5,7 +5,7 @@ Microsoft.Azure.Common --> - 2.0.4 + 2.1.0 $(MSBuildThisFileDirectory) diff --git a/src/Common/Models/ResourceBase.cs b/src/Common/Models/ResourceBase.cs new file mode 100644 index 0000000000000..5876b50fea868 --- /dev/null +++ b/src/Common/Models/ResourceBase.cs @@ -0,0 +1,77 @@ +// +// 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 Hyak.Common; + +namespace Microsoft.Azure +{ + /// + /// Resource information. + /// + public partial class ResourceBase + { + private string _location; + + /// + /// Required. Gets or sets the location of the resource. + /// + public string Location + { + get { return this._location; } + set { this._location = value; } + } + + private IDictionary _tags; + + /// + /// Optional. Gets or sets the tags attached to the resource. + /// + public IDictionary Tags + { + get { return this._tags; } + set { this._tags = value; } + } + + /// + /// Initializes a new instance of the ResourceBase class. + /// + public ResourceBase() + { + this.Tags = new LazyDictionary(); + } + + /// + /// Initializes a new instance of the ResourceBase class with required + /// arguments. + /// + public ResourceBase(string location) + : this() + { + if (location == null) + { + throw new ArgumentNullException("location"); + } + this.Location = location; + } + } +} diff --git a/src/Common/Models/ResourceBaseExtended.cs b/src/Common/Models/ResourceBaseExtended.cs new file mode 100644 index 0000000000000..c01a1c1845ea7 --- /dev/null +++ b/src/Common/Models/ResourceBaseExtended.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 +{ + /// + /// Resource information with extended details. + /// + public partial class ResourceBaseExtended : ResourceBase + { + private string _id; + + /// + /// Optional. Gets or sets the ID of the resource. + /// + public string Id + { + get { return this._id; } + set { this._id = value; } + } + + private string _name; + + /// + /// Optional. Gets or sets the name of the resource. + /// + public string Name + { + get { return this._name; } + set { this._name = value; } + } + + private string _type; + + /// + /// Optional. Gets or sets the type of the resource. + /// + public string Type + { + get { return this._type; } + set { this._type = value; } + } + + /// + /// Initializes a new instance of the ResourceBaseExtended class. + /// + public ResourceBaseExtended() + { + } + + /// + /// Initializes a new instance of the ResourceBaseExtended class with + /// required arguments. + /// + public ResourceBaseExtended(string location) + : this() + { + if (location == null) + { + throw new ArgumentNullException("location"); + } + this.Location = location; + } + } +} diff --git a/src/Common/Models/ResourceIdentity.cs b/src/Common/Models/ResourceIdentity.cs new file mode 100644 index 0000000000000..9e2d185501655 --- /dev/null +++ b/src/Common/Models/ResourceIdentity.cs @@ -0,0 +1,143 @@ +// +// 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. +// + +namespace Microsoft.Azure +{ + /// + /// Resource identity. + /// + public partial class ResourceIdentity + { + private string _parentResourcePath; + + /// + /// Optional. Gets or sets parent resource path (optional). + /// + public string ParentResourcePath + { + get { return this._parentResourcePath; } + set { this._parentResourcePath = value; } + } + + private string _resourceName; + + /// + /// Required. Gets or sets resource name. + /// + public string ResourceName + { + get { return this._resourceName; } + set { this._resourceName = value; } + } + + private string _resourceProviderApiVersion; + + /// + /// Required. Gets or sets API version of the resource provider. + /// + public string ResourceProviderApiVersion + { + get { return this._resourceProviderApiVersion; } + set { this._resourceProviderApiVersion = value; } + } + + private string _resourceProviderNamespace; + + /// + /// Required. Gets or sets namespace of the resource provider. + /// + public string ResourceProviderNamespace + { + get { return this._resourceProviderNamespace; } + set { this._resourceProviderNamespace = value; } + } + + private string _resourceType; + + /// + /// Required. Gets or sets resource type. + /// + public string ResourceType + { + get { return this._resourceType; } + set { this._resourceType = value; } + } + + /// + /// Initializes a new instance of the ResourceIdentity class. + /// + public ResourceIdentity() + { + } + + /// + /// Initializes a new instance of the ResourceIdentity class. + /// + public ResourceIdentity(string name, string resourceType, string apiVersion) + { + ResourceName = name; + ResourceProviderNamespace = GetProviderFromResourceType(resourceType); + ResourceType = GetTypeFromResourceType(resourceType); + ResourceProviderApiVersion = apiVersion; + } + + /// + /// Returns provider string from resource type. + /// + /// Resource type. + /// Provider + public static string GetProviderFromResourceType(string resourceType) + { + if (resourceType == null) + { + return null; + } + + int indexOfSlash = resourceType.IndexOf('/'); + if (indexOfSlash < 0) + { + return string.Empty; + } + else + { + return resourceType.Substring(0, indexOfSlash); + } + } + + /// + /// Returns type string from resource type. + /// + /// Resource type. + /// Type + public static string GetTypeFromResourceType(string resourceType) + { + if (resourceType == null) + { + return null; + } + + int lastIndexOfSlash = resourceType.LastIndexOf('/'); + if (lastIndexOfSlash < 0) + { + return string.Empty; + } + else + { + return resourceType.Substring(lastIndexOfSlash + 1); + } + } + } +} diff --git a/src/Common/Properties/AssemblyInfo.cs b/src/Common/Properties/AssemblyInfo.cs index a0924daa3cd8d..f830ccaf37436 100644 --- a/src/Common/Properties/AssemblyInfo.cs +++ b/src/Common/Properties/AssemblyInfo.cs @@ -18,5 +18,5 @@ //This file is shared with Common.NetFramework to provide consistent file version. //Do not put in extra assembly metadatas here; rather put them in AssemblyAdditionalInfo.cs. //Also merge AssemblyAdditionalInfo.cs into the file once we delete the Common.NetFramework. -[assembly: AssemblyFileVersion("2.0.4.0")] -[assembly: AssemblyVersion("2.0.0.0")] \ No newline at end of file +[assembly: AssemblyFileVersion("2.1.0.0")] +[assembly: AssemblyVersion("2.0.0.0")] diff --git a/src/ComputeManagement/Generated/DeploymentOperations.cs b/src/ComputeManagement/Generated/DeploymentOperations.cs index 81788eb8062eb..75a386529baca 100644 --- a/src/ComputeManagement/Generated/DeploymentOperations.cs +++ b/src/ComputeManagement/Generated/DeploymentOperations.cs @@ -5699,7 +5699,7 @@ public async Task GetByNameAsync(string serviceName, stri XElement timestampElement = guestAgentStatusElement.Element(XName.Get("Timestamp", "http://schemas.microsoft.com/windowsazure")); if (timestampElement != null && !string.IsNullOrEmpty(timestampElement.Value)) { - DateTime timestampInstance = DateTime.Parse(timestampElement.Value, CultureInfo.InvariantCulture); + DateTime timestampInstance = DateTime.Parse(timestampElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); guestAgentStatusInstance.Timestamp = timestampInstance; } @@ -5858,14 +5858,14 @@ public async Task GetByNameAsync(string serviceName, stri XElement timestampElement2 = extensionSettingStatusElement.Element(XName.Get("Timestamp", "http://schemas.microsoft.com/windowsazure")); if (timestampElement2 != null && !string.IsNullOrEmpty(timestampElement2.Value)) { - DateTime timestampInstance2 = DateTime.Parse(timestampElement2.Value, CultureInfo.InvariantCulture); + DateTime timestampInstance2 = DateTime.Parse(timestampElement2.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); extensionSettingStatusInstance.Timestamp = timestampInstance2; } XElement configurationAppliedTimeElement = extensionSettingStatusElement.Element(XName.Get("ConfigurationAppliedTime", "http://schemas.microsoft.com/windowsazure")); if (configurationAppliedTimeElement != null && !string.IsNullOrEmpty(configurationAppliedTimeElement.Value)) { - DateTime configurationAppliedTimeInstance = DateTime.Parse(configurationAppliedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime configurationAppliedTimeInstance = DateTime.Parse(configurationAppliedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); extensionSettingStatusInstance.ConfigurationAppliedTime = configurationAppliedTimeInstance; } @@ -7058,14 +7058,14 @@ public async Task GetByNameAsync(string serviceName, stri XElement createdTimeElement = deploymentElement.Element(XName.Get("CreatedTime", "http://schemas.microsoft.com/windowsazure")); if (createdTimeElement != null) { - DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture); + DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.CreatedTime = createdTimeInstance; } XElement lastModifiedTimeElement = deploymentElement.Element(XName.Get("LastModifiedTime", "http://schemas.microsoft.com/windowsazure")); if (lastModifiedTimeElement != null) { - DateTime lastModifiedTimeInstance = DateTime.Parse(lastModifiedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime lastModifiedTimeInstance = DateTime.Parse(lastModifiedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.LastModifiedTime = lastModifiedTimeInstance; } @@ -7120,14 +7120,14 @@ public async Task GetByNameAsync(string serviceName, stri XElement startTimeElement = persistentVMDowntimeElement.Element(XName.Get("StartTime", "http://schemas.microsoft.com/windowsazure")); if (startTimeElement != null) { - DateTime startTimeInstance = DateTime.Parse(startTimeElement.Value, CultureInfo.InvariantCulture); + DateTime startTimeInstance = DateTime.Parse(startTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); persistentVMDowntimeInstance.StartTime = startTimeInstance; } XElement endTimeElement = persistentVMDowntimeElement.Element(XName.Get("EndTime", "http://schemas.microsoft.com/windowsazure")); if (endTimeElement != null) { - DateTime endTimeInstance = DateTime.Parse(endTimeElement.Value, CultureInfo.InvariantCulture); + DateTime endTimeInstance = DateTime.Parse(endTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); persistentVMDowntimeInstance.EndTime = endTimeInstance; } @@ -7615,7 +7615,7 @@ public async Task GetBySlotAsync(string serviceName, Depl XElement timestampElement = guestAgentStatusElement.Element(XName.Get("Timestamp", "http://schemas.microsoft.com/windowsazure")); if (timestampElement != null && !string.IsNullOrEmpty(timestampElement.Value)) { - DateTime timestampInstance = DateTime.Parse(timestampElement.Value, CultureInfo.InvariantCulture); + DateTime timestampInstance = DateTime.Parse(timestampElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); guestAgentStatusInstance.Timestamp = timestampInstance; } @@ -7774,14 +7774,14 @@ public async Task GetBySlotAsync(string serviceName, Depl XElement timestampElement2 = extensionSettingStatusElement.Element(XName.Get("Timestamp", "http://schemas.microsoft.com/windowsazure")); if (timestampElement2 != null && !string.IsNullOrEmpty(timestampElement2.Value)) { - DateTime timestampInstance2 = DateTime.Parse(timestampElement2.Value, CultureInfo.InvariantCulture); + DateTime timestampInstance2 = DateTime.Parse(timestampElement2.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); extensionSettingStatusInstance.Timestamp = timestampInstance2; } XElement configurationAppliedTimeElement = extensionSettingStatusElement.Element(XName.Get("ConfigurationAppliedTime", "http://schemas.microsoft.com/windowsazure")); if (configurationAppliedTimeElement != null && !string.IsNullOrEmpty(configurationAppliedTimeElement.Value)) { - DateTime configurationAppliedTimeInstance = DateTime.Parse(configurationAppliedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime configurationAppliedTimeInstance = DateTime.Parse(configurationAppliedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); extensionSettingStatusInstance.ConfigurationAppliedTime = configurationAppliedTimeInstance; } @@ -8974,14 +8974,14 @@ public async Task GetBySlotAsync(string serviceName, Depl XElement createdTimeElement = deploymentElement.Element(XName.Get("CreatedTime", "http://schemas.microsoft.com/windowsazure")); if (createdTimeElement != null) { - DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture); + DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.CreatedTime = createdTimeInstance; } XElement lastModifiedTimeElement = deploymentElement.Element(XName.Get("LastModifiedTime", "http://schemas.microsoft.com/windowsazure")); if (lastModifiedTimeElement != null) { - DateTime lastModifiedTimeInstance = DateTime.Parse(lastModifiedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime lastModifiedTimeInstance = DateTime.Parse(lastModifiedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.LastModifiedTime = lastModifiedTimeInstance; } @@ -9036,14 +9036,14 @@ public async Task GetBySlotAsync(string serviceName, Depl XElement startTimeElement = persistentVMDowntimeElement.Element(XName.Get("StartTime", "http://schemas.microsoft.com/windowsazure")); if (startTimeElement != null) { - DateTime startTimeInstance = DateTime.Parse(startTimeElement.Value, CultureInfo.InvariantCulture); + DateTime startTimeInstance = DateTime.Parse(startTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); persistentVMDowntimeInstance.StartTime = startTimeInstance; } XElement endTimeElement = persistentVMDowntimeElement.Element(XName.Get("EndTime", "http://schemas.microsoft.com/windowsazure")); if (endTimeElement != null) { - DateTime endTimeInstance = DateTime.Parse(endTimeElement.Value, CultureInfo.InvariantCulture); + DateTime endTimeInstance = DateTime.Parse(endTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); persistentVMDowntimeInstance.EndTime = endTimeInstance; } @@ -9604,7 +9604,7 @@ public async Task ListEventsAsync(string serviceNam XElement rebootStartTimeElement = rebootEventsElement.Element(XName.Get("RebootStartTime", "http://schemas.microsoft.com/windowsazure")); if (rebootStartTimeElement != null && !string.IsNullOrEmpty(rebootStartTimeElement.Value)) { - DateTime rebootStartTimeInstance = DateTime.Parse(rebootStartTimeElement.Value, CultureInfo.InvariantCulture); + DateTime rebootStartTimeInstance = DateTime.Parse(rebootStartTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); rebootEventInstance.RebootStartTime = rebootStartTimeInstance; } } @@ -9811,7 +9811,7 @@ public async Task ListEventsBySlotAsync(string serv XElement rebootStartTimeElement = rebootEventsElement.Element(XName.Get("RebootStartTime", "http://schemas.microsoft.com/windowsazure")); if (rebootStartTimeElement != null && !string.IsNullOrEmpty(rebootStartTimeElement.Value)) { - DateTime rebootStartTimeInstance = DateTime.Parse(rebootStartTimeElement.Value, CultureInfo.InvariantCulture); + DateTime rebootStartTimeInstance = DateTime.Parse(rebootStartTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); rebootEventInstance.RebootStartTime = rebootStartTimeInstance; } } diff --git a/src/ComputeManagement/Generated/HostedServiceOperations.cs b/src/ComputeManagement/Generated/HostedServiceOperations.cs index a86387786d1ff..f41bec6c805c5 100644 --- a/src/ComputeManagement/Generated/HostedServiceOperations.cs +++ b/src/ComputeManagement/Generated/HostedServiceOperations.cs @@ -1526,14 +1526,14 @@ public async Task GetAsync(string serviceName, Cancell XElement dateCreatedElement = hostedServicePropertiesElement.Element(XName.Get("DateCreated", "http://schemas.microsoft.com/windowsazure")); if (dateCreatedElement != null) { - DateTime dateCreatedInstance = DateTime.Parse(dateCreatedElement.Value, CultureInfo.InvariantCulture); + DateTime dateCreatedInstance = DateTime.Parse(dateCreatedElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); hostedServicePropertiesInstance.DateCreated = dateCreatedInstance; } XElement dateLastModifiedElement = hostedServicePropertiesElement.Element(XName.Get("DateLastModified", "http://schemas.microsoft.com/windowsazure")); if (dateLastModifiedElement != null) { - DateTime dateLastModifiedInstance = DateTime.Parse(dateLastModifiedElement.Value, CultureInfo.InvariantCulture); + DateTime dateLastModifiedInstance = DateTime.Parse(dateLastModifiedElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); hostedServicePropertiesInstance.DateLastModified = dateLastModifiedInstance; } @@ -1928,7 +1928,7 @@ public async Task GetDetailedAsync(string serv XElement timestampElement = guestAgentStatusElement.Element(XName.Get("Timestamp", "http://schemas.microsoft.com/windowsazure")); if (timestampElement != null && !string.IsNullOrEmpty(timestampElement.Value)) { - DateTime timestampInstance = DateTime.Parse(timestampElement.Value, CultureInfo.InvariantCulture); + DateTime timestampInstance = DateTime.Parse(timestampElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); guestAgentStatusInstance.Timestamp = timestampInstance; } @@ -2087,14 +2087,14 @@ public async Task GetDetailedAsync(string serv XElement timestampElement2 = extensionSettingStatusElement.Element(XName.Get("Timestamp", "http://schemas.microsoft.com/windowsazure")); if (timestampElement2 != null && !string.IsNullOrEmpty(timestampElement2.Value)) { - DateTime timestampInstance2 = DateTime.Parse(timestampElement2.Value, CultureInfo.InvariantCulture); + DateTime timestampInstance2 = DateTime.Parse(timestampElement2.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); extensionSettingStatusInstance.Timestamp = timestampInstance2; } XElement configurationAppliedTimeElement = extensionSettingStatusElement.Element(XName.Get("ConfigurationAppliedTime", "http://schemas.microsoft.com/windowsazure")); if (configurationAppliedTimeElement != null && !string.IsNullOrEmpty(configurationAppliedTimeElement.Value)) { - DateTime configurationAppliedTimeInstance = DateTime.Parse(configurationAppliedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime configurationAppliedTimeInstance = DateTime.Parse(configurationAppliedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); extensionSettingStatusInstance.ConfigurationAppliedTime = configurationAppliedTimeInstance; } @@ -3280,7 +3280,7 @@ public async Task GetDetailedAsync(string serv XElement createdTimeElement = deploymentsElement.Element(XName.Get("CreatedTime", "http://schemas.microsoft.com/windowsazure")); if (createdTimeElement != null) { - DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture); + DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); deploymentInstance.CreatedTime = createdTimeInstance; } @@ -3318,14 +3318,14 @@ public async Task GetDetailedAsync(string serv XElement startTimeElement = persistentVMDowntimeElement.Element(XName.Get("StartTime", "http://schemas.microsoft.com/windowsazure")); if (startTimeElement != null) { - DateTime startTimeInstance = DateTime.Parse(startTimeElement.Value, CultureInfo.InvariantCulture); + DateTime startTimeInstance = DateTime.Parse(startTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); persistentVMDowntimeInstance.StartTime = startTimeInstance; } XElement endTimeElement = persistentVMDowntimeElement.Element(XName.Get("EndTime", "http://schemas.microsoft.com/windowsazure")); if (endTimeElement != null) { - DateTime endTimeInstance = DateTime.Parse(endTimeElement.Value, CultureInfo.InvariantCulture); + DateTime endTimeInstance = DateTime.Parse(endTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); persistentVMDowntimeInstance.EndTime = endTimeInstance; } @@ -3459,14 +3459,14 @@ public async Task GetDetailedAsync(string serv XElement dateCreatedElement = hostedServicePropertiesElement.Element(XName.Get("DateCreated", "http://schemas.microsoft.com/windowsazure")); if (dateCreatedElement != null) { - DateTime dateCreatedInstance = DateTime.Parse(dateCreatedElement.Value, CultureInfo.InvariantCulture); + DateTime dateCreatedInstance = DateTime.Parse(dateCreatedElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); hostedServicePropertiesInstance.DateCreated = dateCreatedInstance; } XElement dateLastModifiedElement = hostedServicePropertiesElement.Element(XName.Get("DateLastModified", "http://schemas.microsoft.com/windowsazure")); if (dateLastModifiedElement != null) { - DateTime dateLastModifiedInstance = DateTime.Parse(dateLastModifiedElement.Value, CultureInfo.InvariantCulture); + DateTime dateLastModifiedInstance = DateTime.Parse(dateLastModifiedElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); hostedServicePropertiesInstance.DateLastModified = dateLastModifiedInstance; } @@ -3911,14 +3911,14 @@ public async Task ListAsync(CancellationToken cancell XElement dateCreatedElement = hostedServicePropertiesElement.Element(XName.Get("DateCreated", "http://schemas.microsoft.com/windowsazure")); if (dateCreatedElement != null) { - DateTime dateCreatedInstance = DateTime.Parse(dateCreatedElement.Value, CultureInfo.InvariantCulture); + DateTime dateCreatedInstance = DateTime.Parse(dateCreatedElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); hostedServicePropertiesInstance.DateCreated = dateCreatedInstance; } XElement dateLastModifiedElement = hostedServicePropertiesElement.Element(XName.Get("DateLastModified", "http://schemas.microsoft.com/windowsazure")); if (dateLastModifiedElement != null) { - DateTime dateLastModifiedInstance = DateTime.Parse(dateLastModifiedElement.Value, CultureInfo.InvariantCulture); + DateTime dateLastModifiedInstance = DateTime.Parse(dateLastModifiedElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); hostedServicePropertiesInstance.DateLastModified = dateLastModifiedInstance; } @@ -4291,7 +4291,7 @@ public async Task ListAvailableExt XElement publishedDateElement = extensionImagesElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null && !string.IsNullOrEmpty(publishedDateElement.Value)) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); extensionImageInstance.PublishedDate = publishedDateInstance; } @@ -4945,7 +4945,7 @@ public async Task ListExtensionVer XElement publishedDateElement = extensionImagesElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null && !string.IsNullOrEmpty(publishedDateElement.Value)) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); extensionImageInstance.PublishedDate = publishedDateInstance; } diff --git a/src/ComputeManagement/Generated/VirtualMachineExtensionOperations.cs b/src/ComputeManagement/Generated/VirtualMachineExtensionOperations.cs index 69997f5187206..cfb4f30aae3de 100644 --- a/src/ComputeManagement/Generated/VirtualMachineExtensionOperations.cs +++ b/src/ComputeManagement/Generated/VirtualMachineExtensionOperations.cs @@ -298,7 +298,7 @@ public async Task ListAsync(CancellationTok XElement publishedDateElement = resourceExtensionsElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null && !string.IsNullOrEmpty(publishedDateElement.Value)) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); resourceExtensionInstance.PublishedDate = publishedDateInstance; } @@ -592,7 +592,7 @@ public async Task ListVersionsAsync(string XElement publishedDateElement = resourceExtensionsElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null && !string.IsNullOrEmpty(publishedDateElement.Value)) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); resourceExtensionInstance.PublishedDate = publishedDateInstance; } diff --git a/src/ComputeManagement/Generated/VirtualMachineOSImageOperations.cs b/src/ComputeManagement/Generated/VirtualMachineOSImageOperations.cs index 8ff9fa381de7a..610ec8630f3d5 100644 --- a/src/ComputeManagement/Generated/VirtualMachineOSImageOperations.cs +++ b/src/ComputeManagement/Generated/VirtualMachineOSImageOperations.cs @@ -648,7 +648,7 @@ public async Task CreateAsync(VirtualMachin XElement publishedDateElement2 = oSImageElement2.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement2 != null && !string.IsNullOrEmpty(publishedDateElement2.Value)) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement2.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement2.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.PublishedDate = publishedDateInstance; } @@ -1088,7 +1088,7 @@ public async Task GetAsync(string imageName, C XElement publishedDateElement = oSImageElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.PublishedDate = publishedDateInstance; } @@ -1407,7 +1407,7 @@ public async Task GetDetailsAsync(strin XElement publishedDateElement = oSImageDetailsElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.PublishedDate = publishedDateInstance; } @@ -1691,7 +1691,7 @@ public async Task ListAsync(CancellationToken XElement publishedDateElement = imagesElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); oSImageInstance.PublishedDate = publishedDateInstance; } @@ -2448,7 +2448,7 @@ public async Task UpdateAsync(string imageN XElement publishedDateElement2 = oSImageElement2.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement2 != null && !string.IsNullOrEmpty(publishedDateElement2.Value)) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement2.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement2.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.PublishedDate = publishedDateInstance; } diff --git a/src/ComputeManagement/Generated/VirtualMachineVMImageOperations.cs b/src/ComputeManagement/Generated/VirtualMachineVMImageOperations.cs index 15b25bda3d773..dfad318ed4fa7 100644 --- a/src/ComputeManagement/Generated/VirtualMachineVMImageOperations.cs +++ b/src/ComputeManagement/Generated/VirtualMachineVMImageOperations.cs @@ -1269,14 +1269,14 @@ public async Task GetDetailsAsync(strin XElement createdTimeElement = vMImageDetailsElement.Element(XName.Get("CreatedTime", "http://schemas.microsoft.com/windowsazure")); if (createdTimeElement != null && !string.IsNullOrEmpty(createdTimeElement.Value)) { - DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture); + DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.CreatedTime = createdTimeInstance; } XElement modifiedTimeElement = vMImageDetailsElement.Element(XName.Get("ModifiedTime", "http://schemas.microsoft.com/windowsazure")); if (modifiedTimeElement != null && !string.IsNullOrEmpty(modifiedTimeElement.Value)) { - DateTime modifiedTimeInstance = DateTime.Parse(modifiedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime modifiedTimeInstance = DateTime.Parse(modifiedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.ModifiedTime = modifiedTimeInstance; } @@ -1346,7 +1346,7 @@ public async Task GetDetailsAsync(strin XElement publishedDateElement = vMImageDetailsElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null && !string.IsNullOrEmpty(publishedDateElement.Value)) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.PublishedDate = publishedDateInstance; } @@ -1718,14 +1718,14 @@ public async Task ListAsync(CancellationToken XElement createdTimeElement = vMImagesElement.Element(XName.Get("CreatedTime", "http://schemas.microsoft.com/windowsazure")); if (createdTimeElement != null && !string.IsNullOrEmpty(createdTimeElement.Value)) { - DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture); + DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); vMImageInstance.CreatedTime = createdTimeInstance; } XElement modifiedTimeElement = vMImagesElement.Element(XName.Get("ModifiedTime", "http://schemas.microsoft.com/windowsazure")); if (modifiedTimeElement != null && !string.IsNullOrEmpty(modifiedTimeElement.Value)) { - DateTime modifiedTimeInstance = DateTime.Parse(modifiedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime modifiedTimeInstance = DateTime.Parse(modifiedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); vMImageInstance.ModifiedTime = modifiedTimeInstance; } @@ -1795,7 +1795,7 @@ public async Task ListAsync(CancellationToken XElement publishedDateElement = vMImagesElement.Element(XName.Get("PublishedDate", "http://schemas.microsoft.com/windowsazure")); if (publishedDateElement != null && !string.IsNullOrEmpty(publishedDateElement.Value)) { - DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture); + DateTime publishedDateInstance = DateTime.Parse(publishedDateElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); vMImageInstance.PublishedDate = publishedDateInstance; } diff --git a/src/ComputeManagement/Microsoft.WindowsAzure.Management.Compute.nuget.proj b/src/ComputeManagement/Microsoft.WindowsAzure.Management.Compute.nuget.proj index b3fabd851716c..a9ae2939ea3bb 100644 --- a/src/ComputeManagement/Microsoft.WindowsAzure.Management.Compute.nuget.proj +++ b/src/ComputeManagement/Microsoft.WindowsAzure.Management.Compute.nuget.proj @@ -5,7 +5,7 @@ Microsoft.WindowsAzure.Management.Compute --> - 9.2.0 + 9.2.1 $(MSBuildThisFileDirectory) diff --git a/src/ComputeManagement/Properties/AssemblyInfo.cs b/src/ComputeManagement/Properties/AssemblyInfo.cs index 0f82a714bde0d..ab726e69542de 100644 --- a/src/ComputeManagement/Properties/AssemblyInfo.cs +++ b/src/ComputeManagement/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Virtual Machines and Hosted Services.")] [assembly: AssemblyVersion("9.0.0.0")] -[assembly: AssemblyFileVersion("9.2.0.0")] +[assembly: AssemblyFileVersion("9.2.1.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] diff --git a/src/Management/Generated/AffinityGroupOperations.cs b/src/Management/Generated/AffinityGroupOperations.cs index 85136f9c8ad35..23aa90ab52f65 100644 --- a/src/Management/Generated/AffinityGroupOperations.cs +++ b/src/Management/Generated/AffinityGroupOperations.cs @@ -578,7 +578,7 @@ public async Task GetAsync(string affinityGroupName, C XElement createdTimeElement = affinityGroupElement.Element(XName.Get("CreatedTime", "http://schemas.microsoft.com/windowsazure")); if (createdTimeElement != null && !string.IsNullOrEmpty(createdTimeElement.Value)) { - DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture); + DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.CreatedTime = createdTimeInstance; } @@ -784,7 +784,7 @@ public async Task ListAsync(CancellationToken cancell XElement createdTimeElement = affinityGroupsElement.Element(XName.Get("CreatedTime", "http://schemas.microsoft.com/windowsazure")); if (createdTimeElement != null && !string.IsNullOrEmpty(createdTimeElement.Value)) { - DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture); + DateTime createdTimeInstance = DateTime.Parse(createdTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); affinityGroupInstance.CreatedTime = createdTimeInstance; } diff --git a/src/Management/Generated/ManagementCertificateOperations.cs b/src/Management/Generated/ManagementCertificateOperations.cs index 9e94a0351f292..261db89009fbd 100644 --- a/src/Management/Generated/ManagementCertificateOperations.cs +++ b/src/Management/Generated/ManagementCertificateOperations.cs @@ -507,7 +507,7 @@ public async Task GetAsync(string thumbprint, XElement createdElement = subscriptionCertificateElement.Element(XName.Get("Created", "http://schemas.microsoft.com/windowsazure")); if (createdElement != null) { - DateTime createdInstance = DateTime.Parse(createdElement.Value, CultureInfo.InvariantCulture); + DateTime createdInstance = DateTime.Parse(createdElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); result.Created = createdInstance; } } @@ -676,7 +676,7 @@ public async Task ListAsync(CancellationToken XElement createdElement = subscriptionCertificatesElement.Element(XName.Get("Created", "http://schemas.microsoft.com/windowsazure")); if (createdElement != null) { - DateTime createdInstance = DateTime.Parse(createdElement.Value, CultureInfo.InvariantCulture); + DateTime createdInstance = DateTime.Parse(createdElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); subscriptionCertificateInstance.Created = createdInstance; } } diff --git a/src/Management/Generated/SubscriptionOperations.cs b/src/Management/Generated/SubscriptionOperations.cs index dc0807a73b7f3..504e17a20f65d 100644 --- a/src/Management/Generated/SubscriptionOperations.cs +++ b/src/Management/Generated/SubscriptionOperations.cs @@ -536,14 +536,14 @@ public async Task ListOperationsAsync(Subscr XElement operationStartedTimeElement = subscriptionOperationsElement.Element(XName.Get("OperationStartedTime", "http://schemas.microsoft.com/windowsazure")); if (operationStartedTimeElement != null) { - DateTime operationStartedTimeInstance = DateTime.Parse(operationStartedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime operationStartedTimeInstance = DateTime.Parse(operationStartedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); subscriptionOperationInstance.OperationStartedTime = operationStartedTimeInstance; } XElement operationCompletedTimeElement = subscriptionOperationsElement.Element(XName.Get("OperationCompletedTime", "http://schemas.microsoft.com/windowsazure")); if (operationCompletedTimeElement != null) { - DateTime operationCompletedTimeInstance = DateTime.Parse(operationCompletedTimeElement.Value, CultureInfo.InvariantCulture); + DateTime operationCompletedTimeInstance = DateTime.Parse(operationCompletedTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); subscriptionOperationInstance.OperationCompletedTime = operationCompletedTimeInstance; } } diff --git a/src/Management/Microsoft.WindowsAzure.Management.nuget.proj b/src/Management/Microsoft.WindowsAzure.Management.nuget.proj index 5a4afcf77a375..2035d9ca3f12b 100644 --- a/src/Management/Microsoft.WindowsAzure.Management.nuget.proj +++ b/src/Management/Microsoft.WindowsAzure.Management.nuget.proj @@ -5,7 +5,7 @@ Microsoft.WindowsAzure.Management --> - 4.1.0 + 4.1.1 $(MSBuildThisFileDirectory) diff --git a/src/Management/Properties/AssemblyInfo.cs b/src/Management/Properties/AssemblyInfo.cs index 0a6df212c55fc..e062e9c1ca36c 100644 --- a/src/Management/Properties/AssemblyInfo.cs +++ b/src/Management/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure infrastructure.")] [assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.1.0.0")] +[assembly: AssemblyFileVersion("4.1.1.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] diff --git a/src/RemoteApp/Generated/CollectionOperations.cs b/src/RemoteApp/Generated/CollectionOperations.cs index 507747afe29c2..7df38807ed872 100644 --- a/src/RemoteApp/Generated/CollectionOperations.cs +++ b/src/RemoteApp/Generated/CollectionOperations.cs @@ -244,8 +244,6 @@ public async Task CreateAsync(bool populateOnly, collectionCreationDetailsValue["Mode"] = ((int)collectionDetails.Mode); - collectionCreationDetailsValue["WaitBeforeShutdownInMinutes"] = collectionDetails.WaitBeforeShutdownInMinutes; - if (collectionDetails.Region != null) { collectionCreationDetailsValue["Region"] = collectionDetails.Region; @@ -2704,7 +2702,7 @@ public async Task SendMessageToSessionAsync(strin /// collection details(true for populate only). /// /// - /// Required. Details for the collection to be created. + /// Required. Details for the collection to be updated. /// /// /// Cancellation token. @@ -2712,7 +2710,7 @@ public async Task SendMessageToSessionAsync(strin /// /// The response containing the operation tracking id. /// - public async Task SetAsync(string collectionName, bool forceRedeploy, bool populateOnly, CollectionCreationDetails collectionDetails, CancellationToken cancellationToken) + public async Task SetAsync(string collectionName, bool forceRedeploy, bool populateOnly, CollectionUpdateDetails collectionDetails, CancellationToken cancellationToken) { // Validate if (collectionName == null) @@ -2738,34 +2736,6 @@ public async Task SetAsync(string collectionName, throw new ArgumentNullException("collectionDetails.AdInfo.UserName"); } } - if (collectionDetails.AllowedPrincipals != null) - { - foreach (SecurityPrincipal allowedPrincipalsParameterItem in collectionDetails.AllowedPrincipals) - { - if (allowedPrincipalsParameterItem.Name == null) - { - throw new ArgumentNullException("collectionDetails.AllowedPrincipals.Name"); - } - } - } - if (collectionDetails.Name == null) - { - throw new ArgumentNullException("collectionDetails.Name"); - } - if (collectionDetails.PlanName == null) - { - throw new ArgumentNullException("collectionDetails.PlanName"); - } - if (collectionDetails.PublishedApplications != null) - { - foreach (PublishedApplicationDetails publishedApplicationsParameterItem in collectionDetails.PublishedApplications) - { - if (publishedApplicationsParameterItem.Name == null) - { - throw new ArgumentNullException("collectionDetails.PublishedApplications.Name"); - } - } - } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; @@ -2835,30 +2805,23 @@ public async Task SetAsync(string collectionName, string requestContent = null; JToken requestDoc = null; - JObject collectionCreationDetailsValue = new JObject(); - requestDoc = collectionCreationDetailsValue; - - collectionCreationDetailsValue["Name"] = collectionDetails.Name; + JObject collectionUpdateDetailsValue = new JObject(); + requestDoc = collectionUpdateDetailsValue; if (collectionDetails.Description != null) { - collectionCreationDetailsValue["Description"] = collectionDetails.Description; + collectionUpdateDetailsValue["Description"] = collectionDetails.Description; } if (collectionDetails.TemplateImageName != null) { - collectionCreationDetailsValue["TemplateImageName"] = collectionDetails.TemplateImageName; - } - - if (collectionDetails.VNetName != null) - { - collectionCreationDetailsValue["VnetName"] = collectionDetails.VNetName; + collectionUpdateDetailsValue["TemplateImageName"] = collectionDetails.TemplateImageName; } if (collectionDetails.AdInfo != null) { JObject adInfoValue = new JObject(); - collectionCreationDetailsValue["AdInfo"] = adInfoValue; + collectionUpdateDetailsValue["AdInfo"] = adInfoValue; adInfoValue["DomainName"] = collectionDetails.AdInfo.DomainName; @@ -2872,135 +2835,17 @@ public async Task SetAsync(string collectionName, adInfoValue["ServiceAccountPassword"] = collectionDetails.AdInfo.Password; } - collectionCreationDetailsValue["BillingPlanName"] = collectionDetails.PlanName; - - if (collectionDetails.CustomRdpProperty != null) + if (collectionDetails.PlanName != null) { - collectionCreationDetailsValue["CustomRdpProperty"] = collectionDetails.CustomRdpProperty; + collectionUpdateDetailsValue["BillingPlanName"] = collectionDetails.PlanName; } - collectionCreationDetailsValue["ReadyForPublishing"] = collectionDetails.ReadyForPublishing; - - collectionCreationDetailsValue["Mode"] = ((int)collectionDetails.Mode); - - collectionCreationDetailsValue["WaitBeforeShutdownInMinutes"] = collectionDetails.WaitBeforeShutdownInMinutes; - - if (collectionDetails.Region != null) - { - collectionCreationDetailsValue["Region"] = collectionDetails.Region; - } - - if (collectionDetails.PublishedApplications != null) - { - if (collectionDetails.PublishedApplications is ILazyCollection == false || ((ILazyCollection)collectionDetails.PublishedApplications).IsInitialized) - { - JArray publishedApplicationsArray = new JArray(); - foreach (PublishedApplicationDetails publishedApplicationsItem in collectionDetails.PublishedApplications) - { - JObject publishedApplicationDetailsValue = new JObject(); - publishedApplicationsArray.Add(publishedApplicationDetailsValue); - - publishedApplicationDetailsValue["AvailableToUsers"] = publishedApplicationsItem.AvailableToUsers; - - if (publishedApplicationsItem.Alias != null) - { - publishedApplicationDetailsValue["Alias"] = publishedApplicationsItem.Alias; - } - - if (publishedApplicationsItem.CommandLineArguments != null) - { - publishedApplicationDetailsValue["CommandLineArguments"] = publishedApplicationsItem.CommandLineArguments; - } - - if (publishedApplicationsItem.IconUri != null) - { - publishedApplicationDetailsValue["IconUri"] = publishedApplicationsItem.IconUri; - } - - publishedApplicationDetailsValue["Name"] = publishedApplicationsItem.Name; - - publishedApplicationDetailsValue["Status"] = ((int)publishedApplicationsItem.Status); - - if (publishedApplicationsItem.IconPngUris != null) - { - JObject iconPngUrisValue = new JObject(); - publishedApplicationDetailsValue["IconPngUris"] = iconPngUrisValue; - - if (publishedApplicationsItem.IconPngUris.IconPngUris != null) - { - if (publishedApplicationsItem.IconPngUris.IconPngUris is ILazyCollection == false || ((ILazyCollection)publishedApplicationsItem.IconPngUris.IconPngUris).IsInitialized) - { - JArray iconPngUrisDictionary = new JArray(); - foreach (KeyValuePair pair in publishedApplicationsItem.IconPngUris.IconPngUris) - { - int iconPngUrisKey = pair.Key; - string iconPngUrisValue2 = pair.Value; - JObject iconPngUrisItemObject = new JObject(); - iconPngUrisItemObject["Key"] = iconPngUrisKey.ToString(); - iconPngUrisItemObject["Value"] = iconPngUrisValue2; - iconPngUrisDictionary.Add(iconPngUrisItemObject); - } - iconPngUrisValue["IconPngUris"] = iconPngUrisDictionary; - } - } - } - - if (publishedApplicationsItem.VirtualPath != null) - { - publishedApplicationDetailsValue["VirtualPath"] = publishedApplicationsItem.VirtualPath; - } - } - collectionCreationDetailsValue["PublishedApplications"] = publishedApplicationsArray; - } - } - - if (collectionDetails.AllowedPrincipals != null) - { - if (collectionDetails.AllowedPrincipals is ILazyCollection == false || ((ILazyCollection)collectionDetails.AllowedPrincipals).IsInitialized) - { - JArray allowedPrincipalsArray = new JArray(); - foreach (SecurityPrincipal allowedPrincipalsItem in collectionDetails.AllowedPrincipals) - { - JObject securityPrincipalValue = new JObject(); - allowedPrincipalsArray.Add(securityPrincipalValue); - - securityPrincipalValue["SecurityPrincipalType"] = ((int)allowedPrincipalsItem.SecurityPrincipalType); - - securityPrincipalValue["UserIdType"] = ((int)allowedPrincipalsItem.UserIdType); - - securityPrincipalValue["Name"] = allowedPrincipalsItem.Name; - - if (allowedPrincipalsItem.AadObjectId != null) - { - securityPrincipalValue["AadObjectId"] = allowedPrincipalsItem.AadObjectId; - } - - if (allowedPrincipalsItem.Description != null) - { - securityPrincipalValue["Description"] = allowedPrincipalsItem.Description; - } - } - collectionCreationDetailsValue["AllowedPrincipals"] = allowedPrincipalsArray; - } - } - - if (collectionDetails.DnsServers != null) + if (collectionDetails.CustomRdpProperty != null) { - if (collectionDetails.DnsServers is ILazyCollection == false || ((ILazyCollection)collectionDetails.DnsServers).IsInitialized) - { - JArray dnsServersArray = new JArray(); - foreach (string dnsServersItem in collectionDetails.DnsServers) - { - dnsServersArray.Add(dnsServersItem); - } - collectionCreationDetailsValue["DnsServers"] = dnsServersArray; - } + collectionUpdateDetailsValue["CustomRdpProperty"] = collectionDetails.CustomRdpProperty; } - if (collectionDetails.SubnetName != null) - { - collectionCreationDetailsValue["SubnetName"] = collectionDetails.SubnetName; - } + collectionUpdateDetailsValue["WaitBeforeShutdownInMinutes"] = collectionDetails.WaitBeforeShutdownInMinutes; requestContent = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented); httpRequest.Content = new StringContent(requestContent, Encoding.UTF8); diff --git a/src/RemoteApp/Generated/CollectionOperationsExtensions.cs b/src/RemoteApp/Generated/CollectionOperationsExtensions.cs index 481ec93420d6e..7ddc2c2d53001 100644 --- a/src/RemoteApp/Generated/CollectionOperationsExtensions.cs +++ b/src/RemoteApp/Generated/CollectionOperationsExtensions.cs @@ -588,12 +588,12 @@ public static Task SendMessageToSessionAsync(this /// collection details(true for populate only). /// /// - /// Required. Details for the collection to be created. + /// Required. Details for the collection to be updated. /// /// /// The response containing the operation tracking id. /// - public static OperationResultWithTrackingId Set(this ICollectionOperations operations, string collectionName, bool forceRedeploy, bool populateOnly, CollectionCreationDetails collectionDetails) + public static OperationResultWithTrackingId Set(this ICollectionOperations operations, string collectionName, bool forceRedeploy, bool populateOnly, CollectionUpdateDetails collectionDetails) { return Task.Factory.StartNew((object s) => { @@ -621,12 +621,12 @@ public static OperationResultWithTrackingId Set(this ICollectionOperations opera /// collection details(true for populate only). /// /// - /// Required. Details for the collection to be created. + /// Required. Details for the collection to be updated. /// /// /// The response containing the operation tracking id. /// - public static Task SetAsync(this ICollectionOperations operations, string collectionName, bool forceRedeploy, bool populateOnly, CollectionCreationDetails collectionDetails) + public static Task SetAsync(this ICollectionOperations operations, string collectionName, bool forceRedeploy, bool populateOnly, CollectionUpdateDetails collectionDetails) { return operations.SetAsync(collectionName, forceRedeploy, populateOnly, collectionDetails, CancellationToken.None); } diff --git a/src/RemoteApp/Generated/ICollectionOperations.cs b/src/RemoteApp/Generated/ICollectionOperations.cs index 9b682f7bcf7d7..231c0a80c55a5 100644 --- a/src/RemoteApp/Generated/ICollectionOperations.cs +++ b/src/RemoteApp/Generated/ICollectionOperations.cs @@ -241,7 +241,7 @@ public partial interface ICollectionOperations /// details(true for populate only). /// /// - /// Details for the collection to be created. + /// Details for the collection to be updated. /// /// /// Cancellation token. @@ -249,7 +249,7 @@ public partial interface ICollectionOperations /// /// The response containing the operation tracking id. /// - Task SetAsync(string collectionName, bool forceRedeploy, bool populateOnly, CollectionCreationDetails collectionDetails, CancellationToken cancellationToken); + Task SetAsync(string collectionName, bool forceRedeploy, bool populateOnly, CollectionUpdateDetails collectionDetails, CancellationToken cancellationToken); /// /// Updates the specified Active directory's configuration. diff --git a/src/RemoteApp/Generated/Models/CollectionCreationDetails.cs b/src/RemoteApp/Generated/Models/CollectionCreationDetails.cs index cd056b74e9537..b035ab3f3f08a 100644 --- a/src/RemoteApp/Generated/Models/CollectionCreationDetails.cs +++ b/src/RemoteApp/Generated/Models/CollectionCreationDetails.cs @@ -35,8 +35,7 @@ public partial class CollectionCreationDetails private ActiveDirectoryConfig _adInfo; /// - /// Optional. Active Directory Parameters for the AD associated with - /// this collection. + /// Optional. Active Directory configuration details. /// public ActiveDirectoryConfig AdInfo { @@ -59,8 +58,8 @@ public IList AllowedPrincipals private string _customRdpProperty; /// - /// Optional. Optional customer-defined RDP properties of the - /// collection. + /// Optional. Customer defined Remote Desktop Protocol (RDP) properties + /// of the collection. /// public string CustomRdpProperty { @@ -173,8 +172,8 @@ public string SubnetName private string _templateImageName; /// - /// Optional. The name of the application template image to be used to - /// create this collection. + /// Optional. The name of the template image to be used to create this + /// collection. /// public string TemplateImageName { @@ -193,22 +192,6 @@ public string VNetName set { this._vNetName = value; } } - private int _waitBeforeShutdownInMinutes; - - /// - /// Optional. Number of minutes to wait before logging off the end - /// users when updating this collection.The value of -1 denotes - /// immediate force logoff after the patching is successfully - /// completed.The value of 0 denotes logoff after 60 minutes after the - /// patching is successfully completed.Any other value less than 300 - /// minutes will be honored as is. - /// - public int WaitBeforeShutdownInMinutes - { - get { return this._waitBeforeShutdownInMinutes; } - set { this._waitBeforeShutdownInMinutes = value; } - } - /// /// Initializes a new instance of the CollectionCreationDetails class. /// diff --git a/src/RemoteApp/Generated/Models/CollectionUpdateDetails.cs b/src/RemoteApp/Generated/Models/CollectionUpdateDetails.cs new file mode 100644 index 0000000000000..40171b52e776e --- /dev/null +++ b/src/RemoteApp/Generated/Models/CollectionUpdateDetails.cs @@ -0,0 +1,113 @@ +// +// 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.Linq; +using Microsoft.Azure.Management.RemoteApp.Models; + +namespace Microsoft.Azure.Management.RemoteApp.Models +{ + /// + /// The parameters for collection set request. + /// + public partial class CollectionUpdateDetails + { + private ActiveDirectoryConfig _adInfo; + + /// + /// Optional. Active Directory configuration details to update. + /// + public ActiveDirectoryConfig AdInfo + { + get { return this._adInfo; } + set { this._adInfo = value; } + } + + private string _customRdpProperty; + + /// + /// Optional. Customer defined Remote Desktop Protocol (RDP) properties + /// of the collection. + /// + public string CustomRdpProperty + { + get { return this._customRdpProperty; } + set { this._customRdpProperty = value; } + } + + private string _description; + + /// + /// Optional. The description of the collection. + /// + public string Description + { + get { return this._description; } + set { this._description = value; } + } + + private string _planName; + + /// + /// Optional. The new RemoteApp plan for the collection. + /// + public string PlanName + { + get { return this._planName; } + set { this._planName = value; } + } + + private string _templateImageName; + + /// + /// Optional. The name of the template image to be used to patch the + /// collection. + /// + public string TemplateImageName + { + get { return this._templateImageName; } + set { this._templateImageName = value; } + } + + private int _waitBeforeShutdownInMinutes; + + /// + /// Optional. Number of minutes to wait before logging off the end + /// users when updating this collection.The value of -1 denotes + /// immediate force logoff after the patching is successfully + /// completed.The value of 0 denotes logoff after 60 minutes after the + /// patching is successfully completed.Any other value less than 300 + /// minutes will be honored as is. + /// + public int WaitBeforeShutdownInMinutes + { + get { return this._waitBeforeShutdownInMinutes; } + set { this._waitBeforeShutdownInMinutes = value; } + } + + /// + /// Initializes a new instance of the CollectionUpdateDetails class. + /// + public CollectionUpdateDetails() + { + } + } +} diff --git a/src/RemoteApp/Microsoft.Azure.Management.RemoteApp.nuget.proj b/src/RemoteApp/Microsoft.Azure.Management.RemoteApp.nuget.proj index 153682aef2b5b..08597aff916f2 100644 --- a/src/RemoteApp/Microsoft.Azure.Management.RemoteApp.nuget.proj +++ b/src/RemoteApp/Microsoft.Azure.Management.RemoteApp.nuget.proj @@ -2,7 +2,7 @@ - 1.0.8 + 1.0.9 $(MSBuildThisFileDirectory) true diff --git a/src/RemoteApp/Microsoft.Azure.Management.RemoteApp.nuspec b/src/RemoteApp/Microsoft.Azure.Management.RemoteApp.nuspec index 9605a1ed72372..489aad257ecd7 100644 --- a/src/RemoteApp/Microsoft.Azure.Management.RemoteApp.nuspec +++ b/src/RemoteApp/Microsoft.Azure.Management.RemoteApp.nuspec @@ -8,7 +8,7 @@ azure-sdk, Microsoft false Spec DLL for Microsoft Azure RemoteApp Management - Initial release. + Changed the Collection Set API to take a new type CollectionUpdateDetails type http://aka.ms/windowsazureapache2 https://github.com/Azure/azure-sdk-for-net http://go.microsoft.com/fwlink/?LinkID=288890 diff --git a/src/RemoteApp/Properties/AssemblyInfo.cs b/src/RemoteApp/Properties/AssemblyInfo.cs index fce12562c37a8..c8b57915b818d 100644 --- a/src/RemoteApp/Properties/AssemblyInfo.cs +++ b/src/RemoteApp/Properties/AssemblyInfo.cs @@ -45,4 +45,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.0.0*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.8.0")] +[assembly: AssemblyFileVersion("1.0.9.0")] diff --git a/src/ResourceManagement/Generated/AuthorizationClient.cs b/src/ResourceManagement/Generated/AuthorizationClient.cs new file mode 100644 index 0000000000000..df3334dc7a330 --- /dev/null +++ b/src/ResourceManagement/Generated/AuthorizationClient.cs @@ -0,0 +1,257 @@ +// +// 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.Linq; +using System.Net.Http; +using Hyak.Common; +using Microsoft.Azure; +using Microsoft.Azure.Management.Resources; + +namespace Microsoft.Azure.Management.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/ResourceManagement/Generated/AuthorizationClientExtensions.cs b/src/ResourceManagement/Generated/AuthorizationClientExtensions.cs new file mode 100644 index 0000000000000..4647731030c8a --- /dev/null +++ b/src/ResourceManagement/Generated/AuthorizationClientExtensions.cs @@ -0,0 +1,30 @@ +// +// 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.Linq; + +namespace Microsoft.Azure.Management.Resources +{ + public static partial class AuthorizationClientExtensions + { + } +} diff --git a/src/ResourceManagement/Generated/DeploymentOperations.cs b/src/ResourceManagement/Generated/DeploymentOperations.cs index bf1f83bf53721..de694c89a6833 100644 --- a/src/ResourceManagement/Generated/DeploymentOperations.cs +++ b/src/ResourceManagement/Generated/DeploymentOperations.cs @@ -237,7 +237,7 @@ public async Task CancelAsync(string resourceGroupName, /// /// Template deployment operation create result. /// - public async Task CreateOrUpdateAsync(string resourceGroupName, string deploymentName, BasicDeployment parameters, CancellationToken cancellationToken) + public async Task CreateOrUpdateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) @@ -260,18 +260,21 @@ public async Task CreateOrUpdateAsync(string r { throw new ArgumentNullException("parameters"); } - if (parameters.ParametersLink != null) + if (parameters.Properties != null) { - if (parameters.ParametersLink.Uri == null) + if (parameters.Properties.ParametersLink != null) { - throw new ArgumentNullException("parameters.ParametersLink.Uri"); + if (parameters.Properties.ParametersLink.Uri == null) + { + throw new ArgumentNullException("parameters.Properties.ParametersLink.Uri"); + } } - } - if (parameters.TemplateLink != null) - { - if (parameters.TemplateLink.Uri == null) + if (parameters.Properties.TemplateLink != null) { - throw new ArgumentNullException("parameters.TemplateLink.Uri"); + if (parameters.Properties.TemplateLink.Uri == null) + { + throw new ArgumentNullException("parameters.Properties.TemplateLink.Uri"); + } } } @@ -336,48 +339,53 @@ public async Task CreateOrUpdateAsync(string r string requestContent = null; JToken requestDoc = null; - JObject propertiesValue = new JObject(); - requestDoc = new JObject(); - requestDoc["properties"] = propertiesValue; + JObject deploymentValue = new JObject(); + requestDoc = deploymentValue; - if (parameters.Template != null) + if (parameters.Properties != null) { - propertiesValue["template"] = JObject.Parse(parameters.Template); - } - - if (parameters.TemplateLink != null) - { - JObject templateLinkValue = new JObject(); - propertiesValue["templateLink"] = templateLinkValue; + JObject propertiesValue = new JObject(); + deploymentValue["properties"] = propertiesValue; - templateLinkValue["uri"] = parameters.TemplateLink.Uri.AbsoluteUri; + if (parameters.Properties.Template != null) + { + propertiesValue["template"] = JObject.Parse(parameters.Properties.Template); + } - if (parameters.TemplateLink.ContentVersion != null) + if (parameters.Properties.TemplateLink != null) { - templateLinkValue["contentVersion"] = parameters.TemplateLink.ContentVersion; + 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.Parameters != null) - { - propertiesValue["parameters"] = JObject.Parse(parameters.Parameters); - } - - if (parameters.ParametersLink != null) - { - JObject parametersLinkValue = new JObject(); - propertiesValue["parametersLink"] = parametersLinkValue; - parametersLinkValue["uri"] = parameters.ParametersLink.Uri.AbsoluteUri; + if (parameters.Properties.Parameters != null) + { + propertiesValue["parameters"] = JObject.Parse(parameters.Properties.Parameters); + } - if (parameters.ParametersLink.ContentVersion != null) + if (parameters.Properties.ParametersLink != null) { - parametersLinkValue["contentVersion"] = parameters.ParametersLink.ContentVersion; + 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(); } - propertiesValue["mode"] = parameters.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"); @@ -424,7 +432,7 @@ public async Task CreateOrUpdateAsync(string r if (responseDoc != null && responseDoc.Type != JTokenType.Null) { - Deployment deploymentInstance = new Deployment(); + DeploymentExtended deploymentInstance = new DeploymentExtended(); result.Deployment = deploymentInstance; JToken idValue = responseDoc["id"]; @@ -444,7 +452,7 @@ public async Task CreateOrUpdateAsync(string r JToken propertiesValue2 = responseDoc["properties"]; if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null) { - DeploymentProperties propertiesInstance = new DeploymentProperties(); + DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended(); deploymentInstance.Properties = propertiesInstance; JToken provisioningStateValue = propertiesValue2["provisioningState"]; @@ -843,7 +851,7 @@ public async Task GetAsync(string resourceGroupName, string if (responseDoc != null && responseDoc.Type != JTokenType.Null) { - Deployment deploymentInstance = new Deployment(); + DeploymentExtended deploymentInstance = new DeploymentExtended(); result.Deployment = deploymentInstance; JToken idValue = responseDoc["id"]; @@ -863,7 +871,7 @@ public async Task GetAsync(string resourceGroupName, string JToken propertiesValue = responseDoc["properties"]; if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { - DeploymentProperties propertiesInstance = new DeploymentProperties(); + DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended(); deploymentInstance.Properties = propertiesInstance; JToken provisioningStateValue = propertiesValue["provisioningState"]; @@ -1268,28 +1276,28 @@ public async Task ListAsync(string resourceGroupName, Depl { foreach (JToken valueValue in ((JArray)valueArray)) { - Deployment deploymentInstance = new Deployment(); - result.Deployments.Add(deploymentInstance); + DeploymentExtended deploymentExtendedInstance = new DeploymentExtended(); + result.Deployments.Add(deploymentExtendedInstance); JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); - deploymentInstance.Id = idInstance; + deploymentExtendedInstance.Id = idInstance; } JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); - deploymentInstance.Name = nameInstance; + deploymentExtendedInstance.Name = nameInstance; } JToken propertiesValue = valueValue["properties"]; if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { - DeploymentProperties propertiesInstance = new DeploymentProperties(); - deploymentInstance.Properties = propertiesInstance; + DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended(); + deploymentExtendedInstance.Properties = propertiesInstance; JToken provisioningStateValue = propertiesValue["provisioningState"]; if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null) @@ -1660,28 +1668,28 @@ public async Task ListNextAsync(string nextLink, Cancellat { foreach (JToken valueValue in ((JArray)valueArray)) { - Deployment deploymentInstance = new Deployment(); - result.Deployments.Add(deploymentInstance); + DeploymentExtended deploymentExtendedInstance = new DeploymentExtended(); + result.Deployments.Add(deploymentExtendedInstance); JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { string idInstance = ((string)idValue); - deploymentInstance.Id = idInstance; + deploymentExtendedInstance.Id = idInstance; } JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); - deploymentInstance.Name = nameInstance; + deploymentExtendedInstance.Name = nameInstance; } JToken propertiesValue = valueValue["properties"]; if (propertiesValue != null && propertiesValue.Type != JTokenType.Null) { - DeploymentProperties propertiesInstance = new DeploymentProperties(); - deploymentInstance.Properties = propertiesInstance; + DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended(); + deploymentExtendedInstance.Properties = propertiesInstance; JToken provisioningStateValue = propertiesValue["provisioningState"]; if (provisioningStateValue != null && provisioningStateValue.Type != JTokenType.Null) @@ -1973,7 +1981,7 @@ public async Task ListNextAsync(string nextLink, Cancellat /// /// Information from validate template deployment response. /// - public async Task ValidateAsync(string resourceGroupName, string deploymentName, BasicDeployment parameters, CancellationToken cancellationToken) + public async Task ValidateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) @@ -1996,18 +2004,21 @@ public async Task ValidateAsync(string resourceGroup { throw new ArgumentNullException("parameters"); } - if (parameters.ParametersLink != null) + if (parameters.Properties != null) { - if (parameters.ParametersLink.Uri == null) + if (parameters.Properties.ParametersLink != null) { - throw new ArgumentNullException("parameters.ParametersLink.Uri"); + if (parameters.Properties.ParametersLink.Uri == null) + { + throw new ArgumentNullException("parameters.Properties.ParametersLink.Uri"); + } } - } - if (parameters.TemplateLink != null) - { - if (parameters.TemplateLink.Uri == null) + if (parameters.Properties.TemplateLink != null) { - throw new ArgumentNullException("parameters.TemplateLink.Uri"); + if (parameters.Properties.TemplateLink.Uri == null) + { + throw new ArgumentNullException("parameters.Properties.TemplateLink.Uri"); + } } } @@ -2073,48 +2084,53 @@ public async Task ValidateAsync(string resourceGroup string requestContent = null; JToken requestDoc = null; - JObject propertiesValue = new JObject(); - requestDoc = new JObject(); - requestDoc["properties"] = propertiesValue; + JObject deploymentValue = new JObject(); + requestDoc = deploymentValue; - if (parameters.Template != null) + if (parameters.Properties != null) { - propertiesValue["template"] = JObject.Parse(parameters.Template); - } - - if (parameters.TemplateLink != null) - { - JObject templateLinkValue = new JObject(); - propertiesValue["templateLink"] = templateLinkValue; + JObject propertiesValue = new JObject(); + deploymentValue["properties"] = propertiesValue; - templateLinkValue["uri"] = parameters.TemplateLink.Uri.AbsoluteUri; + if (parameters.Properties.Template != null) + { + propertiesValue["template"] = JObject.Parse(parameters.Properties.Template); + } - if (parameters.TemplateLink.ContentVersion != null) + if (parameters.Properties.TemplateLink != null) { - templateLinkValue["contentVersion"] = parameters.TemplateLink.ContentVersion; + 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.Parameters != null) - { - propertiesValue["parameters"] = JObject.Parse(parameters.Parameters); - } - - if (parameters.ParametersLink != null) - { - JObject parametersLinkValue = new JObject(); - propertiesValue["parametersLink"] = parametersLinkValue; - parametersLinkValue["uri"] = parameters.ParametersLink.Uri.AbsoluteUri; + if (parameters.Properties.Parameters != null) + { + propertiesValue["parameters"] = JObject.Parse(parameters.Properties.Parameters); + } - if (parameters.ParametersLink.ContentVersion != null) + if (parameters.Properties.ParametersLink != null) { - parametersLinkValue["contentVersion"] = parameters.ParametersLink.ContentVersion; + 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(); } - propertiesValue["mode"] = parameters.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"); @@ -2223,7 +2239,7 @@ public async Task ValidateAsync(string resourceGroup JToken propertiesValue2 = responseDoc["properties"]; if (propertiesValue2 != null && propertiesValue2.Type != JTokenType.Null) { - DeploymentProperties propertiesInstance = new DeploymentProperties(); + DeploymentPropertiesExtended propertiesInstance = new DeploymentPropertiesExtended(); result.Properties = propertiesInstance; JToken provisioningStateValue = propertiesValue2["provisioningState"]; diff --git a/src/ResourceManagement/Generated/DeploymentOperationsExtensions.cs b/src/ResourceManagement/Generated/DeploymentOperationsExtensions.cs index 4704e025d9488..c1f71837b25a1 100644 --- a/src/ResourceManagement/Generated/DeploymentOperationsExtensions.cs +++ b/src/ResourceManagement/Generated/DeploymentOperationsExtensions.cs @@ -101,7 +101,7 @@ public static Task CancelAsync(this IDeploymentOperation /// /// Template deployment operation create result. /// - public static DeploymentOperationsCreateResult CreateOrUpdate(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, BasicDeployment parameters) + public static DeploymentOperationsCreateResult CreateOrUpdate(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, Deployment parameters) { return Task.Factory.StartNew((object s) => { @@ -130,7 +130,7 @@ public static DeploymentOperationsCreateResult CreateOrUpdate(this IDeploymentOp /// /// Template deployment operation create result. /// - public static Task CreateOrUpdateAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, BasicDeployment parameters) + public static Task CreateOrUpdateAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, Deployment parameters) { return operations.CreateOrUpdateAsync(resourceGroupName, deploymentName, parameters, CancellationToken.None); } @@ -295,7 +295,7 @@ public static Task ListNextAsync(this IDeploymentOperation /// /// Information from validate template deployment response. /// - public static DeploymentValidateResponse Validate(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, BasicDeployment parameters) + public static DeploymentValidateResponse Validate(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, Deployment parameters) { return Task.Factory.StartNew((object s) => { @@ -324,7 +324,7 @@ public static DeploymentValidateResponse Validate(this IDeploymentOperations ope /// /// Information from validate template deployment response. /// - public static Task ValidateAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, BasicDeployment parameters) + 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/ResourceManagement/Generated/IAuthorizationClient.cs b/src/ResourceManagement/Generated/IAuthorizationClient.cs new file mode 100644 index 0000000000000..a6032963c297d --- /dev/null +++ b/src/ResourceManagement/Generated/IAuthorizationClient.cs @@ -0,0 +1,81 @@ +// +// 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.Linq; +using Microsoft.Azure; +using Microsoft.Azure.Management.Resources; + +namespace Microsoft.Azure.Management.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/ResourceManagement/Generated/IDeploymentOperations.cs b/src/ResourceManagement/Generated/IDeploymentOperations.cs index 4f23c0c48400e..5593da28e10ef 100644 --- a/src/ResourceManagement/Generated/IDeploymentOperations.cs +++ b/src/ResourceManagement/Generated/IDeploymentOperations.cs @@ -69,7 +69,7 @@ public partial interface IDeploymentOperations /// /// Template deployment operation create result. /// - Task CreateOrUpdateAsync(string resourceGroupName, string deploymentName, BasicDeployment parameters, CancellationToken cancellationToken); + Task CreateOrUpdateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken); /// /// Get a deployment. @@ -138,6 +138,6 @@ public partial interface IDeploymentOperations /// /// Information from validate template deployment response. /// - Task ValidateAsync(string resourceGroupName, string deploymentName, BasicDeployment parameters, CancellationToken cancellationToken); + Task ValidateAsync(string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken); } } diff --git a/src/ResourceManagement/Generated/IManagementLockOperations.cs b/src/ResourceManagement/Generated/IManagementLockOperations.cs new file mode 100644 index 0000000000000..355037152b2a8 --- /dev/null +++ b/src/ResourceManagement/Generated/IManagementLockOperations.cs @@ -0,0 +1,236 @@ +// +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure; +using Microsoft.Azure.Management.Resources.Models; + +namespace Microsoft.Azure.Management.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/ResourceManagement/Generated/ManagementLockOperations.cs b/src/ResourceManagement/Generated/ManagementLockOperations.cs new file mode 100644 index 0000000000000..ca3cfee696645 --- /dev/null +++ b/src/ResourceManagement/Generated/ManagementLockOperations.cs @@ -0,0 +1,2316 @@ +// +// 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; +using Microsoft.Azure.Management.Resources; +using Microsoft.Azure.Management.Resources.Models; +using Newtonsoft.Json.Linq; + +namespace Microsoft.Azure.Management.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.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 odatanextLinkValue = responseDoc["@odata.nextLink"]; + if (odatanextLinkValue != null && odatanextLinkValue.Type != JTokenType.Null) + { + string odatanextLinkInstance = ((string)odatanextLinkValue); + result.NextLink = odatanextLinkInstance; + } + } + + } + 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 odatanextLinkValue = responseDoc["@odata.nextLink"]; + if (odatanextLinkValue != null && odatanextLinkValue.Type != JTokenType.Null) + { + string odatanextLinkInstance = ((string)odatanextLinkValue); + result.NextLink = odatanextLinkInstance; + } + } + + } + 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 odatanextLinkValue = responseDoc["@odata.nextLink"]; + if (odatanextLinkValue != null && odatanextLinkValue.Type != JTokenType.Null) + { + string odatanextLinkInstance = ((string)odatanextLinkValue); + result.NextLink = odatanextLinkInstance; + } + } + + } + 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 odatanextLinkValue = responseDoc["@odata.nextLink"]; + if (odatanextLinkValue != null && odatanextLinkValue.Type != JTokenType.Null) + { + string odatanextLinkInstance = ((string)odatanextLinkValue); + result.NextLink = odatanextLinkInstance; + } + } + + } + 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/ResourceManagement/Generated/ManagementLockOperationsExtensions.cs b/src/ResourceManagement/Generated/ManagementLockOperationsExtensions.cs new file mode 100644 index 0000000000000..8f8e632b3349e --- /dev/null +++ b/src/ResourceManagement/Generated/ManagementLockOperationsExtensions.cs @@ -0,0 +1,570 @@ +// +// 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.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Azure; +using Microsoft.Azure.Management.Resources; +using Microsoft.Azure.Management.Resources.Models; + +namespace Microsoft.Azure.Management.Resources +{ + public static partial class ManagementLockOperationsExtensions + { + /// + /// Create or update a management lock at the resource group level. + /// + /// + /// Reference to the + /// Microsoft.Azure.Management.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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/ResourceManagement/Generated/Models/BasicDeployment.cs b/src/ResourceManagement/Generated/Models/BasicDeployment.cs deleted file mode 100644 index b1918273666ef..0000000000000 --- a/src/ResourceManagement/Generated/Models/BasicDeployment.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// 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.Linq; -using Microsoft.Azure.Management.Resources.Models; - -namespace Microsoft.Azure.Management.Resources.Models -{ - /// - /// Deployment create operation parameters. - /// - public partial class BasicDeployment - { - private DeploymentMode _mode; - - /// - /// Optional. Gets or sets the deployment mode. - /// - public DeploymentMode Mode - { - get { return this._mode; } - set { this._mode = value; } - } - - private string _parameters; - - /// - /// Optional. Deployment parameters. Use only one of Parameters or - /// ParametersLink. - /// - public string Parameters - { - get { return this._parameters; } - set { this._parameters = value; } - } - - private ParametersLink _parametersLink; - - /// - /// Optional. Gets or sets the URI referencing the parameters. Use only - /// one of Parameters or ParametersLink. - /// - public ParametersLink ParametersLink - { - get { return this._parametersLink; } - set { this._parametersLink = value; } - } - - private string _template; - - /// - /// Optional. Gets or sets the template content. Use only one of - /// Template or TemplateLink. - /// - public string Template - { - get { return this._template; } - set { this._template = value; } - } - - private TemplateLink _templateLink; - - /// - /// Optional. Gets or sets the URI referencing the template. Use only - /// one of Template or TemplateLink. - /// - public TemplateLink TemplateLink - { - get { return this._templateLink; } - set { this._templateLink = value; } - } - - /// - /// Initializes a new instance of the BasicDeployment class. - /// - public BasicDeployment() - { - } - } -} diff --git a/src/ResourceManagement/Generated/Models/Deployment.cs b/src/ResourceManagement/Generated/Models/Deployment.cs index a2b90e8a9875c..2b557339360d6 100644 --- a/src/ResourceManagement/Generated/Models/Deployment.cs +++ b/src/ResourceManagement/Generated/Models/Deployment.cs @@ -26,36 +26,14 @@ namespace Microsoft.Azure.Management.Resources.Models { /// - /// Deployment information. + /// Deployment operation parameters. /// public partial class Deployment { - 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 DeploymentProperties _properties; /// - /// Optional. Gets or sets deployment properties. + /// Optional. Gets or sets the deployment properties. /// public DeploymentProperties Properties { @@ -69,19 +47,5 @@ public DeploymentProperties Properties public Deployment() { } - - /// - /// Initializes a new instance of the Deployment class with required - /// arguments. - /// - public Deployment(string name) - : this() - { - if (name == null) - { - throw new ArgumentNullException("name"); - } - this.Name = name; - } } } diff --git a/src/ResourceManagement/Generated/Models/DeploymentExtended.cs b/src/ResourceManagement/Generated/Models/DeploymentExtended.cs new file mode 100644 index 0000000000000..646efa0c3bc1b --- /dev/null +++ b/src/ResourceManagement/Generated/Models/DeploymentExtended.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; +using System.Linq; +using Microsoft.Azure.Management.Resources.Models; + +namespace Microsoft.Azure.Management.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/ResourceManagement/Generated/Models/DeploymentGetResult.cs b/src/ResourceManagement/Generated/Models/DeploymentGetResult.cs index 6e678e99c505a..f1fbc9c91c08e 100644 --- a/src/ResourceManagement/Generated/Models/DeploymentGetResult.cs +++ b/src/ResourceManagement/Generated/Models/DeploymentGetResult.cs @@ -31,12 +31,12 @@ namespace Microsoft.Azure.Management.Resources.Models /// public partial class DeploymentGetResult : AzureOperationResponse { - private Deployment _deployment; + private DeploymentExtended _deployment; /// /// Optional. Gets or sets the deployment. /// - public Deployment Deployment + public DeploymentExtended Deployment { get { return this._deployment; } set { this._deployment = value; } diff --git a/src/ResourceManagement/Generated/Models/DeploymentListResult.cs b/src/ResourceManagement/Generated/Models/DeploymentListResult.cs index a1a95a530fb22..352b94acfaac2 100644 --- a/src/ResourceManagement/Generated/Models/DeploymentListResult.cs +++ b/src/ResourceManagement/Generated/Models/DeploymentListResult.cs @@ -33,12 +33,12 @@ namespace Microsoft.Azure.Management.Resources.Models /// public partial class DeploymentListResult : AzureOperationResponse { - private IList _deployments; + private IList _deployments; /// /// Optional. Gets or sets the list of deployments. /// - public IList Deployments + public IList Deployments { get { return this._deployments; } set { this._deployments = value; } @@ -60,7 +60,7 @@ public string NextLink /// public DeploymentListResult() { - this.Deployments = new LazyList(); + this.Deployments = new LazyList(); } } } diff --git a/src/ResourceManagement/Generated/Models/DeploymentOperationsCreateResult.cs b/src/ResourceManagement/Generated/Models/DeploymentOperationsCreateResult.cs index 12a1995c607c2..84f67cd9aa0cf 100644 --- a/src/ResourceManagement/Generated/Models/DeploymentOperationsCreateResult.cs +++ b/src/ResourceManagement/Generated/Models/DeploymentOperationsCreateResult.cs @@ -31,12 +31,12 @@ namespace Microsoft.Azure.Management.Resources.Models /// public partial class DeploymentOperationsCreateResult : AzureOperationResponse { - private Deployment _deployment; + private DeploymentExtended _deployment; /// /// Optional. Gets or sets the deployment. /// - public Deployment Deployment + public DeploymentExtended Deployment { get { return this._deployment; } set { this._deployment = value; } diff --git a/src/ResourceManagement/Generated/Models/DeploymentProperties.cs b/src/ResourceManagement/Generated/Models/DeploymentProperties.cs index f4dc215822b8d..ac4e411beca4e 100644 --- a/src/ResourceManagement/Generated/Models/DeploymentProperties.cs +++ b/src/ResourceManagement/Generated/Models/DeploymentProperties.cs @@ -20,9 +20,7 @@ // code is regenerated. using System; -using System.Collections.Generic; using System.Linq; -using Hyak.Common; using Microsoft.Azure.Management.Resources.Models; namespace Microsoft.Azure.Management.Resources.Models @@ -30,74 +28,65 @@ namespace Microsoft.Azure.Management.Resources.Models /// /// Deployment properties. /// - public partial class DeploymentProperties : BasicDeployment + public partial class DeploymentProperties { - private string _correlationId; + private DeploymentMode _mode; /// - /// Optional. Gets or sets the correlation ID of the deployment. + /// Optional. Gets or sets the deployment mode. /// - public string CorrelationId + public DeploymentMode Mode { - get { return this._correlationId; } - set { this._correlationId = value; } + get { return this._mode; } + set { this._mode = value; } } - private IList _dependencies; + private string _parameters; /// - /// Optional. Gets the list of deployment dependencies. + /// Optional. Deployment parameters. Use only one of Parameters or + /// ParametersLink. /// - public IList Dependencies + public string Parameters { - get { return this._dependencies; } - set { this._dependencies = value; } + get { return this._parameters; } + set { this._parameters = value; } } - private string _outputs; + private ParametersLink _parametersLink; /// - /// Optional. Gets or sets key/value pairs that represent - /// deploymentoutput. + /// Optional. Gets or sets the URI referencing the parameters. Use only + /// one of Parameters or ParametersLink. /// - public string Outputs + public ParametersLink ParametersLink { - get { return this._outputs; } - set { this._outputs = value; } + get { return this._parametersLink; } + set { this._parametersLink = value; } } - private IList _providers; + private string _template; /// - /// Optional. Gets the list of resource providers needed for the - /// deployment. + /// Optional. Gets or sets the template content. Use only one of + /// Template or TemplateLink. /// - public IList Providers + public string Template { - get { return this._providers; } - set { this._providers = value; } + get { return this._template; } + set { this._template = value; } } - private string _provisioningState; + private TemplateLink _templateLink; /// - /// Optional. Gets or sets the state of the provisioning. + /// Optional. Gets or sets the URI referencing the template. Use only + /// one of Template or TemplateLink. /// - public string ProvisioningState + public TemplateLink TemplateLink { - get { return this._provisioningState; } - set { this._provisioningState = value; } - } - - private DateTime _timestamp; - - /// - /// Optional. Gets or sets the timestamp of the template deployment. - /// - public DateTime Timestamp - { - get { return this._timestamp; } - set { this._timestamp = value; } + get { return this._templateLink; } + set { this._templateLink = value; } } /// @@ -105,8 +94,6 @@ public DateTime Timestamp /// public DeploymentProperties() { - this.Dependencies = new LazyList(); - this.Providers = new LazyList(); } } } diff --git a/src/ResourceManagement/Generated/Models/DeploymentPropertiesExtended.cs b/src/ResourceManagement/Generated/Models/DeploymentPropertiesExtended.cs new file mode 100644 index 0000000000000..1ff4eb486bcc7 --- /dev/null +++ b/src/ResourceManagement/Generated/Models/DeploymentPropertiesExtended.cs @@ -0,0 +1,113 @@ +// +// 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 Hyak.Common; +using Microsoft.Azure.Management.Resources.Models; + +namespace Microsoft.Azure.Management.Resources.Models +{ + /// + /// Deployment properties with additional details. + /// + public partial class DeploymentPropertiesExtended : DeploymentProperties + { + private string _correlationId; + + /// + /// Optional. Gets or sets the correlation ID of the deployment. + /// + public string CorrelationId + { + get { return this._correlationId; } + set { this._correlationId = value; } + } + + private IList _dependencies; + + /// + /// Optional. Gets the list of deployment dependencies. + /// + public IList Dependencies + { + get { return this._dependencies; } + set { this._dependencies = value; } + } + + private string _outputs; + + /// + /// Optional. Gets or sets key/value pairs that represent + /// deploymentoutput. + /// + public string Outputs + { + get { return this._outputs; } + set { this._outputs = value; } + } + + private IList _providers; + + /// + /// Optional. Gets the list of resource providers needed for the + /// deployment. + /// + public IList Providers + { + get { return this._providers; } + set { this._providers = value; } + } + + private string _provisioningState; + + /// + /// Optional. Gets or sets the state of the provisioning. + /// + public string ProvisioningState + { + get { return this._provisioningState; } + set { this._provisioningState = value; } + } + + private DateTime _timestamp; + + /// + /// Optional. Gets or sets the timestamp of the template deployment. + /// + public DateTime Timestamp + { + get { return this._timestamp; } + set { this._timestamp = value; } + } + + /// + /// Initializes a new instance of the DeploymentPropertiesExtended + /// class. + /// + public DeploymentPropertiesExtended() + { + this.Dependencies = new LazyList(); + this.Providers = new LazyList(); + } + } +} diff --git a/src/ResourceManagement/Generated/Models/DeploymentValidateResponse.cs b/src/ResourceManagement/Generated/Models/DeploymentValidateResponse.cs index 7ae0924b3e670..57ac4dfe61b13 100644 --- a/src/ResourceManagement/Generated/Models/DeploymentValidateResponse.cs +++ b/src/ResourceManagement/Generated/Models/DeploymentValidateResponse.cs @@ -54,12 +54,12 @@ public bool IsValid set { this._isValid = value; } } - private DeploymentProperties _properties; + private DeploymentPropertiesExtended _properties; /// /// Optional. Gets or sets the template deployment properties. /// - public DeploymentProperties Properties + public DeploymentPropertiesExtended Properties { get { return this._properties; } set { this._properties = value; } diff --git a/src/ResourceManagement/Generated/Models/GenericResource.cs b/src/ResourceManagement/Generated/Models/GenericResource.cs index df730a5213f6a..6a5b09a9ce26c 100644 --- a/src/ResourceManagement/Generated/Models/GenericResource.cs +++ b/src/ResourceManagement/Generated/Models/GenericResource.cs @@ -30,6 +30,17 @@ namespace Microsoft.Azure.Management.Resources.Models /// public partial class GenericResource : ResourceBase { + private Plan _plan; + + /// + /// Optional. Gets or sets the plan of the resource. + /// + public Plan Plan + { + get { return this._plan; } + set { this._plan = value; } + } + private string _properties; /// diff --git a/src/ResourceManagement/Generated/Models/GenericResourceExtended.cs b/src/ResourceManagement/Generated/Models/GenericResourceExtended.cs index 45219264f1ae5..c17a35d82504d 100644 --- a/src/ResourceManagement/Generated/Models/GenericResourceExtended.cs +++ b/src/ResourceManagement/Generated/Models/GenericResourceExtended.cs @@ -30,6 +30,17 @@ namespace Microsoft.Azure.Management.Resources.Models /// public partial class GenericResourceExtended : ResourceBaseExtended { + private Plan _plan; + + /// + /// Optional. Gets or sets the plan of the resource. + /// + public Plan Plan + { + get { return this._plan; } + set { this._plan = value; } + } + private string _properties; /// diff --git a/src/ResourceManagement/Generated/Models/LockLevel.cs b/src/ResourceManagement/Generated/Models/LockLevel.cs new file mode 100644 index 0000000000000..196abe095150b --- /dev/null +++ b/src/ResourceManagement/Generated/Models/LockLevel.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; +using System.Linq; + +namespace Microsoft.Azure.Management.Resources.Models +{ + /// + /// Lock level states. + /// + public static partial class LockLevel + { + /// + /// The lock level is not specified. + /// + public const string NotSpecified = "NotSpecified"; + + /// + /// The lock blocks delete. + /// + public const string CanNotDelete = "CanNotDelete"; + + /// + /// The lock blocks all updates and delete. + /// + public const string ReadOnly = "ReadOnly"; + } +} diff --git a/src/ResourceManagement/Generated/Models/ManagementLockGetQueryParameter.cs b/src/ResourceManagement/Generated/Models/ManagementLockGetQueryParameter.cs new file mode 100644 index 0000000000000..70c7ce1492835 --- /dev/null +++ b/src/ResourceManagement/Generated/Models/ManagementLockGetQueryParameter.cs @@ -0,0 +1,53 @@ +// +// 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.Linq; + +namespace Microsoft.Azure.Management.Resources.Models +{ + /// + /// Management lock get operation scope filter parameters. + /// + public partial class ManagementLockGetQueryParameter + { + private string _atScope; + + /// + /// Optional. Get or sets the atScope parameter. If empty is passed + /// returns all locks at, above or below the scope. Otherwise, returns + /// locks at or above the scope. + /// + public string AtScope + { + get { return this._atScope; } + set { this._atScope = value; } + } + + /// + /// Initializes a new instance of the ManagementLockGetQueryParameter + /// class. + /// + public ManagementLockGetQueryParameter() + { + } + } +} diff --git a/src/ResourceManagement/Generated/Models/ManagementLockListResult.cs b/src/ResourceManagement/Generated/Models/ManagementLockListResult.cs new file mode 100644 index 0000000000000..b7a35d8eba092 --- /dev/null +++ b/src/ResourceManagement/Generated/Models/ManagementLockListResult.cs @@ -0,0 +1,66 @@ +// +// 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 Hyak.Common; +using Microsoft.Azure; +using Microsoft.Azure.Management.Resources.Models; + +namespace Microsoft.Azure.Management.Resources.Models +{ + /// + /// List of management locks. + /// + public partial class ManagementLockListResult : AzureOperationResponse + { + private IList _lock; + + /// + /// Optional. Gets or sets the list of locks. + /// + public IList Lock + { + get { return this._lock; } + set { this._lock = value; } + } + + private string _nextLink; + + /// + /// Optional. Gets or sets the URL to get the next set of results. + /// + public string NextLink + { + get { return this._nextLink; } + set { this._nextLink = value; } + } + + /// + /// Initializes a new instance of the ManagementLockListResult class. + /// + public ManagementLockListResult() + { + this.Lock = new LazyList(); + } + } +} diff --git a/src/ResourceManagement/Generated/Models/ManagementLockObject.cs b/src/ResourceManagement/Generated/Models/ManagementLockObject.cs new file mode 100644 index 0000000000000..1238d47f51005 --- /dev/null +++ b/src/ResourceManagement/Generated/Models/ManagementLockObject.cs @@ -0,0 +1,84 @@ +// +// 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.Linq; +using Microsoft.Azure.Management.Resources.Models; + +namespace Microsoft.Azure.Management.Resources.Models +{ + /// + /// Management lock information. + /// + public partial class ManagementLockObject + { + private string _id; + + /// + /// Optional. Gets or sets the Id of the lock. + /// + public string Id + { + get { return this._id; } + set { this._id = value; } + } + + private string _name; + + /// + /// Optional. Gets or sets the name of the lock. + /// + public string Name + { + get { return this._name; } + set { this._name = value; } + } + + private ManagementLockProperties _properties; + + /// + /// Optional. Gets or sets the properties of the lock. + /// + public ManagementLockProperties Properties + { + get { return this._properties; } + set { this._properties = value; } + } + + private string _type; + + /// + /// Optional. Gets or sets the type of the lock. + /// + public string Type + { + get { return this._type; } + set { this._type = value; } + } + + /// + /// Initializes a new instance of the ManagementLockObject class. + /// + public ManagementLockObject() + { + } + } +} diff --git a/src/ResourceManagement/Generated/Models/ManagementLockProperties.cs b/src/ResourceManagement/Generated/Models/ManagementLockProperties.cs new file mode 100644 index 0000000000000..356c30afde9bb --- /dev/null +++ b/src/ResourceManagement/Generated/Models/ManagementLockProperties.cs @@ -0,0 +1,61 @@ +// +// 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.Linq; + +namespace Microsoft.Azure.Management.Resources.Models +{ + /// + /// The management lock properties. + /// + public partial class ManagementLockProperties + { + private string _level; + + /// + /// Optional. Gets or sets the lock level of the management lock. + /// + public string Level + { + get { return this._level; } + set { this._level = value; } + } + + private string _notes; + + /// + /// Optional. Gets or sets the notes of the management lock. + /// + public string Notes + { + get { return this._notes; } + set { this._notes = value; } + } + + /// + /// Initializes a new instance of the ManagementLockProperties class. + /// + public ManagementLockProperties() + { + } + } +} diff --git a/src/ResourceManagement/Generated/Models/ManagementLockReturnResult.cs b/src/ResourceManagement/Generated/Models/ManagementLockReturnResult.cs new file mode 100644 index 0000000000000..4f404ce539054 --- /dev/null +++ b/src/ResourceManagement/Generated/Models/ManagementLockReturnResult.cs @@ -0,0 +1,52 @@ +// +// 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.Linq; +using Microsoft.Azure; +using Microsoft.Azure.Management.Resources.Models; + +namespace Microsoft.Azure.Management.Resources.Models +{ + /// + /// Management lock information. + /// + public partial class ManagementLockReturnResult : AzureOperationResponse + { + private ManagementLockObject _managementLock; + + /// + /// Optional. Gets or sets the management lock. + /// + public ManagementLockObject ManagementLock + { + get { return this._managementLock; } + set { this._managementLock = value; } + } + + /// + /// Initializes a new instance of the ManagementLockReturnResult class. + /// + public ManagementLockReturnResult() + { + } + } +} diff --git a/src/ResourceManagement/Generated/Models/ResourceBase.cs b/src/ResourceManagement/Generated/Models/ResourceBase.cs index b414e1d221a73..2a1e46b6a1acd 100644 --- a/src/ResourceManagement/Generated/Models/ResourceBase.cs +++ b/src/ResourceManagement/Generated/Models/ResourceBase.cs @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.Linq; using Hyak.Common; -using Microsoft.Azure.Management.Resources.Models; namespace Microsoft.Azure.Management.Resources.Models { @@ -43,17 +42,6 @@ public string Location set { this._location = value; } } - private Plan _plan; - - /// - /// Optional. Gets or sets the plan of the resource. - /// - public Plan Plan - { - get { return this._plan; } - set { this._plan = value; } - } - private IDictionary _tags; /// diff --git a/src/ResourceManagement/Generated/ResourceOperations.cs b/src/ResourceManagement/Generated/ResourceOperations.cs index 07e6d479e6ea6..cb926fa3c24db 100644 --- a/src/ResourceManagement/Generated/ResourceOperations.cs +++ b/src/ResourceManagement/Generated/ResourceOperations.cs @@ -395,20 +395,6 @@ public async Task CreateOrUpdateAsync(string resou genericResourceValue["provisioningState"] = parameters.ProvisioningState; } - genericResourceValue["location"] = parameters.Location; - - if (parameters.Tags != null) - { - JObject tagsDictionary = new JObject(); - foreach (KeyValuePair pair in parameters.Tags) - { - string tagsKey = pair.Key; - string tagsValue = pair.Value; - tagsDictionary[tagsKey] = tagsValue; - } - genericResourceValue["tags"] = tagsDictionary; - } - if (parameters.Plan != null) { JObject planValue = new JObject(); @@ -435,6 +421,20 @@ public async Task CreateOrUpdateAsync(string resou } } + genericResourceValue["location"] = parameters.Location; + + if (parameters.Tags != null) + { + JObject tagsDictionary = new JObject(); + foreach (KeyValuePair pair in parameters.Tags) + { + string tagsKey = pair.Key; + string tagsValue = pair.Value; + tagsDictionary[tagsKey] = tagsValue; + } + genericResourceValue["tags"] = tagsDictionary; + } + 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"); @@ -509,6 +509,41 @@ public async Task CreateOrUpdateAsync(string resou resourceInstance.ProvisioningState = provisioningStateInstance2; } + JToken planValue2 = responseDoc["plan"]; + if (planValue2 != null && planValue2.Type != JTokenType.Null) + { + Plan planInstance = new Plan(); + resourceInstance.Plan = planInstance; + + JToken nameValue = planValue2["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) + { + string nameInstance = ((string)nameValue); + planInstance.Name = nameInstance; + } + + JToken publisherValue = planValue2["publisher"]; + if (publisherValue != null && publisherValue.Type != JTokenType.Null) + { + string publisherInstance = ((string)publisherValue); + planInstance.Publisher = publisherInstance; + } + + JToken productValue = planValue2["product"]; + if (productValue != null && productValue.Type != JTokenType.Null) + { + string productInstance = ((string)productValue); + planInstance.Product = productInstance; + } + + JToken promotionCodeValue = planValue2["promotionCode"]; + if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null) + { + string promotionCodeInstance = ((string)promotionCodeValue); + planInstance.PromotionCode = promotionCodeInstance; + } + } + JToken idValue = responseDoc["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { @@ -516,11 +551,11 @@ public async Task CreateOrUpdateAsync(string resou resourceInstance.Id = idInstance; } - JToken nameValue = responseDoc["name"]; - if (nameValue != null && nameValue.Type != JTokenType.Null) + JToken nameValue2 = responseDoc["name"]; + if (nameValue2 != null && nameValue2.Type != JTokenType.Null) { - string nameInstance = ((string)nameValue); - resourceInstance.Name = nameInstance; + string nameInstance2 = ((string)nameValue2); + resourceInstance.Name = nameInstance2; } JToken typeValue = responseDoc["type"]; @@ -547,41 +582,6 @@ public async Task CreateOrUpdateAsync(string resou resourceInstance.Tags.Add(tagsKey2, tagsValue2); } } - - JToken planValue2 = responseDoc["plan"]; - if (planValue2 != null && planValue2.Type != JTokenType.Null) - { - Plan planInstance = new Plan(); - resourceInstance.Plan = planInstance; - - JToken nameValue2 = planValue2["name"]; - if (nameValue2 != null && nameValue2.Type != JTokenType.Null) - { - string nameInstance2 = ((string)nameValue2); - planInstance.Name = nameInstance2; - } - - JToken publisherValue = planValue2["publisher"]; - if (publisherValue != null && publisherValue.Type != JTokenType.Null) - { - string publisherInstance = ((string)publisherValue); - planInstance.Publisher = publisherInstance; - } - - JToken productValue = planValue2["product"]; - if (productValue != null && productValue.Type != JTokenType.Null) - { - string productInstance = ((string)productValue); - planInstance.Product = productInstance; - } - - JToken promotionCodeValue = planValue2["promotionCode"]; - if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null) - { - string promotionCodeInstance = ((string)promotionCodeValue); - planInstance.PromotionCode = promotionCodeInstance; - } - } } } @@ -978,6 +978,41 @@ public async Task GetAsync(string resourceGroupName, Resource resourceInstance.ProvisioningState = provisioningStateInstance2; } + JToken planValue = responseDoc["plan"]; + if (planValue != null && planValue.Type != JTokenType.Null) + { + Plan planInstance = new Plan(); + resourceInstance.Plan = planInstance; + + JToken nameValue = planValue["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) + { + string nameInstance = ((string)nameValue); + planInstance.Name = nameInstance; + } + + JToken publisherValue = planValue["publisher"]; + if (publisherValue != null && publisherValue.Type != JTokenType.Null) + { + string publisherInstance = ((string)publisherValue); + planInstance.Publisher = publisherInstance; + } + + JToken productValue = planValue["product"]; + if (productValue != null && productValue.Type != JTokenType.Null) + { + string productInstance = ((string)productValue); + planInstance.Product = productInstance; + } + + JToken promotionCodeValue = planValue["promotionCode"]; + if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null) + { + string promotionCodeInstance = ((string)promotionCodeValue); + planInstance.PromotionCode = promotionCodeInstance; + } + } + JToken idValue = responseDoc["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { @@ -985,11 +1020,11 @@ public async Task GetAsync(string resourceGroupName, Resource resourceInstance.Id = idInstance; } - JToken nameValue = responseDoc["name"]; - if (nameValue != null && nameValue.Type != JTokenType.Null) + JToken nameValue2 = responseDoc["name"]; + if (nameValue2 != null && nameValue2.Type != JTokenType.Null) { - string nameInstance = ((string)nameValue); - resourceInstance.Name = nameInstance; + string nameInstance2 = ((string)nameValue2); + resourceInstance.Name = nameInstance2; } JToken typeValue = responseDoc["type"]; @@ -1016,41 +1051,6 @@ public async Task GetAsync(string resourceGroupName, Resource resourceInstance.Tags.Add(tagsKey, tagsValue); } } - - JToken planValue = responseDoc["plan"]; - if (planValue != null && planValue.Type != JTokenType.Null) - { - Plan planInstance = new Plan(); - resourceInstance.Plan = planInstance; - - JToken nameValue2 = planValue["name"]; - if (nameValue2 != null && nameValue2.Type != JTokenType.Null) - { - string nameInstance2 = ((string)nameValue2); - planInstance.Name = nameInstance2; - } - - JToken publisherValue = planValue["publisher"]; - if (publisherValue != null && publisherValue.Type != JTokenType.Null) - { - string publisherInstance = ((string)publisherValue); - planInstance.Publisher = publisherInstance; - } - - JToken productValue = planValue["product"]; - if (productValue != null && productValue.Type != JTokenType.Null) - { - string productInstance = ((string)productValue); - planInstance.Product = productInstance; - } - - JToken promotionCodeValue = planValue["promotionCode"]; - if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null) - { - string promotionCodeInstance = ((string)promotionCodeValue); - planInstance.PromotionCode = promotionCodeInstance; - } - } } } @@ -1253,6 +1253,41 @@ public async Task ListAsync(ResourceListParameters parameter resourceJsonFormatInstance.ProvisioningState = provisioningStateInstance2; } + JToken planValue = valueValue["plan"]; + if (planValue != null && planValue.Type != JTokenType.Null) + { + Plan planInstance = new Plan(); + resourceJsonFormatInstance.Plan = planInstance; + + JToken nameValue = planValue["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) + { + string nameInstance = ((string)nameValue); + planInstance.Name = nameInstance; + } + + JToken publisherValue = planValue["publisher"]; + if (publisherValue != null && publisherValue.Type != JTokenType.Null) + { + string publisherInstance = ((string)publisherValue); + planInstance.Publisher = publisherInstance; + } + + JToken productValue = planValue["product"]; + if (productValue != null && productValue.Type != JTokenType.Null) + { + string productInstance = ((string)productValue); + planInstance.Product = productInstance; + } + + JToken promotionCodeValue = planValue["promotionCode"]; + if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null) + { + string promotionCodeInstance = ((string)promotionCodeValue); + planInstance.PromotionCode = promotionCodeInstance; + } + } + JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { @@ -1260,11 +1295,11 @@ public async Task ListAsync(ResourceListParameters parameter resourceJsonFormatInstance.Id = idInstance; } - JToken nameValue = valueValue["name"]; - if (nameValue != null && nameValue.Type != JTokenType.Null) + JToken nameValue2 = valueValue["name"]; + if (nameValue2 != null && nameValue2.Type != JTokenType.Null) { - string nameInstance = ((string)nameValue); - resourceJsonFormatInstance.Name = nameInstance; + string nameInstance2 = ((string)nameValue2); + resourceJsonFormatInstance.Name = nameInstance2; } JToken typeValue = valueValue["type"]; @@ -1291,41 +1326,6 @@ public async Task ListAsync(ResourceListParameters parameter resourceJsonFormatInstance.Tags.Add(tagsKey, tagsValue); } } - - JToken planValue = valueValue["plan"]; - if (planValue != null && planValue.Type != JTokenType.Null) - { - Plan planInstance = new Plan(); - resourceJsonFormatInstance.Plan = planInstance; - - JToken nameValue2 = planValue["name"]; - if (nameValue2 != null && nameValue2.Type != JTokenType.Null) - { - string nameInstance2 = ((string)nameValue2); - planInstance.Name = nameInstance2; - } - - JToken publisherValue = planValue["publisher"]; - if (publisherValue != null && publisherValue.Type != JTokenType.Null) - { - string publisherInstance = ((string)publisherValue); - planInstance.Publisher = publisherInstance; - } - - JToken productValue = planValue["product"]; - if (productValue != null && productValue.Type != JTokenType.Null) - { - string productInstance = ((string)productValue); - planInstance.Product = productInstance; - } - - JToken promotionCodeValue = planValue["promotionCode"]; - if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null) - { - string promotionCodeInstance = ((string)promotionCodeValue); - planInstance.PromotionCode = promotionCodeInstance; - } - } } } @@ -1493,6 +1493,41 @@ public async Task ListNextAsync(string nextLink, Cancellatio resourceJsonFormatInstance.ProvisioningState = provisioningStateInstance2; } + JToken planValue = valueValue["plan"]; + if (planValue != null && planValue.Type != JTokenType.Null) + { + Plan planInstance = new Plan(); + resourceJsonFormatInstance.Plan = planInstance; + + JToken nameValue = planValue["name"]; + if (nameValue != null && nameValue.Type != JTokenType.Null) + { + string nameInstance = ((string)nameValue); + planInstance.Name = nameInstance; + } + + JToken publisherValue = planValue["publisher"]; + if (publisherValue != null && publisherValue.Type != JTokenType.Null) + { + string publisherInstance = ((string)publisherValue); + planInstance.Publisher = publisherInstance; + } + + JToken productValue = planValue["product"]; + if (productValue != null && productValue.Type != JTokenType.Null) + { + string productInstance = ((string)productValue); + planInstance.Product = productInstance; + } + + JToken promotionCodeValue = planValue["promotionCode"]; + if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null) + { + string promotionCodeInstance = ((string)promotionCodeValue); + planInstance.PromotionCode = promotionCodeInstance; + } + } + JToken idValue = valueValue["id"]; if (idValue != null && idValue.Type != JTokenType.Null) { @@ -1500,11 +1535,11 @@ public async Task ListNextAsync(string nextLink, Cancellatio resourceJsonFormatInstance.Id = idInstance; } - JToken nameValue = valueValue["name"]; - if (nameValue != null && nameValue.Type != JTokenType.Null) + JToken nameValue2 = valueValue["name"]; + if (nameValue2 != null && nameValue2.Type != JTokenType.Null) { - string nameInstance = ((string)nameValue); - resourceJsonFormatInstance.Name = nameInstance; + string nameInstance2 = ((string)nameValue2); + resourceJsonFormatInstance.Name = nameInstance2; } JToken typeValue = valueValue["type"]; @@ -1531,41 +1566,6 @@ public async Task ListNextAsync(string nextLink, Cancellatio resourceJsonFormatInstance.Tags.Add(tagsKey, tagsValue); } } - - JToken planValue = valueValue["plan"]; - if (planValue != null && planValue.Type != JTokenType.Null) - { - Plan planInstance = new Plan(); - resourceJsonFormatInstance.Plan = planInstance; - - JToken nameValue2 = planValue["name"]; - if (nameValue2 != null && nameValue2.Type != JTokenType.Null) - { - string nameInstance2 = ((string)nameValue2); - planInstance.Name = nameInstance2; - } - - JToken publisherValue = planValue["publisher"]; - if (publisherValue != null && publisherValue.Type != JTokenType.Null) - { - string publisherInstance = ((string)publisherValue); - planInstance.Publisher = publisherInstance; - } - - JToken productValue = planValue["product"]; - if (productValue != null && productValue.Type != JTokenType.Null) - { - string productInstance = ((string)productValue); - planInstance.Product = productInstance; - } - - JToken promotionCodeValue = planValue["promotionCode"]; - if (promotionCodeValue != null && promotionCodeValue.Type != JTokenType.Null) - { - string promotionCodeInstance = ((string)promotionCodeValue); - planInstance.PromotionCode = promotionCodeInstance; - } - } } } diff --git a/src/ResourceManagement/Microsoft.Azure.Management.Resources.nuget.proj b/src/ResourceManagement/Microsoft.Azure.Management.Resources.nuget.proj index 9f8ea1fa10cf4..abd939c0670f5 100644 --- a/src/ResourceManagement/Microsoft.Azure.Management.Resources.nuget.proj +++ b/src/ResourceManagement/Microsoft.Azure.Management.Resources.nuget.proj @@ -5,7 +5,7 @@ Microsoft.Azure.Management.Resources --> - 2.15.0-preview + 2.17.0-preview $(MSBuildThisFileDirectory) diff --git a/src/ResourceManagement/Properties/AssemblyInfo.cs b/src/ResourceManagement/Properties/AssemblyInfo.cs index 628260301f4a1..5ec3a890c8d24 100644 --- a/src/ResourceManagement/Properties/AssemblyInfo.cs +++ b/src/ResourceManagement/Properties/AssemblyInfo.cs @@ -21,7 +21,7 @@ [assembly: AssemblyDescription("Provides Microsoft Azure resource management operations including Resource Groups.")] [assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("2.15.0.0")] +[assembly: AssemblyFileVersion("2.17.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] diff --git a/src/SqlManagement2/Properties/AssemblyInfo.cs b/src/SqlManagement2/Properties/AssemblyInfo.cs index f1fbc862953d2..7f5a1130ec885 100644 --- a/src/SqlManagement2/Properties/AssemblyInfo.cs +++ b/src/SqlManagement2/Properties/AssemblyInfo.cs @@ -21,7 +21,7 @@ [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure SQL.")] [assembly: AssemblyVersion("0.9.0.0")] -[assembly: AssemblyFileVersion("0.19.0.0")] +[assembly: AssemblyFileVersion("0.20.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] diff --git a/src/StorageManagement/Generated/StorageAccountOperations.cs b/src/StorageManagement/Generated/StorageAccountOperations.cs index 215651d853aa6..42074e2452034 100644 --- a/src/StorageManagement/Generated/StorageAccountOperations.cs +++ b/src/StorageManagement/Generated/StorageAccountOperations.cs @@ -901,7 +901,7 @@ public async Task GetAsync(string accountName, Cancel XElement lastGeoFailoverTimeElement = storageServicePropertiesElement.Element(XName.Get("LastGeoFailoverTime", "http://schemas.microsoft.com/windowsazure")); if (lastGeoFailoverTimeElement != null && !string.IsNullOrEmpty(lastGeoFailoverTimeElement.Value)) { - DateTime lastGeoFailoverTimeInstance = DateTime.Parse(lastGeoFailoverTimeElement.Value, CultureInfo.InvariantCulture); + DateTime lastGeoFailoverTimeInstance = DateTime.Parse(lastGeoFailoverTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); storageServicePropertiesInstance.LastGeoFailoverTime = lastGeoFailoverTimeInstance; } @@ -1332,7 +1332,7 @@ public async Task ListAsync(CancellationToken cancel XElement lastGeoFailoverTimeElement = storageServicePropertiesElement.Element(XName.Get("LastGeoFailoverTime", "http://schemas.microsoft.com/windowsazure")); if (lastGeoFailoverTimeElement != null && !string.IsNullOrEmpty(lastGeoFailoverTimeElement.Value)) { - DateTime lastGeoFailoverTimeInstance = DateTime.Parse(lastGeoFailoverTimeElement.Value, CultureInfo.InvariantCulture); + DateTime lastGeoFailoverTimeInstance = DateTime.Parse(lastGeoFailoverTimeElement.Value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal).ToLocalTime(); storageServicePropertiesInstance.LastGeoFailoverTime = lastGeoFailoverTimeInstance; } diff --git a/src/StorageManagement/Microsoft.WindowsAzure.Management.Storage.nuget.proj b/src/StorageManagement/Microsoft.WindowsAzure.Management.Storage.nuget.proj index 7e78990dcdeda..4917db4899cc3 100644 --- a/src/StorageManagement/Microsoft.WindowsAzure.Management.Storage.nuget.proj +++ b/src/StorageManagement/Microsoft.WindowsAzure.Management.Storage.nuget.proj @@ -5,7 +5,7 @@ Microsoft.WindowsAzure.Management.Storage --> - 5.1.0 + 5.1.1 $(MSBuildThisFileDirectory) diff --git a/src/StorageManagement/Properties/AssemblyInfo.cs b/src/StorageManagement/Properties/AssemblyInfo.cs index 4bcb2f125e3eb..dfceac75b7f41 100644 --- a/src/StorageManagement/Properties/AssemblyInfo.cs +++ b/src/StorageManagement/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Storage Service.")] [assembly: AssemblyVersion("5.0.0.0")] -[assembly: AssemblyFileVersion("5.1.0.0")] +[assembly: AssemblyFileVersion("5.1.1.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] diff --git a/tools/nuget.targets b/tools/nuget.targets index ea242be8ad74d..b25581a49f5f0 100644 --- a/tools/nuget.targets +++ b/tools/nuget.targets @@ -13,8 +13,8 @@ Condition=" '$(Scope)' == 'Authentication' "/> - + normal