diff --git a/src/SDKs/BotService/AzSdk.RP.props b/src/SDKs/BotService/AzSdk.RP.props index eef0e319e9a7..d34a6430589b 100644 --- a/src/SDKs/BotService/AzSdk.RP.props +++ b/src/SDKs/BotService/AzSdk.RP.props @@ -1,7 +1,7 @@ - BotService_2017-12-01; + BotService_2018-07-12; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/src/SDKs/BotService/Management.BotService/Generated/AzureBotServiceClient.cs b/src/SDKs/BotService/Management.BotService/Generated/AzureBotServiceClient.cs index 5d99896e58c5..88198e6ebf8e 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/AzureBotServiceClient.cs +++ b/src/SDKs/BotService/Management.BotService/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; } @@ -90,6 +90,29 @@ public partial class AzureBotServiceClient : ServiceClient public virtual IOperations Operations { get; private set; } + /// + /// Gets the IBotConnectionOperations. + /// + public virtual IBotConnectionOperations BotConnection { get; private set; } + + /// + /// Gets the IEnterpriseChannelsOperations. + /// + public virtual IEnterpriseChannelsOperations EnterpriseChannels { 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. /// @@ -294,8 +344,10 @@ private void Initialize() Bots = new BotsOperations(this); Channels = new ChannelsOperations(this); Operations = new Operations(this); + BotConnection = new BotConnectionOperations(this); + EnterpriseChannels = new EnterpriseChannelsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2017-12-01"; + ApiVersion = "2018-07-12"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/src/SDKs/BotService/Management.BotService/Generated/BotConnectionOperations.cs b/src/SDKs/BotService/Management.BotService/Generated/BotConnectionOperations.cs new file mode 100644 index 000000000000..642deab6b995 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("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][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][a-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][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][a-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][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("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][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "connectionName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("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/src/SDKs/BotService/Management.BotService/Generated/BotConnectionOperationsExtensions.cs b/src/SDKs/BotService/Management.BotService/Generated/BotConnectionOperationsExtensions.cs new file mode 100644 index 000000000000..acd27a1eaf10 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/BotsOperations.cs b/src/SDKs/BotService/Management.BotService/Generated/BotsOperations.cs index c9c92ac29b2f..af47fb60244d 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/BotsOperations.cs +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/BotsOperationsExtensions.cs b/src/SDKs/BotService/Management.BotService/Generated/BotsOperationsExtensions.cs index c4fab1ee5b80..af40dfe19e34 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/BotsOperationsExtensions.cs +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/ChannelsOperations.cs b/src/SDKs/BotService/Management.BotService/Generated/ChannelsOperations.cs index 98aac56863ec..28d055d58542 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/ChannelsOperations.cs +++ b/src/SDKs/BotService/Management.BotService/Generated/ChannelsOperations.cs @@ -54,7 +54,7 @@ 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. @@ -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,7 +319,7 @@ 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. @@ -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,7 +1075,7 @@ 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. @@ -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/src/SDKs/BotService/Management.BotService/Generated/ChannelsOperationsExtensions.cs b/src/SDKs/BotService/Management.BotService/Generated/ChannelsOperationsExtensions.cs index da7b35534675..2b090cc23815 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/ChannelsOperationsExtensions.cs +++ b/src/SDKs/BotService/Management.BotService/Generated/ChannelsOperationsExtensions.cs @@ -30,7 +30,7 @@ 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. @@ -56,7 +56,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. @@ -88,7 +88,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. @@ -130,7 +130,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. @@ -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,7 +267,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. @@ -290,7 +290,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. @@ -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/src/SDKs/BotService/Management.BotService/Generated/EnterpriseChannelsOperations.cs b/src/SDKs/BotService/Management.BotService/Generated/EnterpriseChannelsOperations.cs new file mode 100644 index 000000000000..eaa722679926 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/EnterpriseChannelsOperations.cs @@ -0,0 +1,1653 @@ +// +// 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; + + /// + /// EnterpriseChannelsOperations operations. + /// + internal partial class EnterpriseChannelsOperations : IServiceOperations, IEnterpriseChannelsOperations + { + /// + /// Initializes a new instance of the EnterpriseChannelsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EnterpriseChannelsOperations(AzureBotServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the AzureBotServiceClient + /// + public AzureBotServiceClient Client { get; private set; } + + /// + /// Check whether an Enterprise Channel name is available. + /// + /// + /// The parameters to provide for the Enterprise Channel check name + /// availability request. + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(EnterpriseChannelCheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + 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("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.BotService/checkEnterpriseChannelNameAvailability").ToString(); + 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; + } + + /// + /// Returns all the resources of a particular type belonging to a resource + /// group. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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 (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("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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/enterpriseChannels").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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; + } + + /// + /// Creates an Enterprise Channel. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The parameters to provide for the new Enterprise Channel. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, EnterpriseChannel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, resourceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates an Enterprise Channel. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// Specifies the location 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 an Enterprise Channel resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, location, tags, sku, kind, etag, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes an Enterprise Channel from the resource group + /// + /// + /// 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. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns an Enterprise Channel specified by the parameters. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "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/enterpriseChannels/{resourceName}").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; + } + + /// + /// Creates an Enterprise Channel. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The parameters to provide for the new Enterprise Channel. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, EnterpriseChannel 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 (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("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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/enterpriseChannels/{resourceName}").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("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 an Enterprise Channel. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// Specifies the location 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 an Enterprise Channel 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (sku != null) + { + sku.Validate(); + } + if (properties != null) + { + properties.Validate(); + } + EnterpriseChannel parameters = new EnterpriseChannel(); + if (location != null || tags != null || sku != null || kind != null || etag != null || properties != null) + { + parameters.Location = location; + parameters.Tags = tags; + parameters.Sku = sku; + parameters.Kind = kind; + parameters.Etag = etag; + parameters.Properties = properties; + } + // 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("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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/enterpriseChannels/{resourceName}").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("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; + } + + /// + /// Deletes an Enterprise Channel from the resource group + /// + /// + /// 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 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 64); + } + if (resourceGroupName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 64) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 64); + } + if (resourceName.Length < 2) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 2); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9][a-zA-Z0-9_.-]*$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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/enterpriseChannels/{resourceName}").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("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 resources of a particular type belonging to a resource + /// group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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/src/SDKs/BotService/Management.BotService/Generated/EnterpriseChannelsOperationsExtensions.cs b/src/SDKs/BotService/Management.BotService/Generated/EnterpriseChannelsOperationsExtensions.cs new file mode 100644 index 000000000000..9118a99644a6 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/EnterpriseChannelsOperationsExtensions.cs @@ -0,0 +1,497 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for EnterpriseChannelsOperations. + /// + public static partial class EnterpriseChannelsOperationsExtensions + { + /// + /// Check whether an Enterprise Channel name is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The parameters to provide for the Enterprise Channel check name + /// availability request. + /// + public static EnterpriseChannelCheckNameAvailabilityResponse CheckNameAvailability(this IEnterpriseChannelsOperations operations, EnterpriseChannelCheckNameAvailabilityRequest parameters) + { + return operations.CheckNameAvailabilityAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// Check whether an Enterprise Channel name is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The parameters to provide for the Enterprise Channel check name + /// availability request. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IEnterpriseChannelsOperations operations, EnterpriseChannelCheckNameAvailabilityRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns all the resources of a particular type belonging to a resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + public static IPage ListByResourceGroup(this IEnterpriseChannelsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Returns all the resources of a particular type belonging to a resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IEnterpriseChannelsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates an Enterprise Channel. + /// + /// + /// 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 parameters to provide for the new Enterprise Channel. + /// + public static EnterpriseChannel Create(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, EnterpriseChannel parameters) + { + return operations.CreateAsync(resourceGroupName, resourceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates an Enterprise Channel. + /// + /// + /// 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 parameters to provide for the new Enterprise Channel. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, EnterpriseChannel parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an Enterprise Channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// Specifies the location 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 an Enterprise Channel resource. + /// + public static EnterpriseChannel Update(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties)) + { + return operations.UpdateAsync(resourceGroupName, resourceName, location, tags, sku, kind, etag, properties).GetAwaiter().GetResult(); + } + + /// + /// Updates an Enterprise Channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// Specifies the location 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 an Enterprise Channel resource. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, location, tags, sku, kind, etag, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Enterprise Channel from the resource group + /// + /// + /// 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 void Delete(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Enterprise Channel from the resource group + /// + /// + /// 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 DeleteAsync(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns an Enterprise Channel specified by the parameters. + /// + /// + /// 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 EnterpriseChannel Get(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns an Enterprise Channel specified by the parameters. + /// + /// + /// 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 GetAsync(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates an Enterprise Channel. + /// + /// + /// 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 parameters to provide for the new Enterprise Channel. + /// + public static EnterpriseChannel BeginCreate(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, EnterpriseChannel parameters) + { + return operations.BeginCreateAsync(resourceGroupName, resourceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates an Enterprise Channel. + /// + /// + /// 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 parameters to provide for the new Enterprise Channel. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, EnterpriseChannel parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, resourceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an Enterprise Channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// Specifies the location 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 an Enterprise Channel resource. + /// + public static EnterpriseChannel BeginUpdate(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties)) + { + return operations.BeginUpdateAsync(resourceGroupName, resourceName, location, tags, sku, kind, etag, properties).GetAwaiter().GetResult(); + } + + /// + /// Updates an Enterprise Channel. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// Specifies the location 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 an Enterprise Channel resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, location, tags, sku, kind, etag, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Enterprise Channel from the resource group + /// + /// + /// 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 void BeginDelete(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName) + { + operations.BeginDeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Enterprise Channel from the resource group + /// + /// + /// 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 BeginDeleteAsync(this IEnterpriseChannelsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns all the resources of a particular type belonging to a resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IEnterpriseChannelsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns all the resources of a particular type belonging to a resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IEnterpriseChannelsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/IAzureBotServiceClient.cs b/src/SDKs/BotService/Management.BotService/Generated/IAzureBotServiceClient.cs index b20a65d23132..e4100a0176e5 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/IAzureBotServiceClient.cs +++ b/src/SDKs/BotService/Management.BotService/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; } @@ -85,5 +85,15 @@ public partial interface IAzureBotServiceClient : System.IDisposable /// IOperations Operations { get; } + /// + /// Gets the IBotConnectionOperations. + /// + IBotConnectionOperations BotConnection { get; } + + /// + /// Gets the IEnterpriseChannelsOperations. + /// + IEnterpriseChannelsOperations EnterpriseChannels { get; } + } } diff --git a/src/SDKs/BotService/Management.BotService/Generated/IBotConnectionOperations.cs b/src/SDKs/BotService/Management.BotService/Generated/IBotConnectionOperations.cs new file mode 100644 index 000000000000..37e2535c1248 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/IBotsOperations.cs b/src/SDKs/BotService/Management.BotService/Generated/IBotsOperations.cs index 95e5168e22b4..7295bd395815 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/IBotsOperations.cs +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/IChannelsOperations.cs b/src/SDKs/BotService/Management.BotService/Generated/IChannelsOperations.cs index 9707b69b1d0c..83f8547c520a 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/IChannelsOperations.cs +++ b/src/SDKs/BotService/Management.BotService/Generated/IChannelsOperations.cs @@ -27,7 +27,7 @@ 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. @@ -61,7 +61,7 @@ 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. @@ -111,7 +111,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 +137,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,7 +165,7 @@ 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. @@ -197,7 +197,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/src/SDKs/BotService/Management.BotService/Generated/IEnterpriseChannelsOperations.cs b/src/SDKs/BotService/Management.BotService/Generated/IEnterpriseChannelsOperations.cs new file mode 100644 index 000000000000..d44de08c39a6 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/IEnterpriseChannelsOperations.cs @@ -0,0 +1,309 @@ +// +// 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; + + /// + /// EnterpriseChannelsOperations operations. + /// + public partial interface IEnterpriseChannelsOperations + { + /// + /// Check whether an Enterprise Channel name is available. + /// + /// + /// The parameters to provide for the Enterprise Channel check name + /// availability request. + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(EnterpriseChannelCheckNameAvailabilityRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns all the resources of a particular type belonging to a + /// resource group. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates an Enterprise Channel. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The parameters to provide for the new Enterprise Channel. + /// + /// + /// 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, EnterpriseChannel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an Enterprise Channel. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// Specifies the location 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 an Enterprise Channel 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Enterprise Channel from the resource group + /// + /// + /// 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 a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns an Enterprise Channel specified by the parameters. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates an Enterprise Channel. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// The parameters to provide for the new Enterprise Channel. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, EnterpriseChannel parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an Enterprise Channel. + /// + /// + /// The name of the Bot resource group in the user subscription. + /// + /// + /// The name of the Bot resource. + /// + /// + /// Specifies the location 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 an Enterprise Channel 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string location = default(string), IDictionary tags = default(IDictionary), Sku sku = default(Sku), string kind = default(string), string etag = default(string), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Enterprise Channel from the resource group + /// + /// + /// 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 a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns all the resources of a particular type belonging to a + /// resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/Models/ConnectionItemName.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/ConnectionItemName.cs new file mode 100644 index 000000000000..f1ae4d6ae115 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/ConnectionSetting.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/ConnectionSetting.cs new file mode 100644 index 000000000000..f1962776955e --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/ConnectionSettingParameter.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/ConnectionSettingParameter.cs new file mode 100644 index 000000000000..4144808ef27a --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/ConnectionSettingProperties.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/ConnectionSettingProperties.cs new file mode 100644 index 000000000000..57fe9775a560 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/DirectLineSite.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/DirectLineSite.cs index 41476af5c076..e6692aaf87ec 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/Models/DirectLineSite.cs +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannel.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannel.cs new file mode 100644 index 000000000000..8378c750b5e8 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannel.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Enterprise Channel resource definition + /// + public partial class EnterpriseChannel : Resource + { + /// + /// Initializes a new instance of the EnterpriseChannel class. + /// + public EnterpriseChannel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnterpriseChannel 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 an + /// Enterprise Channel resource. + public EnterpriseChannel(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), EnterpriseChannelProperties properties = default(EnterpriseChannelProperties)) + : 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 an Enterprise + /// Channel resource. + /// + [JsonProperty(PropertyName = "properties")] + public EnterpriseChannelProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelCheckNameAvailabilityRequest.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelCheckNameAvailabilityRequest.cs new file mode 100644 index 000000000000..c0dc2219b7f4 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelCheckNameAvailabilityRequest.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A request to Bot Service Management to check availability of an + /// Enterprise Channel name. + /// + public partial class EnterpriseChannelCheckNameAvailabilityRequest + { + /// + /// Initializes a new instance of the + /// EnterpriseChannelCheckNameAvailabilityRequest class. + /// + public EnterpriseChannelCheckNameAvailabilityRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EnterpriseChannelCheckNameAvailabilityRequest class. + /// + /// The name of the Enterprise Channel for which + /// availability needs to be checked. + public EnterpriseChannelCheckNameAvailabilityRequest(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the Enterprise Channel for which + /// availability needs to be checked. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelCheckNameAvailabilityResponse.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelCheckNameAvailabilityResponse.cs new file mode 100644 index 000000000000..62f9c7665afb --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelCheckNameAvailabilityResponse.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A request to Bot Service Management to check availability of an + /// Enterprise Channel name. + /// + public partial class EnterpriseChannelCheckNameAvailabilityResponse + { + /// + /// Initializes a new instance of the + /// EnterpriseChannelCheckNameAvailabilityResponse class. + /// + public EnterpriseChannelCheckNameAvailabilityResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EnterpriseChannelCheckNameAvailabilityResponse class. + /// + /// Indicates if the Enterprise Channel name is + /// valid. + /// Additional information about why a bot name + /// is not available. + public EnterpriseChannelCheckNameAvailabilityResponse(bool? valid = default(bool?), string message = default(string)) + { + Valid = valid; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates if the Enterprise Channel name is valid. + /// + [JsonProperty(PropertyName = "valid")] + public bool? Valid { get; set; } + + /// + /// Gets or sets additional information about why a bot name is not + /// available. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelNode.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelNode.cs new file mode 100644 index 000000000000..e65af5e17324 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelNode.cs @@ -0,0 +1,115 @@ +// +// 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 properties specific to an Enterprise Channel Node. + /// + public partial class EnterpriseChannelNode + { + /// + /// Initializes a new instance of the EnterpriseChannelNode class. + /// + public EnterpriseChannelNode() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnterpriseChannelNode class. + /// + /// The name of the Enterprise Channel Node. + /// The sku of the Enterprise Channel + /// Node. + /// The location of the Enterprise Channel + /// Node. + /// Id of Enterprise Channel Node. This is generated + /// by the Bot Framework. + /// The current state of the Enterprise Channel + /// Node. Possible values include: 'Creating', 'CreateFailed', + /// 'Started', 'Starting', 'StartFailed', 'Stopped', 'Stopping', + /// 'StopFailed', 'Deleting', 'DeleteFailed' + public EnterpriseChannelNode(string name, string azureSku, string azureLocation, string id = default(string), string state = default(string)) + { + Id = id; + State = state; + Name = name; + AzureSku = azureSku; + AzureLocation = azureLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of Enterprise Channel Node. This is generated by the Bot + /// Framework. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets or sets the current state of the Enterprise Channel Node. + /// Possible values include: 'Creating', 'CreateFailed', 'Started', + /// 'Starting', 'StartFailed', 'Stopped', 'Stopping', 'StopFailed', + /// 'Deleting', 'DeleteFailed' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets the name of the Enterprise Channel Node. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the sku of the Enterprise Channel Node. + /// + [JsonProperty(PropertyName = "azureSku")] + public string AzureSku { get; set; } + + /// + /// Gets or sets the location of the Enterprise Channel Node. + /// + [JsonProperty(PropertyName = "azureLocation")] + public string AzureLocation { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (AzureSku == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AzureSku"); + } + if (AzureLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AzureLocation"); + } + } + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelNodeState.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelNodeState.cs new file mode 100644 index 000000000000..632dec9ec1fe --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelNodeState.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + + /// + /// Defines values for EnterpriseChannelNodeState. + /// + public static class EnterpriseChannelNodeState + { + public const string Creating = "Creating"; + public const string CreateFailed = "CreateFailed"; + public const string Started = "Started"; + public const string Starting = "Starting"; + public const string StartFailed = "StartFailed"; + public const string Stopped = "Stopped"; + public const string Stopping = "Stopping"; + public const string StopFailed = "StopFailed"; + public const string Deleting = "Deleting"; + public const string DeleteFailed = "DeleteFailed"; + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelProperties.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelProperties.cs new file mode 100644 index 000000000000..52e76a2e375b --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelProperties.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 Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The parameters to provide for the Enterprise Channel. + /// + public partial class EnterpriseChannelProperties + { + /// + /// Initializes a new instance of the EnterpriseChannelProperties + /// class. + /// + public EnterpriseChannelProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnterpriseChannelProperties + /// class. + /// + /// The nodes associated with the Enterprise + /// Channel. + /// The current state of the Enterprise Channel. + /// Possible values include: 'Creating', 'CreateFailed', 'Started', + /// 'Starting', 'StartFailed', 'Stopped', 'Stopping', 'StopFailed', + /// 'Deleting', 'DeleteFailed' + public EnterpriseChannelProperties(IList nodes, string state = default(string)) + { + State = state; + Nodes = nodes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current state of the Enterprise Channel. Possible + /// values include: 'Creating', 'CreateFailed', 'Started', 'Starting', + /// 'StartFailed', 'Stopped', 'Stopping', 'StopFailed', 'Deleting', + /// 'DeleteFailed' + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets the nodes associated with the Enterprise Channel. + /// + [JsonProperty(PropertyName = "nodes")] + public IList Nodes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Nodes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Nodes"); + } + if (Nodes != null) + { + foreach (var element in Nodes) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelState.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelState.cs new file mode 100644 index 000000000000..7e093ea498e6 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/Models/EnterpriseChannelState.cs @@ -0,0 +1,30 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.BotService.Models +{ + + /// + /// Defines values for EnterpriseChannelState. + /// + public static class EnterpriseChannelState + { + public const string Creating = "Creating"; + public const string CreateFailed = "CreateFailed"; + public const string Started = "Started"; + public const string Starting = "Starting"; + public const string StartFailed = "StartFailed"; + public const string Stopped = "Stopped"; + public const string Stopping = "Stopping"; + public const string StopFailed = "StopFailed"; + public const string Deleting = "Deleting"; + public const string DeleteFailed = "DeleteFailed"; + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/Models/MsTeamsChannelProperties.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/MsTeamsChannelProperties.cs index b7ffff1a6556..b8ed1b46cfab 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/Models/MsTeamsChannelProperties.cs +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProvider.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProvider.cs new file mode 100644 index 000000000000..e442d60144af --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProviderParameter.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProviderParameter.cs new file mode 100644 index 000000000000..003b42f81f28 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProviderProperties.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProviderProperties.cs new file mode 100644 index 000000000000..93092b941bb8 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/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/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProviderResponseList.cs b/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProviderResponseList.cs new file mode 100644 index 000000000000..c24f81a0e601 --- /dev/null +++ b/src/SDKs/BotService/Management.BotService/Generated/Models/ServiceProviderResponseList.cs @@ -0,0 +1,67 @@ +// +// 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 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 service providers. + /// Gets the list of bot service 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 + /// service providers. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + /// + /// Gets the list of bot service service providers and their + /// properties. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + } +} diff --git a/src/SDKs/BotService/Management.BotService/Generated/SdkInfo_AzureBotService.cs b/src/SDKs/BotService/Management.BotService/Generated/SdkInfo_AzureBotService.cs index 7cea5b1f8c6e..48d36960f9dc 100644 --- a/src/SDKs/BotService/Management.BotService/Generated/SdkInfo_AzureBotService.cs +++ b/src/SDKs/BotService/Management.BotService/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", "2018-07-12"), + new Tuple("BotService", "Bots", "2018-07-12"), + new Tuple("BotService", "Channels", "2018-07-12"), + new Tuple("BotService", "EnterpriseChannels", "2018-07-12"), + new Tuple("BotService", "Operations", "2018-07-12"), + }.AsEnumerable(); + } + } + } }