From 38193e0b4c131d2071be96163c54060886b7ad82 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 19 Jul 2021 18:36:03 +0000 Subject: [PATCH] CodeGen from PR 15239 in Azure/azure-rest-api-specs Merge 7c001c6819ff1f38b53a743c6b073f5c9ebeada4 into e7682aa897902920f3a95b2f358b6f7729d18666 --- .../src/Generated/AzureBotServiceClient.cs | 94 +- .../src/Generated/BotConnectionOperations.cs | 1890 +++++++++++++++++ .../BotConnectionOperationsExtensions.cs | 370 ++++ .../src/Generated/BotsOperations.cs | 91 +- .../src/Generated/BotsOperationsExtensions.cs | 24 +- .../src/Generated/ChannelsOperations.cs | 116 +- .../Generated/ChannelsOperationsExtensions.cs | 52 +- .../src/Generated/DirectLineOperations.cs | 300 +++ .../DirectLineOperationsExtensions.cs | 81 + .../src/Generated/HostSettingsOperations.cs | 228 ++ .../HostSettingsOperationsExtensions.cs | 55 + .../src/Generated/IAzureBotServiceClient.cs | 44 +- .../src/Generated/IBotConnectionOperations.cs | 239 +++ .../src/Generated/IBotsOperations.cs | 12 +- .../src/Generated/IChannelsOperations.cs | 35 +- .../src/Generated/IDirectLineOperations.cs | 61 + .../src/Generated/IHostSettingsOperations.cs | 47 + .../Generated/IOperationResultsOperations.cs | 71 + .../src/Generated/IOperations.cs | 4 +- .../IPrivateEndpointConnectionsOperations.cs | 142 ++ .../IPrivateLinkResourcesOperations.cs | 52 + .../src/Generated/Models/AlexaChannel.cs | 66 + .../Models/AlexaChannelProperties.cs | 92 + .../src/Generated/Models/Bot.cs | 4 +- .../src/Generated/Models/BotChannel.cs | 4 +- .../src/Generated/Models/BotProperties.cs | 65 +- .../src/Generated/Models/ChannelName.cs | 20 +- .../Generated/Models/ConnectionItemName.cs | 52 + .../src/Generated/Models/ConnectionSetting.cs | 77 + .../Models/ConnectionSettingParameter.cs | 62 + .../Models/ConnectionSettingProperties.cs | 113 + .../src/Generated/Models/DirectLineSite.cs | 37 +- .../Models/DirectLineSpeechChannel.cs | 66 + .../DirectLineSpeechChannelProperties.cs | 120 ++ .../Models/EmailChannelProperties.cs | 10 +- .../Models/FacebookChannelProperties.cs | 12 +- .../src/Generated/Models/FacebookPage.cs | 6 +- .../Generated/Models/HostSettingsResponse.cs | 118 + .../src/Generated/Models/Key.cs | 60 + .../Generated/Models/KikChannelProperties.cs | 10 +- .../src/Generated/Models/Kind.cs | 1 + .../src/Generated/Models/LineChannel.cs | 66 + .../Generated/Models/LineChannelProperties.cs | 86 + .../src/Generated/Models/LineRegistration.cs | 70 + .../Models/MsTeamsChannelProperties.cs | 41 +- .../src/Generated/Models/MsaAppType.cs | 23 + .../Generated/Models/OperationResultStatus.cs | 25 + .../Models/OperationResultsDescription.cs | 82 + .../src/Generated/Models/Page1.cs | 53 + .../src/Generated/Models/PrivateEndpoint.cs | 51 + .../Models/PrivateEndpointConnection.cs | 98 + ...vateEndpointConnectionProvisioningState.cs | 24 + .../PrivateEndpointServiceConnectionStatus.cs | 23 + .../Generated/Models/PrivateLinkResource.cs | 81 + .../Models/PrivateLinkResourceBase.cs | 79 + .../Models/PrivateLinkResourceListResult.cs | 55 + .../PrivateLinkServiceConnectionState.cs | 77 + .../Models/RegenerateKeysChannelName.cs | 60 + .../src/Generated/Models/Resource.cs | 7 +- .../src/Generated/Models/ServiceProvider.cs | 52 + .../Models/ServiceProviderParameter.cs | 94 + .../Models/ServiceProviderProperties.cs | 97 + .../Models/ServiceProviderResponseList.cs | 66 + .../src/Generated/Models/SiteInfo.cs | 76 + .../Models/SlackChannelProperties.cs | 30 +- .../Generated/Models/SmsChannelProperties.cs | 10 +- .../Models/TelegramChannelProperties.cs | 14 +- .../Generated/OperationResultsOperations.cs | 237 +++ .../OperationResultsOperationsExtensions.cs | 93 + .../src/Generated/Operations.cs | 22 +- .../PrivateEndpointConnectionsOperations.cs | 966 +++++++++ ...EndpointConnectionsOperationsExtensions.cs | 216 ++ .../PrivateLinkResourcesOperations.cs | 275 +++ ...rivateLinkResourcesOperationsExtensions.cs | 65 + .../src/Generated/SdkInfo_AzureBotService.cs | 47 +- 75 files changed, 8124 insertions(+), 240 deletions(-) create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotConnectionOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotConnectionOperationsExtensions.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/DirectLineOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/DirectLineOperationsExtensions.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/HostSettingsOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/HostSettingsOperationsExtensions.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IBotConnectionOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IDirectLineOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IHostSettingsOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IOperationResultsOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IPrivateEndpointConnectionsOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IPrivateLinkResourcesOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/AlexaChannel.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/AlexaChannelProperties.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionItemName.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSetting.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSettingParameter.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSettingProperties.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannel.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/HostSettingsResponse.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Key.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineChannel.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineChannelProperties.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineRegistration.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/MsaAppType.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/OperationResultStatus.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/OperationResultsDescription.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Page1.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpoint.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointConnection.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResource.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResourceBase.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResourceListResult.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkServiceConnectionState.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/RegenerateKeysChannelName.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProvider.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderParameter.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderProperties.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderResponseList.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SiteInfo.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/OperationResultsOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/OperationResultsOperationsExtensions.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateEndpointConnectionsOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateLinkResourcesOperations.cs create mode 100644 sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateLinkResourcesOperationsExtensions.cs diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/AzureBotServiceClient.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/AzureBotServiceClient.cs index 5d99896e58c5..6cbc9e34914c 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/AzureBotServiceClient.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/AzureBotServiceClient.cs @@ -53,25 +53,25 @@ public partial class AzureBotServiceClient : ServiceClient - /// Version of the API to be used with the client request. Current version is - /// 2017-12-01 + /// Version of the API to be used with the client request. /// public string ApiVersion { get; private set; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// public string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running Operations. - /// Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. /// public int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. /// public bool? GenerateClientRequestId { get; set; } @@ -85,11 +85,54 @@ public partial class AzureBotServiceClient : ServiceClient public virtual IChannelsOperations Channels { get; private set; } + /// + /// Gets the IDirectLineOperations. + /// + public virtual IDirectLineOperations DirectLine { get; private set; } + /// /// Gets the IOperations. /// public virtual IOperations Operations { get; private set; } + /// + /// Gets the IBotConnectionOperations. + /// + public virtual IBotConnectionOperations BotConnection { get; private set; } + + /// + /// Gets the IHostSettingsOperations. + /// + public virtual IHostSettingsOperations HostSettings { get; private set; } + + /// + /// Gets the IOperationResultsOperations. + /// + public virtual IOperationResultsOperations OperationResults { get; private set; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + + /// + /// Initializes a new instance of the AzureBotServiceClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureBotServiceClient.Dispose(). False: will not dispose provided httpClient + protected AzureBotServiceClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + /// /// Initializes a new instance of the AzureBotServiceClient class. /// @@ -185,6 +228,33 @@ public AzureBotServiceClient(ServiceClientCredentials credentials, params Delega } } + /// + /// Initializes a new instance of the AzureBotServiceClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling AzureBotServiceClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public AzureBotServiceClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + /// /// Initializes a new instance of the AzureBotServiceClient class. /// @@ -293,9 +363,15 @@ private void Initialize() { Bots = new BotsOperations(this); Channels = new ChannelsOperations(this); + DirectLine = new DirectLineOperations(this); Operations = new Operations(this); + BotConnection = new BotConnectionOperations(this); + HostSettings = new HostSettingsOperations(this); + OperationResults = new OperationResultsOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2017-12-01"; + ApiVersion = "2021-05-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -312,6 +388,7 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, @@ -327,6 +404,7 @@ private void Initialize() SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("channelName")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("channelName")); CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotConnectionOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotConnectionOperations.cs new file mode 100644 index 000000000000..70d35ea332e3 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotConnectionOperations.cs @@ -0,0 +1,1890 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BotConnectionOperations operations. + /// + internal partial class BotConnectionOperations : IServiceOperations, IBotConnectionOperations + { + /// + /// Initializes a new instance of the BotConnectionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal BotConnectionOperations(AzureBotServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureBotServiceClient + /// + public AzureBotServiceClient Client { get; private set; } + + /// + /// Lists the available Service Providers for creating Connection Settings + /// + /// + /// 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> ListServiceProvidersWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListServiceProviders", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders").ToString(); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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; + } + + /// + /// Get a Connection Setting registration for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// 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> ListWithSecretsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (connectionName != null) + { + if (connectionName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "connectionName", 64); + } + if (connectionName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "connectionName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(connectionName, "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("connectionName", connectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListWithSecrets", 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.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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; + } + + /// + /// Register a new Auth Connection for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The parameters to provide for creating the Connection Setting. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, ConnectionSetting parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (connectionName != null) + { + if (connectionName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "connectionName", 64); + } + if (connectionName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "connectionName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(connectionName, "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("connectionName", connectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.BotService/botServices/{resourceName}/connections/{connectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a Connection Setting registration for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The parameters to provide for updating the Connection Setting. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, ConnectionSetting parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (connectionName != null) + { + if (connectionName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "connectionName", 64); + } + if (connectionName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "connectionName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(connectionName, "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("connectionName", connectionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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.BotService/botServices/{resourceName}/connections/{connectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + _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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a Connection Setting registration for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (connectionName != null) + { + if (connectionName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "connectionName", 64); + } + if (connectionName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "connectionName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(connectionName, "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("connectionName", connectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + _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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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; + } + + /// + /// Deletes a Connection Setting registration for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (connectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "connectionName"); + } + if (connectionName != null) + { + if (connectionName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "connectionName", 64); + } + if (connectionName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "connectionName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(connectionName, "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][\\sa-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("connectionName", connectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{connectionName}", System.Uri.EscapeDataString(connectionName)); + _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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns all the Connection Settings registered to a particular BotService + /// resource + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// 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>> ListByBotServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + 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("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBotService", 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.BotService/botServices/{resourceName}/connections").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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 all the Connection Settings registered to a particular BotService + /// resource + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListByBotServiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBotServiceNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + 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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotConnectionOperationsExtensions.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotConnectionOperationsExtensions.cs new file mode 100644 index 000000000000..2039f4eb900b --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotConnectionOperationsExtensions.cs @@ -0,0 +1,370 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for BotConnectionOperations. + /// + public static partial class BotConnectionOperationsExtensions + { + /// + /// Lists the available Service Providers for creating Connection Settings + /// + /// + /// The operations group for this extension method. + /// + public static ServiceProviderResponseList ListServiceProviders(this IBotConnectionOperations operations) + { + return operations.ListServiceProvidersAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists the available Service Providers for creating Connection Settings + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task ListServiceProvidersAsync(this IBotConnectionOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListServiceProvidersWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a Connection Setting registration for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + public static ConnectionSetting ListWithSecrets(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName) + { + return operations.ListWithSecretsAsync(resourceGroupName, resourceName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Get a Connection Setting registration for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The cancellation token. + /// + public static async Task ListWithSecretsAsync(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithSecretsWithHttpMessagesAsync(resourceGroupName, resourceName, connectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Register a new Auth Connection for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The parameters to provide for creating the Connection Setting. + /// + public static ConnectionSetting Create(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName, ConnectionSetting parameters) + { + return operations.CreateAsync(resourceGroupName, resourceName, connectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Register a new Auth Connection for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The parameters to provide for creating the Connection Setting. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName, ConnectionSetting parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, connectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a Connection Setting registration for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The parameters to provide for updating the Connection Setting. + /// + public static ConnectionSetting Update(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName, ConnectionSetting parameters) + { + return operations.UpdateAsync(resourceGroupName, resourceName, connectionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a Connection Setting registration for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The parameters to provide for updating the Connection Setting. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName, ConnectionSetting parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, connectionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a Connection Setting registration for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + public static ConnectionSetting Get(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName) + { + return operations.GetAsync(resourceGroupName, resourceName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Get a Connection Setting registration for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, connectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Connection Setting registration for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + public static void Delete(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName) + { + operations.DeleteAsync(resourceGroupName, resourceName, connectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Connection Setting registration for a Bot Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, string connectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, connectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns all the Connection Settings registered to a particular BotService + /// resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + public static IPage ListByBotService(this IBotConnectionOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListByBotServiceAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns all the Connection Settings registered to a particular BotService + /// resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBotServiceAsync(this IBotConnectionOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBotServiceWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns all the Connection Settings registered to a particular BotService + /// resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByBotServiceNext(this IBotConnectionOperations operations, string nextPageLink) + { + return operations.ListByBotServiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns all the Connection Settings registered to a particular BotService + /// resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByBotServiceNextAsync(this IBotConnectionOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBotServiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotsOperations.cs index c9c92ac29b2f..08f960000c7a 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotsOperations.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotsOperations.cs @@ -54,7 +54,7 @@ internal BotsOperations(AzureBotServiceClient client) /// Creates a Bot Service. Bot Service is a resource group wide resource type. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -89,6 +89,21 @@ internal BotsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -296,7 +311,7 @@ internal BotsOperations(AzureBotServiceClient client) /// Updates a Bot Service /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -312,7 +327,7 @@ internal BotsOperations(AzureBotServiceClient client) /// /// /// Required. Gets or sets the Kind of the resource. Possible values include: - /// 'sdk', 'designer', 'bot', 'function' + /// 'sdk', 'designer', 'bot', 'function', 'azurebot' /// /// /// Entity Tag @@ -347,6 +362,21 @@ internal BotsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -564,7 +594,7 @@ internal BotsOperations(AzureBotServiceClient client) /// Deletes a Bot Service from the resource group. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -593,6 +623,21 @@ internal BotsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -749,7 +794,7 @@ internal BotsOperations(AzureBotServiceClient client) /// Returns a BotService specified by the parameters. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -781,6 +826,21 @@ internal BotsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -956,7 +1016,7 @@ internal BotsOperations(AzureBotServiceClient client) /// group /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// Headers that will be added to request. @@ -985,6 +1045,21 @@ internal BotsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1358,7 +1433,7 @@ internal BotsOperations(AzureBotServiceClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.BotService/botServices/checkNameAvailability").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.BotService/checkNameAvailability").ToString(); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1371,7 +1446,7 @@ internal BotsOperations(AzureBotServiceClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotsOperationsExtensions.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotsOperationsExtensions.cs index c4fab1ee5b80..5b28825ca712 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotsOperationsExtensions.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/BotsOperationsExtensions.cs @@ -30,7 +30,7 @@ public static partial class BotsOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -50,7 +50,7 @@ public static Bot Create(this IBotsOperations operations, string resourceGroupNa /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -76,7 +76,7 @@ public static Bot Create(this IBotsOperations operations, string resourceGroupNa /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -92,7 +92,7 @@ public static Bot Create(this IBotsOperations operations, string resourceGroupNa /// /// /// Required. Gets or sets the Kind of the resource. Possible values include: - /// 'sdk', 'designer', 'bot', 'function' + /// 'sdk', 'designer', 'bot', 'function', 'azurebot' /// /// /// Entity Tag @@ -112,7 +112,7 @@ public static Bot Create(this IBotsOperations operations, string resourceGroupNa /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -128,7 +128,7 @@ public static Bot Create(this IBotsOperations operations, string resourceGroupNa /// /// /// Required. Gets or sets the Kind of the resource. Possible values include: - /// 'sdk', 'designer', 'bot', 'function' + /// 'sdk', 'designer', 'bot', 'function', 'azurebot' /// /// /// Entity Tag @@ -154,7 +154,7 @@ public static Bot Create(this IBotsOperations operations, string resourceGroupNa /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -171,7 +171,7 @@ public static void Delete(this IBotsOperations operations, string resourceGroupN /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -191,7 +191,7 @@ public static void Delete(this IBotsOperations operations, string resourceGroupN /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -208,7 +208,7 @@ public static Bot Get(this IBotsOperations operations, string resourceGroupName, /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -232,7 +232,7 @@ public static Bot Get(this IBotsOperations operations, string resourceGroupName, /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// public static IPage ListByResourceGroup(this IBotsOperations operations, string resourceGroupName) { @@ -247,7 +247,7 @@ public static IPage ListByResourceGroup(this IBotsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The cancellation token. diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/ChannelsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/ChannelsOperations.cs index 98aac56863ec..f728a4cf0eb6 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/ChannelsOperations.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/ChannelsOperations.cs @@ -54,16 +54,16 @@ internal ChannelsOperations(AzureBotServiceClient client) /// Creates a Channel registration for a Bot Service /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// The parameters to provide for the created bot. @@ -95,6 +95,21 @@ internal ChannelsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -304,16 +319,16 @@ internal ChannelsOperations(AzureBotServiceClient client) /// Updates a Channel registration for a Bot Service /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// Specifies the location of the resource. @@ -326,7 +341,7 @@ internal ChannelsOperations(AzureBotServiceClient client) /// /// /// Required. Gets or sets the Kind of the resource. Possible values include: - /// 'sdk', 'designer', 'bot', 'function' + /// 'sdk', 'designer', 'bot', 'function', 'azurebot' /// /// /// Entity Tag @@ -361,6 +376,21 @@ internal ChannelsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -576,7 +606,7 @@ internal ChannelsOperations(AzureBotServiceClient client) /// Deletes a Channel registration from a Bot Service /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -608,6 +638,21 @@ internal ChannelsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -785,7 +830,7 @@ internal ChannelsOperations(AzureBotServiceClient client) /// Returns a BotService Channel registration specified by the parameters. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -820,6 +865,21 @@ internal ChannelsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -1015,16 +1075,16 @@ internal ChannelsOperations(AzureBotServiceClient client) /// Lists a Channel registration for a Bot Service including secrets /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// Headers that will be added to request. @@ -1053,6 +1113,21 @@ internal ChannelsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); @@ -1229,7 +1304,7 @@ internal ChannelsOperations(AzureBotServiceClient client) /// Returns all the Channel registrations of a particular BotService resource /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -1261,6 +1336,21 @@ internal ChannelsOperations(AzureBotServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } if (resourceName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/ChannelsOperationsExtensions.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/ChannelsOperationsExtensions.cs index da7b35534675..a340d019ea5b 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/ChannelsOperationsExtensions.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/ChannelsOperationsExtensions.cs @@ -30,16 +30,16 @@ public static partial class ChannelsOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// The parameters to provide for the created bot. @@ -56,16 +56,16 @@ public static BotChannel Create(this IChannelsOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// The parameters to provide for the created bot. @@ -88,16 +88,16 @@ public static BotChannel Create(this IChannelsOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// Specifies the location of the resource. @@ -110,7 +110,7 @@ public static BotChannel Create(this IChannelsOperations operations, string reso /// /// /// Required. Gets or sets the Kind of the resource. Possible values include: - /// 'sdk', 'designer', 'bot', 'function' + /// 'sdk', 'designer', 'bot', 'function', 'azurebot' /// /// /// Entity Tag @@ -130,16 +130,16 @@ public static BotChannel Create(this IChannelsOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// Specifies the location of the resource. @@ -152,7 +152,7 @@ public static BotChannel Create(this IChannelsOperations operations, string reso /// /// /// Required. Gets or sets the Kind of the resource. Possible values include: - /// 'sdk', 'designer', 'bot', 'function' + /// 'sdk', 'designer', 'bot', 'function', 'azurebot' /// /// /// Entity Tag @@ -178,7 +178,7 @@ public static BotChannel Create(this IChannelsOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -198,7 +198,7 @@ public static void Delete(this IChannelsOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -221,7 +221,7 @@ public static void Delete(this IChannelsOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -241,7 +241,7 @@ public static BotChannel Get(this IChannelsOperations operations, string resourc /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -267,16 +267,16 @@ public static BotChannel Get(this IChannelsOperations operations, string resourc /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// public static BotChannel ListWithKeys(this IChannelsOperations operations, string resourceGroupName, string resourceName, ChannelName channelName) { @@ -290,16 +290,16 @@ public static BotChannel ListWithKeys(this IChannelsOperations operations, strin /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// - /// The name of the Channel resource. Possible values include: + /// The name of the Channel resource. Possible values include: 'AlexaChannel', /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'DirectLineChannel', 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// The cancellation token. @@ -319,7 +319,7 @@ public static BotChannel ListWithKeys(this IChannelsOperations operations, strin /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -336,7 +336,7 @@ public static IPage ListByResourceGroup(this IChannelsOperations ope /// The operations group for this extension method. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/DirectLineOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/DirectLineOperations.cs new file mode 100644 index 000000000000..4446aa45909e --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/DirectLineOperations.cs @@ -0,0 +1,300 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DirectLineOperations operations. + /// + internal partial class DirectLineOperations : IServiceOperations, IDirectLineOperations + { + /// + /// Initializes a new instance of the DirectLineOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DirectLineOperations(AzureBotServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureBotServiceClient + /// + public AzureBotServiceClient Client { get; private set; } + + /// + /// Regenerates secret keys and returns them for the DirectLine Channel of a + /// particular BotService resource + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Channel resource for which keys are to be regenerated. + /// Possible values include: 'WebChatChannel', 'DirectLineChannel' + /// + /// + /// The parameters to provide for the created bot. + /// + /// + /// 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> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string resourceName, RegenerateKeysChannelName channelName, SiteInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("channelName", channelName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RegenerateKeys", 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.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{channelName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(channelName, Client.SerializationSettings).Trim('"'))); + 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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/DirectLineOperationsExtensions.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/DirectLineOperationsExtensions.cs new file mode 100644 index 000000000000..9e4d385e5a84 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/DirectLineOperationsExtensions.cs @@ -0,0 +1,81 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DirectLineOperations. + /// + public static partial class DirectLineOperationsExtensions + { + /// + /// Regenerates secret keys and returns them for the DirectLine Channel of a + /// particular BotService resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Channel resource for which keys are to be regenerated. + /// Possible values include: 'WebChatChannel', 'DirectLineChannel' + /// + /// + /// The parameters to provide for the created bot. + /// + public static BotChannel RegenerateKeys(this IDirectLineOperations operations, string resourceGroupName, string resourceName, RegenerateKeysChannelName channelName, SiteInfo parameters) + { + return operations.RegenerateKeysAsync(resourceGroupName, resourceName, channelName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Regenerates secret keys and returns them for the DirectLine Channel of a + /// particular BotService resource + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Channel resource for which keys are to be regenerated. + /// Possible values include: 'WebChatChannel', 'DirectLineChannel' + /// + /// + /// The parameters to provide for the created bot. + /// + /// + /// The cancellation token. + /// + public static async Task RegenerateKeysAsync(this IDirectLineOperations operations, string resourceGroupName, string resourceName, RegenerateKeysChannelName channelName, SiteInfo parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RegenerateKeysWithHttpMessagesAsync(resourceGroupName, resourceName, channelName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/HostSettingsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/HostSettingsOperations.cs new file mode 100644 index 000000000000..fb73267d5635 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/HostSettingsOperations.cs @@ -0,0 +1,228 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HostSettingsOperations operations. + /// + internal partial class HostSettingsOperations : IServiceOperations, IHostSettingsOperations + { + /// + /// Initializes a new instance of the HostSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal HostSettingsOperations(AzureBotServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureBotServiceClient + /// + public AzureBotServiceClient Client { get; private set; } + + /// + /// Get per subscription settings needed to host bot in compute resource such + /// as Azure App Service + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings").ToString(); + _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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/HostSettingsOperationsExtensions.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/HostSettingsOperationsExtensions.cs new file mode 100644 index 000000000000..b166d9f8a546 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/HostSettingsOperationsExtensions.cs @@ -0,0 +1,55 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for HostSettingsOperations. + /// + public static partial class HostSettingsOperationsExtensions + { + /// + /// Get per subscription settings needed to host bot in compute resource such + /// as Azure App Service + /// + /// + /// The operations group for this extension method. + /// + public static HostSettingsResponse Get(this IHostSettingsOperations operations) + { + return operations.GetAsync().GetAwaiter().GetResult(); + } + + /// + /// Get per subscription settings needed to host bot in compute resource such + /// as Azure App Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IHostSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IAzureBotServiceClient.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IAzureBotServiceClient.cs index b20a65d23132..792a53ae3a25 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IAzureBotServiceClient.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IAzureBotServiceClient.cs @@ -47,25 +47,25 @@ public partial interface IAzureBotServiceClient : System.IDisposable string SubscriptionId { get; set; } /// - /// Version of the API to be used with the client request. Current - /// version is 2017-12-01 + /// Version of the API to be used with the client request. /// string ApiVersion { get; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running - /// Operations. Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. /// int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated - /// and included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } @@ -80,10 +80,40 @@ public partial interface IAzureBotServiceClient : System.IDisposable /// IChannelsOperations Channels { get; } + /// + /// Gets the IDirectLineOperations. + /// + IDirectLineOperations DirectLine { get; } + /// /// Gets the IOperations. /// IOperations Operations { get; } + /// + /// Gets the IBotConnectionOperations. + /// + IBotConnectionOperations BotConnection { get; } + + /// + /// Gets the IHostSettingsOperations. + /// + IHostSettingsOperations HostSettings { get; } + + /// + /// Gets the IOperationResultsOperations. + /// + IOperationResultsOperations OperationResults { get; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IBotConnectionOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IBotConnectionOperations.cs new file mode 100644 index 000000000000..a273d3867ff4 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IBotConnectionOperations.cs @@ -0,0 +1,239 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BotConnectionOperations operations. + /// + public partial interface IBotConnectionOperations + { + /// + /// Lists the available Service Providers for creating Connection + /// Settings + /// + /// + /// 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> ListServiceProvidersWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a Connection Setting registration for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// 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> ListWithSecretsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Register a new Auth Connection for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The parameters to provide for creating the Connection Setting. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, ConnectionSetting parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a Connection Setting registration for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The parameters to provide for updating the Connection Setting. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, ConnectionSetting parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a Connection Setting registration for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Connection Setting registration for a Bot Service + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Bot Service Connection Setting resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string connectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns all the Connection Settings registered to a particular + /// BotService resource + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// 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>> ListByBotServiceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns all the Connection Settings registered to a particular + /// BotService resource + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// 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>> ListByBotServiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IBotsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IBotsOperations.cs index 95e5168e22b4..61e9848510a3 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IBotsOperations.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IBotsOperations.cs @@ -28,7 +28,7 @@ public partial interface IBotsOperations /// resource type. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -56,7 +56,7 @@ public partial interface IBotsOperations /// Updates a Bot Service /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -72,7 +72,7 @@ public partial interface IBotsOperations /// /// /// Required. Gets or sets the Kind of the resource. Possible values - /// include: 'sdk', 'designer', 'bot', 'function' + /// include: 'sdk', 'designer', 'bot', 'function', 'azurebot' /// /// /// Entity Tag @@ -100,7 +100,7 @@ public partial interface IBotsOperations /// Deletes a Bot Service from the resource group. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -122,7 +122,7 @@ public partial interface IBotsOperations /// Returns a BotService specified by the parameters. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -148,7 +148,7 @@ public partial interface IBotsOperations /// resource group /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The headers that will be added to request. diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IChannelsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IChannelsOperations.cs index 9707b69b1d0c..8686be9e795f 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IChannelsOperations.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IChannelsOperations.cs @@ -27,16 +27,17 @@ public partial interface IChannelsOperations /// Creates a Channel registration for a Bot Service /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// /// The name of the Channel resource. Possible values include: - /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', - /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'AlexaChannel', 'FacebookChannel', 'EmailChannel', 'KikChannel', + /// 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', + /// 'SkypeChannel', 'WebChatChannel', 'DirectLineChannel', + /// 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// The parameters to provide for the created bot. @@ -61,16 +62,17 @@ public partial interface IChannelsOperations /// Updates a Channel registration for a Bot Service /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// /// The name of the Channel resource. Possible values include: - /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', - /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'AlexaChannel', 'FacebookChannel', 'EmailChannel', 'KikChannel', + /// 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', + /// 'SkypeChannel', 'WebChatChannel', 'DirectLineChannel', + /// 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// Specifies the location of the resource. @@ -83,7 +85,7 @@ public partial interface IChannelsOperations /// /// /// Required. Gets or sets the Kind of the resource. Possible values - /// include: 'sdk', 'designer', 'bot', 'function' + /// include: 'sdk', 'designer', 'bot', 'function', 'azurebot' /// /// /// Entity Tag @@ -111,7 +113,7 @@ public partial interface IChannelsOperations /// Deletes a Channel registration from a Bot Service /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -137,7 +139,7 @@ public partial interface IChannelsOperations /// parameters. /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. @@ -165,16 +167,17 @@ public partial interface IChannelsOperations /// Lists a Channel registration for a Bot Service including secrets /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. /// /// /// The name of the Channel resource. Possible values include: - /// 'FacebookChannel', 'EmailChannel', 'KikChannel', 'TelegramChannel', - /// 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel', 'WebChatChannel', - /// 'DirectLineChannel', 'SmsChannel' + /// 'AlexaChannel', 'FacebookChannel', 'EmailChannel', 'KikChannel', + /// 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', + /// 'SkypeChannel', 'WebChatChannel', 'DirectLineChannel', + /// 'SmsChannel', 'LineChannel', 'DirectLineSpeechChannel' /// /// /// The headers that will be added to request. @@ -197,7 +200,7 @@ public partial interface IChannelsOperations /// resource /// /// - /// The name of the resource group within the user's subscription. + /// The name of the Bot resource group in the user subscription. /// /// /// The name of the Bot resource. diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IDirectLineOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IDirectLineOperations.cs new file mode 100644 index 000000000000..0f507f622ece --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IDirectLineOperations.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DirectLineOperations operations. + /// + public partial interface IDirectLineOperations + { + /// + /// Regenerates secret keys and returns them for the DirectLine Channel + /// of a particular BotService resource + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the Channel resource for which keys are to be + /// regenerated. Possible values include: 'WebChatChannel', + /// 'DirectLineChannel' + /// + /// + /// The parameters to provide for the created bot. + /// + /// + /// 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> RegenerateKeysWithHttpMessagesAsync(string resourceGroupName, string resourceName, RegenerateKeysChannelName channelName, SiteInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IHostSettingsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IHostSettingsOperations.cs new file mode 100644 index 000000000000..8d9f3e4ef749 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IHostSettingsOperations.cs @@ -0,0 +1,47 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// HostSettingsOperations operations. + /// + public partial interface IHostSettingsOperations + { + /// + /// Get per subscription settings needed to host bot in compute + /// resource such as Azure App Service + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IOperationResultsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IOperationResultsOperations.cs new file mode 100644 index 000000000000..208fd04a8fd1 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IOperationResultsOperations.cs @@ -0,0 +1,71 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationResultsOperations operations. + /// + public partial interface IOperationResultsOperations + { + /// + /// Get the operation result for a long running operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the operation result for a long running operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// 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> BeginGetWithHttpMessagesAsync(string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IOperations.cs index 27f723df0fe3..a699513400b5 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IOperations.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IOperations.cs @@ -32,7 +32,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -54,7 +54,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..cebb4487730c --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,142 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + public partial interface IPrivateEndpointConnectionsOperations + { + /// + /// List all the private endpoint connections associated with the Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified private endpoint connection associated with the + /// Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the state of specified private endpoint connection + /// associated with the Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..4718cdad7ae2 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IPrivateLinkResourcesOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + public partial interface IPrivateLinkResourcesOperations + { + /// + /// Gets the private link resources that need to be created for a Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// 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> ListByBotResourceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/AlexaChannel.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/AlexaChannel.cs new file mode 100644 index 000000000000..23b5be200793 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/AlexaChannel.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Alexa channel definition + /// + public partial class AlexaChannel : Channel + { + /// + /// Initializes a new instance of the AlexaChannel class. + /// + public AlexaChannel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlexaChannel class. + /// + /// The set of properties specific to Alexa + /// channel resource + public AlexaChannel(AlexaChannelProperties properties = default(AlexaChannelProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the set of properties specific to Alexa channel + /// resource + /// + [JsonProperty(PropertyName = "properties")] + public AlexaChannelProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/AlexaChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/AlexaChannelProperties.cs new file mode 100644 index 000000000000..ac09ac0c1738 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/AlexaChannelProperties.cs @@ -0,0 +1,92 @@ +// +// 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.BotService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters to provide for the Alexa channel. + /// + public partial class AlexaChannelProperties + { + /// + /// Initializes a new instance of the AlexaChannelProperties class. + /// + public AlexaChannelProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlexaChannelProperties class. + /// + /// The Alexa skill Id + /// Whether this channel is enabled for the + /// bot + /// Url fragment used in part of the Uri + /// configured in Alexa + /// Full Uri used to configured the + /// skill in Alexa + public AlexaChannelProperties(string alexaSkillId, bool isEnabled, string urlFragment = default(string), string serviceEndpointUri = default(string)) + { + AlexaSkillId = alexaSkillId; + UrlFragment = urlFragment; + ServiceEndpointUri = serviceEndpointUri; + IsEnabled = isEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Alexa skill Id + /// + [JsonProperty(PropertyName = "alexaSkillId")] + public string AlexaSkillId { get; set; } + + /// + /// Gets url fragment used in part of the Uri configured in Alexa + /// + [JsonProperty(PropertyName = "urlFragment")] + public string UrlFragment { get; private set; } + + /// + /// Gets full Uri used to configured the skill in Alexa + /// + [JsonProperty(PropertyName = "serviceEndpointUri")] + public string ServiceEndpointUri { get; private set; } + + /// + /// Gets or sets whether this channel is enabled for the bot + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool IsEnabled { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AlexaSkillId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlexaSkillId"); + } + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Bot.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Bot.cs index 9e4326831228..6be940e6017c 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Bot.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Bot.cs @@ -40,8 +40,8 @@ public Bot() /// pairs. /// Gets or sets the SKU of the resource. /// Required. Gets or sets the Kind of the resource. - /// Possible values include: 'sdk', 'designer', 'bot', - /// 'function' + /// Possible values include: 'sdk', 'designer', 'bot', 'function', + /// 'azurebot' /// Entity Tag /// The set of properties specific to bot /// resource diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/BotChannel.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/BotChannel.cs index 997d6551fd51..70d5c1064607 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/BotChannel.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/BotChannel.cs @@ -40,8 +40,8 @@ public BotChannel() /// pairs. /// Gets or sets the SKU of the resource. /// Required. Gets or sets the Kind of the resource. - /// Possible values include: 'sdk', 'designer', 'bot', - /// 'function' + /// Possible values include: 'sdk', 'designer', 'bot', 'function', + /// 'azurebot' /// Entity Tag /// The set of properties specific to bot /// channel resource diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/BotProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/BotProperties.cs index ff4e537b294d..abcab703cf45 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/BotProperties.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/BotProperties.cs @@ -38,6 +38,13 @@ public BotProperties() /// The description of the bot /// The Icon Url of the bot /// The bot's endpoint version + /// Microsoft App Type for the bot. Possible + /// values include: 'UserAssignedMSI', 'SingleTenant', + /// 'MultiTenant' + /// Microsoft App Tenant Id for the + /// bot + /// Microsoft App Managed Identity + /// Resource Id for the bot /// Collection of channels for which /// the bot is configured /// Collection of channels for which the @@ -50,14 +57,23 @@ public BotProperties() /// Insights App Id /// Collection of LUIS App Ids /// The LUIS Key - public BotProperties(string displayName, string endpoint, string msaAppId, string description = default(string), string iconUrl = default(string), string endpointVersion = default(string), IList configuredChannels = default(IList), IList enabledChannels = default(IList), string developerAppInsightKey = default(string), string developerAppInsightsApiKey = default(string), string developerAppInsightsApplicationId = default(string), IList luisAppIds = default(IList), string luisKey = default(string)) + /// Whether Cmek is enabled + /// The CMK Url + /// Whether the bot is in an isolated + /// network + /// The channel schema + /// transformation version for the bot + public BotProperties(string displayName, string endpoint, string msaAppId, string description = default(string), string iconUrl = default(string), string endpointVersion = default(string), string msaAppType = default(string), string msaAppTenantId = default(string), string msaAppMSIResourceId = default(string), IList configuredChannels = default(IList), IList enabledChannels = default(IList), string developerAppInsightKey = default(string), string developerAppInsightsApiKey = default(string), string developerAppInsightsApplicationId = default(string), IList luisAppIds = default(IList), string luisKey = default(string), bool? isCmekEnabled = default(bool?), string cmekKeyVaultUrl = default(string), bool? isIsolated = default(bool?), string schemaTransformationVersion = default(string)) { DisplayName = displayName; Description = description; IconUrl = iconUrl; Endpoint = endpoint; EndpointVersion = endpointVersion; + MsaAppType = msaAppType; MsaAppId = msaAppId; + MsaAppTenantId = msaAppTenantId; + MsaAppMSIResourceId = msaAppMSIResourceId; ConfiguredChannels = configuredChannels; EnabledChannels = enabledChannels; DeveloperAppInsightKey = developerAppInsightKey; @@ -65,6 +81,10 @@ public BotProperties() DeveloperAppInsightsApplicationId = developerAppInsightsApplicationId; LuisAppIds = luisAppIds; LuisKey = luisKey; + IsCmekEnabled = isCmekEnabled; + CmekKeyVaultUrl = cmekKeyVaultUrl; + IsIsolated = isIsolated; + SchemaTransformationVersion = schemaTransformationVersion; CustomInit(); } @@ -103,12 +123,31 @@ public BotProperties() [JsonProperty(PropertyName = "endpointVersion")] public string EndpointVersion { get; private set; } + /// + /// Gets or sets microsoft App Type for the bot. Possible values + /// include: 'UserAssignedMSI', 'SingleTenant', 'MultiTenant' + /// + [JsonProperty(PropertyName = "msaAppType")] + public string MsaAppType { get; set; } + /// /// Gets or sets microsoft App Id for the bot /// [JsonProperty(PropertyName = "msaAppId")] public string MsaAppId { get; set; } + /// + /// Gets or sets microsoft App Tenant Id for the bot + /// + [JsonProperty(PropertyName = "msaAppTenantId")] + public string MsaAppTenantId { get; set; } + + /// + /// Gets or sets microsoft App Managed Identity Resource Id for the bot + /// + [JsonProperty(PropertyName = "msaAppMSIResourceId")] + public string MsaAppMSIResourceId { get; set; } + /// /// Gets collection of channels for which the bot is configured /// @@ -151,6 +190,30 @@ public BotProperties() [JsonProperty(PropertyName = "luisKey")] public string LuisKey { get; set; } + /// + /// Gets or sets whether Cmek is enabled + /// + [JsonProperty(PropertyName = "isCmekEnabled")] + public bool? IsCmekEnabled { get; set; } + + /// + /// Gets or sets the CMK Url + /// + [JsonProperty(PropertyName = "cmekKeyVaultUrl")] + public string CmekKeyVaultUrl { get; set; } + + /// + /// Gets or sets whether the bot is in an isolated network + /// + [JsonProperty(PropertyName = "isIsolated")] + public bool? IsIsolated { get; set; } + + /// + /// Gets or sets the channel schema transformation version for the bot + /// + [JsonProperty(PropertyName = "schemaTransformationVersion")] + public string SchemaTransformationVersion { get; set; } + /// /// Validate the object. /// diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ChannelName.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ChannelName.cs index 3c953a2f9868..323a2806db91 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ChannelName.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ChannelName.cs @@ -21,6 +21,8 @@ namespace Microsoft.Azure.Management.BotService.Models [JsonConverter(typeof(StringEnumConverter))] public enum ChannelName { + [EnumMember(Value = "AlexaChannel")] + AlexaChannel, [EnumMember(Value = "FacebookChannel")] FacebookChannel, [EnumMember(Value = "EmailChannel")] @@ -40,7 +42,11 @@ public enum ChannelName [EnumMember(Value = "DirectLineChannel")] DirectLineChannel, [EnumMember(Value = "SmsChannel")] - SmsChannel + SmsChannel, + [EnumMember(Value = "LineChannel")] + LineChannel, + [EnumMember(Value = "DirectLineSpeechChannel")] + DirectLineSpeechChannel } internal static class ChannelNameEnumExtension { @@ -53,6 +59,8 @@ internal static string ToSerializedValue(this ChannelName value) { switch( value ) { + case ChannelName.AlexaChannel: + return "AlexaChannel"; case ChannelName.FacebookChannel: return "FacebookChannel"; case ChannelName.EmailChannel: @@ -73,6 +81,10 @@ internal static string ToSerializedValue(this ChannelName value) return "DirectLineChannel"; case ChannelName.SmsChannel: return "SmsChannel"; + case ChannelName.LineChannel: + return "LineChannel"; + case ChannelName.DirectLineSpeechChannel: + return "DirectLineSpeechChannel"; } return null; } @@ -81,6 +93,8 @@ internal static string ToSerializedValue(this ChannelName value) { switch( value ) { + case "AlexaChannel": + return ChannelName.AlexaChannel; case "FacebookChannel": return ChannelName.FacebookChannel; case "EmailChannel": @@ -101,6 +115,10 @@ internal static string ToSerializedValue(this ChannelName value) return ChannelName.DirectLineChannel; case "SmsChannel": return ChannelName.SmsChannel; + case "LineChannel": + return ChannelName.LineChannel; + case "DirectLineSpeechChannel": + return ChannelName.DirectLineSpeechChannel; } return null; } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionItemName.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionItemName.cs new file mode 100644 index 000000000000..f1ae4d6ae115 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionItemName.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The display name of a connection Item Setting registered with the Bot + /// + public partial class ConnectionItemName + { + /// + /// Initializes a new instance of the ConnectionItemName class. + /// + public ConnectionItemName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectionItemName class. + /// + /// Connection Item name that has been added in the + /// API + public ConnectionItemName(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets connection Item name that has been added in the API + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSetting.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSetting.cs new file mode 100644 index 000000000000..6b2784e0293e --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSetting.cs @@ -0,0 +1,77 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Bot channel resource definition + /// + public partial class ConnectionSetting : Resource + { + /// + /// Initializes a new instance of the ConnectionSetting class. + /// + public ConnectionSetting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectionSetting class. + /// + /// Specifies the resource ID. + /// Specifies the name of the resource. + /// Specifies the location of the + /// resource. + /// Specifies the type of the resource. + /// Contains resource tags defined as key/value + /// pairs. + /// Gets or sets the SKU of the resource. + /// Required. Gets or sets the Kind of the resource. + /// Possible values include: 'sdk', 'designer', 'bot', 'function', + /// 'azurebot' + /// Entity Tag + /// The set of properties specific to bot + /// channel resource + public ConnectionSetting(string id = default(string), string name = default(string), string location = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), ConnectionSettingProperties properties = default(ConnectionSettingProperties)) + : base(id, name, location, type, tags, sku, kind, etag) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the set of properties specific to bot channel resource + /// + [JsonProperty(PropertyName = "properties")] + public ConnectionSettingProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSettingParameter.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSettingParameter.cs new file mode 100644 index 000000000000..4144808ef27a --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSettingParameter.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Extra Parameter in a Connection Setting Properties to indicate service + /// provider specific properties + /// + public partial class ConnectionSettingParameter + { + /// + /// Initializes a new instance of the ConnectionSettingParameter class. + /// + public ConnectionSettingParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectionSettingParameter class. + /// + /// Key for the Connection Setting Parameter. + /// Value associated with the Connection Setting + /// Parameter. + public ConnectionSettingParameter(string key = default(string), string value = default(string)) + { + Key = key; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets key for the Connection Setting Parameter. + /// + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + + /// + /// Gets or sets value associated with the Connection Setting + /// Parameter. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSettingProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSettingProperties.cs new file mode 100644 index 000000000000..57fe9775a560 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ConnectionSettingProperties.cs @@ -0,0 +1,113 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties for a Connection Setting Item + /// + public partial class ConnectionSettingProperties + { + /// + /// Initializes a new instance of the ConnectionSettingProperties + /// class. + /// + public ConnectionSettingProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectionSettingProperties + /// class. + /// + /// Client Id associated with the Connection + /// Setting. + /// Setting Id set by the service for the + /// Connection Setting. + /// Client Secret associated with the + /// Connection Setting + /// Scopes associated with the Connection + /// Setting + /// Service Provider Id associated with + /// the Connection Setting + /// Service Provider Display + /// Name associated with the Connection Setting + /// Service Provider Parameters associated + /// with the Connection Setting + public ConnectionSettingProperties(string clientId = default(string), string settingId = default(string), string clientSecret = default(string), string scopes = default(string), string serviceProviderId = default(string), string serviceProviderDisplayName = default(string), IList parameters = default(IList)) + { + ClientId = clientId; + SettingId = settingId; + ClientSecret = clientSecret; + Scopes = scopes; + ServiceProviderId = serviceProviderId; + ServiceProviderDisplayName = serviceProviderDisplayName; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets client Id associated with the Connection Setting. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; set; } + + /// + /// Gets setting Id set by the service for the Connection Setting. + /// + [JsonProperty(PropertyName = "settingId")] + public string SettingId { get; private set; } + + /// + /// Gets or sets client Secret associated with the Connection Setting + /// + [JsonProperty(PropertyName = "clientSecret")] + public string ClientSecret { get; set; } + + /// + /// Gets or sets scopes associated with the Connection Setting + /// + [JsonProperty(PropertyName = "scopes")] + public string Scopes { get; set; } + + /// + /// Gets or sets service Provider Id associated with the Connection + /// Setting + /// + [JsonProperty(PropertyName = "serviceProviderId")] + public string ServiceProviderId { get; set; } + + /// + /// Gets or sets service Provider Display Name associated with the + /// Connection Setting + /// + [JsonProperty(PropertyName = "serviceProviderDisplayName")] + public string ServiceProviderDisplayName { get; set; } + + /// + /// Gets or sets service Provider Parameters associated with the + /// Connection Setting + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSite.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSite.cs index 41476af5c076..e6692aaf87ec 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSite.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSite.cs @@ -12,6 +12,8 @@ namespace Microsoft.Azure.Management.BotService.Models { using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -32,17 +34,22 @@ public DirectLineSite() /// /// Site name /// Whether this site is enabled for DirectLine - /// channel + /// channel. /// Whether this site is enabled for Bot - /// Framework V1 protocol + /// Framework V1 protocol. /// Whether this site is enabled for Bot - /// Framework V1 protocol + /// Framework V1 protocol. /// Site Id /// Primary key. Value only returned through POST to /// the action Channel List API, otherwise empty. /// Secondary key. Value only returned through POST /// to the action Channel List API, otherwise empty. - public DirectLineSite(string siteName, bool isEnabled, bool isV1Enabled, bool isV3Enabled, string siteId = default(string), string key = default(string), string key2 = default(string)) + /// Whether this site is enabled for + /// authentication with Bot Framework. + /// List of Trusted Origin URLs for this + /// site. This field is applicable only if isSecureSiteEnabled is + /// True. + public DirectLineSite(string siteName, bool isEnabled, bool isV1Enabled, bool isV3Enabled, string siteId = default(string), string key = default(string), string key2 = default(string), bool? isSecureSiteEnabled = default(bool?), IList trustedOrigins = default(IList)) { SiteId = siteId; SiteName = siteName; @@ -51,6 +58,8 @@ public DirectLineSite() IsEnabled = isEnabled; IsV1Enabled = isV1Enabled; IsV3Enabled = isV3Enabled; + IsSecureSiteEnabled = isSecureSiteEnabled; + TrustedOrigins = trustedOrigins; CustomInit(); } @@ -86,25 +95,39 @@ public DirectLineSite() public string Key2 { get; private set; } /// - /// Gets or sets whether this site is enabled for DirectLine channel + /// Gets or sets whether this site is enabled for DirectLine channel. /// [JsonProperty(PropertyName = "isEnabled")] public bool IsEnabled { get; set; } /// /// Gets or sets whether this site is enabled for Bot Framework V1 - /// protocol + /// protocol. /// [JsonProperty(PropertyName = "isV1Enabled")] public bool IsV1Enabled { get; set; } /// /// Gets or sets whether this site is enabled for Bot Framework V1 - /// protocol + /// protocol. /// [JsonProperty(PropertyName = "isV3Enabled")] public bool IsV3Enabled { get; set; } + /// + /// Gets or sets whether this site is enabled for authentication with + /// Bot Framework. + /// + [JsonProperty(PropertyName = "isSecureSiteEnabled")] + public bool? IsSecureSiteEnabled { get; set; } + + /// + /// Gets or sets list of Trusted Origin URLs for this site. This field + /// is applicable only if isSecureSiteEnabled is True. + /// + [JsonProperty(PropertyName = "trustedOrigins")] + public IList TrustedOrigins { get; set; } + /// /// Validate the object. /// diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannel.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannel.cs new file mode 100644 index 000000000000..04b19cc2400b --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannel.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// DirectLine Speech channel definition + /// + public partial class DirectLineSpeechChannel : Channel + { + /// + /// Initializes a new instance of the DirectLineSpeechChannel class. + /// + public DirectLineSpeechChannel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DirectLineSpeechChannel class. + /// + /// The set of properties specific to + /// DirectLine Speech channel resource + public DirectLineSpeechChannel(DirectLineSpeechChannelProperties properties = default(DirectLineSpeechChannelProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the set of properties specific to DirectLine Speech + /// channel resource + /// + [JsonProperty(PropertyName = "properties")] + public DirectLineSpeechChannelProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs new file mode 100644 index 000000000000..31c47cb0b965 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs @@ -0,0 +1,120 @@ +// +// 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.BotService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters to provide for the DirectLine Speech channel. + /// + public partial class DirectLineSpeechChannelProperties + { + /// + /// Initializes a new instance of the DirectLineSpeechChannelProperties + /// class. + /// + public DirectLineSpeechChannelProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DirectLineSpeechChannelProperties + /// class. + /// + /// The cognitive service region + /// with this channel registration. + /// The cognitive service + /// subscription key to use with this channel registration. + /// Whether this channel is enabled or + /// not. + /// Custom speech model id + /// (optional). + /// Custom voice deployment id + /// (optional). + /// Make this a default bot + /// for chosen cognitive service account. + public DirectLineSpeechChannelProperties(string cognitiveServiceRegion, string cognitiveServiceSubscriptionKey, bool? isEnabled = default(bool?), string customVoiceDeploymentId = default(string), string customSpeechModelId = default(string), bool? isDefaultBotForCogSvcAccount = default(bool?)) + { + CognitiveServiceRegion = cognitiveServiceRegion; + CognitiveServiceSubscriptionKey = cognitiveServiceSubscriptionKey; + IsEnabled = isEnabled; + CustomVoiceDeploymentId = customVoiceDeploymentId; + CustomSpeechModelId = customSpeechModelId; + IsDefaultBotForCogSvcAccount = isDefaultBotForCogSvcAccount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the cognitive service region with this channel + /// registration. + /// + [JsonProperty(PropertyName = "cognitiveServiceRegion")] + public string CognitiveServiceRegion { get; set; } + + /// + /// Gets or sets the cognitive service subscription key to use with + /// this channel registration. + /// + [JsonProperty(PropertyName = "cognitiveServiceSubscriptionKey")] + public string CognitiveServiceSubscriptionKey { get; set; } + + /// + /// Gets or sets whether this channel is enabled or not. + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool? IsEnabled { get; set; } + + /// + /// Gets or sets custom speech model id (optional). + /// + [JsonProperty(PropertyName = "customVoiceDeploymentId")] + public string CustomVoiceDeploymentId { get; set; } + + /// + /// Gets or sets custom voice deployment id (optional). + /// + [JsonProperty(PropertyName = "customSpeechModelId")] + public string CustomSpeechModelId { get; set; } + + /// + /// Gets or sets make this a default bot for chosen cognitive service + /// account. + /// + [JsonProperty(PropertyName = "isDefaultBotForCogSvcAccount")] + public bool? IsDefaultBotForCogSvcAccount { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CognitiveServiceRegion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CognitiveServiceRegion"); + } + if (CognitiveServiceSubscriptionKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CognitiveServiceSubscriptionKey"); + } + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/EmailChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/EmailChannelProperties.cs index 0cfdb80166c3..a483fb801858 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/EmailChannelProperties.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/EmailChannelProperties.cs @@ -31,12 +31,12 @@ public EmailChannelProperties() /// Initializes a new instance of the EmailChannelProperties class. /// /// The email address + /// Whether this channel is enabled for the + /// bot /// The password for the email address. Value /// only returned through POST to the action Channel List API, /// otherwise empty. - /// Whether this channel is enabled for the - /// bot - public EmailChannelProperties(string emailAddress, string password, bool isEnabled) + public EmailChannelProperties(string emailAddress, bool isEnabled, string password = default(string)) { EmailAddress = emailAddress; Password = password; @@ -81,10 +81,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "EmailAddress"); } - if (Password == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Password"); - } } } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/FacebookChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/FacebookChannelProperties.cs index 92ffff557915..97df7558e82c 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/FacebookChannelProperties.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/FacebookChannelProperties.cs @@ -33,16 +33,16 @@ public FacebookChannelProperties() /// Initializes a new instance of the FacebookChannelProperties class. /// /// Facebook application id - /// Facebook application secret. Value only - /// returned through POST to the action Channel List API, otherwise - /// empty. /// Whether this channel is enabled for the /// bot /// Verify token. Value only returned through /// POST to the action Channel List API, otherwise empty. /// The list of Facebook pages + /// Facebook application secret. Value only + /// returned through POST to the action Channel List API, otherwise + /// empty. /// Callback Url - public FacebookChannelProperties(string appId, string appSecret, bool isEnabled, string verifyToken = default(string), IList pages = default(IList), string callbackUrl = default(string)) + public FacebookChannelProperties(string appId, bool isEnabled, string verifyToken = default(string), IList pages = default(IList), string appSecret = default(string), string callbackUrl = default(string)) { VerifyToken = verifyToken; Pages = pages; @@ -108,10 +108,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "AppId"); } - if (AppSecret == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AppSecret"); - } if (Pages != null) { foreach (var element in Pages) diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/FacebookPage.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/FacebookPage.cs index 6f1a8dc581bb..38ee7a26d1b3 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/FacebookPage.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/FacebookPage.cs @@ -34,7 +34,7 @@ public FacebookPage() /// Facebook application access token. Value /// only returned through POST to the action Channel List API, /// otherwise empty. - public FacebookPage(string id, string accessToken) + public FacebookPage(string id, string accessToken = default(string)) { Id = id; AccessToken = accessToken; @@ -71,10 +71,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Id"); } - if (AccessToken == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AccessToken"); - } } } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/HostSettingsResponse.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/HostSettingsResponse.cs new file mode 100644 index 000000000000..edd916629b70 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/HostSettingsResponse.cs @@ -0,0 +1,118 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The response body returned for a request to Bot Service Management to + /// check per subscription hostSettings + /// + public partial class HostSettingsResponse + { + /// + /// Initializes a new instance of the HostSettingsResponse class. + /// + public HostSettingsResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HostSettingsResponse class. + /// + /// For in-conversation bot user + /// authentication + /// For verifying + /// incoming tokens from the channels + /// For verifying incoming + /// tokens from the channels + /// For verifying + /// incoming tokens from bot emulator + /// For getting access token to + /// channels from bot host + /// For getting access token + /// to channels from bot host + /// Per cloud OAuth setting on whether + /// authority is validated + /// Same as + /// toBotFromChannelOpenIdMetadataUrl, used by SDK < v4.12 + public HostSettingsResponse(string oAuthUrl = default(string), string toBotFromChannelOpenIdMetadataUrl = default(string), string toBotFromChannelTokenIssuer = default(string), string toBotFromEmulatorOpenIdMetadataUrl = default(string), string toChannelFromBotLoginUrl = default(string), string toChannelFromBotOAuthScope = default(string), bool? validateAuthority = default(bool?), string botOpenIdMetadata = default(string)) + { + OAuthUrl = oAuthUrl; + ToBotFromChannelOpenIdMetadataUrl = toBotFromChannelOpenIdMetadataUrl; + ToBotFromChannelTokenIssuer = toBotFromChannelTokenIssuer; + ToBotFromEmulatorOpenIdMetadataUrl = toBotFromEmulatorOpenIdMetadataUrl; + ToChannelFromBotLoginUrl = toChannelFromBotLoginUrl; + ToChannelFromBotOAuthScope = toChannelFromBotOAuthScope; + ValidateAuthority = validateAuthority; + BotOpenIdMetadata = botOpenIdMetadata; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets for in-conversation bot user authentication + /// + [JsonProperty(PropertyName = "OAuthUrl")] + public string OAuthUrl { get; set; } + + /// + /// Gets or sets for verifying incoming tokens from the channels + /// + [JsonProperty(PropertyName = "ToBotFromChannelOpenIdMetadataUrl")] + public string ToBotFromChannelOpenIdMetadataUrl { get; set; } + + /// + /// Gets or sets for verifying incoming tokens from the channels + /// + [JsonProperty(PropertyName = "ToBotFromChannelTokenIssuer")] + public string ToBotFromChannelTokenIssuer { get; set; } + + /// + /// Gets or sets for verifying incoming tokens from bot emulator + /// + [JsonProperty(PropertyName = "ToBotFromEmulatorOpenIdMetadataUrl")] + public string ToBotFromEmulatorOpenIdMetadataUrl { get; set; } + + /// + /// Gets or sets for getting access token to channels from bot host + /// + [JsonProperty(PropertyName = "ToChannelFromBotLoginUrl")] + public string ToChannelFromBotLoginUrl { get; set; } + + /// + /// Gets or sets for getting access token to channels from bot host + /// + [JsonProperty(PropertyName = "ToChannelFromBotOAuthScope")] + public string ToChannelFromBotOAuthScope { get; set; } + + /// + /// Gets or sets per cloud OAuth setting on whether authority is + /// validated + /// + [JsonProperty(PropertyName = "ValidateAuthority")] + public bool? ValidateAuthority { get; set; } + + /// + /// Gets or sets same as toBotFromChannelOpenIdMetadataUrl, used by SDK + /// &lt; v4.12 + /// + [JsonProperty(PropertyName = "BotOpenIdMetadata")] + public string BotOpenIdMetadata { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Key.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Key.cs new file mode 100644 index 000000000000..7365bfbc2b11 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Key.cs @@ -0,0 +1,60 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for Key. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Key + { + [EnumMember(Value = "key1")] + Key1, + [EnumMember(Value = "key2")] + Key2 + } + internal static class KeyEnumExtension + { + internal static string ToSerializedValue(this Key? value) + { + return value == null ? null : ((Key)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this Key value) + { + switch( value ) + { + case Key.Key1: + return "key1"; + case Key.Key2: + return "key2"; + } + return null; + } + + internal static Key? ParseKey(this string value) + { + switch( value ) + { + case "key1": + return Key.Key1; + case "key2": + return Key.Key2; + } + return null; + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/KikChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/KikChannelProperties.cs index 6b7039d0c7b0..fbe8eac6dcc9 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/KikChannelProperties.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/KikChannelProperties.cs @@ -31,13 +31,13 @@ public KikChannelProperties() /// Initializes a new instance of the KikChannelProperties class. /// /// The Kik user name - /// Kik API key. Value only returned through POST - /// to the action Channel List API, otherwise empty. /// Whether this channel is enabled for the /// bot + /// Kik API key. Value only returned through POST + /// to the action Channel List API, otherwise empty. /// Whether this channel is validated for the /// bot - public KikChannelProperties(string userName, string apiKey, bool isEnabled, bool? isValidated = default(bool?)) + public KikChannelProperties(string userName, bool isEnabled, string apiKey = default(string), bool? isValidated = default(bool?)) { UserName = userName; ApiKey = apiKey; @@ -88,10 +88,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "UserName"); } - if (ApiKey == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ApiKey"); - } } } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Kind.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Kind.cs index 1a8d20452e79..ac0b7ed4bcdb 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Kind.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Kind.cs @@ -20,5 +20,6 @@ public static class Kind public const string Designer = "designer"; public const string Bot = "bot"; public const string Function = "function"; + public const string Azurebot = "azurebot"; } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineChannel.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineChannel.cs new file mode 100644 index 000000000000..c642b1bffcd5 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineChannel.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Line channel definition + /// + public partial class LineChannel : Channel + { + /// + /// Initializes a new instance of the LineChannel class. + /// + public LineChannel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LineChannel class. + /// + /// The set of properties specific to line + /// channel resource + public LineChannel(LineChannelProperties properties = default(LineChannelProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the set of properties specific to line channel + /// resource + /// + [JsonProperty(PropertyName = "properties")] + public LineChannelProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineChannelProperties.cs new file mode 100644 index 000000000000..eda15c45a19b --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineChannelProperties.cs @@ -0,0 +1,86 @@ +// +// 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.BotService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The parameters to provide for the Line channel. + /// + public partial class LineChannelProperties + { + /// + /// Initializes a new instance of the LineChannelProperties class. + /// + public LineChannelProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LineChannelProperties class. + /// + /// The list of line channel + /// registrations + /// Callback Url to enter in line + /// registration. + /// Whether this channel is validated for the + /// bot + public LineChannelProperties(IList lineRegistrations, string callbackUrl = default(string), bool? isValidated = default(bool?)) + { + LineRegistrations = lineRegistrations; + CallbackUrl = callbackUrl; + IsValidated = isValidated; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of line channel registrations + /// + [JsonProperty(PropertyName = "lineRegistrations")] + public IList LineRegistrations { get; set; } + + /// + /// Gets callback Url to enter in line registration. + /// + [JsonProperty(PropertyName = "callbackUrl")] + public string CallbackUrl { get; private set; } + + /// + /// Gets whether this channel is validated for the bot + /// + [JsonProperty(PropertyName = "isValidated")] + public bool? IsValidated { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (LineRegistrations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LineRegistrations"); + } + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineRegistration.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineRegistration.cs new file mode 100644 index 000000000000..bbae69383e0a --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/LineRegistration.cs @@ -0,0 +1,70 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties corresponding to a line channel registration + /// + public partial class LineRegistration + { + /// + /// Initializes a new instance of the LineRegistration class. + /// + public LineRegistration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LineRegistration class. + /// + /// Id generated for the line channel + /// registration + /// Secret for the line channel + /// registration + /// Access token for the line channel + /// registration + public LineRegistration(string generatedId = default(string), string channelSecret = default(string), string channelAccessToken = default(string)) + { + GeneratedId = generatedId; + ChannelSecret = channelSecret; + ChannelAccessToken = channelAccessToken; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id generated for the line channel registration + /// + [JsonProperty(PropertyName = "generatedId")] + public string GeneratedId { get; private set; } + + /// + /// Gets or sets secret for the line channel registration + /// + [JsonProperty(PropertyName = "channelSecret")] + public string ChannelSecret { get; set; } + + /// + /// Gets or sets access token for the line channel registration + /// + [JsonProperty(PropertyName = "channelAccessToken")] + public string ChannelAccessToken { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/MsTeamsChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/MsTeamsChannelProperties.cs index b7ffff1a6556..b8ed1b46cfab 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/MsTeamsChannelProperties.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/MsTeamsChannelProperties.cs @@ -31,23 +31,14 @@ public MsTeamsChannelProperties() /// /// Whether this channel is enabled for the /// bot - /// Enable messaging for Microsoft Teams - /// channel - /// Enable media cards for Microsoft - /// Teams channel - /// Enable video for Microsoft Teams - /// channel /// Enable calling for Microsoft Teams /// channel - /// Enable messaging for Microsoft Teams - /// channel - public MsTeamsChannelProperties(bool isEnabled, bool? enableMessaging = default(bool?), bool? enableMediaCards = default(bool?), bool? enableVideo = default(bool?), bool? enableCalling = default(bool?), string callMode = default(string)) + /// Webhook for Microsoft Teams channel + /// calls + public MsTeamsChannelProperties(bool isEnabled, bool? enableCalling = default(bool?), string callingWebHook = default(string)) { - EnableMessaging = enableMessaging; - EnableMediaCards = enableMediaCards; - EnableVideo = enableVideo; EnableCalling = enableCalling; - CallMode = callMode; + CallingWebHook = callingWebHook; IsEnabled = isEnabled; CustomInit(); } @@ -57,24 +48,6 @@ public MsTeamsChannelProperties() /// partial void CustomInit(); - /// - /// Gets or sets enable messaging for Microsoft Teams channel - /// - [JsonProperty(PropertyName = "enableMessaging")] - public bool? EnableMessaging { get; set; } - - /// - /// Gets or sets enable media cards for Microsoft Teams channel - /// - [JsonProperty(PropertyName = "enableMediaCards")] - public bool? EnableMediaCards { get; set; } - - /// - /// Gets or sets enable video for Microsoft Teams channel - /// - [JsonProperty(PropertyName = "enableVideo")] - public bool? EnableVideo { get; set; } - /// /// Gets or sets enable calling for Microsoft Teams channel /// @@ -82,10 +55,10 @@ public MsTeamsChannelProperties() public bool? EnableCalling { get; set; } /// - /// Gets or sets enable messaging for Microsoft Teams channel + /// Gets or sets webhook for Microsoft Teams channel calls /// - [JsonProperty(PropertyName = "callMode")] - public string CallMode { get; set; } + [JsonProperty(PropertyName = "callingWebHook")] + public string CallingWebHook { get; set; } /// /// Gets or sets whether this channel is enabled for the bot diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/MsaAppType.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/MsaAppType.cs new file mode 100644 index 000000000000..042bfaa056a0 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/MsaAppType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + + /// + /// Defines values for MsaAppType. + /// + public static class MsaAppType + { + public const string UserAssignedMSI = "UserAssignedMSI"; + public const string SingleTenant = "SingleTenant"; + public const string MultiTenant = "MultiTenant"; + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/OperationResultStatus.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/OperationResultStatus.cs new file mode 100644 index 000000000000..464d13ea9256 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/OperationResultStatus.cs @@ -0,0 +1,25 @@ +// +// 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.BotService.Models +{ + + /// + /// Defines values for OperationResultStatus. + /// + public static class OperationResultStatus + { + public const string Canceled = "Canceled"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Requested = "Requested"; + public const string Running = "Running"; + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/OperationResultsDescription.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/OperationResultsDescription.cs new file mode 100644 index 000000000000..0d8c6eb7e5aa --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/OperationResultsDescription.cs @@ -0,0 +1,82 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties indicating the operation result of an operation on a + /// service. + /// + public partial class OperationResultsDescription + { + /// + /// Initializes a new instance of the OperationResultsDescription + /// class. + /// + public OperationResultsDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationResultsDescription + /// class. + /// + /// The ID of the operation returned. + /// The name of the operation result. + /// The status of the operation being performed. + /// Possible values include: 'Canceled', 'Succeeded', 'Failed', + /// 'Requested', 'Running' + /// The time that the operation was + /// started. + public OperationResultsDescription(string id = default(string), string name = default(string), string status = default(string), System.DateTime? startTime = default(System.DateTime?)) + { + Id = id; + Name = name; + Status = status; + StartTime = startTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ID of the operation returned. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the operation result. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the status of the operation being performed. Possible values + /// include: 'Canceled', 'Succeeded', 'Failed', 'Requested', 'Running' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; private set; } + + /// + /// Gets the time that the operation was started. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; private set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Page1.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Page1.cs new file mode 100644 index 000000000000..0745ca09c1dd --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Page1.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page1 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpoint.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..3906f962d796 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpoint.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint resource. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// The ARM identifier for Private Endpoint + public PrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ARM identifier for Private Endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..362fee99c1ed --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,98 @@ +// +// 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.BotService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint Connection resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection : PrivateLinkResourceBase + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// A collection of + /// information about the state of the connection between service + /// consumer and provider. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The resource of private end + /// point. + /// The provisioning state of the + /// private endpoint connection resource. Possible values include: + /// 'Succeeded', 'Creating', 'Deleting', 'Failed' + public PrivateEndpointConnection(PrivateLinkServiceConnectionState privateLinkServiceConnectionState, string id = default(string), string name = default(string), string type = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), string provisioningState = default(string)) + : base(id, name, type) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource of private end point. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets a collection of information about the state of the + /// connection between service consumer and provider. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets the provisioning state of the private endpoint + /// connection resource. Possible values include: 'Succeeded', + /// 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateLinkServiceConnectionState"); + } + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..003e27a63971 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,24 @@ +// +// 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.BotService.Models +{ + + /// + /// Defines values for PrivateEndpointConnectionProvisioningState. + /// + public static class PrivateEndpointConnectionProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 000000000000..714ba79b7be6 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + + /// + /// Defines values for PrivateEndpointServiceConnectionStatus. + /// + public static class PrivateEndpointServiceConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResource.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 000000000000..7ff80578a594 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,81 @@ +// +// 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.BotService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A private link resource + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource : PrivateLinkResourceBase + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// The private link resource group id. + /// The private link resource required + /// member names. + /// The private link resource Private + /// link DNS zone name. + public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) + : base(id, name, type) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets the private link resource Private link DNS zone name. + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResourceBase.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResourceBase.cs new file mode 100644 index 000000000000..fd23d9c928b4 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResourceBase.cs @@ -0,0 +1,79 @@ +// +// 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.BotService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Private Link Resource Base + /// + /// + /// Common fields that are returned in the response for all BotService + /// Private Link Resources + /// + public partial class PrivateLinkResourceBase : IResource + { + /// + /// Initializes a new instance of the PrivateLinkResourceBase class. + /// + public PrivateLinkResourceBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceBase class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + public PrivateLinkResourceBase(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResourceListResult.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..8c6e324fdb07 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkResourceListResult.cs @@ -0,0 +1,55 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of private link resources + /// + public partial class PrivateLinkResourceListResult + { + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + public PrivateLinkResourceListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceListResult + /// class. + /// + /// Array of private link resources + public PrivateLinkResourceListResult(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of private link resources + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..1093d2ce0ef4 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/PrivateLinkServiceConnectionState.cs @@ -0,0 +1,77 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A collection of information about the state of the connection between + /// service consumer and provider. + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + /// Indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// The reason for approval/rejection of the + /// connection. + /// A message indicating if changes on the + /// service provider require any updates on the consumer. + public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionRequired = default(string)) + { + Status = status; + Description = description; + ActionRequired = actionRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the reason for approval/rejection of the connection. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets a message indicating if changes on the service + /// provider require any updates on the consumer. + /// + [JsonProperty(PropertyName = "actionRequired")] + public string ActionRequired { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/RegenerateKeysChannelName.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/RegenerateKeysChannelName.cs new file mode 100644 index 000000000000..0fdc17ccaee4 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/RegenerateKeysChannelName.cs @@ -0,0 +1,60 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for RegenerateKeysChannelName. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RegenerateKeysChannelName + { + [EnumMember(Value = "WebChatChannel")] + WebChatChannel, + [EnumMember(Value = "DirectLineChannel")] + DirectLineChannel + } + internal static class RegenerateKeysChannelNameEnumExtension + { + internal static string ToSerializedValue(this RegenerateKeysChannelName? value) + { + return value == null ? null : ((RegenerateKeysChannelName)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this RegenerateKeysChannelName value) + { + switch( value ) + { + case RegenerateKeysChannelName.WebChatChannel: + return "WebChatChannel"; + case RegenerateKeysChannelName.DirectLineChannel: + return "DirectLineChannel"; + } + return null; + } + + internal static RegenerateKeysChannelName? ParseRegenerateKeysChannelName(this string value) + { + switch( value ) + { + case "WebChatChannel": + return RegenerateKeysChannelName.WebChatChannel; + case "DirectLineChannel": + return RegenerateKeysChannelName.DirectLineChannel; + } + return null; + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Resource.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Resource.cs index 03c9c85526a8..2cb36b972fc5 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Resource.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/Resource.cs @@ -42,8 +42,8 @@ public Resource() /// pairs. /// Gets or sets the SKU of the resource. /// Required. Gets or sets the Kind of the resource. - /// Possible values include: 'sdk', 'designer', 'bot', - /// 'function' + /// Possible values include: 'sdk', 'designer', 'bot', 'function', + /// 'azurebot' /// Entity Tag public Resource(string id = default(string), string name = default(string), string location = default(string), string type = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string)) { @@ -101,7 +101,8 @@ public Resource() /// /// Gets or sets required. Gets or sets the Kind of the resource. - /// Possible values include: 'sdk', 'designer', 'bot', 'function' + /// Possible values include: 'sdk', 'designer', 'bot', 'function', + /// 'azurebot' /// [JsonProperty(PropertyName = "kind")] public string Kind { get; set; } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProvider.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProvider.cs new file mode 100644 index 000000000000..e442d60144af --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProvider.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Service Provider Definition + /// + public partial class ServiceProvider + { + /// + /// Initializes a new instance of the ServiceProvider class. + /// + public ServiceProvider() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceProvider class. + /// + /// The Properties of a Service Provider + /// Object + public ServiceProvider(ServiceProviderProperties properties = default(ServiceProviderProperties)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Properties of a Service Provider Object + /// + [JsonProperty(PropertyName = "properties")] + public ServiceProviderProperties Properties { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderParameter.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderParameter.cs new file mode 100644 index 000000000000..003b42f81f28 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderParameter.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.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Extra Parameters specific to each Service Provider + /// + public partial class ServiceProviderParameter + { + /// + /// Initializes a new instance of the ServiceProviderParameter class. + /// + public ServiceProviderParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceProviderParameter class. + /// + /// Name of the Service Provider + /// Type of the Service Provider + /// Display Name of the Service + /// Provider + /// Description of the Service + /// Provider + /// Help Url for the Service Provider + /// Default Name for the Service + /// Provider + public ServiceProviderParameter(string name = default(string), string type = default(string), string displayName = default(string), string description = default(string), string helpUrl = default(string), string defaultProperty = default(string)) + { + Name = name; + Type = type; + DisplayName = displayName; + Description = description; + HelpUrl = helpUrl; + DefaultProperty = defaultProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of the Service Provider + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the Service Provider + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets display Name of the Service Provider + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets description of the Service Provider + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets help Url for the Service Provider + /// + [JsonProperty(PropertyName = "helpUrl")] + public string HelpUrl { get; private set; } + + /// + /// Gets default Name for the Service Provider + /// + [JsonProperty(PropertyName = "default")] + public string DefaultProperty { get; private set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderProperties.cs new file mode 100644 index 000000000000..93092b941bb8 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderProperties.cs @@ -0,0 +1,97 @@ +// +// 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.BotService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Object used to describe a Service Provider supported by Bot Service + /// + public partial class ServiceProviderProperties + { + /// + /// Initializes a new instance of the ServiceProviderProperties class. + /// + public ServiceProviderProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceProviderProperties class. + /// + /// Id for Service Provider + /// Display Name of the Service + /// Provider + /// Display Name of the Service + /// Provider + /// Display Name of the Service + /// Provider + /// Display Name of the Service Provider + /// The list of parameters for the Service + /// Provider + public ServiceProviderProperties(string id = default(string), string displayName = default(string), string serviceProviderName = default(string), string devPortalUrl = default(string), string iconUrl = default(string), IList parameters = default(IList)) + { + Id = id; + DisplayName = displayName; + ServiceProviderName = serviceProviderName; + DevPortalUrl = devPortalUrl; + IconUrl = iconUrl; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id for Service Provider + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets display Name of the Service Provider + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets display Name of the Service Provider + /// + [JsonProperty(PropertyName = "serviceProviderName")] + public string ServiceProviderName { get; private set; } + + /// + /// Gets display Name of the Service Provider + /// + [JsonProperty(PropertyName = "devPortalUrl")] + public string DevPortalUrl { get; private set; } + + /// + /// Gets display Name of the Service Provider + /// + [JsonProperty(PropertyName = "iconUrl")] + public string IconUrl { get; private set; } + + /// + /// Gets or sets the list of parameters for the Service Provider + /// + [JsonProperty(PropertyName = "parameters")] + public IList Parameters { get; set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderResponseList.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderResponseList.cs new file mode 100644 index 000000000000..868a9b90b530 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/ServiceProviderResponseList.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of bot service providers response. + /// + public partial class ServiceProviderResponseList + { + /// + /// Initializes a new instance of the ServiceProviderResponseList + /// class. + /// + public ServiceProviderResponseList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ServiceProviderResponseList + /// class. + /// + /// The link used to get the next page of bot + /// service providers. + /// Gets the list of bot service providers and + /// their properties. + public ServiceProviderResponseList(string nextLink = default(string), IList value = default(IList)) + { + NextLink = nextLink; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the link used to get the next page of bot service + /// providers. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + /// + /// Gets the list of bot service providers and their properties. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SiteInfo.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SiteInfo.cs new file mode 100644 index 000000000000..e4a2e5920fab --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SiteInfo.cs @@ -0,0 +1,76 @@ +// +// 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.BotService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Site information for WebChat or DirectLine Channels to identify which + /// site to regenerate keys for. + /// + public partial class SiteInfo + { + /// + /// Initializes a new instance of the SiteInfo class. + /// + public SiteInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SiteInfo class. + /// + /// The site name + /// Determines which key is to be regenerated. + /// Possible values include: 'key1', 'key2' + public SiteInfo(string siteName, Key key) + { + SiteName = siteName; + Key = key; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the site name + /// + [JsonProperty(PropertyName = "siteName")] + public string SiteName { get; set; } + + /// + /// Gets or sets determines which key is to be regenerated. Possible + /// values include: 'key1', 'key2' + /// + [JsonProperty(PropertyName = "key")] + public Key Key { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SiteName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SiteName"); + } + } + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SlackChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SlackChannelProperties.cs index 701731e49401..d3745c6f9eb1 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SlackChannelProperties.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SlackChannelProperties.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.BotService.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -30,6 +29,8 @@ public SlackChannelProperties() /// /// Initializes a new instance of the SlackChannelProperties class. /// + /// Whether this channel is enabled for the + /// bot /// The Slack client id /// The Slack client secret. Value only /// returned through POST to the action Channel List API, otherwise @@ -37,8 +38,6 @@ public SlackChannelProperties() /// The Slack verification token. Value /// only returned through POST to the action Channel List API, /// otherwise empty. - /// Whether this channel is enabled for the - /// bot /// The Slack landing page Url /// The Slack redirect action /// The Sms auth token @@ -47,7 +46,8 @@ public SlackChannelProperties() /// True. /// Whether this channel is validated for the /// bot - public SlackChannelProperties(string clientId, string clientSecret, string verificationToken, bool isEnabled, string landingPageUrl = default(string), string redirectAction = default(string), string lastSubmissionId = default(string), bool? registerBeforeOAuthFlow = default(bool?), bool? isValidated = default(bool?)) + /// The Slack signing secret. + public SlackChannelProperties(bool isEnabled, string clientId = default(string), string clientSecret = default(string), string verificationToken = default(string), string landingPageUrl = default(string), string redirectAction = default(string), string lastSubmissionId = default(string), bool? registerBeforeOAuthFlow = default(bool?), bool? isValidated = default(bool?), string signingSecret = default(string)) { ClientId = clientId; ClientSecret = clientSecret; @@ -57,6 +57,7 @@ public SlackChannelProperties() LastSubmissionId = lastSubmissionId; RegisterBeforeOAuthFlow = registerBeforeOAuthFlow; IsValidated = isValidated; + SigningSecret = signingSecret; IsEnabled = isEnabled; CustomInit(); } @@ -117,6 +118,12 @@ public SlackChannelProperties() [JsonProperty(PropertyName = "isValidated")] public bool? IsValidated { get; private set; } + /// + /// Gets or sets the Slack signing secret. + /// + [JsonProperty(PropertyName = "signingSecret")] + public string SigningSecret { get; set; } + /// /// Gets or sets whether this channel is enabled for the bot /// @@ -126,23 +133,12 @@ public SlackChannelProperties() /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (ClientId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ClientId"); - } - if (ClientSecret == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ClientSecret"); - } - if (VerificationToken == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VerificationToken"); - } + //Nothing to validate } } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SmsChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SmsChannelProperties.cs index 3787bf2037aa..0b55ae111091 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SmsChannelProperties.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/SmsChannelProperties.cs @@ -34,14 +34,14 @@ public SmsChannelProperties() /// The Sms account SID. Value only returned /// through POST to the action Channel List API, otherwise /// empty. + /// Whether this channel is enabled for the + /// bot /// The Sms auth token. Value only returned /// through POST to the action Channel List API, otherwise /// empty. - /// Whether this channel is enabled for the - /// bot /// Whether this channel is validated for the /// bot - public SmsChannelProperties(string phone, string accountSID, string authToken, bool isEnabled, bool? isValidated = default(bool?)) + public SmsChannelProperties(string phone, string accountSID, bool isEnabled, string authToken = default(string), bool? isValidated = default(bool?)) { Phone = phone; AccountSID = accountSID; @@ -104,10 +104,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "AccountSID"); } - if (AuthToken == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AuthToken"); - } } } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/TelegramChannelProperties.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/TelegramChannelProperties.cs index 5d7c4e9788e3..af76bc981f07 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/TelegramChannelProperties.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/TelegramChannelProperties.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.BotService.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -30,14 +29,14 @@ public TelegramChannelProperties() /// /// Initializes a new instance of the TelegramChannelProperties class. /// + /// Whether this channel is enabled for the + /// bot /// The Telegram access token. Value only /// returned through POST to the action Channel List API, otherwise /// empty. - /// Whether this channel is enabled for the - /// bot /// Whether this channel is validated for the /// bot - public TelegramChannelProperties(string accessToken, bool isEnabled, bool? isValidated = default(bool?)) + public TelegramChannelProperties(bool isEnabled, string accessToken = default(string), bool? isValidated = default(bool?)) { AccessToken = accessToken; IsValidated = isValidated; @@ -72,15 +71,12 @@ public TelegramChannelProperties() /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (AccessToken == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AccessToken"); - } + //Nothing to validate } } } diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/OperationResultsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/OperationResultsOperations.cs new file mode 100644 index 000000000000..690827f539bb --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/OperationResultsOperations.cs @@ -0,0 +1,237 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OperationResultsOperations operations. + /// + internal partial class OperationResultsOperations : IServiceOperations, IOperationResultsOperations + { + /// + /// Initializes a new instance of the OperationResultsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OperationResultsOperations(AzureBotServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureBotServiceClient + /// + public AzureBotServiceClient Client { get; private set; } + + + /// + /// Get the operation result for a long running operation. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// 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> BeginGetWithHttpMessagesAsync(string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (operationResultId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "operationResultId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("operationResultId", operationResultId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginGet", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{operationResultId}", System.Uri.EscapeDataString(operationResultId)); + 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 && (int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/OperationResultsOperationsExtensions.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/OperationResultsOperationsExtensions.cs new file mode 100644 index 000000000000..0bd43643a92b --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/OperationResultsOperationsExtensions.cs @@ -0,0 +1,93 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for OperationResultsOperations. + /// + public static partial class OperationResultsOperationsExtensions + { + /// + /// Get the operation result for a long running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID of the operation result to get. + /// + public static OperationResultsDescription Get(this IOperationResultsOperations operations, string operationResultId) + { + return operations.GetAsync(operationResultId).GetAwaiter().GetResult(); + } + + /// + /// Get the operation result for a long running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOperationResultsOperations operations, string operationResultId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(operationResultId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the operation result for a long running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID of the operation result to get. + /// + public static OperationResultsDescription BeginGet(this IOperationResultsOperations operations, string operationResultId) + { + return operations.BeginGetAsync(operationResultId).GetAwaiter().GetResult(); + } + + /// + /// Get the operation result for a long running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The ID of the operation result to get. + /// + /// + /// The cancellation token. + /// + public static async Task BeginGetAsync(this IOperationResultsOperations operations, string operationResultId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginGetWithHttpMessagesAsync(operationResultId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Operations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Operations.cs index b3c15f769aac..1b4a711b8edf 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Operations.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Operations.cs @@ -59,7 +59,7 @@ internal Operations(AzureBotServiceClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -158,14 +158,13 @@ internal Operations(AzureBotServiceClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -175,10 +174,6 @@ internal Operations(AzureBotServiceClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -235,7 +230,7 @@ internal Operations(AzureBotServiceClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -331,14 +326,13 @@ internal Operations(AzureBotServiceClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -348,10 +342,6 @@ internal Operations(AzureBotServiceClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..cbb34cb051cd --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,966 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionsOperations(AzureBotServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureBotServiceClient + /// + public AzureBotServiceClient Client { get; private set; } + + /// + /// List all the private endpoint connections associated with the Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the specified private endpoint connection associated with the Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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; + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (properties != null) + { + properties.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("properties", properties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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(properties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(properties, 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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _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; + } + + /// + /// Deletes the specified private endpoint connection associated with the Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + 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("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..952ca937b25e --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,216 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateEndpointConnectionsOperations. + /// + public static partial class PrivateEndpointConnectionsOperationsExtensions + { + /// + /// List all the private endpoint connections associated with the Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + public static IEnumerable List(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// List all the private endpoint connections associated with the Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the specified private endpoint connection associated with the Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified private endpoint connection associated with the Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + public static PrivateEndpointConnection Create(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties) + { + return operations.CreateAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The private endpoint connection properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static void Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + operations.DeleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..8aa983918d85 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,275 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the PrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinkResourcesOperations(AzureBotServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureBotServiceClient + /// + public AzureBotServiceClient Client { get; private set; } + + /// + /// Gets the private link resources that need to be created for a Bot. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// 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> ListByBotResourceWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByBotResource", 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.BotService/botServices/{resourceName}/privateLinkResources").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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 ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..c240d4e3e0af --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// 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.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateLinkResourcesOperations. + /// + public static partial class PrivateLinkResourcesOperationsExtensions + { + /// + /// Gets the private link resources that need to be created for a Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + public static PrivateLinkResourceListResult ListByBotResource(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListByBotResourceAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the private link resources that need to be created for a Bot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The cancellation token. + /// + public static async Task ListByBotResourceAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByBotResourceWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/SdkInfo_AzureBotService.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/SdkInfo_AzureBotService.cs index 7cea5b1f8c6e..9392d860a7be 100644 --- a/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/SdkInfo_AzureBotService.cs +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/SdkInfo_AzureBotService.cs @@ -1,20 +1,35 @@ -using System; -using System.Collections.Generic; -using System.Linq; +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// -internal static partial class SdkInfo +namespace Microsoft.Azure.Management.BotService { - public static IEnumerable> ApiInfo_AzureBotService - { - get - { - return new Tuple[] - { - new Tuple("BotService", "Bots", "2017-12-01"), - new Tuple("BotService", "Channels", "2017-12-01"), - new Tuple("BotService", "Operations", "2017-12-01"), - }.AsEnumerable(); - } - } + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_AzureBotService + { + get + { + return new Tuple[] + { + new Tuple("BotService", "BotConnection", "2021-05-01-preview"), + new Tuple("BotService", "Bots", "2021-05-01-preview"), + new Tuple("BotService", "Channels", "2021-05-01-preview"), + new Tuple("BotService", "DirectLine", "2021-05-01-preview"), + new Tuple("BotService", "HostSettings", "2021-05-01-preview"), + new Tuple("BotService", "OperationResults", "2021-05-01-preview"), + new Tuple("BotService", "Operations", "2021-05-01-preview"), + new Tuple("BotService", "PrivateEndpointConnections", "2021-05-01-preview"), + new Tuple("BotService", "PrivateLinkResources", "2021-05-01-preview"), + }.AsEnumerable(); + } + } + } }