From aff8441e7007bd5205bbfdd3d42124b908cc2067 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 19 Mar 2021 02:58:29 +0000 Subject: [PATCH] CodeGen from PR 13512 in Azure/azure-rest-api-specs Merge dcba65d90612d63ea931370ebdc20ffe8feb42c0 into 1c292ffc343d0f865dab7597aa10377ac4495cd9 --- .../Generated/ApiKeysOperationsExtensions.cs | 180 -- .../src/Generated/HostsOperations.cs | 420 --- .../Generated/HostsOperationsExtensions.cs | 99 - .../src/Generated/IApiKeysOperations.cs | 126 - .../src/Generated/IHostsOperations.cs | 75 - ...cs => IMarketplaceAgreementsOperations.cs} | 43 +- .../src/Generated/IMicrosoftDatadogClient.cs | 36 +- .../IMonitoredResourcesOperations.cs | 77 - .../src/Generated/IMonitorsOperations.cs | 307 +- .../src/Generated/IOperations.cs | 8 +- .../IRefreshSetPasswordOperations.cs | 53 - .../ISingleSignOnConfigurationsOperations.cs | 25 +- .../src/Generated/ITagRulesOperations.cs | 19 +- .../Generated/LinkedResourcesOperations.cs | 422 --- .../LinkedResourcesOperationsExtensions.cs | 103 - ....cs => MarketplaceAgreementsOperations.cs} | 308 +- ...rketplaceAgreementsOperationsExtensions.cs | 121 + .../src/Generated/MicrosoftDatadogClient.cs | 46 +- .../src/Generated/Models/CreatedByType.cs | 24 + .../Models/DatadogAgreementProperties.cs | 113 + .../Models/DatadogAgreementResource.cs | 81 + .../Models/DatadogMonitorResource.cs | 8 +- .../Models/DatadogOrganizationProperties.cs | 32 +- .../Models/DatadogSingleSignOnProperties.cs | 18 +- .../Models/DatadogSingleSignOnResource.cs | 8 +- .../Generated/Models/ErrorAdditionalInfo.cs | 59 + .../src/Generated/Models/ErrorDetail.cs | 85 + ...faultErrorResponse.cs => ErrorResponse.cs} | 24 +- .../src/Generated/Models/ErrorResponseBody.cs | 66 - ...Exception.cs => ErrorResponseException.cs} | 20 +- .../Models/MarketplaceSubscriptionStatus.cs | 2 + .../src/Generated/Models/MonitorProperties.cs | 6 +- .../Generated/Models/MonitoringTagRules.cs | 8 +- .../Models/MonitoringTagRulesProperties.cs | 14 +- .../src/Generated/Models/SystemData.cs | 103 + .../src/Generated/Models/UserInfo.cs | 3 + .../Generated/MonitoredResourcesOperations.cs | 422 --- .../MonitoredResourcesOperationsExtensions.cs | 103 - .../src/Generated/MonitorsOperations.cs | 2693 +++++++++++++++-- .../Generated/MonitorsOperationsExtensions.cs | 453 ++- .../src/Generated/Operations.cs | 20 +- .../src/Generated/OperationsExtensions.cs | 16 +- .../Generated/RefreshSetPasswordOperations.cs | 252 -- .../RefreshSetPasswordOperationsExtensions.cs | 65 - .../SdkInfo_MicrosoftDatadogClient.cs | 25 +- .../SingleSignOnConfigurationsOperations.cs | 101 +- ...ignOnConfigurationsOperationsExtensions.cs | 22 +- .../src/Generated/TagRulesOperations.cs | 98 +- .../Generated/TagRulesOperationsExtensions.cs | 16 +- 49 files changed, 4275 insertions(+), 3153 deletions(-) delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ApiKeysOperationsExtensions.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/HostsOperations.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/HostsOperationsExtensions.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IApiKeysOperations.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IHostsOperations.cs rename sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/{ILinkedResourcesOperations.cs => IMarketplaceAgreementsOperations.cs} (52%) delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMonitoredResourcesOperations.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IRefreshSetPasswordOperations.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/LinkedResourcesOperations.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/LinkedResourcesOperationsExtensions.cs rename sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/{ApiKeysOperations.cs => MarketplaceAgreementsOperations.cs} (63%) create mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MarketplaceAgreementsOperationsExtensions.cs create mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/CreatedByType.cs create mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogAgreementProperties.cs create mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogAgreementResource.cs create mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorDetail.cs rename sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/{ResourceProviderDefaultErrorResponse.cs => ErrorResponse.cs} (57%) delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponseBody.cs rename sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/{ResourceProviderDefaultErrorResponseException.cs => ErrorResponseException.cs} (63%) create mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/SystemData.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitoredResourcesOperations.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitoredResourcesOperationsExtensions.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/RefreshSetPasswordOperations.cs delete mode 100644 sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/RefreshSetPasswordOperationsExtensions.cs diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ApiKeysOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ApiKeysOperationsExtensions.cs deleted file mode 100644 index 81015b2c1588c..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ApiKeysOperationsExtensions.cs +++ /dev/null @@ -1,180 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ApiKeysOperations. - /// - public static partial class ApiKeysOperationsExtensions - { - /// - /// List the api keys for a given monitor resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - public static IPage List(this IApiKeysOperations operations, string resourceGroupName, string monitorName) - { - return operations.ListAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); - } - - /// - /// List the api keys for a given monitor resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IApiKeysOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get the default api key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - public static DatadogApiKey GetDefaultKey(this IApiKeysOperations operations, string resourceGroupName, string monitorName) - { - return operations.GetDefaultKeyAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); - } - - /// - /// Get the default api key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The cancellation token. - /// - public static async Task GetDefaultKeyAsync(this IApiKeysOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDefaultKeyWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Set the default api key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// - public static void SetDefaultKey(this IApiKeysOperations operations, string resourceGroupName, string monitorName, DatadogApiKey body = default(DatadogApiKey)) - { - operations.SetDefaultKeyAsync(resourceGroupName, monitorName, body).GetAwaiter().GetResult(); - } - - /// - /// Set the default api key. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task SetDefaultKeyAsync(this IApiKeysOperations operations, string resourceGroupName, string monitorName, DatadogApiKey body = default(DatadogApiKey), CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.SetDefaultKeyWithHttpMessagesAsync(resourceGroupName, monitorName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List the api keys for a given monitor resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IApiKeysOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List the api keys for a given monitor 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> ListNextAsync(this IApiKeysOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/HostsOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/HostsOperations.cs deleted file mode 100644 index ed1219877a563..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/HostsOperations.cs +++ /dev/null @@ -1,420 +0,0 @@ -// -// 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.Datadog -{ - 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; - - /// - /// HostsOperations operations. - /// - internal partial class HostsOperations : IServiceOperations, IHostsOperations - { - /// - /// Initializes a new instance of the HostsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal HostsOperations(MicrosoftDatadogClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MicrosoftDatadogClient - /// - public MicrosoftDatadogClient Client { get; private set; } - - /// - /// List the hosts for a given monitor resource. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (monitorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("monitorName", monitorName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); - 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List the hosts for a given monitor 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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("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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/HostsOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/HostsOperationsExtensions.cs deleted file mode 100644 index 44029db154e8a..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/HostsOperationsExtensions.cs +++ /dev/null @@ -1,99 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for HostsOperations. - /// - public static partial class HostsOperationsExtensions - { - /// - /// List the hosts for a given monitor resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - public static IPage List(this IHostsOperations operations, string resourceGroupName, string monitorName) - { - return operations.ListAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); - } - - /// - /// List the hosts for a given monitor resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IHostsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List the hosts for a given monitor resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IHostsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List the hosts for a given monitor 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> ListNextAsync(this IHostsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IApiKeysOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IApiKeysOperations.cs deleted file mode 100644 index f41c56a87efe0..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IApiKeysOperations.cs +++ /dev/null @@ -1,126 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ApiKeysOperations operations. - /// - public partial interface IApiKeysOperations - { - /// - /// List the api keys for a given monitor resource. - /// - /// - /// The name of the resource group to which the Datadog resource - /// belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get the default api key. - /// - /// - /// The name of the resource group to which the Datadog resource - /// belongs. - /// - /// - /// Monitor resource name - /// - /// - /// 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> GetDefaultKeyWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Set the default api key. - /// - /// - /// The name of the resource group to which the Datadog resource - /// belongs. - /// - /// - /// Monitor resource name - /// - /// - /// - /// - /// 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 SetDefaultKeyWithHttpMessagesAsync(string resourceGroupName, string monitorName, DatadogApiKey body = default(DatadogApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the api keys for a given monitor 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IHostsOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IHostsOperations.cs deleted file mode 100644 index c715ef29b2e45..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IHostsOperations.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// HostsOperations operations. - /// - public partial interface IHostsOperations - { - /// - /// List the hosts for a given monitor resource. - /// - /// - /// The name of the resource group to which the Datadog resource - /// belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the hosts for a given monitor 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ILinkedResourcesOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMarketplaceAgreementsOperations.cs similarity index 52% rename from sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ILinkedResourcesOperations.cs rename to sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMarketplaceAgreementsOperations.cs index 4db15d26a5c1c..9fbc051da3f23 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ILinkedResourcesOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMarketplaceAgreementsOperations.cs @@ -19,20 +19,34 @@ namespace Microsoft.Azure.Management.Datadog using System.Threading.Tasks; /// - /// LinkedResourcesOperations operations. + /// MarketplaceAgreementsOperations operations. /// - public partial interface ILinkedResourcesOperations + public partial interface IMarketplaceAgreementsOperations { /// - /// List all Azure resources associated to the same Datadog - /// organization as the target resource. + /// List Datadog marketplace agreements in the subscription. /// - /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. /// - /// - /// Monitor resource name + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create Datadog marketplace agreement in the subscription. + /// + /// + /// Represents the properties of the resource. /// /// /// The headers that will be added to request. @@ -40,7 +54,7 @@ public partial interface ILinkedResourcesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -49,10 +63,9 @@ public partial interface ILinkedResourcesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(DatadogAgreementProperties properties = default(DatadogAgreementProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// List all Azure resources associated to the same Datadog - /// organization as the target resource. + /// List Datadog marketplace agreements in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -63,7 +76,7 @@ public partial interface ILinkedResourcesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -72,6 +85,6 @@ public partial interface ILinkedResourcesOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMicrosoftDatadogClient.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMicrosoftDatadogClient.cs index c545fa3335702..3185d3eb15556 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMicrosoftDatadogClient.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMicrosoftDatadogClient.cs @@ -40,14 +40,14 @@ public partial interface IMicrosoftDatadogClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// The Microsoft Azure subscription ID. + /// The API version to use for this operation. /// - string SubscriptionId { get; set; } + string ApiVersion { get; } /// - /// The API version to use for this operation. + /// The ID of the target subscription. /// - string ApiVersion { get; } + string SubscriptionId { get; set; } /// /// The preferred language for the response. @@ -69,29 +69,9 @@ public partial interface IMicrosoftDatadogClient : System.IDisposable /// - /// Gets the IApiKeysOperations. - /// - IApiKeysOperations ApiKeys { get; } - - /// - /// Gets the IHostsOperations. - /// - IHostsOperations Hosts { get; } - - /// - /// Gets the ILinkedResourcesOperations. - /// - ILinkedResourcesOperations LinkedResources { get; } - - /// - /// Gets the IMonitoredResourcesOperations. + /// Gets the IMarketplaceAgreementsOperations. /// - IMonitoredResourcesOperations MonitoredResources { get; } - - /// - /// Gets the IOperations. - /// - IOperations Operations { get; } + IMarketplaceAgreementsOperations MarketplaceAgreements { get; } /// /// Gets the IMonitorsOperations. @@ -99,9 +79,9 @@ public partial interface IMicrosoftDatadogClient : System.IDisposable IMonitorsOperations Monitors { get; } /// - /// Gets the IRefreshSetPasswordOperations. + /// Gets the IOperations. /// - IRefreshSetPasswordOperations RefreshSetPassword { get; } + IOperations Operations { get; } /// /// Gets the ITagRulesOperations. diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMonitoredResourcesOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMonitoredResourcesOperations.cs deleted file mode 100644 index 1f10b2a0bc604..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMonitoredResourcesOperations.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// MonitoredResourcesOperations operations. - /// - public partial interface IMonitoredResourcesOperations - { - /// - /// List the resources currently being monitored by the Datadog monitor - /// resource. - /// - /// - /// The name of the resource group to which the Datadog resource - /// belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the resources currently being monitored by the Datadog monitor - /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMonitorsOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMonitorsOperations.cs index 5b573323c75ed..155d3057f2fb7 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMonitorsOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IMonitorsOperations.cs @@ -23,6 +23,157 @@ namespace Microsoft.Azure.Management.Datadog /// public partial interface IMonitorsOperations { + /// + /// List the api keys for a given monitor resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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>> ListApiKeysWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the default api key. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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> GetDefaultKeyWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Set the default api key. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// + /// + /// 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 SetDefaultKeyWithHttpMessagesAsync(string resourceGroupName, string monitorName, DatadogApiKey body = default(DatadogApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the hosts for a given monitor resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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>> ListHostsWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all Azure resources associated to the same Datadog + /// organization as the target resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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>> ListLinkedResourcesWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the resources currently being monitored by the Datadog monitor + /// resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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>> ListMonitoredResourcesWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List all monitors under the specified subscription. /// @@ -32,7 +183,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -46,8 +197,7 @@ public partial interface IMonitorsOperations /// List all monitors under the specified resource group. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -55,7 +205,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -69,8 +219,7 @@ public partial interface IMonitorsOperations /// Get the properties of a specific monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -81,7 +230,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -95,8 +244,7 @@ public partial interface IMonitorsOperations /// Create a monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -109,7 +257,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -123,8 +271,7 @@ public partial interface IMonitorsOperations /// Update a monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -137,7 +284,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -151,8 +298,7 @@ public partial interface IMonitorsOperations /// Delete a monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -163,7 +309,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -171,11 +317,35 @@ public partial interface IMonitorsOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Refresh the set password link and return a latest one. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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> RefreshSetPasswordLinkWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Create a monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -188,7 +358,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -202,8 +372,7 @@ public partial interface IMonitorsOperations /// Delete a monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -214,7 +383,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -222,6 +391,96 @@ public partial interface IMonitorsOperations /// Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// List the api keys for a given monitor 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>> ListApiKeysNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the hosts for a given monitor 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>> ListHostsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all Azure resources associated to the same Datadog + /// organization as the target 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>> ListLinkedResourcesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List the resources currently being monitored by the Datadog monitor + /// 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>> ListMonitoredResourcesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// List all monitors under the specified subscription. /// /// @@ -233,7 +492,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -255,7 +514,7 @@ public partial interface IMonitorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IOperations.cs index e5846ca36703a..9156d305eadee 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IOperations.cs @@ -25,7 +25,7 @@ public partial interface IOperations { /// /// List all operations provided by Microsoft.Datadog for the - /// 2020-02-01-preview api version. + /// 2021-03-01 api version. /// /// /// The headers that will be added to request. @@ -33,7 +33,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -45,7 +45,7 @@ public partial interface IOperations Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// List all operations provided by Microsoft.Datadog for the - /// 2020-02-01-preview api version. + /// 2021-03-01 api version. /// /// /// The NextLink from the previous successful call to List operation. @@ -56,7 +56,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IRefreshSetPasswordOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IRefreshSetPasswordOperations.cs deleted file mode 100644 index c95070e8df9bc..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/IRefreshSetPasswordOperations.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// RefreshSetPasswordOperations operations. - /// - public partial interface IRefreshSetPasswordOperations - { - /// - /// Refresh the set password link and return a latest one. - /// - /// - /// The name of the resource group to which the Datadog resource - /// belongs. - /// - /// - /// Monitor resource name - /// - /// - /// 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 monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ISingleSignOnConfigurationsOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ISingleSignOnConfigurationsOperations.cs index 176d2bc8cd65e..eb46111f1060b 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ISingleSignOnConfigurationsOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ISingleSignOnConfigurationsOperations.cs @@ -28,8 +28,7 @@ public partial interface ISingleSignOnConfigurationsOperations /// resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -40,7 +39,7 @@ public partial interface ISingleSignOnConfigurationsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -54,13 +53,13 @@ public partial interface ISingleSignOnConfigurationsOperations /// Configures single-sign-on for this resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// @@ -70,7 +69,7 @@ public partial interface ISingleSignOnConfigurationsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -84,13 +83,13 @@ public partial interface ISingleSignOnConfigurationsOperations /// Gets the datadog single sign-on resource for the given Monitor. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// The headers that will be added to request. @@ -98,7 +97,7 @@ public partial interface ISingleSignOnConfigurationsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -112,13 +111,13 @@ public partial interface ISingleSignOnConfigurationsOperations /// Configures single-sign-on for this resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// @@ -128,7 +127,7 @@ public partial interface ISingleSignOnConfigurationsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -151,7 +150,7 @@ public partial interface ISingleSignOnConfigurationsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ITagRulesOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ITagRulesOperations.cs index 0befb5e6db1d7..072c29393dd2d 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ITagRulesOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ITagRulesOperations.cs @@ -27,8 +27,7 @@ public partial interface ITagRulesOperations /// List the tag rules for a given monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -39,7 +38,7 @@ public partial interface ITagRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -53,13 +52,13 @@ public partial interface ITagRulesOperations /// Create or update a tag rule set for a given monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Rule set name /// /// /// @@ -69,7 +68,7 @@ public partial interface ITagRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -83,13 +82,13 @@ public partial interface ITagRulesOperations /// Get a tag rule set for a given monitor resource. /// /// - /// The name of the resource group to which the Datadog resource - /// belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Rule set name /// /// /// The headers that will be added to request. @@ -97,7 +96,7 @@ public partial interface ITagRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -119,7 +118,7 @@ public partial interface ITagRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/LinkedResourcesOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/LinkedResourcesOperations.cs deleted file mode 100644 index 895cfe9333317..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/LinkedResourcesOperations.cs +++ /dev/null @@ -1,422 +0,0 @@ -// -// 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.Datadog -{ - 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; - - /// - /// LinkedResourcesOperations operations. - /// - internal partial class LinkedResourcesOperations : IServiceOperations, ILinkedResourcesOperations - { - /// - /// Initializes a new instance of the LinkedResourcesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal LinkedResourcesOperations(MicrosoftDatadogClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MicrosoftDatadogClient - /// - public MicrosoftDatadogClient Client { get; private set; } - - /// - /// List all Azure resources associated to the same Datadog organization as the - /// target resource. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (monitorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("monitorName", monitorName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); - 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List all Azure resources associated to the same Datadog organization as the - /// target 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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("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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/LinkedResourcesOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/LinkedResourcesOperationsExtensions.cs deleted file mode 100644 index befe4e89caefe..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/LinkedResourcesOperationsExtensions.cs +++ /dev/null @@ -1,103 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for LinkedResourcesOperations. - /// - public static partial class LinkedResourcesOperationsExtensions - { - /// - /// List all Azure resources associated to the same Datadog organization as the - /// target resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - public static IPage List(this ILinkedResourcesOperations operations, string resourceGroupName, string monitorName) - { - return operations.ListAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); - } - - /// - /// List all Azure resources associated to the same Datadog organization as the - /// target resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ILinkedResourcesOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all Azure resources associated to the same Datadog organization as the - /// target resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ILinkedResourcesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all Azure resources associated to the same Datadog organization as the - /// target 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> ListNextAsync(this ILinkedResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ApiKeysOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MarketplaceAgreementsOperations.cs similarity index 63% rename from sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ApiKeysOperations.cs rename to sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MarketplaceAgreementsOperations.cs index 769079fd90606..a7539fc0048dd 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/ApiKeysOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MarketplaceAgreementsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.Datadog using System.Threading.Tasks; /// - /// ApiKeysOperations operations. + /// MarketplaceAgreementsOperations operations. /// - internal partial class ApiKeysOperations : IServiceOperations, IApiKeysOperations + internal partial class MarketplaceAgreementsOperations : IServiceOperations, IMarketplaceAgreementsOperations { /// - /// Initializes a new instance of the ApiKeysOperations class. + /// Initializes a new instance of the MarketplaceAgreementsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class ApiKeysOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal ApiKeysOperations(MicrosoftDatadogClient client) + internal MarketplaceAgreementsOperations(MicrosoftDatadogClient client) { if (client == null) { @@ -51,21 +51,15 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) public MicrosoftDatadogClient Client { get; private set; } /// - /// List the api keys for a given monitor resource. + /// List Datadog marketplace agreements in the subscription. /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -80,19 +74,18 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (monitorName == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } if (Client.ApiVersion == null) { @@ -112,17 +105,13 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("monitorName", monitorName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -135,7 +124,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -188,11 +177,11 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -216,7 +205,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -229,7 +218,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -249,13 +238,10 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) } /// - /// Get the default api key. + /// Create Datadog marketplace agreement in the subscription. /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name + /// + /// Represents the properties of the resource. /// /// /// Headers that will be added to request. @@ -263,7 +249,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -278,19 +264,18 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetDefaultKeyWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(DatadogAgreementProperties properties = default(DatadogAgreementProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (monitorName == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } if (Client.ApiVersion == null) { @@ -303,6 +288,12 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } + DatadogAgreementResource body = default(DatadogAgreementResource); + if (properties != null) + { + body = new DatadogAgreementResource(); + body.Properties = properties; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -310,17 +301,14 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDefaultKey", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.Datadog/monitors/{monitorName}/getDefaultKey").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Datadog/agreements/default").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -333,7 +321,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -364,6 +352,12 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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) { @@ -386,11 +380,11 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -414,7 +408,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -427,7 +421,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -447,197 +441,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) } /// - /// Set the default api key. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// - /// - /// 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 SetDefaultKeyWithHttpMessagesAsync(string resourceGroupName, string monitorName, DatadogApiKey body = default(DatadogApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (monitorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } - if (body != null) - { - body.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("monitorName", monitorName); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SetDefaultKey", 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.Datadog/monitors/{monitorName}/setDefaultKey").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); - 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(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _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; - } - - /// - /// List the api keys for a given monitor resource. + /// List Datadog marketplace agreements in the subscription. /// /// /// The NextLink from the previous successful call to List operation. @@ -648,7 +452,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -663,7 +467,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -691,7 +495,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -744,11 +548,11 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -772,7 +576,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -785,7 +589,7 @@ internal ApiKeysOperations(MicrosoftDatadogClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MarketplaceAgreementsOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MarketplaceAgreementsOperationsExtensions.cs new file mode 100644 index 0000000000000..1c717caa3e8c1 --- /dev/null +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MarketplaceAgreementsOperationsExtensions.cs @@ -0,0 +1,121 @@ +// +// 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.Datadog +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MarketplaceAgreementsOperations. + /// + public static partial class MarketplaceAgreementsOperationsExtensions + { + /// + /// List Datadog marketplace agreements in the subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IMarketplaceAgreementsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// List Datadog marketplace agreements in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMarketplaceAgreementsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create Datadog marketplace agreement in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Represents the properties of the resource. + /// + public static DatadogAgreementResource CreateOrUpdate(this IMarketplaceAgreementsOperations operations, DatadogAgreementProperties properties = default(DatadogAgreementProperties)) + { + return operations.CreateOrUpdateAsync(properties).GetAwaiter().GetResult(); + } + + /// + /// Create Datadog marketplace agreement in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Represents the properties of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IMarketplaceAgreementsOperations operations, DatadogAgreementProperties properties = default(DatadogAgreementProperties), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List Datadog marketplace agreements in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IMarketplaceAgreementsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List Datadog marketplace agreements in the subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IMarketplaceAgreementsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MicrosoftDatadogClient.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MicrosoftDatadogClient.cs index bbbac3388bcd5..fa9b31a4204fb 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MicrosoftDatadogClient.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MicrosoftDatadogClient.cs @@ -44,14 +44,14 @@ public partial class MicrosoftDatadogClient : ServiceClient - /// The Microsoft Azure subscription ID. + /// The API version to use for this operation. /// - public string SubscriptionId { get; set; } + public string ApiVersion { get; private set; } /// - /// The API version to use for this operation. + /// The ID of the target subscription. /// - public string ApiVersion { get; private set; } + public string SubscriptionId { get; set; } /// /// The preferred language for the response. @@ -72,29 +72,9 @@ public partial class MicrosoftDatadogClient : ServiceClient - /// Gets the IApiKeysOperations. - /// - public virtual IApiKeysOperations ApiKeys { get; private set; } - - /// - /// Gets the IHostsOperations. - /// - public virtual IHostsOperations Hosts { get; private set; } - - /// - /// Gets the ILinkedResourcesOperations. + /// Gets the IMarketplaceAgreementsOperations. /// - public virtual ILinkedResourcesOperations LinkedResources { get; private set; } - - /// - /// Gets the IMonitoredResourcesOperations. - /// - public virtual IMonitoredResourcesOperations MonitoredResources { get; private set; } - - /// - /// Gets the IOperations. - /// - public virtual IOperations Operations { get; private set; } + public virtual IMarketplaceAgreementsOperations MarketplaceAgreements { get; private set; } /// /// Gets the IMonitorsOperations. @@ -102,9 +82,9 @@ public partial class MicrosoftDatadogClient : ServiceClient - /// Gets the IRefreshSetPasswordOperations. + /// Gets the IOperations. /// - public virtual IRefreshSetPasswordOperations RefreshSetPassword { get; private set; } + public virtual IOperations Operations { get; private set; } /// /// Gets the ITagRulesOperations. @@ -357,17 +337,13 @@ public MicrosoftDatadogClient(System.Uri baseUri, ServiceClientCredentials crede /// private void Initialize() { - ApiKeys = new ApiKeysOperations(this); - Hosts = new HostsOperations(this); - LinkedResources = new LinkedResourcesOperations(this); - MonitoredResources = new MonitoredResourcesOperations(this); - Operations = new Operations(this); + MarketplaceAgreements = new MarketplaceAgreementsOperations(this); Monitors = new MonitorsOperations(this); - RefreshSetPassword = new RefreshSetPasswordOperations(this); + Operations = new Operations(this); TagRules = new TagRulesOperations(this); SingleSignOnConfigurations = new SingleSignOnConfigurationsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-02-01-preview"; + ApiVersion = "2021-03-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/CreatedByType.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..69d271dd0d945 --- /dev/null +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Datadog.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogAgreementProperties.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogAgreementProperties.cs new file mode 100644 index 0000000000000..9db4aaa2077cd --- /dev/null +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogAgreementProperties.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.Datadog.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Terms properties. + /// + public partial class DatadogAgreementProperties + { + /// + /// Initializes a new instance of the DatadogAgreementProperties class. + /// + public DatadogAgreementProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatadogAgreementProperties class. + /// + /// Publisher identifier string. + /// Product identifier string. + /// Plan identifier string. + /// Link to HTML with Microsoft and + /// Publisher terms. + /// Link to the privacy policy of the + /// publisher. + /// Date and time in UTC of when the + /// terms were accepted. This is empty if Accepted is false. + /// Terms signature. + /// If any version of the terms have been + /// accepted, otherwise false. + public DatadogAgreementProperties(string publisher = default(string), string product = default(string), string plan = default(string), string licenseTextLink = default(string), string privacyPolicyLink = default(string), System.DateTime? retrieveDatetime = default(System.DateTime?), string signature = default(string), bool? accepted = default(bool?)) + { + Publisher = publisher; + Product = product; + Plan = plan; + LicenseTextLink = licenseTextLink; + PrivacyPolicyLink = privacyPolicyLink; + RetrieveDatetime = retrieveDatetime; + Signature = signature; + Accepted = accepted; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets publisher identifier string. + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets product identifier string. + /// + [JsonProperty(PropertyName = "product")] + public string Product { get; set; } + + /// + /// Gets or sets plan identifier string. + /// + [JsonProperty(PropertyName = "plan")] + public string Plan { get; set; } + + /// + /// Gets or sets link to HTML with Microsoft and Publisher terms. + /// + [JsonProperty(PropertyName = "licenseTextLink")] + public string LicenseTextLink { get; set; } + + /// + /// Gets or sets link to the privacy policy of the publisher. + /// + [JsonProperty(PropertyName = "privacyPolicyLink")] + public string PrivacyPolicyLink { get; set; } + + /// + /// Gets or sets date and time in UTC of when the terms were accepted. + /// This is empty if Accepted is false. + /// + [JsonProperty(PropertyName = "retrieveDatetime")] + public System.DateTime? RetrieveDatetime { get; set; } + + /// + /// Gets or sets terms signature. + /// + [JsonProperty(PropertyName = "signature")] + public string Signature { get; set; } + + /// + /// Gets or sets if any version of the terms have been accepted, + /// otherwise false. + /// + [JsonProperty(PropertyName = "accepted")] + public bool? Accepted { get; set; } + + } +} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogAgreementResource.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogAgreementResource.cs new file mode 100644 index 0000000000000..a100efea4a845 --- /dev/null +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogAgreementResource.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Datadog.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class DatadogAgreementResource : IResource + { + /// + /// Initializes a new instance of the DatadogAgreementResource class. + /// + public DatadogAgreementResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DatadogAgreementResource class. + /// + /// ARM id of the resource. + /// Name of the agreement. + /// The type of the resource. + /// Represents the properties of the + /// resource. + public DatadogAgreementResource(string id = default(string), string name = default(string), string type = default(string), DatadogAgreementProperties properties = default(DatadogAgreementProperties), SystemData systemData = default(SystemData)) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets ARM id of the resource. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agreement. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets represents the properties of the resource. + /// + [JsonProperty(PropertyName = "properties")] + public DatadogAgreementProperties Properties { get; set; } + + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + + } +} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogMonitorResource.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogMonitorResource.cs index d779b00507b45..74cff3c485c39 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogMonitorResource.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogMonitorResource.cs @@ -33,7 +33,7 @@ public DatadogMonitorResource() /// ARM id of the monitor resource. /// Name of the monitor resource. /// The type of the monitor resource. - public DatadogMonitorResource(string location, string id = default(string), string name = default(string), string type = default(string), ResourceSku sku = default(ResourceSku), MonitorProperties properties = default(MonitorProperties), IdentityProperties identity = default(IdentityProperties), IDictionary tags = default(IDictionary)) + public DatadogMonitorResource(string location, string id = default(string), string name = default(string), string type = default(string), ResourceSku sku = default(ResourceSku), MonitorProperties properties = default(MonitorProperties), IdentityProperties identity = default(IdentityProperties), IDictionary tags = default(IDictionary), SystemData systemData = default(SystemData)) { Id = id; Name = name; @@ -43,6 +43,7 @@ public DatadogMonitorResource() Identity = identity; Tags = tags; Location = location; + SystemData = systemData; CustomInit(); } @@ -94,6 +95,11 @@ public DatadogMonitorResource() [JsonProperty(PropertyName = "location")] public string Location { get; set; } + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogOrganizationProperties.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogOrganizationProperties.cs index 461996f98473d..09ede033270fc 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogOrganizationProperties.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogOrganizationProperties.cs @@ -13,6 +13,9 @@ namespace Microsoft.Azure.Management.Datadog.Models using Newtonsoft.Json; using System.Linq; + /// + /// Datadog organization properties + /// public partial class DatadogOrganizationProperties { /// @@ -34,14 +37,22 @@ public DatadogOrganizationProperties() /// existing datadog organization. /// The client_id from an existing in /// exchange for an auth token to link organization. + /// The redirect uri for linking. + /// Api key associated to the Datadog + /// organization. + /// Application key associated to the + /// Datadog organization. /// The Id of the Enterprise App used for /// Single sign on. - public DatadogOrganizationProperties(string name = default(string), string id = default(string), string linkingAuthCode = default(string), string linkingClientId = default(string), string enterpriseAppId = default(string)) + public DatadogOrganizationProperties(string name = default(string), string id = default(string), string linkingAuthCode = default(string), string linkingClientId = default(string), string redirectUri = default(string), string apiKey = default(string), string applicationKey = default(string), string enterpriseAppId = default(string)) { Name = name; Id = id; LinkingAuthCode = linkingAuthCode; LinkingClientId = linkingClientId; + RedirectUri = redirectUri; + ApiKey = apiKey; + ApplicationKey = applicationKey; EnterpriseAppId = enterpriseAppId; CustomInit(); } @@ -77,6 +88,25 @@ public DatadogOrganizationProperties() [JsonProperty(PropertyName = "linkingClientId")] public string LinkingClientId { get; set; } + /// + /// Gets or sets the redirect uri for linking. + /// + [JsonProperty(PropertyName = "redirectUri")] + public string RedirectUri { get; set; } + + /// + /// Gets or sets api key associated to the Datadog organization. + /// + [JsonProperty(PropertyName = "apiKey")] + public string ApiKey { get; set; } + + /// + /// Gets or sets application key associated to the Datadog + /// organization. + /// + [JsonProperty(PropertyName = "applicationKey")] + public string ApplicationKey { get; set; } + /// /// Gets or sets the Id of the Enterprise App used for Single sign on. /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.cs index d61ed71857eae..394a2c8297ef6 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogSingleSignOnProperties.cs @@ -28,14 +28,18 @@ public DatadogSingleSignOnProperties() /// Initializes a new instance of the DatadogSingleSignOnProperties /// class. /// + /// Possible values include: + /// 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Canceled', 'Deleted', 'NotSpecified' /// Possible values include: 'Initial', /// 'Enable', 'Disable', 'Existing' /// The Id of the Enterprise App used for /// Single sign-on. /// The login URL specific to this /// Datadog Organization. - public DatadogSingleSignOnProperties(string singleSignOnState = default(string), string enterpriseAppId = default(string), string singleSignOnUrl = default(string)) + public DatadogSingleSignOnProperties(string provisioningState = default(string), string singleSignOnState = default(string), string enterpriseAppId = default(string), string singleSignOnUrl = default(string)) { + ProvisioningState = provisioningState; SingleSignOnState = singleSignOnState; EnterpriseAppId = enterpriseAppId; SingleSignOnUrl = singleSignOnUrl; @@ -47,6 +51,14 @@ public DatadogSingleSignOnProperties() /// partial void CustomInit(); + /// + /// Gets or sets possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', + /// 'Deleted', 'NotSpecified' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + /// /// Gets or sets possible values include: 'Initial', 'Enable', /// 'Disable', 'Existing' @@ -61,10 +73,10 @@ public DatadogSingleSignOnProperties() public string EnterpriseAppId { get; set; } /// - /// Gets or sets the login URL specific to this Datadog Organization. + /// Gets the login URL specific to this Datadog Organization. /// [JsonProperty(PropertyName = "singleSignOnUrl")] - public string SingleSignOnUrl { get; set; } + public string SingleSignOnUrl { get; private set; } } } diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogSingleSignOnResource.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogSingleSignOnResource.cs index f18d9af0b5d69..6f373e59233d1 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogSingleSignOnResource.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/DatadogSingleSignOnResource.cs @@ -33,12 +33,13 @@ public DatadogSingleSignOnResource() /// ARM id of the resource. /// Name of the configuration. /// The type of the resource. - public DatadogSingleSignOnResource(string id = default(string), string name = default(string), string type = default(string), DatadogSingleSignOnProperties properties = default(DatadogSingleSignOnProperties)) + public DatadogSingleSignOnResource(string id = default(string), string name = default(string), string type = default(string), DatadogSingleSignOnProperties properties = default(DatadogSingleSignOnProperties), SystemData systemData = default(SystemData)) { Id = id; Name = name; Type = type; Properties = properties; + SystemData = systemData; CustomInit(); } @@ -70,5 +71,10 @@ public DatadogSingleSignOnResource() [JsonProperty(PropertyName = "properties")] public DatadogSingleSignOnProperties Properties { get; set; } + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..712389be1444b --- /dev/null +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// 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.Datadog.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorDetail.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 0000000000000..6ddc068b6504b --- /dev/null +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// 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.Datadog.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ResourceProviderDefaultErrorResponse.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponse.cs similarity index 57% rename from sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ResourceProviderDefaultErrorResponse.cs rename to sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponse.cs index 52bccfa4645cf..19a8e022370d2 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ResourceProviderDefaultErrorResponse.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponse.cs @@ -13,22 +13,29 @@ namespace Microsoft.Azure.Management.Datadog.Models using Newtonsoft.Json; using System.Linq; - public partial class ResourceProviderDefaultErrorResponse + /// + /// Error response + /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse { /// - /// Initializes a new instance of the - /// ResourceProviderDefaultErrorResponse class. + /// Initializes a new instance of the ErrorResponse class. /// - public ResourceProviderDefaultErrorResponse() + public ErrorResponse() { CustomInit(); } /// - /// Initializes a new instance of the - /// ResourceProviderDefaultErrorResponse class. + /// Initializes a new instance of the ErrorResponse class. /// - public ResourceProviderDefaultErrorResponse(ErrorResponseBody error = default(ErrorResponseBody)) + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) { Error = error; CustomInit(); @@ -40,9 +47,10 @@ public ResourceProviderDefaultErrorResponse() partial void CustomInit(); /// + /// Gets or sets the error object. /// [JsonProperty(PropertyName = "error")] - public ErrorResponseBody Error { get; set; } + public ErrorDetail Error { get; set; } } } diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponseBody.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponseBody.cs deleted file mode 100644 index 6bc9344ead5d9..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponseBody.cs +++ /dev/null @@ -1,66 +0,0 @@ -// -// 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.Datadog.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class ErrorResponseBody - { - /// - /// Initializes a new instance of the ErrorResponseBody class. - /// - public ErrorResponseBody() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorResponseBody class. - /// - public ErrorResponseBody(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) - { - Code = code; - Message = message; - Target = target; - Details = details; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; set; } - - /// - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ResourceProviderDefaultErrorResponseException.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponseException.cs similarity index 63% rename from sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ResourceProviderDefaultErrorResponseException.cs rename to sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponseException.cs index 1f7bc4d63fb9b..aea9d4fc8dfd1 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ResourceProviderDefaultErrorResponseException.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/ErrorResponseException.cs @@ -13,10 +13,10 @@ namespace Microsoft.Azure.Management.Datadog.Models using Microsoft.Rest; /// - /// Exception thrown for an invalid response with - /// ResourceProviderDefaultErrorResponse information. + /// Exception thrown for an invalid response with ErrorResponse + /// information. /// - public partial class ResourceProviderDefaultErrorResponseException : RestException + public partial class ErrorResponseException : RestException { /// /// Gets information about the associated HTTP request. @@ -31,30 +31,30 @@ public partial class ResourceProviderDefaultErrorResponseException : RestExcepti /// /// Gets or sets the body object. /// - public ResourceProviderDefaultErrorResponse Body { get; set; } + public ErrorResponse Body { get; set; } /// - /// Initializes a new instance of the ResourceProviderDefaultErrorResponseException class. + /// Initializes a new instance of the ErrorResponseException class. /// - public ResourceProviderDefaultErrorResponseException() + public ErrorResponseException() { } /// - /// Initializes a new instance of the ResourceProviderDefaultErrorResponseException class. + /// Initializes a new instance of the ErrorResponseException class. /// /// The exception message. - public ResourceProviderDefaultErrorResponseException(string message) + public ErrorResponseException(string message) : this(message, null) { } /// - /// Initializes a new instance of the ResourceProviderDefaultErrorResponseException class. + /// Initializes a new instance of the ErrorResponseException class. /// /// The exception message. /// Inner exception. - public ResourceProviderDefaultErrorResponseException(string message, System.Exception innerException) + public ErrorResponseException(string message, System.Exception innerException) : base(message, innerException) { } diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MarketplaceSubscriptionStatus.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MarketplaceSubscriptionStatus.cs index 7ca947d6e37a8..3ca57524d9dab 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MarketplaceSubscriptionStatus.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MarketplaceSubscriptionStatus.cs @@ -16,7 +16,9 @@ namespace Microsoft.Azure.Management.Datadog.Models /// public static class MarketplaceSubscriptionStatus { + public const string Provisioning = "Provisioning"; public const string Active = "Active"; public const string Suspended = "Suspended"; + public const string Unsubscribed = "Unsubscribed"; } } diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitorProperties.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitorProperties.cs index 7f124a490d6b2..3d24bd84fb7fd 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitorProperties.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitorProperties.cs @@ -35,7 +35,8 @@ public MonitorProperties() /// Possible values include: 'Enabled', /// 'Disabled' /// Possible values - /// include: 'Active', 'Suspended' + /// include: 'Provisioning', 'Active', 'Suspended', + /// 'Unsubscribed' /// Possible values include: /// 'Unknown', 'MonitorLogs' /// The priority of the @@ -72,7 +73,8 @@ public MonitorProperties() public string MonitoringStatus { get; set; } /// - /// Gets or sets possible values include: 'Active', 'Suspended' + /// Gets or sets possible values include: 'Provisioning', 'Active', + /// 'Suspended', 'Unsubscribed' /// [JsonProperty(PropertyName = "marketplaceSubscriptionStatus")] public string MarketplaceSubscriptionStatus { get; set; } diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitoringTagRules.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitoringTagRules.cs index 8d9088b8cf24a..899906aaba1e1 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitoringTagRules.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitoringTagRules.cs @@ -34,12 +34,13 @@ public MonitoringTagRules() /// Name of the rule set. /// The id of the rule set. /// The type of the rule set. - public MonitoringTagRules(string name = default(string), string id = default(string), string type = default(string), MonitoringTagRulesProperties properties = default(MonitoringTagRulesProperties)) + public MonitoringTagRules(string name = default(string), string id = default(string), string type = default(string), MonitoringTagRulesProperties properties = default(MonitoringTagRulesProperties), SystemData systemData = default(SystemData)) { Name = name; Id = id; Type = type; Properties = properties; + SystemData = systemData; CustomInit(); } @@ -71,5 +72,10 @@ public MonitoringTagRules() [JsonProperty(PropertyName = "properties")] public MonitoringTagRulesProperties Properties { get; set; } + /// + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitoringTagRulesProperties.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitoringTagRulesProperties.cs index 5cf27df24b697..9bfd3b6530d97 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitoringTagRulesProperties.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/MonitoringTagRulesProperties.cs @@ -31,8 +31,12 @@ public MonitoringTagRulesProperties() /// Initializes a new instance of the MonitoringTagRulesProperties /// class. /// - public MonitoringTagRulesProperties(LogRules logRules = default(LogRules), MetricRules metricRules = default(MetricRules)) + /// Possible values include: + /// 'Accepted', 'Creating', 'Updating', 'Deleting', 'Succeeded', + /// 'Failed', 'Canceled', 'Deleted', 'NotSpecified' + public MonitoringTagRulesProperties(string provisioningState = default(string), LogRules logRules = default(LogRules), MetricRules metricRules = default(MetricRules)) { + ProvisioningState = provisioningState; LogRules = logRules; MetricRules = metricRules; CustomInit(); @@ -43,6 +47,14 @@ public MonitoringTagRulesProperties() /// partial void CustomInit(); + /// + /// Gets or sets possible values include: 'Accepted', 'Creating', + /// 'Updating', 'Deleting', 'Succeeded', 'Failed', 'Canceled', + /// 'Deleted', 'NotSpecified' + /// + [JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState { get; set; } + /// /// [JsonProperty(PropertyName = "logRules")] diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/SystemData.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..768c23ac70011 --- /dev/null +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// 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.Datadog.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/UserInfo.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/UserInfo.cs index 3f5d83619f355..deaa6d33be367 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/UserInfo.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Models/UserInfo.cs @@ -14,6 +14,9 @@ namespace Microsoft.Azure.Management.Datadog.Models using Newtonsoft.Json; using System.Linq; + /// + /// User info + /// public partial class UserInfo { /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitoredResourcesOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitoredResourcesOperations.cs deleted file mode 100644 index 386c7b53818ac..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitoredResourcesOperations.cs +++ /dev/null @@ -1,422 +0,0 @@ -// -// 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.Datadog -{ - 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; - - /// - /// MonitoredResourcesOperations operations. - /// - internal partial class MonitoredResourcesOperations : IServiceOperations, IMonitoredResourcesOperations - { - /// - /// Initializes a new instance of the MonitoredResourcesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal MonitoredResourcesOperations(MicrosoftDatadogClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MicrosoftDatadogClient - /// - public MicrosoftDatadogClient Client { get; private set; } - - /// - /// List the resources currently being monitored by the Datadog monitor - /// resource. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (monitorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("monitorName", monitorName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); - 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List the resources currently being monitored by the Datadog monitor - /// 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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("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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitoredResourcesOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitoredResourcesOperationsExtensions.cs deleted file mode 100644 index 0cb64a4ac5b80..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitoredResourcesOperationsExtensions.cs +++ /dev/null @@ -1,103 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MonitoredResourcesOperations. - /// - public static partial class MonitoredResourcesOperationsExtensions - { - /// - /// List the resources currently being monitored by the Datadog monitor - /// resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - public static IPage List(this IMonitoredResourcesOperations operations, string resourceGroupName, string monitorName) - { - return operations.ListAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); - } - - /// - /// List the resources currently being monitored by the Datadog monitor - /// resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IMonitoredResourcesOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List the resources currently being monitored by the Datadog monitor - /// resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IMonitoredResourcesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List the resources currently being monitored by the Datadog monitor - /// 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> ListNextAsync(this IMonitoredResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitorsOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitorsOperations.cs index a9909dde73aed..8469d0ff1b217 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitorsOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitorsOperations.cs @@ -51,15 +51,21 @@ internal MonitorsOperations(MicrosoftDatadogClient client) public MicrosoftDatadogClient Client { get; private set; } /// - /// List all monitors under the specified subscription. + /// List the api keys for a given monitor resource. /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -74,12 +80,42 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListApiKeysWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -98,13 +134,17 @@ internal MonitorsOperations(MicrosoftDatadogClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListApiKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listApiKeys").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -117,7 +157,7 @@ internal MonitorsOperations(MicrosoftDatadogClient 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) @@ -170,11 +210,11 @@ internal MonitorsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -198,7 +238,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -211,7 +251,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -231,10 +271,13 @@ internal MonitorsOperations(MicrosoftDatadogClient client) } /// - /// List all monitors under the specified resource group. + /// Get the default api key. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name /// /// /// Headers that will be added to request. @@ -242,7 +285,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -257,16 +300,42 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetDefaultKeyWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -286,14 +355,16 @@ internal MonitorsOperations(MicrosoftDatadogClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetDefaultKey", 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.Datadog/monitors").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/getDefaultKey").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -306,7 +377,7 @@ internal MonitorsOperations(MicrosoftDatadogClient 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) @@ -359,11 +430,11 @@ internal MonitorsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -387,7 +458,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -400,7 +471,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -420,26 +491,25 @@ internal MonitorsOperations(MicrosoftDatadogClient client) } /// - /// Get the properties of a specific monitor resource. + /// Set the default api key. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// + /// + /// /// /// 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 /// @@ -449,16 +519,38 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task SetDefaultKeyWithHttpMessagesAsync(string resourceGroupName, string monitorName, DatadogApiKey body = default(DatadogApiKey), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -474,6 +566,10 @@ internal MonitorsOperations(MicrosoftDatadogClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } + if (body != null) + { + body.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -483,12 +579,13 @@ internal MonitorsOperations(MicrosoftDatadogClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SetDefaultKey", 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.Datadog/monitors/{monitorName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/setDefaultKey").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); @@ -504,7 +601,7 @@ internal MonitorsOperations(MicrosoftDatadogClient 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) @@ -535,6 +632,12 @@ internal MonitorsOperations(MicrosoftDatadogClient client) // Serialize Request string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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) { @@ -557,11 +660,11 @@ internal MonitorsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -585,31 +688,13 @@ internal MonitorsOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + 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); @@ -618,47 +703,21 @@ internal MonitorsOperations(MicrosoftDatadogClient client) } /// - /// Create a monitor resource. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, DatadogMonitorResource body = default(DatadogMonitorResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, body, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Update a monitor resource. + /// List the hosts for a given monitor resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// - /// - /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -673,16 +732,38 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string monitorName, DatadogMonitorResourceUpdateParameters body = default(DatadogMonitorResourceUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListHostsWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -707,13 +788,12 @@ internal MonitorsOperations(MicrosoftDatadogClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("monitorName", monitorName); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListHosts", 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.Datadog/monitors/{monitorName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listHosts").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); @@ -729,7 +809,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -760,12 +840,6 @@ internal MonitorsOperations(MicrosoftDatadogClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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) { @@ -788,11 +862,11 @@ internal MonitorsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -816,7 +890,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -829,7 +903,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -849,45 +923,22 @@ internal MonitorsOperations(MicrosoftDatadogClient client) } /// - /// Delete a monitor resource. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Create a monitor resource. + /// List all Azure resources associated to the same Datadog organization as the + /// target resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// - /// - /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -902,16 +953,38 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, DatadogMonitorResource body = default(DatadogMonitorResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListLinkedResourcesWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -927,10 +1000,6 @@ internal MonitorsOperations(MicrosoftDatadogClient client) throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (body != null) - { - body.Validate(); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -940,13 +1009,12 @@ internal MonitorsOperations(MicrosoftDatadogClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("monitorName", monitorName); - tracingParameters.Add("body", body); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListLinkedResources", 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.Datadog/monitors/{monitorName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listLinkedResources").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); @@ -962,7 +1030,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -993,12 +1061,6 @@ internal MonitorsOperations(MicrosoftDatadogClient client) // Serialize Request string _requestContent = null; - if(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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) { @@ -1019,13 +1081,13 @@ internal MonitorsOperations(MicrosoftDatadogClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1049,7 +1111,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1062,25 +1124,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) _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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1100,10 +1144,11 @@ internal MonitorsOperations(MicrosoftDatadogClient client) } /// - /// Delete a monitor resource. + /// List the resources currently being monitored by the Datadog monitor + /// resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -1114,9 +1159,12 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// 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 /// @@ -1126,23 +1174,45 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListMonitoredResourcesWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (resourceGroupName == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } - if (monitorName == null) + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.ApiVersion != null) { @@ -1161,11 +1231,11 @@ internal MonitorsOperations(MicrosoftDatadogClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("monitorName", monitorName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListMonitoredResources", 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.Datadog/monitors/{monitorName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); @@ -1181,7 +1251,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1232,13 +1302,13 @@ internal MonitorsOperations(MicrosoftDatadogClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1262,13 +1332,2268 @@ internal MonitorsOperations(MicrosoftDatadogClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all monitors under the specified 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // 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, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Datadog/monitors").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all monitors under the specified resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // 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.Datadog/monitors").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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 the properties of a specific monitor resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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 monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + 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.Datadog/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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; + } + + /// + /// Create a monitor resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, DatadogMonitorResource body = default(DatadogMonitorResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, monitorName, body, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update a monitor resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// + /// + /// 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 monitorName, DatadogMonitorResourceUpdateParameters body = default(DatadogMonitorResourceUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("body", body); + 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.Datadog/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + 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(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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; + } + + /// + /// Delete a monitor resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Refresh the set password link and return a latest one. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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> RefreshSetPasswordLinkWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RefreshSetPasswordLink", 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.Datadog/monitors/{monitorName}/refreshSetPasswordLink").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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; + } + + /// + /// Create a monitor resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// + /// + /// 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 monitorName, DatadogMonitorResource body = default(DatadogMonitorResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (body != null) + { + body.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + tracingParameters.Add("body", body); + 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.Datadog/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + 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(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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; + } + + /// + /// Delete a monitor resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// 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 monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (monitorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("monitorName", monitorName); + 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.Datadog/monitors/{monitorName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); + 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 != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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; + } + + /// + /// List the api keys for a given monitor 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>> ListApiKeysNextWithHttpMessagesAsync(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, "ListApiKeysNext", 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("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the hosts for a given monitor 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>> ListHostsNextWithHttpMessagesAsync(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, "ListHostsNext", 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("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all Azure resources associated to the same Datadog organization as the + /// target 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>> ListLinkedResourcesNextWithHttpMessagesAsync(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, "ListLinkedResourcesNext", 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("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List the resources currently being monitored by the Datadog monitor + /// 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>> ListMonitoredResourcesNextWithHttpMessagesAsync(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, "ListMonitoredResourcesNext", 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("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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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); @@ -1288,7 +3613,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1384,11 +3709,11 @@ internal MonitorsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -1456,7 +3781,7 @@ internal MonitorsOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1552,11 +3877,11 @@ internal MonitorsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitorsOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitorsOperationsExtensions.cs index 60553e63e0562..876724cfa6edc 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitorsOperationsExtensions.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/MonitorsOperationsExtensions.cs @@ -21,6 +21,251 @@ namespace Microsoft.Azure.Management.Datadog /// public static partial class MonitorsOperationsExtensions { + /// + /// List the api keys for a given monitor resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + public static IPage ListApiKeys(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.ListApiKeysAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// List the api keys for a given monitor resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// The cancellation token. + /// + public static async Task> ListApiKeysAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListApiKeysWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the default api key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + public static DatadogApiKey GetDefaultKey(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.GetDefaultKeyAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Get the default api key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// The cancellation token. + /// + public static async Task GetDefaultKeyAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDefaultKeyWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Set the default api key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// + public static void SetDefaultKey(this IMonitorsOperations operations, string resourceGroupName, string monitorName, DatadogApiKey body = default(DatadogApiKey)) + { + operations.SetDefaultKeyAsync(resourceGroupName, monitorName, body).GetAwaiter().GetResult(); + } + + /// + /// Set the default api key. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task SetDefaultKeyAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, DatadogApiKey body = default(DatadogApiKey), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SetDefaultKeyWithHttpMessagesAsync(resourceGroupName, monitorName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List the hosts for a given monitor resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + public static IPage ListHosts(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.ListHostsAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// List the hosts for a given monitor resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// The cancellation token. + /// + public static async Task> ListHostsAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListHostsWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all Azure resources associated to the same Datadog organization as the + /// target resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + public static IPage ListLinkedResources(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.ListLinkedResourcesAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// List all Azure resources associated to the same Datadog organization as the + /// target resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// The cancellation token. + /// + public static async Task> ListLinkedResourcesAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListLinkedResourcesWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the resources currently being monitored by the Datadog monitor + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + public static IPage ListMonitoredResources(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.ListMonitoredResourcesAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// List the resources currently being monitored by the Datadog monitor + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// The cancellation token. + /// + public static async Task> ListMonitoredResourcesAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMonitoredResourcesWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// List all monitors under the specified subscription. /// @@ -56,7 +301,7 @@ public static IPage List(this IMonitorsOperations operat /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// public static IPage ListByResourceGroup(this IMonitorsOperations operations, string resourceGroupName) { @@ -70,7 +315,7 @@ public static IPage ListByResourceGroup(this IMonitorsOp /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. @@ -90,7 +335,7 @@ public static IPage ListByResourceGroup(this IMonitorsOp /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -107,7 +352,7 @@ public static DatadogMonitorResource Get(this IMonitorsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -130,7 +375,7 @@ public static DatadogMonitorResource Get(this IMonitorsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -149,7 +394,7 @@ public static DatadogMonitorResource Get(this IMonitorsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -174,7 +419,7 @@ public static DatadogMonitorResource Get(this IMonitorsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -193,7 +438,7 @@ public static DatadogMonitorResource Get(this IMonitorsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -218,7 +463,7 @@ public static DatadogMonitorResource Get(this IMonitorsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -235,7 +480,7 @@ public static void Delete(this IMonitorsOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -248,6 +493,46 @@ public static void Delete(this IMonitorsOperations operations, string resourceGr (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Refresh the set password link and return a latest one. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + public static DatadogSetPasswordLink RefreshSetPasswordLink(this IMonitorsOperations operations, string resourceGroupName, string monitorName) + { + return operations.RefreshSetPasswordLinkAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); + } + + /// + /// Refresh the set password link and return a latest one. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Monitor resource name + /// + /// + /// The cancellation token. + /// + public static async Task RefreshSetPasswordLinkAsync(this IMonitorsOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RefreshSetPasswordLinkWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Create a monitor resource. /// @@ -255,7 +540,7 @@ public static void Delete(this IMonitorsOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -274,7 +559,7 @@ public static void Delete(this IMonitorsOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -299,7 +584,7 @@ public static void Delete(this IMonitorsOperations operations, string resourceGr /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -316,7 +601,7 @@ public static void BeginDelete(this IMonitorsOperations operations, string resou /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -329,6 +614,146 @@ public static void BeginDelete(this IMonitorsOperations operations, string resou (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// List the api keys for a given monitor resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListApiKeysNext(this IMonitorsOperations operations, string nextPageLink) + { + return operations.ListApiKeysNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the api keys for a given monitor 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> ListApiKeysNextAsync(this IMonitorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListApiKeysNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the hosts for a given monitor resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListHostsNext(this IMonitorsOperations operations, string nextPageLink) + { + return operations.ListHostsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the hosts for a given monitor 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> ListHostsNextAsync(this IMonitorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListHostsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all Azure resources associated to the same Datadog organization as the + /// target resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListLinkedResourcesNext(this IMonitorsOperations operations, string nextPageLink) + { + return operations.ListLinkedResourcesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all Azure resources associated to the same Datadog organization as the + /// target 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> ListLinkedResourcesNextAsync(this IMonitorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListLinkedResourcesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List the resources currently being monitored by the Datadog monitor + /// resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListMonitoredResourcesNext(this IMonitorsOperations operations, string nextPageLink) + { + return operations.ListMonitoredResourcesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the resources currently being monitored by the Datadog monitor + /// 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> ListMonitoredResourcesNextAsync(this IMonitorsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListMonitoredResourcesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// List all monitors under the specified subscription. /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Operations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Operations.cs index 0f5d727a60191..581f6ef66e63f 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Operations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/Operations.cs @@ -51,8 +51,8 @@ internal Operations(MicrosoftDatadogClient client) public MicrosoftDatadogClient Client { get; private set; } /// - /// List all operations provided by Microsoft.Datadog for the - /// 2020-02-01-preview api version. + /// List all operations provided by Microsoft.Datadog for the 2021-03-01 api + /// version. /// /// /// Headers that will be added to request. @@ -60,7 +60,7 @@ internal Operations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -166,11 +166,11 @@ internal Operations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -227,8 +227,8 @@ internal Operations(MicrosoftDatadogClient client) } /// - /// List all operations provided by Microsoft.Datadog for the - /// 2020-02-01-preview api version. + /// List all operations provided by Microsoft.Datadog for the 2021-03-01 api + /// version. /// /// /// The NextLink from the previous successful call to List operation. @@ -239,7 +239,7 @@ internal Operations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -335,11 +335,11 @@ internal Operations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/OperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/OperationsExtensions.cs index cd3077a3dabf1..a2e74f0dea096 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/OperationsExtensions.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/OperationsExtensions.cs @@ -22,8 +22,8 @@ namespace Microsoft.Azure.Management.Datadog public static partial class OperationsExtensions { /// - /// List all operations provided by Microsoft.Datadog for the - /// 2020-02-01-preview api version. + /// List all operations provided by Microsoft.Datadog for the 2021-03-01 api + /// version. /// /// /// The operations group for this extension method. @@ -34,8 +34,8 @@ public static IPage List(this IOperations operations) } /// - /// List all operations provided by Microsoft.Datadog for the - /// 2020-02-01-preview api version. + /// List all operations provided by Microsoft.Datadog for the 2021-03-01 api + /// version. /// /// /// The operations group for this extension method. @@ -52,8 +52,8 @@ public static IPage List(this IOperations operations) } /// - /// List all operations provided by Microsoft.Datadog for the - /// 2020-02-01-preview api version. + /// List all operations provided by Microsoft.Datadog for the 2021-03-01 api + /// version. /// /// /// The operations group for this extension method. @@ -67,8 +67,8 @@ public static IPage ListNext(this IOperations operations, strin } /// - /// List all operations provided by Microsoft.Datadog for the - /// 2020-02-01-preview api version. + /// List all operations provided by Microsoft.Datadog for the 2021-03-01 api + /// version. /// /// /// The operations group for this extension method. diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/RefreshSetPasswordOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/RefreshSetPasswordOperations.cs deleted file mode 100644 index f185c8186e969..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/RefreshSetPasswordOperations.cs +++ /dev/null @@ -1,252 +0,0 @@ -// -// 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.Datadog -{ - 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; - - /// - /// RefreshSetPasswordOperations operations. - /// - internal partial class RefreshSetPasswordOperations : IServiceOperations, IRefreshSetPasswordOperations - { - /// - /// Initializes a new instance of the RefreshSetPasswordOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal RefreshSetPasswordOperations(MicrosoftDatadogClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MicrosoftDatadogClient - /// - public MicrosoftDatadogClient Client { get; private set; } - - /// - /// Refresh the set password link and return a latest one. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// 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 monitorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (monitorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (Client.ApiVersion != null) - { - if (Client.ApiVersion.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); - } - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("monitorName", monitorName); - 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.Datadog/monitors/{monitorName}/refreshSetPasswordLink").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{monitorName}", System.Uri.EscapeDataString(monitorName)); - 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 ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/RefreshSetPasswordOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/RefreshSetPasswordOperationsExtensions.cs deleted file mode 100644 index 9e0867d27fc0e..0000000000000 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/RefreshSetPasswordOperationsExtensions.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.Datadog -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for RefreshSetPasswordOperations. - /// - public static partial class RefreshSetPasswordOperationsExtensions - { - /// - /// Refresh the set password link and return a latest one. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - public static DatadogSetPasswordLink Get(this IRefreshSetPasswordOperations operations, string resourceGroupName, string monitorName) - { - return operations.GetAsync(resourceGroupName, monitorName).GetAwaiter().GetResult(); - } - - /// - /// Refresh the set password link and return a latest one. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to which the Datadog resource belongs. - /// - /// - /// Monitor resource name - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IRefreshSetPasswordOperations operations, string resourceGroupName, string monitorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, monitorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SdkInfo_MicrosoftDatadogClient.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SdkInfo_MicrosoftDatadogClient.cs index 8a14d17a5ea0e..86073ce026eef 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SdkInfo_MicrosoftDatadogClient.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SdkInfo_MicrosoftDatadogClient.cs @@ -19,28 +19,13 @@ public static IEnumerable> ApiInfo_MicrosoftDatado { return new Tuple[] { - new Tuple("Datadog", "ApiKeys", "2020-02-01-preview"), - new Tuple("Datadog", "Hosts", "2020-02-01-preview"), - new Tuple("Datadog", "LinkedResources", "2020-02-01-preview"), - new Tuple("Datadog", "MonitoredResources", "2020-02-01-preview"), - new Tuple("Datadog", "Monitors", "2020-02-01-preview"), - new Tuple("Datadog", "Operations", "2020-02-01-preview"), - new Tuple("Datadog", "RefreshSetPassword", "2020-02-01-preview"), - new Tuple("Datadog", "SingleSignOnConfigurations", "2020-02-01-preview"), - new Tuple("Datadog", "TagRules", "2020-02-01-preview"), + new Tuple("Datadog", "MarketplaceAgreements", "2021-03-01"), + new Tuple("Datadog", "Monitors", "2021-03-01"), + new Tuple("Datadog", "Operations", "2021-03-01"), + new Tuple("Datadog", "SingleSignOnConfigurations", "2021-03-01"), + new Tuple("Datadog", "TagRules", "2021-03-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/datadog/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\work\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "183db615e7e870d12668972c874897f095fe256c"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SingleSignOnConfigurationsOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SingleSignOnConfigurationsOperations.cs index b3d98f639e9b5..79f2674192fe1 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SingleSignOnConfigurationsOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SingleSignOnConfigurationsOperations.cs @@ -54,7 +54,7 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) /// List the single sign-on configurations for a given monitor resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -65,7 +65,7 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -86,10 +86,32 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -188,11 +210,11 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -252,12 +274,13 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) /// Configures single-sign-on for this resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// @@ -278,12 +301,13 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) /// Gets the datadog single sign-on resource for the given Monitor. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// Headers that will be added to request. @@ -291,7 +315,7 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -312,10 +336,32 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -420,11 +466,11 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -484,12 +530,13 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) /// Configures single-sign-on for this resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// @@ -499,7 +546,7 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -520,10 +567,32 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -641,11 +710,11 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -731,7 +800,7 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -827,11 +896,11 @@ internal SingleSignOnConfigurationsOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SingleSignOnConfigurationsOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SingleSignOnConfigurationsOperationsExtensions.cs index b68a85fbf3a02..ff38657aecd5c 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SingleSignOnConfigurationsOperationsExtensions.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/SingleSignOnConfigurationsOperationsExtensions.cs @@ -28,7 +28,7 @@ public static partial class SingleSignOnConfigurationsOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -45,7 +45,7 @@ public static IPage List(this ISingleSignOnConfigur /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -68,12 +68,13 @@ public static IPage List(this ISingleSignOnConfigur /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// @@ -89,12 +90,13 @@ public static IPage List(this ISingleSignOnConfigur /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// @@ -116,12 +118,13 @@ public static IPage List(this ISingleSignOnConfigur /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// public static DatadogSingleSignOnResource Get(this ISingleSignOnConfigurationsOperations operations, string resourceGroupName, string monitorName, string configurationName) { @@ -135,12 +138,13 @@ public static DatadogSingleSignOnResource Get(this ISingleSignOnConfigurationsOp /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// The cancellation token. @@ -160,12 +164,13 @@ public static DatadogSingleSignOnResource Get(this ISingleSignOnConfigurationsOp /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// @@ -181,12 +186,13 @@ public static DatadogSingleSignOnResource Get(this ISingleSignOnConfigurationsOp /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Configuration name /// /// /// diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/TagRulesOperations.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/TagRulesOperations.cs index 46f53070713f5..fa6e90df36780 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/TagRulesOperations.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/TagRulesOperations.cs @@ -54,7 +54,7 @@ internal TagRulesOperations(MicrosoftDatadogClient client) /// List the tag rules for a given monitor resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -65,7 +65,7 @@ internal TagRulesOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -86,10 +86,32 @@ internal TagRulesOperations(MicrosoftDatadogClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -188,11 +210,11 @@ internal TagRulesOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -252,12 +274,13 @@ internal TagRulesOperations(MicrosoftDatadogClient client) /// Create or update a tag rule set for a given monitor resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Rule set name /// /// /// @@ -267,7 +290,7 @@ internal TagRulesOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -288,10 +311,32 @@ internal TagRulesOperations(MicrosoftDatadogClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -409,11 +454,11 @@ internal TagRulesOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -473,12 +518,13 @@ internal TagRulesOperations(MicrosoftDatadogClient client) /// Get a tag rule set for a given monitor resource. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Rule set name /// /// /// Headers that will be added to request. @@ -486,7 +532,7 @@ internal TagRulesOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -507,10 +553,32 @@ internal TagRulesOperations(MicrosoftDatadogClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (monitorName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "monitorName"); @@ -615,11 +683,11 @@ internal TagRulesOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; @@ -687,7 +755,7 @@ internal TagRulesOperations(MicrosoftDatadogClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -783,11 +851,11 @@ internal TagRulesOperations(MicrosoftDatadogClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ResourceProviderDefaultErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResourceProviderDefaultErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; diff --git a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/TagRulesOperationsExtensions.cs b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/TagRulesOperationsExtensions.cs index 28aa217815bec..db8d07baeecb2 100644 --- a/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/TagRulesOperationsExtensions.cs +++ b/sdk/datadog/Microsoft.Azure.Management.Datadog/src/Generated/TagRulesOperationsExtensions.cs @@ -28,7 +28,7 @@ public static partial class TagRulesOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -45,7 +45,7 @@ public static IPage List(this ITagRulesOperations operations /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name @@ -68,12 +68,13 @@ public static IPage List(this ITagRulesOperations operations /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Rule set name /// /// /// @@ -89,12 +90,13 @@ public static IPage List(this ITagRulesOperations operations /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Rule set name /// /// /// @@ -116,12 +118,13 @@ public static IPage List(this ITagRulesOperations operations /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Rule set name /// public static MonitoringTagRules Get(this ITagRulesOperations operations, string resourceGroupName, string monitorName, string ruleSetName) { @@ -135,12 +138,13 @@ public static MonitoringTagRules Get(this ITagRulesOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group to which the Datadog resource belongs. + /// The name of the resource group. The name is case insensitive. /// /// /// Monitor resource name /// /// + /// Rule set name /// /// /// The cancellation token.