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..d39769f1d2f0 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,34 @@ 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; } + + /// + /// 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 +208,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 +343,11 @@ private void Initialize() { Bots = new BotsOperations(this); Channels = new ChannelsOperations(this); + DirectLine = new DirectLineOperations(this); Operations = new Operations(this); + BotConnection = new BotConnectionOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2017-12-01"; + ApiVersion = "2020-06-02"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; 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..b54f584f3b21 --- /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..af47fb60244d 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. @@ -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..af40dfe19e34 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. @@ -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. @@ -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..3abbd78e545b 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. @@ -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..59d4b101b32e 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. @@ -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. @@ -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/IAzureBotServiceClient.cs b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/IAzureBotServiceClient.cs index b20a65d23132..4b582adb538b 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,20 @@ 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; } + } } 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..7295bd395815 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. @@ -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..e2dc39fa3780 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. @@ -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/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/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..f1962776955e --- /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' + /// 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..f73bec3eb9b3 --- /dev/null +++ b/sdk/botservice/Microsoft.Azure.Management.BotService/src/Generated/Models/DirectLineSpeechChannelProperties.cs @@ -0,0 +1,106 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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 + /// subscription ID 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 cognitiveServicesSubscriptionId, bool? isEnabled = default(bool?), string customVoiceDeploymentId = default(string), string customSpeechModelId = default(string), bool? isDefaultBotForCogSvcAccount = default(bool?)) + { + CognitiveServicesSubscriptionId = cognitiveServicesSubscriptionId; + 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 subscription ID to use with this + /// channel registration. + /// + [JsonProperty(PropertyName = "cognitiveServicesSubscriptionId")] + public string CognitiveServicesSubscriptionId { 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 (CognitiveServicesSubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "CognitiveServicesSubscriptionId"); + } + } + } +} 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/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/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/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..54e3d42e44b1 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 @@ -47,7 +47,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(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?), string signingSecret = default(string)) { ClientId = clientId; ClientSecret = clientSecret; @@ -57,6 +58,7 @@ public SlackChannelProperties() LastSubmissionId = lastSubmissionId; RegisterBeforeOAuthFlow = registerBeforeOAuthFlow; IsValidated = isValidated; + SigningSecret = signingSecret; IsEnabled = isEnabled; CustomInit(); } @@ -117,6 +119,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 /// 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..86f6ae3299b0 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,31 @@ -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", "2020-06-02"), + new Tuple("BotService", "Bots", "2020-06-02"), + new Tuple("BotService", "Channels", "2020-06-02"), + new Tuple("BotService", "DirectLine", "2020-06-02"), + new Tuple("BotService", "Operations", "2020-06-02"), + }.AsEnumerable(); + } + } + } }