From 77f5144dcc75ebaa9b58ca341d73b5a0adcbec0b Mon Sep 17 00:00:00 2001 From: Shubham Dhond Date: Sun, 7 Jun 2020 20:16:53 -0700 Subject: [PATCH] [App Service] Azure .NET SDK update for Powershell (#12380) --- .../mgmtmetadata/web_resource-manager.txt | 6 +- .../src/Generated/IWebAppsOperations.cs | 149 +++ .../src/Generated/Models/ApiKVReference.cs | 9 +- .../Models/AppServicePlanPatchResource.cs | 15 +- ...PublishingCredentialsPoliciesCollection.cs | 94 ++ .../CsmPublishingCredentialsPoliciesEntity.cs | 75 ++ .../Models/KeyVaultReferenceResource.cs | 9 +- .../Models/ManagedServiceIdentity.cs | 6 +- .../Models/ManagedServiceIdentityType.cs | 20 +- .../SdkInfo_WebSiteManagementClient.cs | 4 +- .../src/Generated/WebAppsOperations.cs | 1083 +++++++++++++++++ .../Generated/WebAppsOperationsExtensions.cs | 246 ++++ ...Microsoft.Azure.Management.Websites.csproj | 4 +- .../src/Properties/AssemblyInfo.cs | 4 +- 14 files changed, 1693 insertions(+), 31 deletions(-) create mode 100644 sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/CsmPublishingCredentialsPoliciesCollection.cs create mode 100644 sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/CsmPublishingCredentialsPoliciesEntity.cs diff --git a/eng/mgmt/mgmtmetadata/web_resource-manager.txt b/eng/mgmt/mgmtmetadata/web_resource-manager.txt index cdbabccdb095..3afc786fad26 100644 --- a/eng/mgmt/mgmtmetadata/web_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/web_resource-manager.txt @@ -3,12 +3,12 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/web/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=K:\DotNet-SDK\latest\azure-sdk-for-net\sdk -2020-04-21 08:47:41 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/web/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=E:\github\azure-sdk-for-net\sdk +2020-06-05 06:44:53 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 7fdcacc0b1bec9942938067b2594ec5447041050 +Commit: 4e744672338f604d8f7193c359d340832074e9e6 AutoRest information Requested version: v2 Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/IWebAppsOperations.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/IWebAppsOperations.cs index 7d7ccea278e7..2588d8931036 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/IWebAppsOperations.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/IWebAppsOperations.cs @@ -460,6 +460,155 @@ public partial interface IWebAppsOperations /// Task RestoreWithHttpMessagesAsync(string resourceGroupName, string name, string backupId, RestoreRequest request, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Returns whether Scm basic auth is allowed and whether Ftp is + /// allowed for a given site. + /// + /// + /// Description for Returns whether Scm basic auth is allowed and + /// whether Ftp is allowed for a given site. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetBasicPublishingCredentialsPoliciesWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns whether FTP is allowed on the site or not. + /// + /// + /// Description for Returns whether FTP is allowed on the site or not. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetFtpAllowedWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates whether FTP is allowed on the site or not. + /// + /// + /// Description for Updates whether FTP is allowed on the site or not. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateFtpAllowedWithHttpMessagesAsync(string resourceGroupName, string name, CsmPublishingCredentialsPoliciesEntity csmPublishingAccessPoliciesEntity, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns whether Scm basic auth is allowed on the site or not. + /// + /// + /// Description for Returns whether Scm basic auth is allowed on the + /// site or not. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetScmAllowedWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates whether user publishing credentials are allowed on the site + /// or not. + /// + /// + /// Description for Updates whether user publishing credentials are + /// allowed on the site or not. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateScmAllowedWithHttpMessagesAsync(string resourceGroupName, string name, CsmPublishingCredentialsPoliciesEntity csmPublishingAccessPoliciesEntity, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// List the configurations of an app /// /// diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ApiKVReference.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ApiKVReference.cs index 03ac32368367..89e9a6e20a42 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ApiKVReference.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ApiKVReference.cs @@ -33,8 +33,9 @@ public ApiKVReference() /// 'Resolved', 'InvalidSyntax', 'MSINotEnabled', 'VaultNotFound', /// 'SecretNotFound', 'SecretVersionNotFound', /// 'AccessToKeyVaultDenied', 'OtherReasons' - /// Possible values include: 'None', - /// 'SystemAssigned', 'UserAssigned' + /// Possible values include: + /// 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', + /// 'None' /// Possible values include: 'KeyVault' /// Possible values include: /// 'ApplicationSetting' @@ -87,8 +88,8 @@ public ApiKVReference() public string SecretVersion { get; set; } /// - /// Gets or sets possible values include: 'None', 'SystemAssigned', - /// 'UserAssigned' + /// Gets or sets possible values include: 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' /// [JsonProperty(PropertyName = "identityType")] public ManagedServiceIdentityType? IdentityType { get; set; } diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/AppServicePlanPatchResource.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/AppServicePlanPatchResource.cs index 127bc05ced1e..55716222a405 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/AppServicePlanPatchResource.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/AppServicePlanPatchResource.cs @@ -66,9 +66,11 @@ public AppServicePlanPatchResource() /// free offer expires. /// Resource group of the App Service /// plan. - /// If Linux app service plan - /// <code>true</code>, <code>false</code> - /// otherwise. + /// This needs to set to + /// <code>true</code> when creating a Linux App Service + /// Plan, along with <code>kind</code> set to + /// <code>Linux</code>. It should be + /// <code>false</code> otherwise. /// Obsolete: If Hyper-V container app service /// plan <code>true</code>, <code>false</code> /// otherwise. @@ -198,8 +200,11 @@ public AppServicePlanPatchResource() public string ResourceGroup { get; private set; } /// - /// Gets or sets if Linux app service plan - /// &lt;code&gt;true&lt;/code&gt;, + /// Gets or sets this needs to set to + /// &lt;code&gt;true&lt;/code&gt; when creating a Linux + /// App Service Plan, along with + /// &lt;code&gt;kind&lt;/code&gt; set to + /// &lt;code&gt;Linux&lt;/code&gt;. It should be /// &lt;code&gt;false&lt;/code&gt; otherwise. /// [JsonProperty(PropertyName = "properties.reserved")] diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/CsmPublishingCredentialsPoliciesCollection.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/CsmPublishingCredentialsPoliciesCollection.cs new file mode 100644 index 000000000000..364b186fed71 --- /dev/null +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/CsmPublishingCredentialsPoliciesCollection.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.WebSites.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Publishing Credentials Policies collection. + /// + [Rest.Serialization.JsonTransformation] + public partial class CsmPublishingCredentialsPoliciesCollection : ProxyOnlyResource + { + /// + /// Initializes a new instance of the + /// CsmPublishingCredentialsPoliciesCollection class. + /// + public CsmPublishingCredentialsPoliciesCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CsmPublishingCredentialsPoliciesCollection class. + /// + /// Whether FTP is allowed. + /// Whether Scm Basic Auth is allowed. + /// Resource Id. + /// Resource Name. + /// Kind of resource. + /// Resource type. + public CsmPublishingCredentialsPoliciesCollection(CsmPublishingCredentialsPoliciesEntity ftp, CsmPublishingCredentialsPoliciesEntity scm, string id = default(string), string name = default(string), string kind = default(string), string type = default(string)) + : base(id, name, kind, type) + { + Ftp = ftp; + Scm = scm; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether FTP is allowed. + /// + [JsonProperty(PropertyName = "properties.ftp")] + public CsmPublishingCredentialsPoliciesEntity Ftp { get; set; } + + /// + /// Gets or sets whether Scm Basic Auth is allowed. + /// + [JsonProperty(PropertyName = "properties.scm")] + public CsmPublishingCredentialsPoliciesEntity Scm { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Ftp == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Ftp"); + } + if (Scm == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Scm"); + } + if (Ftp != null) + { + Ftp.Validate(); + } + if (Scm != null) + { + Scm.Validate(); + } + } + } +} diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/CsmPublishingCredentialsPoliciesEntity.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/CsmPublishingCredentialsPoliciesEntity.cs new file mode 100644 index 000000000000..3b389e6e76fa --- /dev/null +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/CsmPublishingCredentialsPoliciesEntity.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.WebSites.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Publishing Credentials Policies parameters. + /// + [Rest.Serialization.JsonTransformation] + public partial class CsmPublishingCredentialsPoliciesEntity : ProxyOnlyResource + { + /// + /// Initializes a new instance of the + /// CsmPublishingCredentialsPoliciesEntity class. + /// + public CsmPublishingCredentialsPoliciesEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CsmPublishingCredentialsPoliciesEntity class. + /// + /// <code>true</code> to allow access + /// to a publishing method; otherwise, + /// <code>false</code>. + /// Resource Id. + /// Resource Name. + /// Kind of resource. + /// Resource type. + public CsmPublishingCredentialsPoliciesEntity(bool allow, string id = default(string), string name = default(string), string kind = default(string), string type = default(string)) + : base(id, name, kind, type) + { + Allow = allow; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets &lt;code&gt;true&lt;/code&gt; to allow + /// access to a publishing method; otherwise, + /// &lt;code&gt;false&lt;/code&gt;. + /// + [JsonProperty(PropertyName = "properties.allow")] + public bool Allow { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/KeyVaultReferenceResource.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/KeyVaultReferenceResource.cs index 625646f05b9b..77369aa724b0 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/KeyVaultReferenceResource.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/KeyVaultReferenceResource.cs @@ -40,8 +40,9 @@ public KeyVaultReferenceResource() /// 'Resolved', 'InvalidSyntax', 'MSINotEnabled', 'VaultNotFound', /// 'SecretNotFound', 'SecretVersionNotFound', /// 'AccessToKeyVaultDenied', 'OtherReasons' - /// Possible values include: 'None', - /// 'SystemAssigned', 'UserAssigned' + /// Possible values include: + /// 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', + /// 'None' /// Possible values include: 'KeyVault' /// Possible values include: /// 'ApplicationSetting' @@ -95,8 +96,8 @@ public KeyVaultReferenceResource() public string SecretVersion { get; set; } /// - /// Gets or sets possible values include: 'None', 'SystemAssigned', - /// 'UserAssigned' + /// Gets or sets possible values include: 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned, UserAssigned', 'None' /// [JsonProperty(PropertyName = "properties.identityType")] public ManagedServiceIdentityType? IdentityType { get; set; } diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ManagedServiceIdentity.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ManagedServiceIdentity.cs index 4cfd54166a17..2063a4bd6055 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ManagedServiceIdentity.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ManagedServiceIdentity.cs @@ -32,7 +32,8 @@ public ManagedServiceIdentity() /// Initializes a new instance of the ManagedServiceIdentity class. /// /// Type of managed service identity. Possible - /// values include: 'None', 'SystemAssigned', 'UserAssigned' + /// values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + /// UserAssigned', 'None' /// Tenant of managed service identity. /// Principal Id of managed service /// identity. @@ -56,7 +57,8 @@ public ManagedServiceIdentity() /// /// Gets or sets type of managed service identity. Possible values - /// include: 'None', 'SystemAssigned', 'UserAssigned' + /// include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, + /// UserAssigned', 'None' /// [JsonProperty(PropertyName = "type")] public ManagedServiceIdentityType? Type { get; set; } diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ManagedServiceIdentityType.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ManagedServiceIdentityType.cs index 9b91a7579271..c03bf44b3d17 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ManagedServiceIdentityType.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/Models/ManagedServiceIdentityType.cs @@ -21,12 +21,14 @@ namespace Microsoft.Azure.Management.WebSites.Models [JsonConverter(typeof(StringEnumConverter))] public enum ManagedServiceIdentityType { - [EnumMember(Value = "None")] - None, [EnumMember(Value = "SystemAssigned")] SystemAssigned, [EnumMember(Value = "UserAssigned")] - UserAssigned + UserAssigned, + [EnumMember(Value = "SystemAssigned, UserAssigned")] + SystemAssignedUserAssigned, + [EnumMember(Value = "None")] + None } internal static class ManagedServiceIdentityTypeEnumExtension { @@ -39,12 +41,14 @@ internal static string ToSerializedValue(this ManagedServiceIdentityType value) { switch( value ) { - case ManagedServiceIdentityType.None: - return "None"; case ManagedServiceIdentityType.SystemAssigned: return "SystemAssigned"; case ManagedServiceIdentityType.UserAssigned: return "UserAssigned"; + case ManagedServiceIdentityType.SystemAssignedUserAssigned: + return "SystemAssigned, UserAssigned"; + case ManagedServiceIdentityType.None: + return "None"; } return null; } @@ -53,12 +57,14 @@ internal static string ToSerializedValue(this ManagedServiceIdentityType value) { switch( value ) { - case "None": - return ManagedServiceIdentityType.None; case "SystemAssigned": return ManagedServiceIdentityType.SystemAssigned; case "UserAssigned": return ManagedServiceIdentityType.UserAssigned; + case "SystemAssigned, UserAssigned": + return ManagedServiceIdentityType.SystemAssignedUserAssigned; + case "None": + return ManagedServiceIdentityType.None; } return null; } diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/SdkInfo_WebSiteManagementClient.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/SdkInfo_WebSiteManagementClient.cs index 0b186c4214bf..6a2ad6e602d2 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/SdkInfo_WebSiteManagementClient.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/SdkInfo_WebSiteManagementClient.cs @@ -56,10 +56,10 @@ public static IEnumerable> ApiInfo_WebSiteManageme // BEGIN: Code Generation Metadata Section public static readonly String AutoRestVersion = "v2"; public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/web/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=K:\\DotNet-SDK\\latest\\azure-sdk-for-net\\sdk"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/web/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=E:\\github\\azure-sdk-for-net\\sdk"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "7fdcacc0b1bec9942938067b2594ec5447041050"; + public static readonly String GithubCommidId = "4e744672338f604d8f7193c359d340832074e9e6"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/WebAppsOperations.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/WebAppsOperations.cs index 9dc7d8bc6418..2e4ef43d82de 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/WebAppsOperations.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/WebAppsOperations.cs @@ -2680,6 +2680,1089 @@ internal WebAppsOperations(WebSiteManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Returns whether Scm basic auth is allowed and whether Ftp is allowed for a + /// given site. + /// + /// + /// Description for Returns whether Scm basic auth is allowed and whether Ftp + /// is allowed for a given site. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetBasicPublishingCredentialsPoliciesWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+[^\\.]$"); + } + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetBasicPublishingCredentialsPolicies", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new DefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + DefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns whether FTP is allowed on the site or not. + /// + /// + /// Description for Returns whether FTP is allowed on the site or not. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetFtpAllowedWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+[^\\.]$"); + } + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetFtpAllowed", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new DefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + DefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates whether FTP is allowed on the site or not. + /// + /// + /// Description for Updates whether FTP is allowed on the site or not. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateFtpAllowedWithHttpMessagesAsync(string resourceGroupName, string name, CsmPublishingCredentialsPoliciesEntity csmPublishingAccessPoliciesEntity, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+[^\\.]$"); + } + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (csmPublishingAccessPoliciesEntity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "csmPublishingAccessPoliciesEntity"); + } + if (csmPublishingAccessPoliciesEntity != null) + { + csmPublishingAccessPoliciesEntity.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("csmPublishingAccessPoliciesEntity", csmPublishingAccessPoliciesEntity); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateFtpAllowed", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/ftp").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(csmPublishingAccessPoliciesEntity != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(csmPublishingAccessPoliciesEntity, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new DefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + DefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns whether Scm basic auth is allowed on the site or not. + /// + /// + /// Description for Returns whether Scm basic auth is allowed on the site or + /// not. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetScmAllowedWithHttpMessagesAsync(string resourceGroupName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+[^\\.]$"); + } + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetScmAllowed", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new DefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + DefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates whether user publishing credentials are allowed on the site or not. + /// + /// + /// Description for Updates whether user publishing credentials are allowed on + /// the site or not. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateScmAllowedWithHttpMessagesAsync(string resourceGroupName, string name, CsmPublishingCredentialsPoliciesEntity csmPublishingAccessPoliciesEntity, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+[^\\.]$"); + } + } + if (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (csmPublishingAccessPoliciesEntity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "csmPublishingAccessPoliciesEntity"); + } + if (csmPublishingAccessPoliciesEntity != null) + { + csmPublishingAccessPoliciesEntity.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("name", name); + tracingParameters.Add("csmPublishingAccessPoliciesEntity", csmPublishingAccessPoliciesEntity); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateScmAllowed", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/basicPublishingCredentialsPolicies/scm").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(csmPublishingAccessPoliciesEntity != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(csmPublishingAccessPoliciesEntity, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new DefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + DefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// List the configurations of an app /// diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/WebAppsOperationsExtensions.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/WebAppsOperationsExtensions.cs index c7f958ef25be..d5e9d19774b7 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/WebAppsOperationsExtensions.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Generated/WebAppsOperationsExtensions.cs @@ -766,6 +766,252 @@ public static void Restore(this IWebAppsOperations operations, string resourceGr (await operations.RestoreWithHttpMessagesAsync(resourceGroupName, name, backupId, request, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Returns whether Scm basic auth is allowed and whether Ftp is allowed for a + /// given site. + /// + /// + /// Description for Returns whether Scm basic auth is allowed and whether Ftp + /// is allowed for a given site. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + public static CsmPublishingCredentialsPoliciesCollection GetBasicPublishingCredentialsPolicies(this IWebAppsOperations operations, string resourceGroupName, string name) + { + return operations.GetBasicPublishingCredentialsPoliciesAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Returns whether Scm basic auth is allowed and whether Ftp is allowed for a + /// given site. + /// + /// + /// Description for Returns whether Scm basic auth is allowed and whether Ftp + /// is allowed for a given site. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// The cancellation token. + /// + public static async Task GetBasicPublishingCredentialsPoliciesAsync(this IWebAppsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetBasicPublishingCredentialsPoliciesWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns whether FTP is allowed on the site or not. + /// + /// + /// Description for Returns whether FTP is allowed on the site or not. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + public static CsmPublishingCredentialsPoliciesEntity GetFtpAllowed(this IWebAppsOperations operations, string resourceGroupName, string name) + { + return operations.GetFtpAllowedAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Returns whether FTP is allowed on the site or not. + /// + /// + /// Description for Returns whether FTP is allowed on the site or not. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// The cancellation token. + /// + public static async Task GetFtpAllowedAsync(this IWebAppsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetFtpAllowedWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates whether FTP is allowed on the site or not. + /// + /// + /// Description for Updates whether FTP is allowed on the site or not. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// + public static CsmPublishingCredentialsPoliciesEntity UpdateFtpAllowed(this IWebAppsOperations operations, string resourceGroupName, string name, CsmPublishingCredentialsPoliciesEntity csmPublishingAccessPoliciesEntity) + { + return operations.UpdateFtpAllowedAsync(resourceGroupName, name, csmPublishingAccessPoliciesEntity).GetAwaiter().GetResult(); + } + + /// + /// Updates whether FTP is allowed on the site or not. + /// + /// + /// Description for Updates whether FTP is allowed on the site or not. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateFtpAllowedAsync(this IWebAppsOperations operations, string resourceGroupName, string name, CsmPublishingCredentialsPoliciesEntity csmPublishingAccessPoliciesEntity, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateFtpAllowedWithHttpMessagesAsync(resourceGroupName, name, csmPublishingAccessPoliciesEntity, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns whether Scm basic auth is allowed on the site or not. + /// + /// + /// Description for Returns whether Scm basic auth is allowed on the site or + /// not. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + public static CsmPublishingCredentialsPoliciesEntity GetScmAllowed(this IWebAppsOperations operations, string resourceGroupName, string name) + { + return operations.GetScmAllowedAsync(resourceGroupName, name).GetAwaiter().GetResult(); + } + + /// + /// Returns whether Scm basic auth is allowed on the site or not. + /// + /// + /// Description for Returns whether Scm basic auth is allowed on the site or + /// not. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// The cancellation token. + /// + public static async Task GetScmAllowedAsync(this IWebAppsOperations operations, string resourceGroupName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetScmAllowedWithHttpMessagesAsync(resourceGroupName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates whether user publishing credentials are allowed on the site or not. + /// + /// + /// Description for Updates whether user publishing credentials are allowed on + /// the site or not. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// + public static CsmPublishingCredentialsPoliciesEntity UpdateScmAllowed(this IWebAppsOperations operations, string resourceGroupName, string name, CsmPublishingCredentialsPoliciesEntity csmPublishingAccessPoliciesEntity) + { + return operations.UpdateScmAllowedAsync(resourceGroupName, name, csmPublishingAccessPoliciesEntity).GetAwaiter().GetResult(); + } + + /// + /// Updates whether user publishing credentials are allowed on the site or not. + /// + /// + /// Description for Updates whether user publishing credentials are allowed on + /// the site or not. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group to which the resource belongs. + /// + /// + /// Name of the app. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateScmAllowedAsync(this IWebAppsOperations operations, string resourceGroupName, string name, CsmPublishingCredentialsPoliciesEntity csmPublishingAccessPoliciesEntity, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateScmAllowedWithHttpMessagesAsync(resourceGroupName, name, csmPublishingAccessPoliciesEntity, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// List the configurations of an app /// diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Microsoft.Azure.Management.Websites.csproj b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Microsoft.Azure.Management.Websites.csproj index d7362646cedb..a068c0ee243d 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Microsoft.Azure.Management.Websites.csproj +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Microsoft.Azure.Management.Websites.csproj @@ -7,9 +7,9 @@ Microsoft.Azure.Management.Websites Provides website management capabilities for Microsoft Azure. Microsoft.Azure.Management.Websites - 3.0.0 + 3.0.1 Microsoft Azure website management;website management; - + $(SdkTargetFx) diff --git a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Properties/AssemblyInfo.cs b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Properties/AssemblyInfo.cs index 14bef01787e9..34ac919a3965 100644 --- a/sdk/websites/Microsoft.Azure.Management.WebSites/src/Properties/AssemblyInfo.cs +++ b/sdk/websites/Microsoft.Azure.Management.WebSites/src/Properties/AssemblyInfo.cs @@ -8,8 +8,8 @@ [assembly: AssemblyTitle("Microsoft Azure Web Sites Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Web Sites.")] -[assembly: AssemblyVersion("2.0.0")] -[assembly: AssemblyFileVersion("2.2.0")] +[assembly: AssemblyVersion("3.0.0")] +[assembly: AssemblyFileVersion("3.0.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")]