From 95175273c4147ce39cdbbfbd87a067ba0f2061cb Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2019 01:09:21 +0000 Subject: [PATCH 01/16] Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json --- .../Generated/ILegacyPeeringsOperations.cs | 4 ++ .../src/Generated/IOperations.cs | 4 ++ .../src/Generated/IPeerAsnsOperations.cs | 4 ++ .../Generated/IPeeringLocationsOperations.cs | 4 ++ .../src/Generated/IPeeringManagementClient.cs | 16 +++++--- .../IPeeringServiceLocationsOperations.cs | 4 ++ .../IPeeringServicePrefixesOperations.cs | 4 ++ .../IPeeringServiceProvidersOperations.cs | 4 ++ .../Generated/IPeeringServicesOperations.cs | 8 +++- .../src/Generated/IPeeringsOperations.cs | 8 +++- .../src/Generated/IPrefixesOperations.cs | 4 ++ .../src/Generated/LegacyPeeringsOperations.cs | 4 ++ .../LegacyPeeringsOperationsExtensions.cs | 4 ++ .../src/Generated/Models/BgpSession.cs | 4 ++ .../CheckServiceProviderAvailabilityInput.cs | 4 ++ .../src/Generated/Models/ConnectionState.cs | 4 ++ .../src/Generated/Models/ContactInfo.cs | 4 ++ .../src/Generated/Models/DirectConnection.cs | 4 ++ .../Generated/Models/DirectPeeringFacility.cs | 4 ++ .../src/Generated/Models/DirectPeeringType.cs | 4 ++ .../src/Generated/Models/ErrorResponse.cs | 4 ++ .../Models/ErrorResponseException.cs | 4 ++ .../Generated/Models/ExchangeConnection.cs | 4 ++ .../Models/ExchangePeeringFacility.cs | 4 ++ .../src/Generated/Models/Family.cs | 4 ++ .../src/Generated/Models/Kind.cs | 4 ++ .../src/Generated/Models/LearnedType.cs | 4 ++ .../src/Generated/Models/Name.cs | 4 ++ .../src/Generated/Models/Operation.cs | 4 ++ .../Generated/Models/OperationDisplayInfo.cs | 4 ++ .../src/Generated/Models/Page.cs | 4 ++ .../src/Generated/Models/PeerAsn.cs | 4 ++ .../Generated/Models/PeeringBandwidthOffer.cs | 4 ++ .../src/Generated/Models/PeeringLocation.cs | 4 ++ .../Models/PeeringLocationPropertiesDirect.cs | 4 ++ .../PeeringLocationPropertiesExchange.cs | 4 ++ .../src/Generated/Models/PeeringModel.cs | 4 ++ .../Models/PeeringPropertiesDirect.cs | 4 ++ .../Models/PeeringPropertiesExchange.cs | 4 ++ .../src/Generated/Models/PeeringService.cs | 4 ++ .../Models/PeeringServiceLocation.cs | 4 ++ .../Generated/Models/PeeringServicePrefix.cs | 4 ++ .../Models/PeeringServiceProvider.cs | 4 ++ .../src/Generated/Models/PeeringSku.cs | 4 ++ .../Generated/Models/PrefixValidationState.cs | 4 ++ .../src/Generated/Models/ProvisioningState.cs | 4 ++ .../src/Generated/Models/Resource.cs | 4 ++ .../src/Generated/Models/ResourceTags.cs | 4 ++ .../Models/SessionAddressProvider.cs | 4 ++ .../src/Generated/Models/SessionStateV4.cs | 4 ++ .../src/Generated/Models/SessionStateV6.cs | 4 ++ .../src/Generated/Models/Size.cs | 4 ++ .../src/Generated/Models/SubResource.cs | 4 ++ .../src/Generated/Models/Tier.cs | 4 ++ .../src/Generated/Models/ValidationState.cs | 4 ++ .../src/Generated/Operations.cs | 4 ++ .../src/Generated/OperationsExtensions.cs | 4 ++ .../src/Generated/PeerAsnsOperations.cs | 4 ++ .../Generated/PeerAsnsOperationsExtensions.cs | 4 ++ .../Generated/PeeringLocationsOperations.cs | 4 ++ .../PeeringLocationsOperationsExtensions.cs | 4 ++ .../src/Generated/PeeringManagementClient.cs | 26 ++++++++----- .../PeeringManagementClientExtensions.cs | 28 +++++++++----- .../PeeringServiceLocationsOperations.cs | 4 ++ ...ingServiceLocationsOperationsExtensions.cs | 4 ++ .../PeeringServicePrefixesOperations.cs | 4 ++ ...ringServicePrefixesOperationsExtensions.cs | 4 ++ .../PeeringServiceProvidersOperations.cs | 4 ++ ...ingServiceProvidersOperationsExtensions.cs | 4 ++ .../Generated/PeeringServicesOperations.cs | 23 +++++++----- .../PeeringServicesOperationsExtensions.cs | 14 +++++-- .../src/Generated/PeeringsOperations.cs | 23 +++++++----- .../Generated/PeeringsOperationsExtensions.cs | 14 +++++-- .../src/Generated/PrefixesOperations.cs | 4 ++ .../Generated/PrefixesOperationsExtensions.cs | 4 ++ .../SdkInfo_PeeringManagementClient.cs | 37 +++++++++++++++++++ 76 files changed, 407 insertions(+), 54 deletions(-) create mode 100644 sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILegacyPeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILegacyPeeringsOperations.cs index f95591b8d989..32ba98539261 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILegacyPeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/ILegacyPeeringsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IOperations.cs index 24d846de18d7..3b50883f2ef7 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeerAsnsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeerAsnsOperations.cs index c2d8a945cae2..b1ac930e2c48 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeerAsnsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeerAsnsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs index e8f5895d4930..6ffabfd9df99 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringLocationsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs index 3c13cf4563bf..80274c97bc23 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringManagementClient.cs @@ -1,4 +1,8 @@ // +// 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. @@ -16,7 +20,7 @@ namespace Microsoft.Azure.Management.Peering using System.Threading.Tasks; /// - /// APIs to manage Peering resources through the Azure Resource Manager. + /// Peering Client /// public partial interface IPeeringManagementClient : System.IDisposable { @@ -123,9 +127,11 @@ public partial interface IPeeringManagementClient : System.IDisposable /// Checks if the peering service provider is present within 1000 miles /// of customer's location /// - /// - /// The CheckServiceProviderAvailabilityInput - /// indicating customer location and service provider. + /// + /// Gets or sets the PeeringServiceLocation + /// + /// + /// Gets or sets the PeeringServiceProvider /// /// /// The headers that will be added to request. @@ -133,7 +139,7 @@ public partial interface IPeeringManagementClient : System.IDisposable /// /// The cancellation token. /// - Task> CheckServiceProviderAvailabilityWithHttpMessagesAsync(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckServiceProviderAvailabilityWithHttpMessagesAsync(string peeringServiceLocation = default(string), string peeringServiceProvider = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceLocationsOperations.cs index 2077c3ff18ce..4542b3a6e069 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceLocationsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicePrefixesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicePrefixesOperations.cs index e0bb14322943..616ef6ce2c7e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicePrefixesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicePrefixesOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceProvidersOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceProvidersOperations.cs index 9bc4e4b0cdbe..6f7e5fa560af 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceProvidersOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServiceProvidersOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs index e3bd51690a9a..9decb2909c55 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringServicesOperations.cs @@ -1,4 +1,8 @@ // +// 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. @@ -108,7 +112,7 @@ public partial interface IPeeringServicesOperations /// The name of the peering service. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// The headers that will be added to request. @@ -125,7 +129,7 @@ public partial interface IPeeringServicesOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, ResourceTags tags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all of the peering services under the given subscription and /// resource group. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringsOperations.cs index 40fb8db251aa..6c0cbd197e7e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPeeringsOperations.cs @@ -1,4 +1,8 @@ // +// 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. @@ -108,7 +112,7 @@ public partial interface IPeeringsOperations /// The name of the peering. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// The headers that will be added to request. @@ -125,7 +129,7 @@ public partial interface IPeeringsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringName, ResourceTags tags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all of the peerings under the given subscription and resource /// group. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPrefixesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPrefixesOperations.cs index 34927dc72ef9..63d0f3650045 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPrefixesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/IPrefixesOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs index 3cf31c6319d7..99dd96469659 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperationsExtensions.cs index 078c711c3099..77bb88c6daf6 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/LegacyPeeringsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/BgpSession.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/BgpSession.cs index 040f6fa2d7b4..c661e56575b7 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/BgpSession.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/BgpSession.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/CheckServiceProviderAvailabilityInput.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/CheckServiceProviderAvailabilityInput.cs index 279d48f81376..24ef7f9c760e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/CheckServiceProviderAvailabilityInput.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/CheckServiceProviderAvailabilityInput.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionState.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionState.cs index 6dc947f756bf..854cd63329ab 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionState.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ConnectionState.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ContactInfo.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ContactInfo.cs index d9cdbd9ae87a..73d7e8111531 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ContactInfo.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ContactInfo.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectConnection.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectConnection.cs index e5d4b5e2f2c2..3aa4fe6dd153 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectConnection.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectConnection.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs index efa35b18bf57..1bf764f9feeb 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringFacility.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs index 3ca527934b09..86a609020e8c 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/DirectPeeringType.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponse.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponse.cs index d9eb52c8742b..8754219779a5 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponse.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponse.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponseException.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponseException.cs index cec1576f2c45..9eced8ee065e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponseException.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ErrorResponseException.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangeConnection.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangeConnection.cs index 060fefabf744..48079d5d03f2 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangeConnection.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangeConnection.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangePeeringFacility.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangePeeringFacility.cs index eca74a8f6fdc..557fc135e136 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangePeeringFacility.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ExchangePeeringFacility.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Family.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Family.cs index 5ea908359fb6..c665d28486d0 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Family.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Family.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Kind.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Kind.cs index 0674d99e0578..2e841e4fef3f 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Kind.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Kind.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LearnedType.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LearnedType.cs index c72c959e4b16..fa055cb03d2a 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LearnedType.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/LearnedType.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Name.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Name.cs index 50b94fdcbfbc..facd278af481 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Name.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Name.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs index a13943b92238..0c1e561b991e 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Operation.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/OperationDisplayInfo.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/OperationDisplayInfo.cs index 3dc6249a7037..b803cb4c26fc 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/OperationDisplayInfo.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/OperationDisplayInfo.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Page.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Page.cs index 31a43eb5bbf6..b8592e5aab38 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Page.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Page.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs index db1031ae4ffe..33b7cb00e7b7 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeerAsn.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringBandwidthOffer.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringBandwidthOffer.cs index bf305d4f172c..af9a12dbcb07 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringBandwidthOffer.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringBandwidthOffer.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocation.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocation.cs index c58f7cf3f9d1..78f94db9d452 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocation.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocation.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesDirect.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesDirect.cs index 75921877b606..1cf995ef7a57 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesDirect.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesDirect.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.cs index 0c7d8349c348..69550fa50557 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringLocationPropertiesExchange.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringModel.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringModel.cs index f1992d57fcde..fcac6e70fa33 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringModel.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringModel.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs index 220e44d47127..59a0ffd94d52 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesDirect.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesExchange.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesExchange.cs index 7fc0aca62366..39ac553528b1 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesExchange.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringPropertiesExchange.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs index 7062fb3408d2..6c92dfdd4f26 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringService.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceLocation.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceLocation.cs index d1b1f1b65aea..36c2394debe4 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceLocation.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceLocation.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServicePrefix.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServicePrefix.cs index f0377d0fcb4a..6c778e77a813 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServicePrefix.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServicePrefix.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs index cb0719e21dfd..1cbca93ee403 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringServiceProvider.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs index 5f2706b991d2..6392406fc954 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PeeringSku.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PrefixValidationState.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PrefixValidationState.cs index 53e0ea4f61b2..bd6eb6dbdc8b 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PrefixValidationState.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/PrefixValidationState.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ProvisioningState.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ProvisioningState.cs index 159af9cfb1cd..93e28e656b91 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ProvisioningState.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ProvisioningState.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Resource.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Resource.cs index b46ba7a28c67..f8328bbf9f3b 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Resource.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Resource.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ResourceTags.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ResourceTags.cs index f3f55cdfb29c..e3064128884b 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ResourceTags.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ResourceTags.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionAddressProvider.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionAddressProvider.cs index 8efa4d2a0583..6b424295f875 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionAddressProvider.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionAddressProvider.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV4.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV4.cs index 4f32bf3f5a0b..b439bc773f09 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV4.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV4.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV6.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV6.cs index b1f34a067265..9d3620d28872 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV6.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SessionStateV6.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Size.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Size.cs index a204164bccda..75afcc848e14 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Size.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Size.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SubResource.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SubResource.cs index 9f5f1f9845e6..534c008149d3 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SubResource.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/SubResource.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Tier.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Tier.cs index 09d180b51ea1..82442b73bcf3 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Tier.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/Tier.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ValidationState.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ValidationState.cs index fc3631a057f6..ba14a3a3e681 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ValidationState.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Models/ValidationState.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Operations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Operations.cs index 40010abb26dd..1e758fcbf8e9 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Operations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/Operations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/OperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/OperationsExtensions.cs index 3bb6e9c51924..8be78042ca7c 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/OperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/OperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperations.cs index 18eb0dbf57d2..a534188bc988 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperationsExtensions.cs index 2aa47f63508e..3944221030e9 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeerAsnsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs index 23772b2ae156..98bc7adb7cb0 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs index f47f220df1bc..4807bc9742a8 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringLocationsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs index 960bfd99d966..339a6fd5c5ca 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClient.cs @@ -1,4 +1,8 @@ // +// 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. @@ -20,7 +24,7 @@ namespace Microsoft.Azure.Management.Peering using System.Threading.Tasks; /// - /// APIs to manage Peering resources through the Azure Resource Manager. + /// Peering Client /// public partial class PeeringManagementClient : ServiceClient, IPeeringManagementClient, IAzureClient { @@ -412,9 +416,11 @@ private void Initialize() /// Checks if the peering service provider is present within 1000 miles of /// customer's location /// - /// - /// The CheckServiceProviderAvailabilityInput - /// indicating customer location and service provider. + /// + /// Gets or sets the PeeringServiceLocation + /// + /// + /// Gets or sets the PeeringServiceProvider /// /// /// Headers that will be added to request. @@ -437,12 +443,8 @@ private void Initialize() /// /// A response object containing the response body and response headers. /// - public async Task> CheckServiceProviderAvailabilityWithHttpMessagesAsync(CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CheckServiceProviderAvailabilityWithHttpMessagesAsync(string peeringServiceLocation = default(string), string peeringServiceProvider = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (checkServiceProviderAvailabilityInput == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "checkServiceProviderAvailabilityInput"); - } if (SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); @@ -451,6 +453,12 @@ private void Initialize() { throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); } + CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput = new CheckServiceProviderAvailabilityInput(); + if (peeringServiceLocation != null || peeringServiceProvider != null) + { + checkServiceProviderAvailabilityInput.PeeringServiceLocation = peeringServiceLocation; + checkServiceProviderAvailabilityInput.PeeringServiceProvider = peeringServiceProvider; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClientExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClientExtensions.cs index 3cf93b236f66..370b366464d5 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClientExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringManagementClientExtensions.cs @@ -1,4 +1,8 @@ // +// 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. @@ -24,13 +28,15 @@ public static partial class PeeringManagementClientExtensions /// /// The operations group for this extension method. /// - /// - /// The CheckServiceProviderAvailabilityInput - /// indicating customer location and service provider. + /// + /// Gets or sets the PeeringServiceLocation /// - public static string CheckServiceProviderAvailability(this IPeeringManagementClient operations, CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput) + /// + /// Gets or sets the PeeringServiceProvider + /// + public static string CheckServiceProviderAvailability(this IPeeringManagementClient operations, string peeringServiceLocation = default(string), string peeringServiceProvider = default(string)) { - return operations.CheckServiceProviderAvailabilityAsync(checkServiceProviderAvailabilityInput).GetAwaiter().GetResult(); + return operations.CheckServiceProviderAvailabilityAsync(peeringServiceLocation, peeringServiceProvider).GetAwaiter().GetResult(); } /// @@ -40,16 +46,18 @@ public static string CheckServiceProviderAvailability(this IPeeringManagementCli /// /// The operations group for this extension method. /// - /// - /// The CheckServiceProviderAvailabilityInput - /// indicating customer location and service provider. + /// + /// Gets or sets the PeeringServiceLocation + /// + /// + /// Gets or sets the PeeringServiceProvider /// /// /// The cancellation token. /// - public static async Task CheckServiceProviderAvailabilityAsync(this IPeeringManagementClient operations, CheckServiceProviderAvailabilityInput checkServiceProviderAvailabilityInput, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CheckServiceProviderAvailabilityAsync(this IPeeringManagementClient operations, string peeringServiceLocation = default(string), string peeringServiceProvider = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CheckServiceProviderAvailabilityWithHttpMessagesAsync(checkServiceProviderAvailabilityInput, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CheckServiceProviderAvailabilityWithHttpMessagesAsync(peeringServiceLocation, peeringServiceProvider, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperations.cs index 54ec9fc8aa67..72a7c60090e6 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperationsExtensions.cs index 0d5431799281..1c14bcad8ac4 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceLocationsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperations.cs index 84ca6862ec3c..0f23284e10e3 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperationsExtensions.cs index 6d797b9a21d8..1c7b121140e3 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicePrefixesOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperations.cs index 94e4cba6f4aa..c87dd239921b 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperationsExtensions.cs index 3aa3fc54cb62..899a2d16cc37 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServiceProvidersOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs index 5b7cb092a84c..969074805a68 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperations.cs @@ -1,4 +1,8 @@ // +// 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. @@ -648,7 +652,7 @@ internal PeeringServicesOperations(PeeringManagementClient client) /// The name of the peering service. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// Headers that will be added to request. @@ -671,7 +675,7 @@ internal PeeringServicesOperations(PeeringManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, ResourceTags tags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -681,10 +685,6 @@ internal PeeringServicesOperations(PeeringManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "peeringServiceName"); } - if (tags == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tags"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -693,6 +693,11 @@ internal PeeringServicesOperations(PeeringManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + ResourceTags tags1 = new ResourceTags(); + if (tags != null) + { + tags1.Tags = tags; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -702,7 +707,7 @@ internal PeeringServicesOperations(PeeringManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("peeringServiceName", peeringServiceName); - tracingParameters.Add("tags", tags); + tracingParameters.Add("tags1", tags1); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -755,9 +760,9 @@ internal PeeringServicesOperations(PeeringManagementClient client) // Serialize Request string _requestContent = null; - if(tags != null) + if(tags1 != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tags, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tags1, 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"); } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs index 135751d7332e..1c2cdfc0be82 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringServicesOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. @@ -9,6 +13,8 @@ namespace Microsoft.Azure.Management.Peering using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; + using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -160,9 +166,9 @@ public static void Delete(this IPeeringServicesOperations operations, string res /// The name of the peering service. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// - public static PeeringService Update(this IPeeringServicesOperations operations, string resourceGroupName, string peeringServiceName, ResourceTags tags) + public static PeeringService Update(this IPeeringServicesOperations operations, string resourceGroupName, string peeringServiceName, IDictionary tags = default(IDictionary)) { return operations.UpdateAsync(resourceGroupName, peeringServiceName, tags).GetAwaiter().GetResult(); } @@ -181,12 +187,12 @@ public static PeeringService Update(this IPeeringServicesOperations operations, /// The name of the peering service. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IPeeringServicesOperations operations, string resourceGroupName, string peeringServiceName, ResourceTags tags, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IPeeringServicesOperations operations, string resourceGroupName, string peeringServiceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, peeringServiceName, tags, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperations.cs index f500fb867401..05d4c7ccc3ef 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperations.cs @@ -1,4 +1,8 @@ // +// 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. @@ -648,7 +652,7 @@ internal PeeringsOperations(PeeringManagementClient client) /// The name of the peering. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// Headers that will be added to request. @@ -671,7 +675,7 @@ internal PeeringsOperations(PeeringManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringName, ResourceTags tags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string peeringName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -681,10 +685,6 @@ internal PeeringsOperations(PeeringManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "peeringName"); } - if (tags == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tags"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -693,6 +693,11 @@ internal PeeringsOperations(PeeringManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + ResourceTags tags1 = new ResourceTags(); + if (tags != null) + { + tags1.Tags = tags; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -702,7 +707,7 @@ internal PeeringsOperations(PeeringManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("peeringName", peeringName); - tracingParameters.Add("tags", tags); + tracingParameters.Add("tags1", tags1); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -755,9 +760,9 @@ internal PeeringsOperations(PeeringManagementClient client) // Serialize Request string _requestContent = null; - if(tags != null) + if(tags1 != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tags, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(tags1, 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"); } diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperationsExtensions.cs index 67e42c4c8d65..3048ab59ccb8 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PeeringsOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. @@ -9,6 +13,8 @@ namespace Microsoft.Azure.Management.Peering using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; + using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -160,9 +166,9 @@ public static void Delete(this IPeeringsOperations operations, string resourceGr /// The name of the peering. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// - public static PeeringModel Update(this IPeeringsOperations operations, string resourceGroupName, string peeringName, ResourceTags tags) + public static PeeringModel Update(this IPeeringsOperations operations, string resourceGroupName, string peeringName, IDictionary tags = default(IDictionary)) { return operations.UpdateAsync(resourceGroupName, peeringName, tags).GetAwaiter().GetResult(); } @@ -181,12 +187,12 @@ public static PeeringModel Update(this IPeeringsOperations operations, string re /// The name of the peering. /// /// - /// The resource tags. + /// Gets or sets the tags, a dictionary of descriptors arm object /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IPeeringsOperations operations, string resourceGroupName, string peeringName, ResourceTags tags, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IPeeringsOperations operations, string resourceGroupName, string peeringName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, peeringName, tags, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperations.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperations.cs index 57cb4ff48972..9b5473fe577d 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperations.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperations.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperationsExtensions.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperationsExtensions.cs index c31750f1b6ab..74671d9b33e0 100644 --- a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperationsExtensions.cs +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/PrefixesOperationsExtensions.cs @@ -1,4 +1,8 @@ // +// 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. diff --git a/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs new file mode 100644 index 000000000000..9343c90ffa9e --- /dev/null +++ b/sdk/peering/Microsoft.Azure.Management.Peering/src/Generated/SdkInfo_PeeringManagementClient.cs @@ -0,0 +1,37 @@ + +// +// 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.Peering +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_PeeringManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Peering", "CheckServiceProviderAvailability", "2019-08-01-preview"), + new Tuple("Peering", "LegacyPeerings", "2019-08-01-preview"), + new Tuple("Peering", "Operations", "2019-08-01-preview"), + new Tuple("Peering", "PeerAsns", "2019-08-01-preview"), + new Tuple("Peering", "PeeringLocations", "2019-08-01-preview"), + new Tuple("Peering", "PeeringServiceLocations", "2019-08-01-preview"), + new Tuple("Peering", "PeeringServicePrefixes", "2019-08-01-preview"), + new Tuple("Peering", "PeeringServiceProviders", "2019-08-01-preview"), + new Tuple("Peering", "PeeringServices", "2019-08-01-preview"), + new Tuple("Peering", "Peerings", "2019-08-01-preview"), + new Tuple("Peering", "Prefixes", "2019-08-01-preview"), + }.AsEnumerable(); + } + } + } +} From 55c5bcb2bc0f10c5dcc6bcf40f236e8f5e325f33 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2019 08:33:13 +0000 Subject: [PATCH 02/16] Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only --- ...sOperations.cs => IPublicIPAddressesOperations.cs} | 0 .../src/Generated/IServiceTagsOperations.cs | 5 ++++- ...ualWANsOperations.cs => IVirtualWansOperations.cs} | 0 ...s => ApplicationGatewayFrontendIPConfiguration.cs} | 0 ...ration.cs => ApplicationGatewayIPConfiguration.cs} | 0 ...dIpConfiguration.cs => FrontendIPConfiguration.cs} | 0 .../{IpAllocationMethod.cs => IPAllocationMethod.cs} | 0 ...guration.cs => NetworkInterfaceIPConfiguration.cs} | 0 .../Models/{PublicIpAddress.cs => PublicIPAddress.cs} | 0 ...ssDnsSettings.cs => PublicIPAddressDnsSettings.cs} | 0 ...ion.cs => VirtualNetworkGatewayIPConfiguration.cs} | 0 ...esOperations.cs => PublicIPAddressesOperations.cs} | 0 ...ns.cs => PublicIPAddressesOperationsExtensions.cs} | 0 .../src/Generated/SdkInfo_NetworkManagementClient.cs | 11 ----------- .../src/Generated/ServiceTagsOperations.cs | 5 ++++- .../src/Generated/ServiceTagsOperationsExtensions.cs | 10 ++++++++-- ...tualWANsOperations.cs => VirtualWansOperations.cs} | 0 ...tensions.cs => VirtualWansOperationsExtensions.cs} | 0 18 files changed, 16 insertions(+), 15 deletions(-) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{IPublicIpAddressesOperations.cs => IPublicIPAddressesOperations.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{IVirtualWANsOperations.cs => IVirtualWansOperations.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{ApplicationGatewayFrontendIpConfiguration.cs => ApplicationGatewayFrontendIPConfiguration.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{ApplicationGatewayIpConfiguration.cs => ApplicationGatewayIPConfiguration.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{FrontendIpConfiguration.cs => FrontendIPConfiguration.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{IpAllocationMethod.cs => IPAllocationMethod.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{NetworkInterfaceIpConfiguration.cs => NetworkInterfaceIPConfiguration.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{PublicIpAddress.cs => PublicIPAddress.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{PublicIpAddressDnsSettings.cs => PublicIPAddressDnsSettings.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{VirtualNetworkGatewayIpConfiguration.cs => VirtualNetworkGatewayIPConfiguration.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{PublicIpAddressesOperations.cs => PublicIPAddressesOperations.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{PublicIpAddressesOperationsExtensions.cs => PublicIPAddressesOperationsExtensions.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{VirtualWANsOperations.cs => VirtualWansOperations.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{VirtualWANsOperationsExtensions.cs => VirtualWansOperationsExtensions.cs} (100%) diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIPAddressesOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIPAddressesOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs index 7aa52a33381d..d6e0a0b50a27 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs @@ -27,7 +27,10 @@ public partial interface IServiceTagsOperations /// Gets a list of service tag information resources. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a + /// filter based on location, you will get the list of service tags + /// with prefix details across all regions but limited to the cloud + /// that your subscription belongs to). /// /// /// The headers that will be added to request. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWANsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWansOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWANsOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWansOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IpAllocationMethod.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IPAllocationMethod.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IpAllocationMethod.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IPAllocationMethod.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddress.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddress.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddress.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddress.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddressDnsSettings.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddressDnsSettings.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddressDnsSettings.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddressDnsSettings.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperationsExtensions.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperationsExtensions.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs index 19fcffb4a449..fadd92b8afbd 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs @@ -108,16 +108,5 @@ public static IEnumerable> ApiInfo_NetworkManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/network/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\Projects\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "9dacca31bc76fc9cc1f59ee62ed1ab1c8f0d61c6"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs index 6addc5e6580d..cb28c68ff4b4 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs @@ -54,7 +54,10 @@ internal ServiceTagsOperations(NetworkManagementClient client) /// Gets a list of service tag information resources. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// /// /// Headers that will be added to request. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs index d575231bde96..be01db34c7b1 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs @@ -28,7 +28,10 @@ public static partial class ServiceTagsOperationsExtensions /// The operations group for this extension method. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// public static ServiceTagsListResult List(this IServiceTagsOperations operations, string location) { @@ -42,7 +45,10 @@ public static ServiceTagsListResult List(this IServiceTagsOperations operations, /// The operations group for this extension method. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// /// /// The cancellation token. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperationsExtensions.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperationsExtensions.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperationsExtensions.cs From 6229c526c92c2b10a98819c17b945b14df39780b Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2019 02:58:59 +0000 Subject: [PATCH 03/16] [AutoPR Microsoft.Azure.Management.HealthcareApis] Move to stable version (#134) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 98f6703f2854ce61a22c8ba99a243a3ecb85ec8c Updated the way we retrieve version parameter --- .../HealthcareApisManagementClient.cs | 4 +- .../IHealthcareApisManagementClient.cs | 2 +- .../IMoveResourcesStatusOperations.cs | 48 ---- .../Models/MoveResourcesParameters.cs | 101 ------- .../src/Generated/Models/Resource.cs | 10 +- .../Models/ServiceAccessPolicyEntry.cs | 8 +- .../Generated/Models/ServicesDescription.cs | 5 +- .../MoveResourcesStatusOperations.cs | 255 ------------------ ...MoveResourcesStatusOperationsExtensions.cs | 61 ----- .../Generated/OperationResultsOperations.cs | 4 + .../src/Generated/Operations.cs | 10 + .../SdkInfo_HealthcareApisManagementClient.cs | 6 +- .../src/Generated/ServicesOperations.cs | 28 ++ 13 files changed, 58 insertions(+), 484 deletions(-) delete mode 100644 sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IMoveResourcesStatusOperations.cs delete mode 100644 sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MoveResourcesParameters.cs delete mode 100644 sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperations.cs delete mode 100644 sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperationsExtensions.cs diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs index b905761494d8..91fcce4aeb28 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/HealthcareApisManagementClient.cs @@ -52,7 +52,7 @@ public partial class HealthcareApisManagementClient : ServiceClient - /// The version of the API. + /// Client Api Version. /// public string ApiVersion { get; private set; } @@ -334,7 +334,7 @@ private void Initialize() Operations = new Operations(this); OperationResults = new OperationResultsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-08-20-preview"; + ApiVersion = "2019-09-16"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs index 19b39d21a6c6..0582aaf46518 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IHealthcareApisManagementClient.cs @@ -46,7 +46,7 @@ public partial interface IHealthcareApisManagementClient : System.IDisposable string SubscriptionId { get; set; } /// - /// The version of the API. + /// Client Api Version. /// string ApiVersion { get; } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IMoveResourcesStatusOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IMoveResourcesStatusOperations.cs deleted file mode 100644 index 51922ed73101..000000000000 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/IMoveResourcesStatusOperations.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// 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.HealthcareApis -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// MoveResourcesStatusOperations operations. - /// - public partial interface IMoveResourcesStatusOperations - { - /// - /// Get the operation result for a long running move operation. - /// - /// - /// The location of the operation. - /// - /// - /// The ID of the operation result to get. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MoveResourcesParameters.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MoveResourcesParameters.cs deleted file mode 100644 index ba45d3bb6023..000000000000 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/MoveResourcesParameters.cs +++ /dev/null @@ -1,101 +0,0 @@ -// -// 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.HealthcareApis.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Input values. - /// - public partial class MoveResourcesParameters - { - /// - /// Initializes a new instance of the MoveResourcesParameters class. - /// - public MoveResourcesParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MoveResourcesParameters class. - /// - /// The target subscription to move - /// resources to. - /// The target resource group to - /// move resources to. - /// The list of resources to - /// move. - public MoveResourcesParameters(string targetSubscriptionId, string targetResourceGroupName, IList resourceIdsToMove) - { - TargetSubscriptionId = targetSubscriptionId; - TargetResourceGroupName = targetResourceGroupName; - ResourceIdsToMove = resourceIdsToMove; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the target subscription to move resources to. - /// - [JsonProperty(PropertyName = "targetSubscriptionId")] - public string TargetSubscriptionId { get; set; } - - /// - /// Gets or sets the target resource group to move resources to. - /// - [JsonProperty(PropertyName = "targetResourceGroupName")] - public string TargetResourceGroupName { get; set; } - - /// - /// Gets or sets the list of resources to move. - /// - [JsonProperty(PropertyName = "resourceIdsToMove")] - public IList ResourceIdsToMove { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (TargetSubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TargetSubscriptionId"); - } - if (TargetResourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TargetResourceGroupName"); - } - if (ResourceIdsToMove == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ResourceIdsToMove"); - } - if (ResourceIdsToMove != null) - { - if (ResourceIdsToMove.Count > 250) - { - throw new ValidationException(ValidationRules.MaxItems, "ResourceIdsToMove", 250); - } - if (ResourceIdsToMove.Count < 1) - { - throw new ValidationException(ValidationRules.MinItems, "ResourceIdsToMove", 1); - } - } - } - } -} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Resource.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Resource.cs index 849a717cd55d..f01af7e84f4f 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Resource.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/Resource.cs @@ -33,9 +33,8 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// The kind of the service. Valid values are: fhir, - /// fhir-Stu3 and fhir-R4. Possible values include: 'fhir', - /// 'fhir-Stu3', 'fhir-R4' + /// The kind of the service. Possible values + /// include: 'fhir', 'fhir-Stu3', 'fhir-R4' /// The resource location. /// The resource identifier. /// The resource name. @@ -79,9 +78,8 @@ public Resource() public string Type { get; private set; } /// - /// Gets or sets the kind of the service. Valid values are: fhir, - /// fhir-Stu3 and fhir-R4. Possible values include: 'fhir', - /// 'fhir-Stu3', 'fhir-R4' + /// Gets or sets the kind of the service. Possible values include: + /// 'fhir', 'fhir-Stu3', 'fhir-R4' /// [JsonProperty(PropertyName = "kind")] public Kind Kind { get; set; } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAccessPolicyEntry.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAccessPolicyEntry.cs index e9f4d4139b57..2628f7272561 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAccessPolicyEntry.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServiceAccessPolicyEntry.cs @@ -30,8 +30,8 @@ public ServiceAccessPolicyEntry() /// /// Initializes a new instance of the ServiceAccessPolicyEntry class. /// - /// An object ID that is allowed access to the - /// FHIR service. + /// An Azure AD object ID (User or Apps) that is + /// allowed access to the FHIR service. public ServiceAccessPolicyEntry(string objectId) { ObjectId = objectId; @@ -44,8 +44,8 @@ public ServiceAccessPolicyEntry(string objectId) partial void CustomInit(); /// - /// Gets or sets an object ID that is allowed access to the FHIR - /// service. + /// Gets or sets an Azure AD object ID (User or Apps) that is allowed + /// access to the FHIR service. /// [JsonProperty(PropertyName = "objectId")] public string ObjectId { get; set; } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs index 7ff0a2c3ca34..02d27083ac45 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Models/ServicesDescription.cs @@ -31,9 +31,8 @@ public ServicesDescription() /// /// Initializes a new instance of the ServicesDescription class. /// - /// The kind of the service. Valid values are: fhir, - /// fhir-Stu3 and fhir-R4. Possible values include: 'fhir', - /// 'fhir-Stu3', 'fhir-R4' + /// The kind of the service. Possible values + /// include: 'fhir', 'fhir-Stu3', 'fhir-R4' /// The resource location. /// The resource identifier. /// The resource name. diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperations.cs deleted file mode 100644 index b85ca0adcb1c..000000000000 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperations.cs +++ /dev/null @@ -1,255 +0,0 @@ -// -// 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.HealthcareApis -{ - 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; - - /// - /// MoveResourcesStatusOperations operations. - /// - internal partial class MoveResourcesStatusOperations : IServiceOperations, IMoveResourcesStatusOperations - { - /// - /// Initializes a new instance of the MoveResourcesStatusOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal MoveResourcesStatusOperations(HealthcareApisManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the HealthcareApisManagementClient - /// - public HealthcareApisManagementClient Client { get; private set; } - - /// - /// Get the operation result for a long running move operation. - /// - /// - /// The location of the operation. - /// - /// - /// The ID of the operation result to get. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (locationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "locationName"); - } - if (operationResultId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "operationResultId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("locationName", locationName); - tracingParameters.Add("operationResultId", operationResultId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/moveResourcesStatus/{operationResultId}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); - _url = _url.Replace("{operationResultId}", System.Uri.EscapeDataString(operationResultId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 404) - { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorDetails _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 == 404) - { - _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/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperationsExtensions.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperationsExtensions.cs deleted file mode 100644 index 65e0edcd2498..000000000000 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/MoveResourcesStatusOperationsExtensions.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// 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.HealthcareApis -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MoveResourcesStatusOperations. - /// - public static partial class MoveResourcesStatusOperationsExtensions - { - /// - /// Get the operation result for a long running move operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The location of the operation. - /// - /// - /// The ID of the operation result to get. - /// - public static object Get(this IMoveResourcesStatusOperations operations, string locationName, string operationResultId) - { - return operations.GetAsync(locationName, operationResultId).GetAwaiter().GetResult(); - } - - /// - /// Get the operation result for a long running move operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The location of the operation. - /// - /// - /// The ID of the operation result to get. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IMoveResourcesStatusOperations operations, string locationName, string operationResultId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(locationName, operationResultId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs index c9cccf09efb7..c037a4dbe436 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/OperationResultsOperations.cs @@ -82,6 +82,10 @@ internal OperationResultsOperations(HealthcareApisManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string locationName, string operationResultId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs index 326523891511..5f5cb16bf3f3 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/Operations.cs @@ -65,11 +65,21 @@ internal Operations(HealthcareApisManagementClient client) /// /// 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.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs index 1b7156ad8962..a0f9f7e31853 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/SdkInfo_HealthcareApisManagementClient.cs @@ -19,9 +19,9 @@ public static IEnumerable> ApiInfo_HealthcareApisM { return new Tuple[] { - new Tuple("HealthcareApis", "OperationResults", "2018-08-20-preview"), - new Tuple("HealthcareApis", "Operations", "2018-08-20-preview"), - new Tuple("HealthcareApis", "Services", "2018-08-20-preview"), + new Tuple("HealthcareApis", "OperationResults", "2019-09-16"), + new Tuple("HealthcareApis", "Operations", "2019-09-16"), + new Tuple("HealthcareApis", "Services", "2019-09-16"), }.AsEnumerable(); } } diff --git a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/ServicesOperations.cs b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/ServicesOperations.cs index 0daea70e3748..5f9a054b8b3c 100644 --- a/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/ServicesOperations.cs +++ b/sdk/healthcareapis/Microsoft.Azure.Management.HealthcareApis/src/Generated/ServicesOperations.cs @@ -82,6 +82,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -361,6 +365,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -533,6 +541,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -727,6 +739,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityParameters checkNameAvailabilityInputs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -920,6 +936,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ServicesDescription serviceDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1169,6 +1189,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ServicesPatchDescription servicePatchDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1390,6 +1414,10 @@ internal ServicesOperations(HealthcareApisManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); From e5884cd763302e35d0050f2984c5abf33bd11928 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2019 03:24:57 +0000 Subject: [PATCH 04/16] [AutoPR Microsoft.Azure.Management.DataFactory] Chainingtrigger (#163) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 5e1bb35d5c3314d8f4fead76c3d69a2522be026b Update review comments --- .../src/Generated/Models/ChainingTrigger.cs | 126 ++++++++++++++++++ .../src/Generated/Models/PipelineResource.cs | 10 +- .../src/Generated/Models/PipelineRun.cs | 11 +- ...kageLocation.cs => SSISPackageLocation.cs} | 0 .../src/Generated/Models/TriggerRun.cs | 20 ++- .../SdkInfo_DataFactoryManagementClient.cs | 11 -- 6 files changed, 164 insertions(+), 14 deletions(-) create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ChainingTrigger.cs rename sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/{SsisPackageLocation.cs => SSISPackageLocation.cs} (100%) diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ChainingTrigger.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ChainingTrigger.cs new file mode 100644 index 000000000000..5f3386bbedc7 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ChainingTrigger.cs @@ -0,0 +1,126 @@ +// +// 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.DataFactory.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Trigger that allows the referenced pipeline to depend on other pipeline + /// runs based on runDimension Name/Value pairs. Upstream pipelines should + /// declare the same runDimension Name and their runs should have the + /// values for those runDimensions. The referenced pipeline run would be + /// triggered if the values for the runDimension match for all upstream + /// pipeline runs. + /// + [Rest.Serialization.JsonTransformation] + public partial class ChainingTrigger : Trigger + { + /// + /// Initializes a new instance of the ChainingTrigger class. + /// + public ChainingTrigger() + { + Pipeline = new TriggerPipelineReference(); + CustomInit(); + } + + /// + /// Initializes a new instance of the ChainingTrigger class. + /// + /// Pipeline for which runs are created when all + /// upstream pipelines complete successfully. + /// Upstream Pipelines. + /// Run Dimension property that needs to be + /// emitted by upstream pipelines. + /// Unmatched properties from the + /// message are deserialized this collection + /// Trigger description. + /// Indicates if trigger is running or not. + /// Updated when Start/Stop APIs are called on the Trigger. Possible + /// values include: 'Started', 'Stopped', 'Disabled' + /// List of tags that can be used for + /// describing the trigger. + public ChainingTrigger(TriggerPipelineReference pipeline, IList dependsOn, string runDimension, IDictionary additionalProperties = default(IDictionary), string description = default(string), string runtimeState = default(string), IList annotations = default(IList)) + : base(additionalProperties, description, runtimeState, annotations) + { + Pipeline = pipeline; + DependsOn = dependsOn; + RunDimension = runDimension; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets pipeline for which runs are created when all upstream + /// pipelines complete successfully. + /// + [JsonProperty(PropertyName = "pipeline")] + public TriggerPipelineReference Pipeline { get; set; } + + /// + /// Gets or sets upstream Pipelines. + /// + [JsonProperty(PropertyName = "typeProperties.dependsOn")] + public IList DependsOn { get; set; } + + /// + /// Gets or sets run Dimension property that needs to be emitted by + /// upstream pipelines. + /// + [JsonProperty(PropertyName = "typeProperties.runDimension")] + public string RunDimension { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Pipeline == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Pipeline"); + } + if (DependsOn == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DependsOn"); + } + if (RunDimension == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RunDimension"); + } + if (Pipeline != null) + { + Pipeline.Validate(); + } + if (DependsOn != null) + { + foreach (var element in DependsOn) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineResource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineResource.cs index 4c376ee88166..71b481d9e008 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineResource.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineResource.cs @@ -48,9 +48,10 @@ public PipelineResource() /// pipeline. /// List of tags that can be used for /// describing the Pipeline. + /// Dimensions emitted by Pipeline. /// The folder that this Pipeline is in. If not /// specified, Pipeline will appear at the root level. - public PipelineResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary additionalProperties = default(IDictionary), string description = default(string), IList activities = default(IList), IDictionary parameters = default(IDictionary), IDictionary variables = default(IDictionary), int? concurrency = default(int?), IList annotations = default(IList), PipelineFolder folder = default(PipelineFolder)) + public PipelineResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IDictionary additionalProperties = default(IDictionary), string description = default(string), IList activities = default(IList), IDictionary parameters = default(IDictionary), IDictionary variables = default(IDictionary), int? concurrency = default(int?), IList annotations = default(IList), IDictionary runDimensions = default(IDictionary), PipelineFolder folder = default(PipelineFolder)) : base(id, name, type, etag) { AdditionalProperties = additionalProperties; @@ -60,6 +61,7 @@ public PipelineResource() Variables = variables; Concurrency = concurrency; Annotations = annotations; + RunDimensions = runDimensions; Folder = folder; CustomInit(); } @@ -113,6 +115,12 @@ public PipelineResource() [JsonProperty(PropertyName = "properties.annotations")] public IList Annotations { get; set; } + /// + /// Gets or sets dimensions emitted by Pipeline. + /// + [JsonProperty(PropertyName = "properties.runDimensions")] + public IDictionary RunDimensions { get; set; } + /// /// Gets or sets the folder that this Pipeline is in. If not specified, /// Pipeline will appear at the root level. diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineRun.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineRun.cs index 7210c76a29e6..f1d431a01efa 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineRun.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/PipelineRun.cs @@ -41,6 +41,8 @@ public PipelineRun() /// The pipeline name. /// The full or partial list of parameter /// name, value pair used in the pipeline run. + /// Run dimensions emitted by Pipeline + /// run. /// Entity that started the pipeline /// run. /// The last updated timestamp for the @@ -52,7 +54,7 @@ public PipelineRun() /// The duration of a pipeline run. /// The status of a pipeline run. /// The message from a pipeline run. - public PipelineRun(IDictionary additionalProperties = default(IDictionary), string runId = default(string), string runGroupId = default(string), bool? isLatest = default(bool?), string pipelineName = default(string), IDictionary parameters = default(IDictionary), PipelineRunInvokedBy invokedBy = default(PipelineRunInvokedBy), System.DateTime? lastUpdated = default(System.DateTime?), System.DateTime? runStart = default(System.DateTime?), System.DateTime? runEnd = default(System.DateTime?), int? durationInMs = default(int?), string status = default(string), string message = default(string)) + public PipelineRun(IDictionary additionalProperties = default(IDictionary), string runId = default(string), string runGroupId = default(string), bool? isLatest = default(bool?), string pipelineName = default(string), IDictionary parameters = default(IDictionary), IDictionary runDimensions = default(IDictionary), PipelineRunInvokedBy invokedBy = default(PipelineRunInvokedBy), System.DateTime? lastUpdated = default(System.DateTime?), System.DateTime? runStart = default(System.DateTime?), System.DateTime? runEnd = default(System.DateTime?), int? durationInMs = default(int?), string status = default(string), string message = default(string)) { AdditionalProperties = additionalProperties; RunId = runId; @@ -60,6 +62,7 @@ public PipelineRun() IsLatest = isLatest; PipelineName = pipelineName; Parameters = parameters; + RunDimensions = runDimensions; InvokedBy = invokedBy; LastUpdated = lastUpdated; RunStart = runStart; @@ -115,6 +118,12 @@ public PipelineRun() [JsonProperty(PropertyName = "parameters")] public IDictionary Parameters { get; private set; } + /// + /// Gets run dimensions emitted by Pipeline run. + /// + [JsonProperty(PropertyName = "runDimensions")] + public IDictionary RunDimensions { get; private set; } + /// /// Gets entity that started the pipeline run. /// diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SsisPackageLocation.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SSISPackageLocation.cs similarity index 100% rename from sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SsisPackageLocation.cs rename to sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/SSISPackageLocation.cs diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/TriggerRun.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/TriggerRun.cs index 8ec466fcd6e5..5e9e585d51f8 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/TriggerRun.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/TriggerRun.cs @@ -44,7 +44,11 @@ public TriggerRun() /// trigger run. Name, value pair depends on type of trigger. /// List of pipeline name and run Id /// triggered by the trigger run. - public TriggerRun(IDictionary additionalProperties = default(IDictionary), string triggerRunId = default(string), string triggerName = default(string), string triggerType = default(string), System.DateTime? triggerRunTimestamp = default(System.DateTime?), string status = default(string), string message = default(string), IDictionary properties = default(IDictionary), IDictionary triggeredPipelines = default(IDictionary)) + /// Run dimension for which trigger was + /// fired. + /// Status of the upstream + /// pipelines. + public TriggerRun(IDictionary additionalProperties = default(IDictionary), string triggerRunId = default(string), string triggerName = default(string), string triggerType = default(string), System.DateTime? triggerRunTimestamp = default(System.DateTime?), string status = default(string), string message = default(string), IDictionary properties = default(IDictionary), IDictionary triggeredPipelines = default(IDictionary), IDictionary runDimension = default(IDictionary), IDictionary dependencyStatus = default(IDictionary)) { AdditionalProperties = additionalProperties; TriggerRunId = triggerRunId; @@ -55,6 +59,8 @@ public TriggerRun() Message = message; Properties = properties; TriggeredPipelines = triggeredPipelines; + RunDimension = runDimension; + DependencyStatus = dependencyStatus; CustomInit(); } @@ -120,5 +126,17 @@ public TriggerRun() [JsonProperty(PropertyName = "triggeredPipelines")] public IDictionary TriggeredPipelines { get; private set; } + /// + /// Gets run dimension for which trigger was fired. + /// + [JsonProperty(PropertyName = "runDimension")] + public IDictionary RunDimension { get; private set; } + + /// + /// Gets status of the upstream pipelines. + /// + [JsonProperty(PropertyName = "dependencyStatus")] + public IDictionary DependencyStatus { get; private set; } + } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/SdkInfo_DataFactoryManagementClient.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/SdkInfo_DataFactoryManagementClient.cs index 6c4f6b0598b1..afb3bebe6aa9 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/SdkInfo_DataFactoryManagementClient.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/SdkInfo_DataFactoryManagementClient.cs @@ -36,16 +36,5 @@ public static IEnumerable> ApiInfo_DataFactoryMana }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/datafactory/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --tag=package-2018-06 --csharp-sdks-folder=C:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "fb8f078deac2367f3dbcfbd8a542c77083c28a5b"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - From 9eb472c0a3553567780d52f904bb224585c5091c Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2019 05:22:02 +0000 Subject: [PATCH 05/16] [AutoPR Microsoft.Azure.Management.EventHub] Eventhub: added NetworkRuleSets list API (#155) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 8bc2a7edfeebb1a6bb30abbbb03d08bf1f8a8dbc update --- .../src/Generated/INamespacesOperations.cs | 47 +++ .../src/Generated/NamespacesOperations.cs | 381 ++++++++++++++++++ .../NamespacesOperationsExtensions.cs | 74 ++++ 3 files changed, 502 insertions(+) diff --git a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/INamespacesOperations.cs b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/INamespacesOperations.cs index c5d90965e6b4..5da100b5b861 100644 --- a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/INamespacesOperations.cs +++ b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/INamespacesOperations.cs @@ -442,6 +442,31 @@ public partial interface INamespacesOperations /// Task> GetNetworkRuleSetWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// Name of the resource group within the azure subscription. + /// + /// + /// The Namespace 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>> ListNetworkRuleSetsWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates a namespace. Once created, this namespace's /// resource manifest is immutable. This operation is idempotent. /// @@ -560,5 +585,27 @@ public partial interface INamespacesOperations /// Thrown when a required parameter is null /// Task>> ListAuthorizationRulesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// 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>> ListNetworkRuleSetsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperations.cs b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperations.cs index c62283f38142..b9d7e86c02d0 100644 --- a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperations.cs +++ b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperations.cs @@ -3161,6 +3161,219 @@ internal NamespacesOperations(EventHubManagementClient client) return _result; } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// Name of the resource group within the azure subscription. + /// + /// + /// The Namespace 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>> ListNetworkRuleSetsWithHttpMessagesAsync(string resourceGroupName, string namespaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (namespaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namespaceName"); + } + if (namespaceName != null) + { + if (namespaceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "namespaceName", 50); + } + if (namespaceName.Length < 6) + { + throw new ValidationException(ValidationRules.MinLength, "namespaceName", 6); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("namespaceName", namespaceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNetworkRuleSets", 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.EventHub/namespaces/{namespaceName}/networkRuleSets").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{namespaceName}", System.Uri.EscapeDataString(namespaceName)); + _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; + } + /// /// Creates or updates a namespace. Once created, this namespace's resource /// manifest is immutable. This operation is idempotent. @@ -4109,5 +4322,173 @@ internal NamespacesOperations(EventHubManagementClient client) return _result; } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// 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>> ListNetworkRuleSetsNextWithHttpMessagesAsync(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, "ListNetworkRuleSetsNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new 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; + } + } } diff --git a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperationsExtensions.cs b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperationsExtensions.cs index 26e4b04409d5..409eed350c43 100644 --- a/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperationsExtensions.cs +++ b/sdk/eventhub/Microsoft.Azure.Management.EventHub/src/Generated/NamespacesOperationsExtensions.cs @@ -701,6 +701,46 @@ public static NetworkRuleSet GetNetworkRuleSet(this INamespacesOperations operat } } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group within the azure subscription. + /// + /// + /// The Namespace name + /// + public static IPage ListNetworkRuleSets(this INamespacesOperations operations, string resourceGroupName, string namespaceName) + { + return operations.ListNetworkRuleSetsAsync(resourceGroupName, namespaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the resource group within the azure subscription. + /// + /// + /// The Namespace name + /// + /// + /// The cancellation token. + /// + public static async Task> ListNetworkRuleSetsAsync(this INamespacesOperations operations, string resourceGroupName, string namespaceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNetworkRuleSetsWithHttpMessagesAsync(resourceGroupName, namespaceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates a namespace. Once created, this namespace's resource /// manifest is immutable. This operation is idempotent. @@ -892,5 +932,39 @@ public static IPage ListAuthorizationRulesNext(this INamespac } } + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNetworkRuleSetsNext(this INamespacesOperations operations, string nextPageLink) + { + return operations.ListNetworkRuleSetsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets list of NetworkRuleSet for a Namespace. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNetworkRuleSetsNextAsync(this INamespacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNetworkRuleSetsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } From 511ac18ccb34deffb8d477e56adf01d759335ef0 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2019 09:04:47 +0000 Subject: [PATCH 06/16] [AutoPR Microsoft.Azure.Management.Compute] [Compute] Add missing $expand parameter to AvSet list by subscription API (#165) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from ed6acf4e35d75fc3c1c9e617b7131e83b6f59384 Add missing $expand parameter to AvSet list by subscription API --- .../src/Generated/SdkInfo_ComputeManagementClient.cs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs index e8ef6710bfa7..92e16cbf4f6d 100644 --- a/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs +++ b/sdk/compute/Microsoft.Azure.Management.Compute/src/Generated/SdkInfo_ComputeManagementClient.cs @@ -49,16 +49,5 @@ public static IEnumerable> ApiInfo_ComputeManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/compute/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\hylee-sdk\\avset\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "6359c5dac93947b24007afd9c569e23e92848ea5"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - From 81f9788943a204419cefdc5968da5b08de56b5df Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2019 16:59:15 +0000 Subject: [PATCH 07/16] [AutoPR Microsoft.Azure.Management.CognitiveServices] Fix check domain path (#147) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 111d1bc1666fe89cebb960135cf2f5336bbcb35a Removed rogue file --- .../CognitiveServicesManagementClient.cs | 207 ++++++++++++++++++ ...itiveServicesManagementClientExtensions.cs | 65 ++++++ .../ICognitiveServicesManagementClient.cs | 21 ++ .../CheckDomainAvailabilityParameter.cs | 79 +++++++ .../Models/CheckDomainAvailabilityResult.cs | 78 +++++++ .../Generated/Models/{IPRule.cs => IpRule.cs} | 0 ...kInfo_CognitiveServicesManagementClient.cs | 12 +- 7 files changed, 451 insertions(+), 11 deletions(-) create mode 100644 sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClientExtensions.cs create mode 100644 sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityParameter.cs create mode 100644 sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityResult.cs rename sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/{IPRule.cs => IpRule.cs} (100%) diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClient.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClient.cs index 7faff410cf95..ffe7811c27c8 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClient.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClient.cs @@ -20,6 +20,8 @@ namespace Microsoft.Azure.Management.CognitiveServices using System.Linq; using System.Net; using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; /// /// Cognitive Services Management Client @@ -375,5 +377,210 @@ private void Initialize() DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } + /// + /// Check whether a domain is available. + /// + /// + /// The subdomain name to use. + /// + /// + /// The Type of the resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CheckDomainAvailabilityWithHttpMessagesAsync(string subdomainName, string type, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (subdomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "subdomainName"); + } + if (type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "type"); + } + CheckDomainAvailabilityParameter parameters = new CheckDomainAvailabilityParameter(); + if (subdomainName != null || type != null) + { + parameters.SubdomainName = subdomainName; + parameters.Type = type; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckDomainAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = SafeJsonConvert.SerializeObject(parameters, 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 (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 = SafeJsonConvert.DeserializeObject(_responseContent, 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/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClientExtensions.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClientExtensions.cs new file mode 100644 index 000000000000..a92a604ee2ee --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/CognitiveServicesManagementClientExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CognitiveServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for CognitiveServicesManagementClient. + /// + public static partial class CognitiveServicesManagementClientExtensions + { + /// + /// Check whether a domain is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The subdomain name to use. + /// + /// + /// The Type of the resource. + /// + public static CheckDomainAvailabilityResult CheckDomainAvailability(this ICognitiveServicesManagementClient operations, string subdomainName, string type) + { + return operations.CheckDomainAvailabilityAsync(subdomainName, type).GetAwaiter().GetResult(); + } + + /// + /// Check whether a domain is available. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The subdomain name to use. + /// + /// + /// The Type of the resource. + /// + /// + /// The cancellation token. + /// + public static async Task CheckDomainAvailabilityAsync(this ICognitiveServicesManagementClient operations, string subdomainName, string type, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckDomainAvailabilityWithHttpMessagesAsync(subdomainName, type, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/ICognitiveServicesManagementClient.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/ICognitiveServicesManagementClient.cs index 6e897bac33a1..9229ed9da261 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/ICognitiveServicesManagementClient.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/ICognitiveServicesManagementClient.cs @@ -14,6 +14,10 @@ namespace Microsoft.Azure.Management.CognitiveServices using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// Cognitive Services Management Client @@ -90,5 +94,22 @@ public partial interface ICognitiveServicesManagementClient : System.IDisposable /// ICheckSkuAvailabilityOperations CheckSkuAvailability { get; } + /// + /// Check whether a domain is available. + /// + /// + /// The subdomain name to use. + /// + /// + /// The Type of the resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> CheckDomainAvailabilityWithHttpMessagesAsync(string subdomainName, string type, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityParameter.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityParameter.cs new file mode 100644 index 000000000000..2fc0681513a9 --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityParameter.cs @@ -0,0 +1,79 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.CognitiveServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Check Domain availability parameter. + /// + public partial class CheckDomainAvailabilityParameter + { + /// + /// Initializes a new instance of the CheckDomainAvailabilityParameter + /// class. + /// + public CheckDomainAvailabilityParameter() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckDomainAvailabilityParameter + /// class. + /// + /// The subdomain name to use. + /// The Type of the resource. + public CheckDomainAvailabilityParameter(string subdomainName, string type) + { + SubdomainName = subdomainName; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the subdomain name to use. + /// + [JsonProperty(PropertyName = "subdomainName")] + public string SubdomainName { get; set; } + + /// + /// Gets or sets the Type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SubdomainName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SubdomainName"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityResult.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityResult.cs new file mode 100644 index 000000000000..7582f4616c84 --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CheckDomainAvailabilityResult.cs @@ -0,0 +1,78 @@ +// +// 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.CognitiveServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Check Domain availability result. + /// + public partial class CheckDomainAvailabilityResult + { + /// + /// Initializes a new instance of the CheckDomainAvailabilityResult + /// class. + /// + public CheckDomainAvailabilityResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckDomainAvailabilityResult + /// class. + /// + /// Indicates the given SKU is + /// available or not. + /// Reason why the SKU is not available. + /// The subdomain name to use. + /// The Type of the resource. + public CheckDomainAvailabilityResult(bool? isSubdomainAvailable = default(bool?), string reason = default(string), string subdomainName = default(string), string type = default(string)) + { + IsSubdomainAvailable = isSubdomainAvailable; + Reason = reason; + SubdomainName = subdomainName; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates the given SKU is available or not. + /// + [JsonProperty(PropertyName = "isSubdomainAvailable")] + public bool? IsSubdomainAvailable { get; set; } + + /// + /// Gets or sets reason why the SKU is not available. + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + /// + /// Gets or sets the subdomain name to use. + /// + [JsonProperty(PropertyName = "subdomainName")] + public string SubdomainName { get; set; } + + /// + /// Gets or sets the Type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IPRule.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IpRule.cs similarity index 100% rename from sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IPRule.cs rename to sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IpRule.cs diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs index 230a99061186..48cf31a0e168 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs @@ -20,22 +20,12 @@ public static IEnumerable> ApiInfo_CognitiveServic return new Tuple[] { new Tuple("CognitiveServices", "Accounts", "2017-04-18"), + new Tuple("CognitiveServices", "CheckDomainAvailability", "2017-04-18"), new Tuple("CognitiveServices", "CheckSkuAvailability", "2017-04-18"), new Tuple("CognitiveServices", "Operations", "2017-04-18"), new Tuple("CognitiveServices", "ResourceSkus", "2017-04-18"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cognitiveservices/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\Github\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "f58c2f349207bda6f5ca4c010dd7f56c38ddb70e"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - From cdef400a5b61c4bc803dad632b6fa6eac8f6b7b2 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2019 05:36:05 +0000 Subject: [PATCH 08/16] Generated from ba2bfe74bad69d5419a8966d712ebb7fbee44941 (#170) removed pageable --- .../src/Generated/IOperations.cs | 2 +- .../src/Generated/Models/OperationList.cs | 53 +++++++++++++++++++ .../src/Generated/Operations.cs | 6 +-- .../src/Generated/OperationsExtensions.cs | 6 +-- .../SdkInfo_AttestationManagementClient.cs | 11 ---- 5 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Models/OperationList.cs diff --git a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/IOperations.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/IOperations.cs index ab7abf8e6217..c504661a385e 100644 --- a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/IOperations.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/IOperations.cs @@ -41,6 +41,6 @@ public partial interface IOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Models/OperationList.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Models/OperationList.cs new file mode 100644 index 000000000000..3ffcb68ab59b --- /dev/null +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Models/OperationList.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Attestation.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of supported operations. + /// + public partial class OperationList + { + /// + /// Initializes a new instance of the OperationList class. + /// + public OperationList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationList class. + /// + /// List of supported operations. + public OperationList(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of supported operations. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Operations.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Operations.cs index d8efd6c507a6..01412dc4fd9c 100644 --- a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Operations.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/Operations.cs @@ -68,7 +68,7 @@ internal Operations(AttestationManagementClient 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> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -181,7 +181,7 @@ internal Operations(AttestationManagementClient 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")) @@ -194,7 +194,7 @@ internal Operations(AttestationManagementClient 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/attestation/Microsoft.Azure.Management.Attestation/src/Generated/OperationsExtensions.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/OperationsExtensions.cs index 7b482b509c0f..b0654baf1691 100644 --- a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/OperationsExtensions.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/OperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Attestation using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -29,7 +27,7 @@ public static partial class OperationsExtensions /// /// The operations group for this extension method. /// - public static IEnumerable List(this IOperations operations) + public static OperationList List(this IOperations operations) { return operations.ListAsync().GetAwaiter().GetResult(); } @@ -43,7 +41,7 @@ public static IEnumerable List(this IOperations operations /// /// The cancellation token. /// - public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/SdkInfo_AttestationManagementClient.cs b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/SdkInfo_AttestationManagementClient.cs index 8a7744bc37a7..d73cbdde8c92 100644 --- a/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/SdkInfo_AttestationManagementClient.cs +++ b/sdk/attestation/Microsoft.Azure.Management.Attestation/src/Generated/SdkInfo_AttestationManagementClient.cs @@ -24,16 +24,5 @@ public static IEnumerable> ApiInfo_AttestationMana }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/attestation/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "76c353d92b8037fe1e02c36deeb06d78d284e5d7"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - From 3e219860a7310453997563dd925bda2d3941b144 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2019 01:33:38 +0000 Subject: [PATCH 09/16] [AutoPR Microsoft.Azure.Management.DataFactory] [Data Factory]Add ORC Dataset/Copy Source/Copy Sink (#143) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 864a2b3827b7237d7cb60d77069b693dcbaf7001 [DataFactory]Add support for ORC dataset --- .../src/Generated/Models/OrcDataset.cs | 93 +++++++++++++++++++ .../src/Generated/Models/OrcSink.cs | 69 ++++++++++++++ .../src/Generated/Models/OrcSource.cs | 77 +++++++++++++++ 3 files changed, 239 insertions(+) create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcDataset.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSink.cs create mode 100644 sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSource.cs diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcDataset.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcDataset.cs new file mode 100644 index 000000000000..ab3d94b1cc48 --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcDataset.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataFactory.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ORC dataset. + /// + [Newtonsoft.Json.JsonObject("Orc")] + [Rest.Serialization.JsonTransformation] + public partial class OrcDataset : Dataset + { + /// + /// Initializes a new instance of the OrcDataset class. + /// + public OrcDataset() + { + LinkedServiceName = new LinkedServiceReference(); + CustomInit(); + } + + /// + /// Initializes a new instance of the OrcDataset class. + /// + /// Linked service reference. + /// The location of the ORC data + /// storage. + /// Unmatched properties from the + /// message are deserialized this collection + /// Dataset description. + /// Columns that define the structure of the + /// dataset. Type: array (or Expression with resultType array), + /// itemType: DatasetDataElement. + /// Columns that define the physical type schema + /// of the dataset. Type: array (or Expression with resultType array), + /// itemType: DatasetSchemaDataElement. + /// Parameters for dataset. + /// List of tags that can be used for + /// describing the Dataset. + /// The folder that this Dataset is in. If not + /// specified, Dataset will appear at the root level. + public OrcDataset(LinkedServiceReference linkedServiceName, DatasetLocation location, IDictionary additionalProperties = default(IDictionary), string description = default(string), object structure = default(object), object schema = default(object), IDictionary parameters = default(IDictionary), IList annotations = default(IList), DatasetFolder folder = default(DatasetFolder)) + : base(linkedServiceName, additionalProperties, description, structure, schema, parameters, annotations, folder) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the location of the ORC data storage. + /// + [JsonProperty(PropertyName = "typeProperties.location")] + public DatasetLocation Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + if (Location != null) + { + Location.Validate(); + } + } + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSink.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSink.cs new file mode 100644 index 000000000000..0eb07d896d9e --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSink.cs @@ -0,0 +1,69 @@ +// +// 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.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A copy activity ORC sink. + /// + public partial class OrcSink : CopySink + { + /// + /// Initializes a new instance of the OrcSink class. + /// + public OrcSink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OrcSink class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// Write batch size. Type: integer (or + /// Expression with resultType integer), minimum: 0. + /// Write batch timeout. Type: string + /// (or Expression with resultType string), pattern: + /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + /// Sink retry count. Type: integer (or + /// Expression with resultType integer). + /// Sink retry wait. Type: string (or + /// Expression with resultType string), pattern: + /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + /// The maximum concurrent + /// connection count for the sink data store. Type: integer (or + /// Expression with resultType integer). + /// ORC store settings. + public OrcSink(IDictionary additionalProperties = default(IDictionary), object writeBatchSize = default(object), object writeBatchTimeout = default(object), object sinkRetryCount = default(object), object sinkRetryWait = default(object), object maxConcurrentConnections = default(object), StoreWriteSettings storeSettings = default(StoreWriteSettings)) + : base(additionalProperties, writeBatchSize, writeBatchTimeout, sinkRetryCount, sinkRetryWait, maxConcurrentConnections) + { + StoreSettings = storeSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ORC store settings. + /// + [JsonProperty(PropertyName = "storeSettings")] + public StoreWriteSettings StoreSettings { get; set; } + + } +} diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSource.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSource.cs new file mode 100644 index 000000000000..6a3f09c364bd --- /dev/null +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/OrcSource.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DataFactory.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A copy activity ORC source. + /// + public partial class OrcSource : CopySource + { + /// + /// Initializes a new instance of the OrcSource class. + /// + public OrcSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OrcSource class. + /// + /// Unmatched properties from the + /// message are deserialized this collection + /// Source retry count. Type: integer + /// (or Expression with resultType integer). + /// Source retry wait. Type: string (or + /// Expression with resultType string), pattern: + /// ((\d+)\.)?(\d\d):(60|([0-5][0-9])):(60|([0-5][0-9])). + /// The maximum concurrent + /// connection count for the source data store. Type: integer (or + /// Expression with resultType integer). + /// ORC store settings. + public OrcSource(IDictionary additionalProperties = default(IDictionary), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), StoreReadSettings storeSettings = default(StoreReadSettings)) + : base(additionalProperties, sourceRetryCount, sourceRetryWait, maxConcurrentConnections) + { + StoreSettings = storeSettings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets ORC store settings. + /// + [JsonProperty(PropertyName = "storeSettings")] + public StoreReadSettings StoreSettings { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StoreSettings != null) + { + StoreSettings.Validate(); + } + } + } +} From 1389b8fb7477144782705086d49511199d256eac Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2019 02:10:37 +0000 Subject: [PATCH 10/16] [AutoPR Microsoft.Azure.Management.DataFactory] [Datafactory] Add a new property in Office365 connector (#166) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * [AutoPR Microsoft.Azure.Management.HealthcareApis] Move to stable version (#134) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 98f6703f2854ce61a22c8ba99a243a3ecb85ec8c Updated the way we retrieve version parameter * [AutoPR Microsoft.Azure.Management.DataFactory] Chainingtrigger (#163) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 5e1bb35d5c3314d8f4fead76c3d69a2522be026b Update review comments * [AutoPR Microsoft.Azure.Management.EventHub] Eventhub: added NetworkRuleSets list API (#155) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 8bc2a7edfeebb1a6bb30abbbb03d08bf1f8a8dbc update * Generated from eb6cdadb1aa229489cd5d7108cf02ba799416f40 Resovle comments --- .../Generated/DataFactoryManagementClient.cs | 2 -- .../src/Generated/Models/AvroSink.cs | 17 +++++++++++++ .../Models/AzureBlobFSWriteSettings.cs | 23 +++++++++--------- .../Models/AzureBlobStorageWriteSettings.cs | 23 +++++++++--------- .../Models/AzureDataLakeStoreWriteSettings.cs | 15 ++++++++++-- .../src/Generated/Models/BinarySink.cs | 13 ++++++++++ .../src/Generated/Models/DelimitedTextSink.cs | 4 ++++ .../Models/FileServerWriteSettings.cs | 15 ++++++++++-- .../src/Generated/Models/JsonSink.cs | 17 +++++++++++++ .../src/Generated/Models/Office365Source.cs | 18 ++++++++++++-- .../src/Generated/Models/ParquetSink.cs | 13 ++++++++++ .../Generated/Models/StoreWriteSettings.cs | 24 ++++++++++++++++++- 12 files changed, 151 insertions(+), 33 deletions(-) diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs index e33e68d2d6aa..9766686b44ba 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/DataFactoryManagementClient.cs @@ -457,8 +457,6 @@ private void Initialize() DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("authorizationType")); diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AvroSink.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AvroSink.cs index 971fe631c2e1..674850039188 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AvroSink.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AvroSink.cs @@ -73,5 +73,22 @@ public AvroSink() [JsonProperty(PropertyName = "formatSettings")] public AvroWriteSettings FormatSettings { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StoreSettings != null) + { + StoreSettings.Validate(); + } + if (FormatSettings != null) + { + FormatSettings.Validate(); + } + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.cs index a4190a133de4..b80df367637a 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureBlobFSWriteSettings.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.DataFactory.Models { - using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -31,6 +30,7 @@ public AzureBlobFSWriteSettings() /// /// Initializes a new instance of the AzureBlobFSWriteSettings class. /// + /// The write setting type. /// Unmatched properties from the /// message are deserialized this collection /// The maximum concurrent @@ -38,13 +38,9 @@ public AzureBlobFSWriteSettings() /// Expression with resultType integer). /// The type of copy behavior for copy /// sink. - /// Indicates the block size(MB) when - /// writing data to blob. Type: integer (or Expression with resultType - /// integer). - public AzureBlobFSWriteSettings(IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object), object blockSizeInMB = default(object)) - : base(additionalProperties, maxConcurrentConnections, copyBehavior) + public AzureBlobFSWriteSettings(string type, IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) + : base(type, additionalProperties, maxConcurrentConnections, copyBehavior) { - BlockSizeInMB = blockSizeInMB; CustomInit(); } @@ -54,11 +50,14 @@ public AzureBlobFSWriteSettings() partial void CustomInit(); /// - /// Gets or sets indicates the block size(MB) when writing data to - /// blob. Type: integer (or Expression with resultType integer). + /// Validate the object. /// - [JsonProperty(PropertyName = "blockSizeInMB")] - public object BlockSizeInMB { get; set; } - + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.cs index 5abe50e082e2..b40c03973a83 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureBlobStorageWriteSettings.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.DataFactory.Models { - using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -33,6 +32,7 @@ public AzureBlobStorageWriteSettings() /// Initializes a new instance of the AzureBlobStorageWriteSettings /// class. /// + /// The write setting type. /// Unmatched properties from the /// message are deserialized this collection /// The maximum concurrent @@ -40,13 +40,9 @@ public AzureBlobStorageWriteSettings() /// Expression with resultType integer). /// The type of copy behavior for copy /// sink. - /// Indicates the block size(MB) when - /// writing data to blob. Type: integer (or Expression with resultType - /// integer). - public AzureBlobStorageWriteSettings(IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object), object blockSizeInMB = default(object)) - : base(additionalProperties, maxConcurrentConnections, copyBehavior) + public AzureBlobStorageWriteSettings(string type, IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) + : base(type, additionalProperties, maxConcurrentConnections, copyBehavior) { - BlockSizeInMB = blockSizeInMB; CustomInit(); } @@ -56,11 +52,14 @@ public AzureBlobStorageWriteSettings() partial void CustomInit(); /// - /// Gets or sets indicates the block size(MB) when writing data to - /// blob. Type: integer (or Expression with resultType integer). + /// Validate the object. /// - [JsonProperty(PropertyName = "blockSizeInMB")] - public object BlockSizeInMB { get; set; } - + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.cs index 6a3e6a6958a7..5d10b8f5583d 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/AzureDataLakeStoreWriteSettings.cs @@ -32,6 +32,7 @@ public AzureDataLakeStoreWriteSettings() /// Initializes a new instance of the AzureDataLakeStoreWriteSettings /// class. /// + /// The write setting type. /// Unmatched properties from the /// message are deserialized this collection /// The maximum concurrent @@ -39,8 +40,8 @@ public AzureDataLakeStoreWriteSettings() /// Expression with resultType integer). /// The type of copy behavior for copy /// sink. - public AzureDataLakeStoreWriteSettings(IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) - : base(additionalProperties, maxConcurrentConnections, copyBehavior) + public AzureDataLakeStoreWriteSettings(string type, IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) + : base(type, additionalProperties, maxConcurrentConnections, copyBehavior) { CustomInit(); } @@ -50,5 +51,15 @@ public AzureDataLakeStoreWriteSettings() /// partial void CustomInit(); + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/BinarySink.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/BinarySink.cs index 5fec652f6705..ecfd2b070915 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/BinarySink.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/BinarySink.cs @@ -65,5 +65,18 @@ public BinarySink() [JsonProperty(PropertyName = "storeSettings")] public StoreWriteSettings StoreSettings { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StoreSettings != null) + { + StoreSettings.Validate(); + } + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/DelimitedTextSink.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/DelimitedTextSink.cs index d6c268d8b94f..48aa6c4a5e6d 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/DelimitedTextSink.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/DelimitedTextSink.cs @@ -81,6 +81,10 @@ public DelimitedTextSink() /// public virtual void Validate() { + if (StoreSettings != null) + { + StoreSettings.Validate(); + } if (FormatSettings != null) { FormatSettings.Validate(); diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/FileServerWriteSettings.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/FileServerWriteSettings.cs index b89b89c40ba2..c7f5984e798d 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/FileServerWriteSettings.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/FileServerWriteSettings.cs @@ -30,6 +30,7 @@ public FileServerWriteSettings() /// /// Initializes a new instance of the FileServerWriteSettings class. /// + /// The write setting type. /// Unmatched properties from the /// message are deserialized this collection /// The maximum concurrent @@ -37,8 +38,8 @@ public FileServerWriteSettings() /// Expression with resultType integer). /// The type of copy behavior for copy /// sink. - public FileServerWriteSettings(IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) - : base(additionalProperties, maxConcurrentConnections, copyBehavior) + public FileServerWriteSettings(string type, IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) + : base(type, additionalProperties, maxConcurrentConnections, copyBehavior) { CustomInit(); } @@ -48,5 +49,15 @@ public FileServerWriteSettings() /// partial void CustomInit(); + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/JsonSink.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/JsonSink.cs index 703c9718ea8c..9017df04eaad 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/JsonSink.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/JsonSink.cs @@ -73,5 +73,22 @@ public JsonSink() [JsonProperty(PropertyName = "formatSettings")] public JsonWriteSettings FormatSettings { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StoreSettings != null) + { + StoreSettings.Validate(); + } + if (FormatSettings != null) + { + FormatSettings.Validate(); + } + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Office365Source.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Office365Source.cs index 1116608ddbf4..a76dbc6d1004 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Office365Source.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/Office365Source.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.DataFactory.Models using System.Linq; /// - /// A copy activity source for an Office365 service. + /// A copy activity source for an Office 365 service. /// public partial class Office365Source : CopySource { @@ -55,7 +55,11 @@ public Office365Source() /// End time of the requested range for this /// dataset. Type: string (or Expression with resultType /// string). - public Office365Source(IDictionary additionalProperties = default(IDictionary), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), object allowedGroups = default(object), object userScopeFilterUri = default(object), object dateFilterColumn = default(object), object startTime = default(object), object endTime = default(object)) + /// The columns to be read out from the + /// Office 365 table. Type: array of objects (or Expression with + /// resultType array of objects). Example: [ { "name": "Id" }, { + /// "name": "CreatedDateTime" } ] + public Office365Source(IDictionary additionalProperties = default(IDictionary), object sourceRetryCount = default(object), object sourceRetryWait = default(object), object maxConcurrentConnections = default(object), object allowedGroups = default(object), object userScopeFilterUri = default(object), object dateFilterColumn = default(object), object startTime = default(object), object endTime = default(object), object outputColumns = default(object)) : base(additionalProperties, sourceRetryCount, sourceRetryWait, maxConcurrentConnections) { AllowedGroups = allowedGroups; @@ -63,6 +67,7 @@ public Office365Source() DateFilterColumn = dateFilterColumn; StartTime = startTime; EndTime = endTime; + OutputColumns = outputColumns; CustomInit(); } @@ -108,5 +113,14 @@ public Office365Source() [JsonProperty(PropertyName = "endTime")] public object EndTime { get; set; } + /// + /// Gets or sets the columns to be read out from the Office 365 table. + /// Type: array of objects (or Expression with resultType array of + /// objects). Example: [ { "name": "Id" }, { "name": "CreatedDateTime" + /// } ] + /// + [JsonProperty(PropertyName = "outputColumns")] + public object OutputColumns { get; set; } + } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ParquetSink.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ParquetSink.cs index 67b95379fe09..73efe2afcdf0 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ParquetSink.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/ParquetSink.cs @@ -65,5 +65,18 @@ public ParquetSink() [JsonProperty(PropertyName = "storeSettings")] public StoreWriteSettings StoreSettings { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (StoreSettings != null) + { + StoreSettings.Validate(); + } + } } } diff --git a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/StoreWriteSettings.cs b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/StoreWriteSettings.cs index 0346d5e0d099..a2865e56f776 100644 --- a/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/StoreWriteSettings.cs +++ b/sdk/datafactory/Microsoft.Azure.Management.DataFactory/src/Generated/Models/StoreWriteSettings.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.DataFactory.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -31,6 +32,7 @@ public StoreWriteSettings() /// /// Initializes a new instance of the StoreWriteSettings class. /// + /// The write setting type. /// Unmatched properties from the /// message are deserialized this collection /// The maximum concurrent @@ -38,9 +40,10 @@ public StoreWriteSettings() /// Expression with resultType integer). /// The type of copy behavior for copy /// sink. - public StoreWriteSettings(IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) + public StoreWriteSettings(string type, IDictionary additionalProperties = default(IDictionary), object maxConcurrentConnections = default(object), object copyBehavior = default(object)) { AdditionalProperties = additionalProperties; + Type = type; MaxConcurrentConnections = maxConcurrentConnections; CopyBehavior = copyBehavior; CustomInit(); @@ -58,6 +61,12 @@ public StoreWriteSettings() [JsonExtensionData] public IDictionary AdditionalProperties { get; set; } + /// + /// Gets or sets the write setting type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + /// /// Gets or sets the maximum concurrent connection count for the source /// data store. Type: integer (or Expression with resultType integer). @@ -71,5 +80,18 @@ public StoreWriteSettings() [JsonProperty(PropertyName = "copyBehavior")] public object CopyBehavior { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } } } From 92b8ed14d535971e2825507d2c46b738e8403e52 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 04:55:06 +0000 Subject: [PATCH 11/16] [AutoPR Microsoft.Azure.Management.ContainerService] Container Services: add java package 2019 08 01 (#172) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * [AutoPR Microsoft.Azure.Management.HealthcareApis] Move to stable version (#134) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 98f6703f2854ce61a22c8ba99a243a3ecb85ec8c Updated the way we retrieve version parameter * [AutoPR Microsoft.Azure.Management.DataFactory] Chainingtrigger (#163) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 5e1bb35d5c3314d8f4fead76c3d69a2522be026b Update review comments * [AutoPR Microsoft.Azure.Management.EventHub] Eventhub: added NetworkRuleSets list API (#155) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 8bc2a7edfeebb1a6bb30abbbb03d08bf1f8a8dbc update * [AutoPR Microsoft.Azure.Management.Compute] [Compute] Add missing $expand parameter to AvSet list by subscription API (#165) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from ed6acf4e35d75fc3c1c9e617b7131e83b6f59384 Add missing $expand parameter to AvSet list by subscription API * [AutoPR Microsoft.Azure.Management.CognitiveServices] Fix check domain path (#147) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 111d1bc1666fe89cebb960135cf2f5336bbcb35a Removed rogue file * Generated from ba2bfe74bad69d5419a8966d712ebb7fbee44941 (#170) removed pageable * [AutoPR Microsoft.Azure.Management.DataFactory] [Data Factory]Add ORC Dataset/Copy Source/Copy Sink (#143) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 864a2b3827b7237d7cb60d77069b693dcbaf7001 [DataFactory]Add support for ORC dataset * [AutoPR Microsoft.Azure.Management.DataFactory] [Datafactory] Add a new property in Office365 connector (#166) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * [AutoPR Microsoft.Azure.Management.HealthcareApis] Move to stable version (#134) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 98f6703f2854ce61a22c8ba99a243a3ecb85ec8c Updated the way we retrieve version parameter * [AutoPR Microsoft.Azure.Management.DataFactory] Chainingtrigger (#163) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 5e1bb35d5c3314d8f4fead76c3d69a2522be026b Update review comments * [AutoPR Microsoft.Azure.Management.EventHub] Eventhub: added NetworkRuleSets list API (#155) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 8bc2a7edfeebb1a6bb30abbbb03d08bf1f8a8dbc update * Generated from eb6cdadb1aa229489cd5d7108cf02ba799416f40 Resovle comments * Generated from 65a64690d9907f680b0070b16416ed61391f7d90 fix: not to remove 2019-06 tag in multiapi --- .../src/Generated/AgentPoolsOperations.cs | 465 +++++++++++++++++- .../AgentPoolsOperationsExtensions.cs | 106 ++++ .../Generated/ContainerServicesOperations.cs | 2 +- .../src/Generated/IAgentPoolsOperations.cs | 63 +++ .../Generated/ManagedClustersOperations.cs | 24 +- .../src/Generated/Models/AgentPool.cs | 45 +- .../Models/AgentPoolAvailableVersions.cs | 83 ++++ ...VersionsPropertiesAgentPoolVersionsItem.cs | 70 +++ .../Models/AgentPoolUpgradeProfile.cs | 120 +++++ ...oolUpgradeProfilePropertiesUpgradesItem.cs | 60 +++ .../Models/ContainerServiceNetworkProfile.cs | 15 +- .../src/Generated/Models/ManagedCluster.cs | 15 +- .../ManagedClusterAPIServerAccessProfile.cs | 66 +++ .../Models/ManagedClusterAgentPoolProfile.cs | 14 +- ...anagedClusterAgentPoolProfileProperties.cs | 45 +- .../ManagedClusterLoadBalancerProfile.cs | 100 ++++ ...erLoadBalancerProfileManagedOutboundIPs.cs | 75 +++ ...erLoadBalancerProfileOutboundIPPrefixes.cs | 56 +++ ...edClusterLoadBalancerProfileOutboundIPs.cs | 55 +++ .../src/Generated/Models/ResourceReference.cs | 51 ++ .../Models/ScaleSetEvictionPolicy.cs | 22 + .../src/Generated/Models/ScaleSetPriority.cs | 22 + .../src/Generated/Operations.cs | 2 +- .../SdkInfo_ContainerServiceClient.cs | 8 +- 24 files changed, 1549 insertions(+), 35 deletions(-) create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs create mode 100644 sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs index 50bf7e4b6b92..1d911abb78e4 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs @@ -120,7 +120,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -346,7 +346,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -557,6 +557,463 @@ internal AgentPoolsOperations(ContainerServiceClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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> GetUpgradeProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (agentPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); + } + string apiVersion = "2019-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("agentPoolName", agentPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetUpgradeProfile", 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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{agentPoolName}", System.Uri.EscapeDataString(agentPoolName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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> GetAvailableAgentPoolVersionsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (agentPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); + } + string apiVersion = "2019-08-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("agentPoolName", agentPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetAvailableAgentPoolVersions", 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.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/availableAgentPoolVersions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{agentPoolName}", System.Uri.EscapeDataString(agentPoolName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Creates or updates an agent pool. /// @@ -644,7 +1101,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -894,7 +1351,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs index 333bc9802a1a..e9bab4e54b14 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs @@ -228,6 +228,112 @@ public static void Delete(this IAgentPoolsOperations operations, string resource (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + public static AgentPoolUpgradeProfile GetUpgradeProfile(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName) + { + return operations.GetUpgradeProfileAsync(resourceGroupName, resourceName, agentPoolName).GetAwaiter().GetResult(); + } + + /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a specified + /// resource group and managed cluster name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetUpgradeProfileAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetUpgradeProfileWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + public static AgentPoolAvailableVersions GetAvailableAgentPoolVersions(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName) + { + return operations.GetAvailableAgentPoolVersionsAsync(resourceGroupName, resourceName, agentPoolName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// The cancellation token. + /// + public static async Task GetAvailableAgentPoolVersionsAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetAvailableAgentPoolVersionsWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Creates or updates an agent pool. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs index b8ec9621329d..564aab684620 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServicesOperations.cs @@ -735,7 +735,7 @@ internal ContainerServicesOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs index fe31c66be91b..e496ec668ace 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs @@ -148,6 +148,69 @@ public partial interface IAgentPoolsOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets upgrade profile for an agent pool. + /// + /// + /// Gets the details of the upgrade profile for an agent pool with a + /// specified resource group and managed cluster name. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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> GetUpgradeProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// Gets a list of supported versions for the specified agent pool. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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> GetAvailableAgentPoolVersionsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates an agent pool. /// /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs index b42496c1c241..f4c6fb41f833 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs @@ -84,7 +84,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -278,7 +278,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -496,7 +496,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -723,7 +723,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "roleName"); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -945,7 +945,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1165,7 +1165,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1385,7 +1385,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1756,7 +1756,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2003,7 +2003,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; TagsObject parameters = new TagsObject(); if (tags != null) { @@ -2231,7 +2231,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2441,7 +2441,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2658,7 +2658,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) { parameters.Validate(); } - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs index 62d800ddd453..17ca5dc61071 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs @@ -123,7 +123,17 @@ public AgentPool() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public AgentPool(int count, string vmSize, string id = default(string), string name = default(string), string type = default(string), int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string agentPoolType = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public AgentPool(int count, string vmSize, string id = default(string), string name = default(string), string type = default(string), int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string agentPoolType = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) : base(id, name, type) { Count = count; @@ -139,6 +149,10 @@ public AgentPool() OrchestratorVersion = orchestratorVersion; ProvisioningState = provisioningState; AvailabilityZones = availabilityZones; + EnableNodePublicIP = enableNodePublicIP; + ScaleSetPriority = scaleSetPriority; + ScaleSetEvictionPolicy = scaleSetEvictionPolicy; + NodeTaints = nodeTaints; CustomInit(); } @@ -291,6 +305,35 @@ public AgentPool() [JsonProperty(PropertyName = "properties.availabilityZones")] public IList AvailabilityZones { get; set; } + /// + /// Gets or sets enable public IP for nodes + /// + [JsonProperty(PropertyName = "properties.enableNodePublicIP")] + public bool? EnableNodePublicIP { get; set; } + + /// + /// Gets or sets scaleSetPriority to be used to specify virtual machine + /// scale set priority. Default to regular. Possible values include: + /// 'Low', 'Regular' + /// + [JsonProperty(PropertyName = "properties.scaleSetPriority")] + public string ScaleSetPriority { get; set; } + + /// + /// Gets or sets scaleSetEvictionPolicy to be used to specify eviction + /// policy for low priority virtual machine scale set. Default to + /// Delete. Possible values include: 'Delete', 'Deallocate' + /// + [JsonProperty(PropertyName = "properties.scaleSetEvictionPolicy")] + public string ScaleSetEvictionPolicy { get; set; } + + /// + /// Gets or sets taints added to new nodes during node pool create and + /// scale. For example, key=value:NoSchedule. + /// + [JsonProperty(PropertyName = "properties.nodeTaints")] + public IList NodeTaints { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs new file mode 100644 index 000000000000..aef063574593 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs @@ -0,0 +1,83 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of available versions for an agent pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class AgentPoolAvailableVersions + { + /// + /// Initializes a new instance of the AgentPoolAvailableVersions class. + /// + public AgentPoolAvailableVersions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolAvailableVersions class. + /// + /// Id of the agent pool available versions. + /// Name of the agent pool available + /// versions. + /// Type of the agent pool available + /// versions. + /// List of versions available for + /// agent pool. + public AgentPoolAvailableVersions(string id = default(string), string name = default(string), string type = default(string), IList agentPoolVersions = default(IList)) + { + Id = id; + Name = name; + Type = type; + AgentPoolVersions = agentPoolVersions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the agent pool available versions. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agent pool available versions. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the agent pool available versions. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets list of versions available for agent pool. + /// + [JsonProperty(PropertyName = "properties.agentPoolVersions")] + public IList AgentPoolVersions { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs new file mode 100644 index 000000000000..8642c1dbda4c --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem + { + /// + /// Initializes a new instance of the + /// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem class. + /// + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem class. + /// + /// Whether this version is the default + /// agent pool version. + /// Kubernetes version (major, minor, + /// patch). + /// Whether Kubernetes version is currently in + /// preview. + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem(bool? defaultProperty = default(bool?), string kubernetesVersion = default(string), bool? isPreview = default(bool?)) + { + DefaultProperty = defaultProperty; + KubernetesVersion = kubernetesVersion; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether this version is the default agent pool + /// version. + /// + [JsonProperty(PropertyName = "default")] + public bool? DefaultProperty { get; set; } + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets whether Kubernetes version is currently in preview. + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs new file mode 100644 index 000000000000..7e876988de79 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfile.cs @@ -0,0 +1,120 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list of available upgrades for an agent pool. + /// + [Rest.Serialization.JsonTransformation] + public partial class AgentPoolUpgradeProfile + { + /// + /// Initializes a new instance of the AgentPoolUpgradeProfile class. + /// + public AgentPoolUpgradeProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolUpgradeProfile class. + /// + /// Kubernetes version (major, minor, + /// patch). + /// OsType to be used to specify os type. Choose + /// from Linux and Windows. Default to Linux. Possible values include: + /// 'Linux', 'Windows' + /// Id of the agent pool upgrade profile. + /// Name of the agent pool upgrade profile. + /// Type of the agent pool upgrade profile. + /// List of orchestrator types and versions + /// available for upgrade. + public AgentPoolUpgradeProfile(string kubernetesVersion, string osType, string id = default(string), string name = default(string), string type = default(string), IList upgrades = default(IList)) + { + Id = id; + Name = name; + Type = type; + KubernetesVersion = kubernetesVersion; + OsType = osType; + Upgrades = upgrades; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets id of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets name of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets type of the agent pool upgrade profile. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "properties.kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets osType to be used to specify os type. Choose from + /// Linux and Windows. Default to Linux. Possible values include: + /// 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; set; } + + /// + /// Gets or sets list of orchestrator types and versions available for + /// upgrade. + /// + [JsonProperty(PropertyName = "properties.upgrades")] + public IList Upgrades { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (KubernetesVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "KubernetesVersion"); + } + if (OsType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OsType"); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs new file mode 100644 index 000000000000..e449e974e445 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem + { + /// + /// Initializes a new instance of the + /// AgentPoolUpgradeProfilePropertiesUpgradesItem class. + /// + public AgentPoolUpgradeProfilePropertiesUpgradesItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolUpgradeProfilePropertiesUpgradesItem class. + /// + /// Kubernetes version (major, minor, + /// patch). + /// Whether Kubernetes version is currently in + /// preview. + public AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion = default(string), bool? isPreview = default(bool?)) + { + KubernetesVersion = kubernetesVersion; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets kubernetes version (major, minor, patch). + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets whether Kubernetes version is currently in preview. + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs index 311110d17c1a..0d1e3604982b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs @@ -51,7 +51,9 @@ public ContainerServiceNetworkProfile() /// ranges or the Kubernetes service address range. /// The load balancer sku for the managed /// cluster. Possible values include: 'standard', 'basic' - public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string loadBalancerSku = default(string)) + /// Profile of the cluster load + /// balancer. + public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string loadBalancerSku = default(string), ManagedClusterLoadBalancerProfile loadBalancerProfile = default(ManagedClusterLoadBalancerProfile)) { NetworkPlugin = networkPlugin; NetworkPolicy = networkPolicy; @@ -60,6 +62,7 @@ public ContainerServiceNetworkProfile() DnsServiceIP = dnsServiceIP; DockerBridgeCidr = dockerBridgeCidr; LoadBalancerSku = loadBalancerSku; + LoadBalancerProfile = loadBalancerProfile; CustomInit(); } @@ -119,6 +122,12 @@ public ContainerServiceNetworkProfile() [JsonProperty(PropertyName = "loadBalancerSku")] public string LoadBalancerSku { get; set; } + /// + /// Gets or sets profile of the cluster load balancer. + /// + [JsonProperty(PropertyName = "loadBalancerProfile")] + public ManagedClusterLoadBalancerProfile LoadBalancerProfile { get; set; } + /// /// Validate the object. /// @@ -155,6 +164,10 @@ public virtual void Validate() throw new ValidationException(ValidationRules.Pattern, "DockerBridgeCidr", "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$"); } } + if (LoadBalancerProfile != null) + { + LoadBalancerProfile.Validate(); + } } } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs index 7a4181186b42..7fa8fc43785a 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs @@ -69,11 +69,11 @@ public ManagedCluster() /// configuration. /// Profile of Azure Active Directory /// configuration. - /// (PREVIEW) Authorized IP - /// Ranges to kubernetes API server. + /// Access profile for managed + /// cluster API server. /// The identity of the managed cluster, if /// configured. - public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdn = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), IList apiServerAuthorizedIPRanges = default(IList), ManagedClusterIdentity identity = default(ManagedClusterIdentity)) + public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdn = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), ManagedClusterAPIServerAccessProfile apiServerAccessProfile = default(ManagedClusterAPIServerAccessProfile), ManagedClusterIdentity identity = default(ManagedClusterIdentity)) : base(location, id, name, type, tags) { ProvisioningState = provisioningState; @@ -91,7 +91,7 @@ public ManagedCluster() EnablePodSecurityPolicy = enablePodSecurityPolicy; NetworkProfile = networkProfile; AadProfile = aadProfile; - ApiServerAuthorizedIPRanges = apiServerAuthorizedIPRanges; + ApiServerAccessProfile = apiServerAccessProfile; Identity = identity; CustomInit(); } @@ -201,11 +201,10 @@ public ManagedCluster() public ManagedClusterAADProfile AadProfile { get; set; } /// - /// Gets or sets (PREVIEW) Authorized IP Ranges to kubernetes API - /// server. + /// Gets or sets access profile for managed cluster API server. /// - [JsonProperty(PropertyName = "properties.apiServerAuthorizedIPRanges")] - public IList ApiServerAuthorizedIPRanges { get; set; } + [JsonProperty(PropertyName = "properties.apiServerAccessProfile")] + public ManagedClusterAPIServerAccessProfile ApiServerAccessProfile { get; set; } /// /// Gets or sets the identity of the managed cluster, if configured. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs new file mode 100644 index 000000000000..a950f33365d1 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Access profile for managed cluster API server. + /// + public partial class ManagedClusterAPIServerAccessProfile + { + /// + /// Initializes a new instance of the + /// ManagedClusterAPIServerAccessProfile class. + /// + public ManagedClusterAPIServerAccessProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterAPIServerAccessProfile class. + /// + /// Authorized IP Ranges to kubernetes + /// API server. + /// Whether to create the cluster as + /// a private cluster or not. + public ManagedClusterAPIServerAccessProfile(IList authorizedIPRanges = default(IList), bool? enablePrivateCluster = default(bool?)) + { + AuthorizedIPRanges = authorizedIPRanges; + EnablePrivateCluster = enablePrivateCluster; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets authorized IP Ranges to kubernetes API server. + /// + [JsonProperty(PropertyName = "authorizedIPRanges")] + public IList AuthorizedIPRanges { get; set; } + + /// + /// Gets or sets whether to create the cluster as a private cluster or + /// not. + /// + [JsonProperty(PropertyName = "enablePrivateCluster")] + public bool? EnablePrivateCluster { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs index 357545428fe3..107edfb3be3d 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs @@ -120,8 +120,18 @@ public ManagedClusterAgentPoolProfile() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public ManagedClusterAgentPoolProfile(int count, string vmSize, string name, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) - : base(count, vmSize, osDiskSizeGB, vnetSubnetID, maxPods, osType, maxCount, minCount, enableAutoScaling, type, orchestratorVersion, provisioningState, availabilityZones) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public ManagedClusterAgentPoolProfile(int count, string vmSize, string name, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) + : base(count, vmSize, osDiskSizeGB, vnetSubnetID, maxPods, osType, maxCount, minCount, enableAutoScaling, type, orchestratorVersion, provisioningState, availabilityZones, enableNodePublicIP, scaleSetPriority, scaleSetEvictionPolicy, nodeTaints) { Name = name; CustomInit(); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs index 6e86f0cc9df6..a99b90999b08 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs @@ -118,7 +118,17 @@ public ManagedClusterAgentPoolProfileProperties() /// provisioning state, which only appears in the response. /// (PREVIEW) Availability zones for /// nodes. Must use VirtualMachineScaleSets AgentPoolType. - public ManagedClusterAgentPoolProfileProperties(int count, string vmSize, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList)) + /// Enable public IP for nodes + /// ScaleSetPriority to be used to + /// specify virtual machine scale set priority. Default to regular. + /// Possible values include: 'Low', 'Regular' + /// ScaleSetEvictionPolicy to be + /// used to specify eviction policy for low priority virtual machine + /// scale set. Default to Delete. Possible values include: 'Delete', + /// 'Deallocate' + /// Taints added to new nodes during node pool + /// create and scale. For example, key=value:NoSchedule. + public ManagedClusterAgentPoolProfileProperties(int count, string vmSize, int? osDiskSizeGB = default(int?), string vnetSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string type = default(string), string orchestratorVersion = default(string), string provisioningState = default(string), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), IList nodeTaints = default(IList)) { Count = count; VmSize = vmSize; @@ -133,6 +143,10 @@ public ManagedClusterAgentPoolProfileProperties() OrchestratorVersion = orchestratorVersion; ProvisioningState = provisioningState; AvailabilityZones = availabilityZones; + EnableNodePublicIP = enableNodePublicIP; + ScaleSetPriority = scaleSetPriority; + ScaleSetEvictionPolicy = scaleSetEvictionPolicy; + NodeTaints = nodeTaints; CustomInit(); } @@ -285,6 +299,35 @@ public ManagedClusterAgentPoolProfileProperties() [JsonProperty(PropertyName = "availabilityZones")] public IList AvailabilityZones { get; set; } + /// + /// Gets or sets enable public IP for nodes + /// + [JsonProperty(PropertyName = "enableNodePublicIP")] + public bool? EnableNodePublicIP { get; set; } + + /// + /// Gets or sets scaleSetPriority to be used to specify virtual machine + /// scale set priority. Default to regular. Possible values include: + /// 'Low', 'Regular' + /// + [JsonProperty(PropertyName = "scaleSetPriority")] + public string ScaleSetPriority { get; set; } + + /// + /// Gets or sets scaleSetEvictionPolicy to be used to specify eviction + /// policy for low priority virtual machine scale set. Default to + /// Delete. Possible values include: 'Delete', 'Deallocate' + /// + [JsonProperty(PropertyName = "scaleSetEvictionPolicy")] + public string ScaleSetEvictionPolicy { get; set; } + + /// + /// Gets or sets taints added to new nodes during node pool create and + /// scale. For example, key=value:NoSchedule. + /// + [JsonProperty(PropertyName = "nodeTaints")] + public IList NodeTaints { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs new file mode 100644 index 000000000000..2c9728a8cd0d --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs @@ -0,0 +1,100 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Profile of the managed cluster load balancer + /// + public partial class ManagedClusterLoadBalancerProfile + { + /// + /// Initializes a new instance of the ManagedClusterLoadBalancerProfile + /// class. + /// + public ManagedClusterLoadBalancerProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterLoadBalancerProfile + /// class. + /// + /// Desired managed outbound IPs for + /// the cluster load balancer. + /// Desired outbound IP Prefix + /// resources for the cluster load balancer. + /// Desired outbound IP resources for the + /// cluster load balancer. + /// The effective outbound IP + /// resources of the cluster load balancer. + public ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default(ManagedClusterLoadBalancerProfileManagedOutboundIPs), ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default(ManagedClusterLoadBalancerProfileOutboundIPPrefixes), ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default(ManagedClusterLoadBalancerProfileOutboundIPs), IList effectiveOutboundIPs = default(IList)) + { + ManagedOutboundIPs = managedOutboundIPs; + OutboundIPPrefixes = outboundIPPrefixes; + OutboundIPs = outboundIPs; + EffectiveOutboundIPs = effectiveOutboundIPs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired managed outbound IPs for the cluster load + /// balancer. + /// + [JsonProperty(PropertyName = "managedOutboundIPs")] + public ManagedClusterLoadBalancerProfileManagedOutboundIPs ManagedOutboundIPs { get; set; } + + /// + /// Gets or sets desired outbound IP Prefix resources for the cluster + /// load balancer. + /// + [JsonProperty(PropertyName = "outboundIPPrefixes")] + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes OutboundIPPrefixes { get; set; } + + /// + /// Gets or sets desired outbound IP resources for the cluster load + /// balancer. + /// + [JsonProperty(PropertyName = "outboundIPs")] + public ManagedClusterLoadBalancerProfileOutboundIPs OutboundIPs { get; set; } + + /// + /// Gets or sets the effective outbound IP resources of the cluster + /// load balancer. + /// + [JsonProperty(PropertyName = "effectiveOutboundIPs")] + public IList EffectiveOutboundIPs { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ManagedOutboundIPs != null) + { + ManagedOutboundIPs.Validate(); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs new file mode 100644 index 000000000000..d72f7f793e37 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Desired managed outbound IPs for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileManagedOutboundIPs + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. + /// + public ManagedClusterLoadBalancerProfileManagedOutboundIPs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. + /// + /// Desired number of outbound IP created/managed + /// by Azure for the cluster load balancer. Allowed values must be in + /// the range of 1 to 100 (inclusive). The default value is 1. + public ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count = default(int?)) + { + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets desired number of outbound IP created/managed by Azure + /// for the cluster load balancer. Allowed values must be in the range + /// of 1 to 100 (inclusive). The default value is 1. + /// + [JsonProperty(PropertyName = "count")] + public int? Count { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Count > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Count", 100); + } + if (Count < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Count", 1); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs new file mode 100644 index 000000000000..e4220de6974b --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Desired outbound IP Prefix resources for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPPrefixes class. + /// + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPPrefixes class. + /// + /// A list of public IP prefix + /// resources. + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes(IList publicIPPrefixes = default(IList)) + { + PublicIPPrefixes = publicIPPrefixes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of public IP prefix resources. + /// + [JsonProperty(PropertyName = "publicIPPrefixes")] + public IList PublicIPPrefixes { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs new file mode 100644 index 000000000000..8c6863afa7cb --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Desired outbound IP resources for the cluster load balancer. + /// + public partial class ManagedClusterLoadBalancerProfileOutboundIPs + { + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPs class. + /// + public ManagedClusterLoadBalancerProfileOutboundIPs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterLoadBalancerProfileOutboundIPs class. + /// + /// A list of public IP resources. + public ManagedClusterLoadBalancerProfileOutboundIPs(IList publicIPs = default(IList)) + { + PublicIPs = publicIPs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a list of public IP resources. + /// + [JsonProperty(PropertyName = "publicIPs")] + public IList PublicIPs { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs new file mode 100644 index 000000000000..d272c94add12 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ResourceReference.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A reference to an Azure resource. + /// + public partial class ResourceReference + { + /// + /// Initializes a new instance of the ResourceReference class. + /// + public ResourceReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceReference class. + /// + /// The fully qualified Azure resource id. + public ResourceReference(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the fully qualified Azure resource id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs new file mode 100644 index 000000000000..25bd3db49c44 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs @@ -0,0 +1,22 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for ScaleSetEvictionPolicy. + /// + public static class ScaleSetEvictionPolicy + { + public const string Delete = "Delete"; + public const string Deallocate = "Deallocate"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs new file mode 100644 index 000000000000..5edcae14e830 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ScaleSetPriority.cs @@ -0,0 +1,22 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for ScaleSetPriority. + /// + public static class ScaleSetPriority + { + public const string Low = "Low"; + public const string Regular = "Regular"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs index ec90823197fa..33c25ec737fe 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs @@ -70,7 +70,7 @@ internal Operations(ContainerServiceClient client) /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - string apiVersion = "2019-04-01"; + string apiVersion = "2019-08-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs index e35757d72020..2330060e78a7 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs @@ -19,12 +19,12 @@ public static IEnumerable> ApiInfo_ContainerServic { return new Tuple[] { - new Tuple("ContainerService", "AgentPools", "2019-04-01"), + new Tuple("ContainerService", "AgentPools", "2019-08-01"), new Tuple("ContainerService", "ContainerServices", "2017-07-01"), - new Tuple("ContainerService", "ContainerServices", "2019-04-01"), - new Tuple("ContainerService", "ManagedClusters", "2019-04-01"), + new Tuple("ContainerService", "ContainerServices", "2019-08-01"), + new Tuple("ContainerService", "ManagedClusters", "2019-08-01"), new Tuple("ContainerService", "OpenShiftManagedClusters", "2019-04-30"), - new Tuple("ContainerService", "Operations", "2019-04-01"), + new Tuple("ContainerService", "Operations", "2019-08-01"), }.AsEnumerable(); } } From 9115d34e71e1eef58d90b01954f25a9155bfc28d Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2019 01:34:03 +0000 Subject: [PATCH 12/16] [AutoPR Microsoft.Azure.Management.IotHub] [Hub Generated] Review request for Microsoft.Devices to add version stable/2019-03-22 (#173) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * [AutoPR Microsoft.Azure.Management.HealthcareApis] Move to stable version (#134) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 98f6703f2854ce61a22c8ba99a243a3ecb85ec8c Updated the way we retrieve version parameter * [AutoPR Microsoft.Azure.Management.DataFactory] Chainingtrigger (#163) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 5e1bb35d5c3314d8f4fead76c3d69a2522be026b Update review comments * [AutoPR Microsoft.Azure.Management.EventHub] Eventhub: added NetworkRuleSets list API (#155) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 8bc2a7edfeebb1a6bb30abbbb03d08bf1f8a8dbc update * [AutoPR Microsoft.Azure.Management.Compute] [Compute] Add missing $expand parameter to AvSet list by subscription API (#165) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from ed6acf4e35d75fc3c1c9e617b7131e83b6f59384 Add missing $expand parameter to AvSet list by subscription API * [AutoPR Microsoft.Azure.Management.CognitiveServices] Fix check domain path (#147) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 111d1bc1666fe89cebb960135cf2f5336bbcb35a Removed rogue file * Generated from ba2bfe74bad69d5419a8966d712ebb7fbee44941 (#170) removed pageable * [AutoPR Microsoft.Azure.Management.DataFactory] [Data Factory]Add ORC Dataset/Copy Source/Copy Sink (#143) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 864a2b3827b7237d7cb60d77069b693dcbaf7001 [DataFactory]Add support for ORC dataset * [AutoPR Microsoft.Azure.Management.DataFactory] [Datafactory] Add a new property in Office365 connector (#166) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * [AutoPR Microsoft.Azure.Management.HealthcareApis] Move to stable version (#134) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 98f6703f2854ce61a22c8ba99a243a3ecb85ec8c Updated the way we retrieve version parameter * [AutoPR Microsoft.Azure.Management.DataFactory] Chainingtrigger (#163) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 5e1bb35d5c3314d8f4fead76c3d69a2522be026b Update review comments * [AutoPR Microsoft.Azure.Management.EventHub] Eventhub: added NetworkRuleSets list API (#155) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 92006e420d65cb70e4b93bc5850af575da4efb78 (#162) Mark "provisioningState" as read-only * Generated from 8bc2a7edfeebb1a6bb30abbbb03d08bf1f8a8dbc update * Generated from eb6cdadb1aa229489cd5d7108cf02ba799416f40 Resovle comments * Generated from f05eef4a3235f304777a2a1489423c6bb11335e9 Update iothub.json --- .../src/Generated/IIotHubOperations.cs | 28 +++-- .../src/Generated/IotHubClient.cs | 2 +- .../src/Generated/IotHubOperations.cs | 26 +++-- .../Generated/IotHubOperationsExtensions.cs | 52 +++++---- .../Generated/Models/EnrichmentProperties.cs | 102 ------------------ .../Models/IotHubLocationDescription.cs | 19 ++-- .../src/Generated/Models/IotHubProperties.cs | 11 +- .../Models/IotHubPropertiesDeviceStreams.cs | 56 ---------- .../src/Generated/Models/RoutingProperties.cs | 24 +---- .../src/Generated/SdkInfo_iotHubClient.cs | 21 +--- 10 files changed, 87 insertions(+), 254 deletions(-) delete mode 100644 sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EnrichmentProperties.cs delete mode 100644 sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs index 6c2670299f9b..3575635a842b 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs @@ -24,19 +24,23 @@ namespace Microsoft.Azure.Management.IotHub public partial interface IIotHubOperations { /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary + /// region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary + /// region. To learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the + /// value from the secondary location in the locations property. To + /// learn more, see https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Resource group in which the IoT hub is in /// /// /// The headers that will be added to request. @@ -52,19 +56,23 @@ public partial interface IIotHubOperations /// Task ManualFailoverWithHttpMessagesAsync(string iotHubName, FailoverInput failoverInput, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary + /// region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary + /// region. To learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the + /// value from the secondary location in the locations property. To + /// learn more, see https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Resource group in which the IoT hub is in /// /// /// The headers that will be added to request. diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs index 460dd9fe79be..d333bdf74b4f 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs @@ -346,7 +346,7 @@ private void Initialize() Certificates = new CertificatesOperations(this); IotHub = new IotHubOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-03-22-preview"; + ApiVersion = "2019-03-22"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs index 7134be018cc5..30286aa52144 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs @@ -51,19 +51,22 @@ internal IotHubOperations(IotHubClient client) public IotHubClient Client { get; private set; } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Resource group in which the IoT hub is in /// /// /// The headers that will be added to request. @@ -79,19 +82,22 @@ internal IotHubOperations(IotHubClient client) } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Resource group in which the IoT hub is in /// /// /// Headers that will be added to request. diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs index 6dbd00354cf6..078a0b5cfcb0 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs @@ -22,22 +22,25 @@ namespace Microsoft.Azure.Management.IotHub public static partial class IotHubOperationsExtensions { /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Resource group in which the IoT hub is in /// public static void ManualFailover(this IIotHubOperations operations, string iotHubName, FailoverInput failoverInput, string resourceGroupName) { @@ -45,22 +48,25 @@ public static void ManualFailover(this IIotHubOperations operations, string iotH } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Resource group in which the IoT hub is in /// /// /// The cancellation token. @@ -71,22 +77,25 @@ public static void ManualFailover(this IIotHubOperations operations, string iotH } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Resource group in which the IoT hub is in /// public static void BeginManualFailover(this IIotHubOperations operations, string iotHubName, FailoverInput failoverInput, string resourceGroupName) { @@ -94,22 +103,25 @@ public static void BeginManualFailover(this IIotHubOperations operations, string } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over + /// Name of the IoT hub to failover /// /// - /// Region to failover to. Must be a azure DR pair + /// Region to failover to. Must be the Azure paired region. Get the value from + /// the secondary location in the locations property. To learn more, see + /// https://aka.ms/manualfailover/region /// /// - /// resource group which Iot Hub belongs to + /// Resource group in which the IoT hub is in /// /// /// The cancellation token. diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EnrichmentProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EnrichmentProperties.cs deleted file mode 100644 index b277ee3a4127..000000000000 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EnrichmentProperties.cs +++ /dev/null @@ -1,102 +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.IotHub.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The properties of an enrichment that your IoT hub applies to messages - /// delivered to endpoints. - /// - public partial class EnrichmentProperties - { - /// - /// Initializes a new instance of the EnrichmentProperties class. - /// - public EnrichmentProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnrichmentProperties class. - /// - /// The key or name for the enrichment - /// property. - /// The value for the enrichment property. - /// The list of endpoints for which the - /// enrichment is applied to the message. - public EnrichmentProperties(string key, string value, IList endpointNames) - { - Key = key; - Value = value; - EndpointNames = endpointNames; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the key or name for the enrichment property. - /// - [JsonProperty(PropertyName = "key")] - public string Key { get; set; } - - /// - /// Gets or sets the value for the enrichment property. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets the list of endpoints for which the enrichment is - /// applied to the message. - /// - [JsonProperty(PropertyName = "endpointNames")] - public IList EndpointNames { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Key == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Key"); - } - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - if (EndpointNames == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EndpointNames"); - } - if (EndpointNames != null) - { - if (EndpointNames.Count < 1) - { - throw new ValidationException(ValidationRules.MinItems, "EndpointNames", 1); - } - } - } - } -} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs index 81b9b6254fe0..31cefac3ab94 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs @@ -30,9 +30,13 @@ public IotHubLocationDescription() /// /// Initializes a new instance of the IotHubLocationDescription class. /// - /// Azure Geo Regions - /// Specific Role assigned to this location. - /// Possible values include: 'primary', 'secondary' + /// The name of the Azure region + /// The role of the region, can be either primary or + /// secondary. The primary region is where the IoT hub is currently + /// provisioned. The secondary region is the the Azure disaster + /// recovery (DR) paired region and also the region where the IoT hub + /// can failover to. Possible values include: 'primary', + /// 'secondary' public IotHubLocationDescription(string location = default(string), string role = default(string)) { Location = location; @@ -46,14 +50,17 @@ public IotHubLocationDescription() partial void CustomInit(); /// - /// Gets or sets azure Geo Regions + /// Gets or sets the name of the Azure region /// [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// - /// Gets or sets specific Role assigned to this location. Possible - /// values include: 'primary', 'secondary' + /// Gets or sets the role of the region, can be either primary or + /// secondary. The primary region is where the IoT hub is currently + /// provisioned. The secondary region is the the Azure disaster + /// recovery (DR) paired region and also the region where the IoT hub + /// can failover to. Possible values include: 'primary', 'secondary' /// [JsonProperty(PropertyName = "role")] public string Role { get; set; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs index 77b4a13002f3..bc0a2480a45b 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs @@ -53,14 +53,12 @@ public IotHubProperties() /// If True, file upload /// notifications are enabled. /// IoT hub comments. - /// The device streams properties of - /// iothub. /// The capabilities and features enabled for /// the IoT hub. Possible values include: 'None', /// 'DeviceManagement' /// Primary and secondary location for iot /// hub - public IotHubProperties(IList authorizationPolicies = default(IList), IList ipFilterRules = default(IList), string provisioningState = default(string), string state = default(string), string hostName = default(string), IDictionary eventHubEndpoints = default(IDictionary), RoutingProperties routing = default(RoutingProperties), IDictionary storageEndpoints = default(IDictionary), IDictionary messagingEndpoints = default(IDictionary), bool? enableFileUploadNotifications = default(bool?), CloudToDeviceProperties cloudToDevice = default(CloudToDeviceProperties), string comments = default(string), IotHubPropertiesDeviceStreams deviceStreams = default(IotHubPropertiesDeviceStreams), string features = default(string), IList locations = default(IList)) + public IotHubProperties(IList authorizationPolicies = default(IList), IList ipFilterRules = default(IList), string provisioningState = default(string), string state = default(string), string hostName = default(string), IDictionary eventHubEndpoints = default(IDictionary), RoutingProperties routing = default(RoutingProperties), IDictionary storageEndpoints = default(IDictionary), IDictionary messagingEndpoints = default(IDictionary), bool? enableFileUploadNotifications = default(bool?), CloudToDeviceProperties cloudToDevice = default(CloudToDeviceProperties), string comments = default(string), string features = default(string), IList locations = default(IList)) { AuthorizationPolicies = authorizationPolicies; IpFilterRules = ipFilterRules; @@ -74,7 +72,6 @@ public IotHubProperties() EnableFileUploadNotifications = enableFileUploadNotifications; CloudToDevice = cloudToDevice; Comments = comments; - DeviceStreams = deviceStreams; Features = features; Locations = locations; CustomInit(); @@ -166,12 +163,6 @@ public IotHubProperties() [JsonProperty(PropertyName = "comments")] public string Comments { get; set; } - /// - /// Gets or sets the device streams properties of iothub. - /// - [JsonProperty(PropertyName = "deviceStreams")] - public IotHubPropertiesDeviceStreams DeviceStreams { get; set; } - /// /// Gets or sets the capabilities and features enabled for the IoT hub. /// Possible values include: 'None', 'DeviceManagement' diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs deleted file mode 100644 index 19f258e077c3..000000000000 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs +++ /dev/null @@ -1,56 +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.IotHub.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The device streams properties of iothub. - /// - public partial class IotHubPropertiesDeviceStreams - { - /// - /// Initializes a new instance of the IotHubPropertiesDeviceStreams - /// class. - /// - public IotHubPropertiesDeviceStreams() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IotHubPropertiesDeviceStreams - /// class. - /// - /// List of Device Streams - /// Endpoints. - public IotHubPropertiesDeviceStreams(IList streamingEndpoints = default(IList)) - { - StreamingEndpoints = streamingEndpoints; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of Device Streams Endpoints. - /// - [JsonProperty(PropertyName = "streamingEndpoints")] - public IList StreamingEndpoints { get; set; } - - } -} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs index 43333e1f9020..1c77b24f666e 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs @@ -42,15 +42,11 @@ public RoutingProperties() /// this property is not set, the messages which do not meet any of the /// conditions specified in the 'routes' section get routed to the /// built-in eventhub endpoint. - /// The list of user-provided enrichments - /// that the IoT hub applies to messages to be delivered to built-in - /// and custom endpoints. See: https://aka.ms/iotmsgenrich - public RoutingProperties(RoutingEndpoints endpoints = default(RoutingEndpoints), IList routes = default(IList), FallbackRouteProperties fallbackRoute = default(FallbackRouteProperties), IList enrichments = default(IList)) + public RoutingProperties(RoutingEndpoints endpoints = default(RoutingEndpoints), IList routes = default(IList), FallbackRouteProperties fallbackRoute = default(FallbackRouteProperties)) { Endpoints = endpoints; Routes = routes; FallbackRoute = fallbackRoute; - Enrichments = enrichments; CustomInit(); } @@ -84,14 +80,6 @@ public RoutingProperties() [JsonProperty(PropertyName = "fallbackRoute")] public FallbackRouteProperties FallbackRoute { get; set; } - /// - /// Gets or sets the list of user-provided enrichments that the IoT hub - /// applies to messages to be delivered to built-in and custom - /// endpoints. See: https://aka.ms/iotmsgenrich - /// - [JsonProperty(PropertyName = "enrichments")] - public IList Enrichments { get; set; } - /// /// Validate the object. /// @@ -114,16 +102,6 @@ public virtual void Validate() { FallbackRoute.Validate(); } - if (Enrichments != null) - { - foreach (var element1 in Enrichments) - { - if (element1 != null) - { - element1.Validate(); - } - } - } } } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs index 8c714a355a2f..ed595d80c15d 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs @@ -19,24 +19,13 @@ public static IEnumerable> ApiInfo_iotHubClient { return new Tuple[] { - new Tuple("Devices", "Certificates", "2019-03-22-preview"), - new Tuple("Devices", "IotHub", "2019-03-22-preview"), - new Tuple("Devices", "IotHubResource", "2019-03-22-preview"), - new Tuple("Devices", "Operations", "2019-03-22-preview"), - new Tuple("Devices", "ResourceProviderCommon", "2019-03-22-preview"), + new Tuple("Devices", "Certificates", "2019-03-22"), + new Tuple("Devices", "IotHub", "2019-03-22"), + new Tuple("Devices", "IotHubResource", "2019-03-22"), + new Tuple("Devices", "Operations", "2019-03-22"), + new Tuple("Devices", "ResourceProviderCommon", "2019-03-22"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/iothub/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "2a65faa9ddbf9970708ba507eeb8071a2d310b57"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - From 8c367d30a23837cf39ef747d60aeb7e7a99cf4e7 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2019 19:21:15 +0000 Subject: [PATCH 13/16] Generated from 0382c5495183ec9676153aca02fa21e186ef98d3 (#108) naming and mismatch --- .../src/Generated/APIKeysOperations.cs | 987 ++++++++ .../Generated/APIKeysOperationsExtensions.cs | 207 ++ .../src/Generated/AnalyticsItemsOperations.cs | 1065 ++++++++ .../AnalyticsItemsOperationsExtensions.cs | 298 +++ .../src/Generated/AnnotationsOperations.cs | 978 ++++++++ .../AnnotationsOperationsExtensions.cs | 222 ++ ...=> ApplicationInsightsManagementClient.cs} | 203 +- .../ComponentAvailableFeaturesOperations.cs | 279 +++ ...ntAvailableFeaturesOperationsExtensions.cs | 65 + ...mponentCurrentBillingFeaturesOperations.cs | 519 ++++ ...rentBillingFeaturesOperationsExtensions.cs | 113 + .../ComponentFeatureCapabilitiesOperations.cs | 279 +++ ...FeatureCapabilitiesOperationsExtensions.cs | 65 + ...s.cs => ComponentQuotaStatusOperations.cs} | 151 +- ...omponentQuotaStatusOperationsExtensions.cs | 67 + .../src/Generated/ComponentsOperations.cs | 2204 +++++++++++++++++ .../ComponentsOperationsExtensions.cs | 432 ++++ .../src/Generated/Events.cs | 651 ----- .../src/Generated/EventsExtensions.cs | 265 -- .../ExportConfigurationsOperations.cs | 1242 ++++++++++ ...xportConfigurationsOperationsExtensions.cs | 273 ++ .../src/Generated/FavoritesOperations.cs | 1262 ++++++++++ .../FavoritesOperationsExtensions.cs | 300 +++ .../src/Generated/IAPIKeysOperations.cs | 139 ++ .../Generated/IAnalyticsItemsOperations.cs | 189 ++ .../src/Generated/IAnnotationsOperations.cs | 143 ++ .../IApplicationInsightsDataClient.cs | 60 - .../IApplicationInsightsManagementClient.cs | 153 ++ .../IComponentAvailableFeaturesOperations.cs | 53 + ...mponentCurrentBillingFeaturesOperations.cs | 83 + ...IComponentFeatureCapabilitiesOperations.cs | 52 + .../IComponentQuotaStatusOperations.cs | 53 + .../src/Generated/IComponentsOperations.cs | 282 +++ .../src/Generated/IEvents.cs | 165 -- .../IExportConfigurationsOperations.cs | 175 ++ .../src/Generated/IFavoritesOperations.cs | 195 ++ .../src/Generated/IMetrics.cs | 173 -- .../src/Generated/IOperations.cs | 68 + ...activeDetectionConfigurationsOperations.cs | 116 + .../src/Generated/IQueryOperations.cs | 65 - .../Generated/IWebTestLocationsOperations.cs | 53 + .../src/Generated/IWebTestsOperations.cs | 269 ++ .../IWorkItemConfigurationsOperations.cs | 200 ++ .../src/Generated/IWorkbooksOperations.cs | 165 ++ .../src/Generated/MetricsExtensions.cs | 283 --- .../src/Generated/Models/APIKeyRequest.cs | 71 + .../src/Generated/Models/Annotation.cs | 93 + ...{EventsTraceInfo.cs => AnnotationError.cs} | 35 +- .../Models/AnnotationErrorException.cs | 62 + .../Models/ApplicationInsightsComponent.cs | 227 ++ .../ApplicationInsightsComponentAPIKey.cs | 102 + ...plicationInsightsComponentAnalyticsItem.cs | 131 + ...nsightsComponentAnalyticsItemProperties.cs | 56 + ...ationInsightsComponentAvailableFeatures.cs | 56 + ...icationInsightsComponentBillingFeatures.cs | 69 + ...plicationInsightsComponentDataVolumeCap.cs | 99 + ...ionInsightsComponentExportConfiguration.cs | 234 ++ ...plicationInsightsComponentExportRequest.cs | 134 + .../ApplicationInsightsComponentFavorite.cs | 162 ++ .../ApplicationInsightsComponentFeature.cs | 123 + ...ionInsightsComponentFeatureCapabilities.cs | 178 ++ ...ationInsightsComponentFeatureCapability.cs | 95 + ...omponentProactiveDetectionConfiguration.cs | 107 + ...veDetectionConfigurationRuleDefinitions.cs | 123 + ...ApplicationInsightsComponentQuotaStatus.cs | 74 + ...icationInsightsComponentWebTestLocation.cs | 64 + ...tricsAggregation.cs => ApplicationType.cs} | 14 +- .../src/Generated/Models/CategoryType.cs | 24 + ...csResultsItem.cs => ComponentPurgeBody.cs} | 56 +- .../Models/ComponentPurgeBodyFilters.cs | 90 + ...ryResults.cs => ComponentPurgeResponse.cs} | 45 +- .../Models/ComponentPurgeStatusResponse.cs | 70 + .../Generated/Models/ComponentsResource.cs | 100 + .../src/Generated/Models/ErrorDetail.cs | 115 - .../Generated/Models/ErrorFieldContract.cs | 68 + .../src/Generated/Models/ErrorInfo.cs | 115 - .../src/Generated/Models/ErrorResponse.cs | 43 +- .../Models/ErrorResponseException.cs | 2 +- .../src/Generated/Models/EventType.cs | 31 - .../src/Generated/Models/EventsAiInfo.cs | 75 - .../Models/EventsAvailabilityResultInfo.cs | 114 - .../Models/EventsAvailabilityResultResult.cs | 67 - .../Models/EventsBrowserTimingInfo.cs | 127 - .../Models/EventsBrowserTimingResult.cs | 71 - .../src/Generated/Models/EventsClientInfo.cs | 109 - .../src/Generated/Models/EventsCloudInfo.cs | 59 - .../Generated/Models/EventsCustomEventInfo.cs | 51 - .../Models/EventsCustomEventResult.cs | 65 - .../Models/EventsCustomMetricInfo.cs | 102 - .../Models/EventsCustomMetricResult.cs | 65 - .../Generated/Models/EventsDependencyInfo.cs | 117 - .../Models/EventsDependencyResult.cs | 65 - .../Generated/Models/EventsExceptionDetail.cs | 94 - .../EventsExceptionDetailsParsedStack.cs | 77 - .../Generated/Models/EventsExceptionInfo.cs | 182 -- .../Generated/Models/EventsExceptionResult.cs | 65 - .../Generated/Models/EventsOperationInfo.cs | 76 - .../Generated/Models/EventsPageViewInfo.cs | 76 - .../Generated/Models/EventsPageViewResult.cs | 65 - .../Models/EventsPerformanceCounterInfo.cs | 97 - .../Models/EventsPerformanceCounterResult.cs | 67 - .../src/Generated/Models/EventsRequestInfo.cs | 109 - .../Generated/Models/EventsRequestResult.cs | 65 - .../src/Generated/Models/EventsResult.cs | 59 - .../src/Generated/Models/EventsResultData.cs | 142 -- .../EventsResultDataCustomMeasurements.cs | 51 - .../src/Generated/Models/EventsResults.cs | 70 - .../src/Generated/Models/EventsSessionInfo.cs | 51 - .../src/Generated/Models/EventsTraceResult.cs | 65 - .../src/Generated/Models/EventsUserInfo.cs | 67 - .../Generated/Models/FavoriteSourceType.cs | 28 + .../src/Generated/Models/FavoriteType.cs | 60 + .../src/Generated/Models/FlowType.cs | 21 + .../src/Generated/Models/InnerError.cs | 60 + .../src/Generated/Models/ItemScope.cs | 22 + .../src/Generated/Models/ItemScopePath.cs | 22 + .../src/Generated/Models/ItemType.cs | 24 + .../src/Generated/Models/ItemTypeParameter.cs | 25 + .../src/Generated/Models/LinkProperties.cs | 67 + .../src/Generated/Models/MetricId.cs | 52 - .../Generated/Models/MetricsPostBodySchema.cs | 87 - .../Models/MetricsPostBodySchemaParameters.cs | 149 -- .../src/Generated/Models/MetricsResult.cs | 49 - .../src/Generated/Models/MetricsResultInfo.cs | 89 - .../src/Generated/Models/MetricsSegment.cs | 36 - .../Generated/Models/MetricsSegmentInfo.cs | 84 - .../Models/{Column.cs => Operation.cs} | 33 +- .../src/Generated/Models/OperationDisplay.cs | 70 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/Page1.cs | 53 + .../src/Generated/Models/PurgeState.cs | 22 + .../src/Generated/Models/QueryBody.cs | 91 - .../src/Generated/Models/RequestSource.cs | 21 + .../src/Generated/Models/SharedTypeKind.cs | 22 + .../src/Generated/Models/Table.cs | 94 - ...entsApplicationInfo.cs => TagsResource.cs} | 27 +- .../src/Generated/Models/WebTest.cs | 200 ++ ...rformanceInfo.cs => WebTestGeolocation.cs} | 28 +- .../src/Generated/Models/WebTestKind.cs | 60 + ...s.cs => WebTestPropertiesConfiguration.cs} | 24 +- .../src/Generated/Models/WebtestsResource.cs | 100 + .../Generated/Models/WorkItemConfiguration.cs | 88 + .../Models/WorkItemConfigurationError.cs | 66 + .../WorkItemConfigurationErrorException.cs | 62 + .../Models/WorkItemCreateConfiguration.cs | 81 + .../src/Generated/Models/Workbook.cs | 201 ++ .../src/Generated/Models/WorkbookError.cs | 75 + .../Models/WorkbookErrorException.cs | 62 + .../src/Generated/Models/WorkbookResource.cs | 87 + .../src/Generated/Operations.cs | 397 +++ .../src/Generated/OperationsExtensions.cs | 87 + ...ctiveDetectionConfigurationsOperations.cs} | 488 ++-- ...ctionConfigurationsOperationsExtensions.cs | 173 ++ .../Generated/QueryOperationsExtensions.cs | 93 - .../SdkInfo_ApplicationInsightsDataClient.cs | 29 - ...nfo_ApplicationInsightsManagementClient.cs | 42 + .../Generated/WebTestLocationsOperations.cs | 280 +++ .../WebTestLocationsOperationsExtensions.cs | 69 + .../src/Generated/WebTestsOperations.cs | 2123 ++++++++++++++++ .../Generated/WebTestsOperationsExtensions.cs | 410 +++ .../WorkItemConfigurationsOperations.cs | 1439 +++++++++++ ...kItemConfigurationsOperationsExtensions.cs | 306 +++ .../src/Generated/WorkbooksOperations.cs | 1204 +++++++++ .../WorkbooksOperationsExtensions.cs | 252 ++ 164 files changed, 24989 insertions(+), 5792 deletions(-) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperationsExtensions.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/{ApplicationInsightsDataClient.cs => ApplicationInsightsManagementClient.cs} (55%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperationsExtensions.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/{QueryOperations.cs => ComponentQuotaStatusOperations.cs} (54%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperationsExtensions.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Events.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/EventsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAPIKeysOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnalyticsItemsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnnotationsOperations.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsDataClient.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsManagementClient.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentAvailableFeaturesOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentCurrentBillingFeaturesOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentFeatureCapabilitiesOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentQuotaStatusOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentsOperations.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IEvents.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IExportConfigurationsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IFavoritesOperations.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IMetrics.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IProactiveDetectionConfigurationsOperations.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IQueryOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestLocationsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkItemConfigurationsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkbooksOperations.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/MetricsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/APIKeyRequest.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Annotation.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/{EventsTraceInfo.cs => AnnotationError.cs} (50%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationErrorException.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponent.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/{MetricsAggregation.cs => ApplicationType.cs} (50%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/CategoryType.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/{MetricsResultsItem.cs => ComponentPurgeBody.cs} (50%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/{QueryResults.cs => ComponentPurgeResponse.cs} (52%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentsResource.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorDetail.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorFieldContract.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventType.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAiInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCloudInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetail.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetailsParsedStack.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsOperationInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultData.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomMeasurements.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResults.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsSessionInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsUserInfo.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteSourceType.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteType.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FlowType.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/InnerError.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScope.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScopePath.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemType.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemTypeParameter.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/LinkProperties.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricId.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchema.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchemaParameters.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResult.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultInfo.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegment.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegmentInfo.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/{Column.cs => Operation.cs} (53%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page1.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/PurgeState.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryBody.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/RequestSource.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/SharedTypeKind.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Table.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/{EventsApplicationInfo.cs => TagsResource.cs} (51%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTest.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/{EventsClientPerformanceInfo.cs => WebTestGeolocation.cs} (52%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestKind.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/{EventsResultDataCustomDimensions.cs => WebTestPropertiesConfiguration.cs} (52%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebtestsResource.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationError.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationErrorException.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Workbook.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookError.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookErrorException.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookResource.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Operations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/OperationsExtensions.cs rename sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/{Metrics.cs => ProactiveDetectionConfigurationsOperations.cs} (51%) create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperationsExtensions.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperationsExtensions.cs delete mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsDataClient.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsManagementClient.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperationsExtensions.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperations.cs create mode 100644 sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperationsExtensions.cs diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperations.cs new file mode 100644 index 000000000000..67529382daa0 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperations.cs @@ -0,0 +1,987 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// APIKeysOperations operations. + /// + internal partial class APIKeysOperations : IServiceOperations, IAPIKeysOperations + { + /// + /// Initializes a new instance of the APIKeysOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal APIKeysOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of API keys of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 an API Key of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an API key of a Application + /// Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, APIKeyRequest aPIKeyProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (aPIKeyProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "aPIKeyProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("aPIKeyProperties", aPIKeyProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(aPIKeyProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(aPIKeyProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 an API Key of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string keyId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (keyId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("keyId", keyId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{keyId}", System.Uri.EscapeDataString(keyId)); + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 API Key for this key id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string keyId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (keyId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "keyId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("keyId", keyId); + 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.Insights/components/{resourceName}/APIKeys/{keyId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{keyId}", System.Uri.EscapeDataString(keyId)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperationsExtensions.cs new file mode 100644 index 000000000000..4e850259461b --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/APIKeysOperationsExtensions.cs @@ -0,0 +1,207 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for APIKeysOperations. + /// + public static partial class APIKeysOperationsExtensions + { + /// + /// Gets a list of API keys of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IEnumerable List(this IAPIKeysOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of API keys of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create an API Key of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an API key of a Application + /// Insights component. + /// + public static ApplicationInsightsComponentAPIKey Create(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, APIKeyRequest aPIKeyProperties) + { + return operations.CreateAsync(resourceGroupName, resourceName, aPIKeyProperties).GetAwaiter().GetResult(); + } + + /// + /// Create an API Key of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an API key of a Application + /// Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, APIKeyRequest aPIKeyProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, aPIKeyProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an API Key of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + public static ApplicationInsightsComponentAPIKey Delete(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, string keyId) + { + return operations.DeleteAsync(resourceGroupName, resourceName, keyId).GetAwaiter().GetResult(); + } + + /// + /// Delete an API Key of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, string keyId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, keyId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the API Key for this key id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + public static ApplicationInsightsComponentAPIKey Get(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, string keyId) + { + return operations.GetAsync(resourceGroupName, resourceName, keyId).GetAwaiter().GetResult(); + } + + /// + /// Get the API Key for this key id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAPIKeysOperations operations, string resourceGroupName, string resourceName, string keyId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, keyId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperations.cs new file mode 100644 index 000000000000..062bf473adb0 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperations.cs @@ -0,0 +1,1065 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// AnalyticsItemsOperations operations. + /// + internal partial class AnalyticsItemsOperations : IServiceOperations, IAnalyticsItemsOperations + { + /// + /// Initializes a new instance of the AnalyticsItemsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AnalyticsItemsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'shared', 'user' + /// + /// + /// Enum indicating the type of the Analytics item. Possible values include: + /// 'none', 'query', 'function', 'folder', 'recent' + /// + /// + /// Flag indicating whether or not to return the content of each applicable + /// item. If false, only return the item information. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string scope = default(string), string type = default(string), bool? includeContent = default(bool?), 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (scopePath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopePath"); + } + 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("resourceName", resourceName); + tracingParameters.Add("scopePath", scopePath); + tracingParameters.Add("scope", scope); + tracingParameters.Add("type", type); + tracingParameters.Add("includeContent", includeContent); + 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.insights/components/{resourceName}/{scopePath}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{scopePath}", System.Uri.EscapeDataString(scopePath)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (scope != null) + { + _queryParameters.Add(string.Format("scope={0}", System.Uri.EscapeDataString(scope))); + } + if (type != null) + { + _queryParameters.Add(string.Format("type={0}", System.Uri.EscapeDataString(type))); + } + if (includeContent != null) + { + _queryParameters.Add(string.Format("includeContent={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeContent, Client.SerializationSettings).Trim('"')))); + } + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (scopePath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopePath"); + } + 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("resourceName", resourceName); + tracingParameters.Add("scopePath", scopePath); + tracingParameters.Add("id", id); + tracingParameters.Add("name", name); + 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.insights/components/{resourceName}/{scopePath}/item").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{scopePath}", System.Uri.EscapeDataString(scopePath)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (id != null) + { + _queryParameters.Add(string.Format("id={0}", System.Uri.EscapeDataString(id))); + } + if (name != null) + { + _queryParameters.Add(string.Format("name={0}", System.Uri.EscapeDataString(name))); + } + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Adds or Updates a specific Analytics Item within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Properties that need to be specified to create a new item and add it to an + /// Application Insights component. + /// + /// + /// Flag indicating whether or not to force save an item. This allows + /// overriding an item if it already exists. + /// + /// + /// 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> PutWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, ApplicationInsightsComponentAnalyticsItem itemProperties, bool? overrideItem = default(bool?), 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (scopePath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopePath"); + } + 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 (itemProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "itemProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("scopePath", scopePath); + tracingParameters.Add("overrideItem", overrideItem); + tracingParameters.Add("itemProperties", itemProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Put", 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.insights/components/{resourceName}/{scopePath}/item").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{scopePath}", System.Uri.EscapeDataString(scopePath)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (overrideItem != null) + { + _queryParameters.Add(string.Format("overrideItem={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(overrideItem, Client.SerializationSettings).Trim('"')))); + } + 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(itemProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(itemProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (scopePath == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scopePath"); + } + 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("resourceName", resourceName); + tracingParameters.Add("scopePath", scopePath); + tracingParameters.Add("id", id); + tracingParameters.Add("name", name); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{scopePath}", System.Uri.EscapeDataString(scopePath)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (id != null) + { + _queryParameters.Add(string.Format("id={0}", System.Uri.EscapeDataString(id))); + } + if (name != null) + { + _queryParameters.Add(string.Format("name={0}", System.Uri.EscapeDataString(name))); + } + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperationsExtensions.cs new file mode 100644 index 000000000000..8f4f7ffa4b64 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnalyticsItemsOperationsExtensions.cs @@ -0,0 +1,298 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AnalyticsItemsOperations. + /// + public static partial class AnalyticsItemsOperationsExtensions + { + /// + /// Gets a list of Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'shared', 'user' + /// + /// + /// Enum indicating the type of the Analytics item. Possible values include: + /// 'none', 'query', 'function', 'folder', 'recent' + /// + /// + /// Flag indicating whether or not to return the content of each applicable + /// item. If false, only return the item information. + /// + public static IList List(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string scope = default(string), string type = default(string), bool? includeContent = default(bool?)) + { + return operations.ListAsync(resourceGroupName, resourceName, scopePath, scope, type, includeContent).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'shared', 'user' + /// + /// + /// Enum indicating the type of the Analytics item. Possible values include: + /// 'none', 'query', 'function', 'folder', 'recent' + /// + /// + /// Flag indicating whether or not to return the content of each applicable + /// item. If false, only return the item information. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string scope = default(string), string type = default(string), bool? includeContent = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, scopePath, scope, type, includeContent, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + public static ApplicationInsightsComponentAnalyticsItem Get(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string)) + { + return operations.GetAsync(resourceGroupName, resourceName, scopePath, id, name).GetAwaiter().GetResult(); + } + + /// + /// Gets a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, scopePath, id, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Adds or Updates a specific Analytics Item within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Properties that need to be specified to create a new item and add it to an + /// Application Insights component. + /// + /// + /// Flag indicating whether or not to force save an item. This allows + /// overriding an item if it already exists. + /// + public static ApplicationInsightsComponentAnalyticsItem Put(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, ApplicationInsightsComponentAnalyticsItem itemProperties, bool? overrideItem = default(bool?)) + { + return operations.PutAsync(resourceGroupName, resourceName, scopePath, itemProperties, overrideItem).GetAwaiter().GetResult(); + } + + /// + /// Adds or Updates a specific Analytics Item within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// Properties that need to be specified to create a new item and add it to an + /// Application Insights component. + /// + /// + /// Flag indicating whether or not to force save an item. This allows + /// overriding an item if it already exists. + /// + /// + /// The cancellation token. + /// + public static async Task PutAsync(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, ApplicationInsightsComponentAnalyticsItem itemProperties, bool? overrideItem = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutWithHttpMessagesAsync(resourceGroupName, resourceName, scopePath, itemProperties, overrideItem, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + public static void Delete(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string)) + { + operations.DeleteAsync(resourceGroupName, resourceName, scopePath, id, name).GetAwaiter().GetResult(); + } + + /// + /// Deletes a specific Analytics Items defined within an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user or is + /// shared between all users with access to the Application Insights component. + /// Possible values include: 'analyticsItems', 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights component + /// + /// + /// The name of a specific item defined in the Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAnalyticsItemsOperations operations, string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, scopePath, id, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperations.cs new file mode 100644 index 000000000000..579a7f55dd31 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperations.cs @@ -0,0 +1,978 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// AnnotationsOperations operations. + /// + internal partial class AnnotationsOperations : IServiceOperations, IAnnotationsOperations + { + /// + /// Initializes a new instance of the AnnotationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal AnnotationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets the list of annotations for a component for given time range + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The start time to query from for annotations, cannot be older than 90 days + /// from current date. + /// + /// + /// The end time to query for annotations. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, string start, string end, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (start == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "start"); + } + if (end == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "end"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("start", start); + tracingParameters.Add("end", end); + 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.Insights/components/{resourceName}/Annotations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (start != null) + { + _queryParameters.Add(string.Format("start={0}", System.Uri.EscapeDataString(start))); + } + if (end != null) + { + _queryParameters.Add(string.Format("end={0}", System.Uri.EscapeDataString(end))); + } + 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 AnnotationErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AnnotationError _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 an Annotation of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an annotation of a + /// Application Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Annotation annotationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (annotationProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "annotationProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("annotationProperties", annotationProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(annotationProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(annotationProperties, 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 AnnotationErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AnnotationError _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 an Annotation of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string annotationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (annotationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "annotationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("annotationId", annotationId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{annotationId}", System.Uri.EscapeDataString(annotationId)); + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Get the annotation for given id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string annotationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (annotationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "annotationId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("annotationId", annotationId); + 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.Insights/components/{resourceName}/Annotations/{annotationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{annotationId}", System.Uri.EscapeDataString(annotationId)); + 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 AnnotationErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + AnnotationError _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperationsExtensions.cs new file mode 100644 index 000000000000..3ac7686026fe --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/AnnotationsOperationsExtensions.cs @@ -0,0 +1,222 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for AnnotationsOperations. + /// + public static partial class AnnotationsOperationsExtensions + { + /// + /// Gets the list of annotations for a component for given time range + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The start time to query from for annotations, cannot be older than 90 days + /// from current date. + /// + /// + /// The end time to query for annotations. + /// + public static IEnumerable List(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string start, string end) + { + return operations.ListAsync(resourceGroupName, resourceName, start, end).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of annotations for a component for given time range + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The start time to query from for annotations, cannot be older than 90 days + /// from current date. + /// + /// + /// The end time to query for annotations. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string start, string end, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, start, end, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create an Annotation of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an annotation of a + /// Application Insights component. + /// + public static IList Create(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, Annotation annotationProperties) + { + return operations.CreateAsync(resourceGroupName, resourceName, annotationProperties).GetAwaiter().GetResult(); + } + + /// + /// Create an Annotation of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an annotation of a + /// Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task> CreateAsync(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, Annotation annotationProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, annotationProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete an Annotation of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + public static void Delete(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string annotationId) + { + operations.DeleteAsync(resourceGroupName, resourceName, annotationId).GetAwaiter().GetResult(); + } + + /// + /// Delete an Annotation of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string annotationId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, annotationId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get the annotation for given id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + public static IList Get(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string annotationId) + { + return operations.GetAsync(resourceGroupName, resourceName, annotationId).GetAwaiter().GetResult(); + } + + /// + /// Get the annotation for given id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application Insights + /// component. + /// + /// + /// The cancellation token. + /// + public static async Task> GetAsync(this IAnnotationsOperations operations, string resourceGroupName, string resourceName, string annotationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, annotationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsDataClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsManagementClient.cs similarity index 55% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsDataClient.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsManagementClient.cs index ee70799c84ea..0f94ec45392e 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsDataClient.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ApplicationInsightsManagementClient.cs @@ -8,21 +8,23 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query +namespace Microsoft.Azure.Management.ApplicationInsights.Management { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Microsoft.Rest.Serialization; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; + using System.Linq; using System.Net; using System.Net.Http; /// - /// Composite Swagger for Application Insights Data Client + /// Composite Swagger for Application Insights Management Client /// - public partial class ApplicationInsightsDataClient : ServiceClient, IApplicationInsightsDataClient + public partial class ApplicationInsightsManagementClient : ServiceClient, IApplicationInsightsManagementClient, IAzureClient { /// /// The base URI of the service. @@ -40,51 +42,144 @@ public partial class ApplicationInsightsDataClient : ServiceClient - /// Subscription credentials which uniquely identify client subscription. + /// Credentials needed for the client to connect to Azure. /// public ServiceClientCredentials Credentials { get; private set; } /// - /// Gets the IMetrics. + /// The API version to use for this operation. /// - public virtual IMetrics Metrics { get; private set; } + public string ApiVersion { get; private set; } /// - /// Gets the IEvents. + /// The ID of the target subscription. /// - public virtual IEvents Events { get; private set; } + public string SubscriptionId { get; set; } /// - /// Gets the IQueryOperations. + /// The preferred language for the response. /// - public virtual IQueryOperations Query { get; private set; } + public string AcceptLanguage { get; set; } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IAnnotationsOperations. + /// + public virtual IAnnotationsOperations Annotations { get; private set; } + + /// + /// Gets the IAPIKeysOperations. + /// + public virtual IAPIKeysOperations APIKeys { get; private set; } + + /// + /// Gets the IExportConfigurationsOperations. + /// + public virtual IExportConfigurationsOperations ExportConfigurations { get; private set; } + + /// + /// Gets the IComponentCurrentBillingFeaturesOperations. + /// + public virtual IComponentCurrentBillingFeaturesOperations ComponentCurrentBillingFeatures { get; private set; } + + /// + /// Gets the IComponentQuotaStatusOperations. + /// + public virtual IComponentQuotaStatusOperations ComponentQuotaStatus { get; private set; } + + /// + /// Gets the IComponentFeatureCapabilitiesOperations. + /// + public virtual IComponentFeatureCapabilitiesOperations ComponentFeatureCapabilities { get; private set; } + + /// + /// Gets the IComponentAvailableFeaturesOperations. + /// + public virtual IComponentAvailableFeaturesOperations ComponentAvailableFeatures { get; private set; } + + /// + /// Gets the IProactiveDetectionConfigurationsOperations. + /// + public virtual IProactiveDetectionConfigurationsOperations ProactiveDetectionConfigurations { get; private set; } + + /// + /// Gets the IComponentsOperations. + /// + public virtual IComponentsOperations Components { get; private set; } + + /// + /// Gets the IWorkItemConfigurationsOperations. + /// + public virtual IWorkItemConfigurationsOperations WorkItemConfigurations { get; private set; } + + /// + /// Gets the IFavoritesOperations. + /// + public virtual IFavoritesOperations Favorites { get; private set; } + + /// + /// Gets the IWebTestLocationsOperations. + /// + public virtual IWebTestLocationsOperations WebTestLocations { get; private set; } + + /// + /// Gets the IWebTestsOperations. + /// + public virtual IWebTestsOperations WebTests { get; private set; } + + /// + /// Gets the IAnalyticsItemsOperations. + /// + public virtual IAnalyticsItemsOperations AnalyticsItems { get; private set; } + + /// + /// Gets the IWorkbooksOperations. + /// + public virtual IWorkbooksOperations Workbooks { get; private set; } + + /// + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling ApplicationInsightsDataClient.Dispose(). False: will not dispose provided httpClient - protected ApplicationInsightsDataClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + /// True: will dispose the provided httpClient on calling ApplicationInsightsManagementClient.Dispose(). False: will not dispose provided httpClient + protected ApplicationInsightsManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { Initialize(); } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ApplicationInsightsDataClient(params DelegatingHandler[] handlers) : base(handlers) + protected ApplicationInsightsManagementClient(params DelegatingHandler[] handlers) : base(handlers) { Initialize(); } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -92,13 +187,13 @@ protected ApplicationInsightsDataClient(params DelegatingHandler[] handlers) : b /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ApplicationInsightsDataClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected ApplicationInsightsManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { Initialize(); } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The base URI of the service. @@ -109,7 +204,7 @@ protected ApplicationInsightsDataClient(HttpClientHandler rootHandler, params De /// /// Thrown when a required parameter is null /// - protected ApplicationInsightsDataClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected ApplicationInsightsManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -119,7 +214,7 @@ protected ApplicationInsightsDataClient(System.Uri baseUri, params DelegatingHan } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The base URI of the service. @@ -133,7 +228,7 @@ protected ApplicationInsightsDataClient(System.Uri baseUri, params DelegatingHan /// /// Thrown when a required parameter is null /// - protected ApplicationInsightsDataClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected ApplicationInsightsManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -143,10 +238,10 @@ protected ApplicationInsightsDataClient(System.Uri baseUri, HttpClientHandler ro } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The delegating handlers to add to the http client pipeline. @@ -154,7 +249,7 @@ protected ApplicationInsightsDataClient(System.Uri baseUri, HttpClientHandler ro /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public ApplicationInsightsManagementClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { @@ -168,20 +263,20 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, param } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// HttpClient to be used /// /// - /// True: will dispose the provided httpClient on calling ApplicationInsightsDataClient.Dispose(). False: will not dispose provided httpClient + /// True: will dispose the provided httpClient on calling ApplicationInsightsManagementClient.Dispose(). False: will not dispose provided httpClient /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + public ApplicationInsightsManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { @@ -195,10 +290,10 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpC } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The http client handler used to handle http transport. @@ -209,7 +304,7 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpC /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ApplicationInsightsManagementClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { @@ -223,13 +318,13 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpC } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The base URI of the service. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The delegating handlers to add to the http client pipeline. @@ -237,7 +332,7 @@ public ApplicationInsightsDataClient(ServiceClientCredentials credentials, HttpC /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public ApplicationInsightsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -256,13 +351,13 @@ public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredential } /// - /// Initializes a new instance of the ApplicationInsightsDataClient class. + /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// /// /// Optional. The base URI of the service. /// /// - /// Required. Subscription credentials which uniquely identify client subscription. + /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The http client handler used to handle http transport. @@ -273,7 +368,7 @@ public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredential /// /// Thrown when a required parameter is null /// - public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ApplicationInsightsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -293,17 +388,34 @@ public ApplicationInsightsDataClient(System.Uri baseUri, ServiceClientCredential /// /// An optional partial-method to perform custom initialization. - /// + /// partial void CustomInitialize(); /// /// Initializes client properties. /// private void Initialize() { - Metrics = new Metrics(this); - Events = new Events(this); - Query = new QueryOperations(this); - BaseUri = new System.Uri("https://api.applicationinsights.io/v1"); + Operations = new Operations(this); + Annotations = new AnnotationsOperations(this); + APIKeys = new APIKeysOperations(this); + ExportConfigurations = new ExportConfigurationsOperations(this); + ComponentCurrentBillingFeatures = new ComponentCurrentBillingFeaturesOperations(this); + ComponentQuotaStatus = new ComponentQuotaStatusOperations(this); + ComponentFeatureCapabilities = new ComponentFeatureCapabilitiesOperations(this); + ComponentAvailableFeatures = new ComponentAvailableFeaturesOperations(this); + ProactiveDetectionConfigurations = new ProactiveDetectionConfigurationsOperations(this); + Components = new ComponentsOperations(this); + WorkItemConfigurations = new WorkItemConfigurationsOperations(this); + Favorites = new FavoritesOperations(this); + WebTestLocations = new WebTestLocationsOperations(this); + WebTests = new WebTestsOperations(this); + AnalyticsItems = new AnalyticsItemsOperations(this); + Workbooks = new WorkbooksOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2015-05-01"; + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, @@ -312,11 +424,12 @@ private void Initialize() NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + Converters = new List { new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, @@ -329,9 +442,9 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperations.cs new file mode 100644 index 000000000000..6ce9d56bd2d2 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperations.cs @@ -0,0 +1,279 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ComponentAvailableFeaturesOperations operations. + /// + internal partial class ComponentAvailableFeaturesOperations : IServiceOperations, IComponentAvailableFeaturesOperations + { + /// + /// Initializes a new instance of the ComponentAvailableFeaturesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComponentAvailableFeaturesOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Returns all available features of the application insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/getavailablebillingfeatures").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperationsExtensions.cs new file mode 100644 index 000000000000..7e3573984435 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentAvailableFeaturesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentAvailableFeaturesOperations. + /// + public static partial class ComponentAvailableFeaturesOperationsExtensions + { + /// + /// Returns all available features of the application insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponentAvailableFeatures Get(this IComponentAvailableFeaturesOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns all available features of the application insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentAvailableFeaturesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperations.cs new file mode 100644 index 000000000000..b6e4872a00ef --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperations.cs @@ -0,0 +1,519 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ComponentCurrentBillingFeaturesOperations operations. + /// + internal partial class ComponentCurrentBillingFeaturesOperations : IServiceOperations, IComponentCurrentBillingFeaturesOperations + { + /// + /// Initializes a new instance of the ComponentCurrentBillingFeaturesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComponentCurrentBillingFeaturesOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Returns current billing features for an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update current billing features for an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to update billing features for an + /// Application Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponentBillingFeatures billingFeaturesProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (billingFeaturesProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "billingFeaturesProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("billingFeaturesProperties", billingFeaturesProperties); + 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.Insights/components/{resourceName}/currentbillingfeatures").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(billingFeaturesProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(billingFeaturesProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs new file mode 100644 index 000000000000..bfe874ee7a55 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentCurrentBillingFeaturesOperations. + /// + public static partial class ComponentCurrentBillingFeaturesOperationsExtensions + { + /// + /// Returns current billing features for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponentBillingFeatures Get(this IComponentCurrentBillingFeaturesOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns current billing features for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentCurrentBillingFeaturesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update current billing features for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to update billing features for an + /// Application Insights component. + /// + public static ApplicationInsightsComponentBillingFeatures Update(this IComponentCurrentBillingFeaturesOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponentBillingFeatures billingFeaturesProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, billingFeaturesProperties).GetAwaiter().GetResult(); + } + + /// + /// Update current billing features for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to update billing features for an + /// Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IComponentCurrentBillingFeaturesOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponentBillingFeatures billingFeaturesProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, billingFeaturesProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperations.cs new file mode 100644 index 000000000000..310673117efe --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperations.cs @@ -0,0 +1,279 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ComponentFeatureCapabilitiesOperations operations. + /// + internal partial class ComponentFeatureCapabilitiesOperations : IServiceOperations, IComponentFeatureCapabilitiesOperations + { + /// + /// Initializes a new instance of the ComponentFeatureCapabilitiesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComponentFeatureCapabilitiesOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Returns feature capabilities of the application insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/featurecapabilities").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperationsExtensions.cs new file mode 100644 index 000000000000..22beeeb25ff4 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentFeatureCapabilitiesOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentFeatureCapabilitiesOperations. + /// + public static partial class ComponentFeatureCapabilitiesOperationsExtensions + { + /// + /// Returns feature capabilities of the application insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponentFeatureCapabilities Get(this IComponentFeatureCapabilitiesOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns feature capabilities of the application insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentFeatureCapabilitiesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperations.cs similarity index 54% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperations.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperations.cs index be4285fadbe6..170b7f378779 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperations.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperations.cs @@ -8,14 +8,14 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query +namespace Microsoft.Azure.Management.ApplicationInsights.Management { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; - using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -23,12 +23,12 @@ namespace Microsoft.Azure.ApplicationInsights.Query using System.Threading.Tasks; /// - /// QueryOperations operations. + /// ComponentQuotaStatusOperations operations. /// - public partial class QueryOperations : IServiceOperations, IQueryOperations + internal partial class ComponentQuotaStatusOperations : IServiceOperations, IComponentQuotaStatusOperations { /// - /// Initializes a new instance of the QueryOperations class. + /// Initializes a new instance of the ComponentQuotaStatusOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ public partial class QueryOperations : IServiceOperations /// Thrown when a required parameter is null /// - public QueryOperations(ApplicationInsightsDataClient client) + internal ComponentQuotaStatusOperations(ApplicationInsightsManagementClient client) { if (client == null) { @@ -46,32 +46,19 @@ public QueryOperations(ApplicationInsightsDataClient client) } /// - /// Gets a reference to the ApplicationInsightsDataClient + /// Gets a reference to the ApplicationInsightsManagementClient /// - public ApplicationInsightsDataClient Client { get; private set; } + public ApplicationInsightsManagementClient Client { get; private set; } /// - /// Execute an Analytics query + /// Returns daily data volume cap (quota) status for an Application Insights + /// component. /// - /// - /// Executes an Analytics query for data. - /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) - /// is an example for using POST with an Analytics query. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// The query to execute. - /// - /// - /// Optional. The timespan over which to query data. This is an ISO8601 time - /// period value. This timespan is applied in addition to any that are - /// specified in the query expression. - /// - /// - /// A list of Application IDs for cross-application queries. + /// + /// The name of the Application Insights component resource. /// /// /// Headers that will be added to request. @@ -79,7 +66,7 @@ public QueryOperations(ApplicationInsightsDataClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -94,22 +81,52 @@ public QueryOperations(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ExecuteWithHttpMessagesAsync(string appId, string query, string timespan = default(string), IList applications = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + 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); + } + } + if (Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (query == null) + if (Client.SubscriptionId != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "query"); + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } } - QueryBody body = new QueryBody(); - if (query != null || timespan != null || applications != null) + if (resourceName == null) { - body.Query = query; - body.Timespan = timespan; - body.Applications = applications; + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -118,21 +135,44 @@ public QueryOperations(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Execute", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/query").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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.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) @@ -149,12 +189,6 @@ public QueryOperations(ApplicationInsightsDataClient 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) { @@ -177,13 +211,14 @@ public QueryOperations(ApplicationInsightsDataClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -193,6 +228,10 @@ public QueryOperations(ApplicationInsightsDataClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -205,16 +244,20 @@ public QueryOperations(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperationsExtensions.cs new file mode 100644 index 000000000000..38372e71e887 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentQuotaStatusOperationsExtensions.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentQuotaStatusOperations. + /// + public static partial class ComponentQuotaStatusOperationsExtensions + { + /// + /// Returns daily data volume cap (quota) status for an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponentQuotaStatus Get(this IComponentQuotaStatusOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns daily data volume cap (quota) status for an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentQuotaStatusOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperations.cs new file mode 100644 index 000000000000..8c44df8641f3 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperations.cs @@ -0,0 +1,2204 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ComponentsOperations operations. + /// + internal partial class ComponentsOperations : IServiceOperations, IComponentsOperations + { + /// + /// Initializes a new instance of the ComponentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ComponentsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of all Application Insights components within a 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.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 (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); + } + } + // 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.Insights/components").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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of Application Insights components within a 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 (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); + } + } + 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); + } + } + // 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.Insights/components").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates (or updates) an Application Insights component. Note: You cannot + /// specify a different value for InstrumentationKey nor AppId in the Put + /// operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an Application Insights + /// component. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (insightProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "insightProperties"); + } + if (insightProperties != null) + { + insightProperties.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("insightProperties", insightProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + 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.Insights/components/{resourceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(insightProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(insightProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates an existing component's tags. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + TagsResource componentTags = new TagsResource(); + if (tags != null) + { + componentTags.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("componentTags", componentTags); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", 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.Insights/components/{resourceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(componentTags != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(componentTags, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Purges data in an Application Insights component by a set of user-defined + /// filters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Describes the body of a request to purge data in a single table of an + /// Application Insights component + /// + /// + /// 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> PurgeWithHttpMessagesAsync(string resourceGroupName, string resourceName, ComponentPurgeBody body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (body == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "body"); + } + 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("resourceName", resourceName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Purge", 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.Insights/components/{resourceName}/purge").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 != 202) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 == 202) + { + _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 status for an ongoing purge operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// In a purge status request, this is the Id of the operation the status of + /// which is returned. + /// + /// + /// 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> GetPurgeStatusWithHttpMessagesAsync(string resourceGroupName, string resourceName, string purgeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (purgeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "purgeId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("purgeId", purgeId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetPurgeStatus", 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.Insights/components/{resourceName}/operations/{purgeId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{purgeId}", System.Uri.EscapeDataString(purgeId)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// 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("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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperationsExtensions.cs new file mode 100644 index 000000000000..d0769c850c61 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ComponentsOperationsExtensions.cs @@ -0,0 +1,432 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ComponentsOperations. + /// + public static partial class ComponentsOperationsExtensions + { + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IComponentsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IComponentsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IComponentsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IComponentsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static void Delete(this IComponentsOperations operations, string resourceGroupName, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static ApplicationInsightsComponent Get(this IComponentsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Returns an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates (or updates) an Application Insights component. Note: You cannot + /// specify a different value for InstrumentationKey nor AppId in the Put + /// operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an Application Insights + /// component. + /// + public static ApplicationInsightsComponent CreateOrUpdate(this IComponentsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, insightProperties).GetAwaiter().GetResult(); + } + + /// + /// Creates (or updates) an Application Insights component. Note: You cannot + /// specify a different value for InstrumentationKey nor AppId in the Put + /// operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an Application Insights + /// component. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, insightProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates an existing component's tags. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Resource tags + /// + public static ApplicationInsightsComponent UpdateTags(this IComponentsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateTagsAsync(resourceGroupName, resourceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates an existing component's tags. To update other fields use the + /// CreateOrUpdate method. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateTagsAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, resourceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Purges data in an Application Insights component by a set of user-defined + /// filters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Describes the body of a request to purge data in a single table of an + /// Application Insights component + /// + public static ComponentPurgeResponse Purge(this IComponentsOperations operations, string resourceGroupName, string resourceName, ComponentPurgeBody body) + { + return operations.PurgeAsync(resourceGroupName, resourceName, body).GetAwaiter().GetResult(); + } + + /// + /// Purges data in an Application Insights component by a set of user-defined + /// filters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Describes the body of a request to purge data in a single table of an + /// Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task PurgeAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, ComponentPurgeBody body, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PurgeWithHttpMessagesAsync(resourceGroupName, resourceName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get status for an ongoing purge operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// In a purge status request, this is the Id of the operation the status of + /// which is returned. + /// + public static ComponentPurgeStatusResponse GetPurgeStatus(this IComponentsOperations operations, string resourceGroupName, string resourceName, string purgeId) + { + return operations.GetPurgeStatusAsync(resourceGroupName, resourceName, purgeId).GetAwaiter().GetResult(); + } + + /// + /// Get status for an ongoing purge operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// In a purge status request, this is the Id of the operation the status of + /// which is returned. + /// + /// + /// The cancellation token. + /// + public static async Task GetPurgeStatusAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, string purgeId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetPurgeStatusWithHttpMessagesAsync(resourceGroupName, resourceName, purgeId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of all Application Insights components within a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IComponentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of all Application Insights components within a 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 IComponentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IComponentsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Application Insights components within a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IComponentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Events.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Events.cs deleted file mode 100644 index 495ea13b6a4c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Events.cs +++ /dev/null @@ -1,651 +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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Events operations. - /// - public partial class Events : IServiceOperations, IEvents - { - /// - /// Initializes a new instance of the Events class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public Events(ApplicationInsightsDataClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the ApplicationInsightsDataClient - /// - public ApplicationInsightsDataClient Client { get; private set; } - - /// - /// Execute OData query - /// - /// - /// Executes an OData query for events - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// An expression used to filter the returned events - /// - /// - /// A free-text search expression to match for whether a particular event - /// should be returned - /// - /// - /// A comma-separated list of properties with \"asc\" (the default) or \"desc\" - /// to control the order of returned events - /// - /// - /// Limits the properties to just those requested on each returned event - /// - /// - /// The number of items to skip over before returning events - /// - /// - /// The number of events to return - /// - /// - /// Format for the returned events - /// - /// - /// Request a count of matching items included with the returned events - /// - /// - /// An expression used for aggregation over returned events - /// - /// - /// 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> GetByTypeWithHttpMessagesAsync(string appId, string eventType, string timespan = default(string), string filter = default(string), string search = default(string), string orderby = default(string), string select = default(string), int? skip = default(int?), int? top = default(int?), string format = default(string), bool? count = default(bool?), string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (appId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); - } - if (eventType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "eventType"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("eventType", eventType); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("filter", filter); - tracingParameters.Add("search", search); - tracingParameters.Add("orderby", orderby); - tracingParameters.Add("select", select); - tracingParameters.Add("skip", skip); - tracingParameters.Add("top", top); - tracingParameters.Add("format", format); - tracingParameters.Add("count", count); - tracingParameters.Add("apply", apply); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetByType", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/events/{eventType}").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); - _url = _url.Replace("{eventType}", System.Uri.EscapeDataString(eventType)); - List _queryParameters = new List(); - if (timespan != null) - { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - if (search != null) - { - _queryParameters.Add(string.Format("$search={0}", System.Uri.EscapeDataString(search))); - } - if (orderby != null) - { - _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); - } - if (select != null) - { - _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); - } - if (skip != null) - { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); - } - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (format != null) - { - _queryParameters.Add(string.Format("$format={0}", System.Uri.EscapeDataString(format))); - } - if (count != null) - { - _queryParameters.Add(string.Format("$count={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(count, Client.SerializationSettings).Trim('"')))); - } - if (apply != null) - { - _queryParameters.Add(string.Format("$apply={0}", System.Uri.EscapeDataString(apply))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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 an event - /// - /// - /// Gets the data for a single event - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// ID of event. - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// 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 appId, string eventType, string eventId, string timespan = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (appId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); - } - if (eventType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "eventType"); - } - if (eventId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "eventId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("eventType", eventType); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("eventId", eventId); - 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("/") ? "" : "/")), "apps/{appId}/events/{eventType}/{eventId}").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); - _url = _url.Replace("{eventType}", System.Uri.EscapeDataString(eventType)); - _url = _url.Replace("{eventId}", System.Uri.EscapeDataString(eventId)); - List _queryParameters = new List(); - if (timespan != null) - { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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 OData metadata - /// - /// - /// Gets OData EDMX metadata describing the event data model - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// 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> GetOdataMetadataWithHttpMessagesAsync(string appId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (appId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetOdataMetadata", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/events/$metadata").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); - // 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 (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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/EventsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/EventsExtensions.cs deleted file mode 100644 index 3a8eceb61006..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/EventsExtensions.cs +++ /dev/null @@ -1,265 +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.ApplicationInsights.Query -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Events. - /// - public static partial class EventsExtensions - { - /// - /// Execute OData query - /// - /// - /// Executes an OData query for events - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// An expression used to filter the returned events - /// - /// - /// A free-text search expression to match for whether a particular event - /// should be returned - /// - /// - /// A comma-separated list of properties with \"asc\" (the default) or \"desc\" - /// to control the order of returned events - /// - /// - /// Limits the properties to just those requested on each returned event - /// - /// - /// The number of items to skip over before returning events - /// - /// - /// The number of events to return - /// - /// - /// Format for the returned events - /// - /// - /// Request a count of matching items included with the returned events - /// - /// - /// An expression used for aggregation over returned events - /// - public static EventsResults GetByType(this IEvents operations, string appId, string eventType, string timespan = default(string), string filter = default(string), string search = default(string), string orderby = default(string), string select = default(string), int? skip = default(int?), int? top = default(int?), string format = default(string), bool? count = default(bool?), string apply = default(string)) - { - return operations.GetByTypeAsync(appId, eventType, timespan, filter, search, orderby, select, skip, top, format, count, apply).GetAwaiter().GetResult(); - } - - /// - /// Execute OData query - /// - /// - /// Executes an OData query for events - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// An expression used to filter the returned events - /// - /// - /// A free-text search expression to match for whether a particular event - /// should be returned - /// - /// - /// A comma-separated list of properties with \"asc\" (the default) or \"desc\" - /// to control the order of returned events - /// - /// - /// Limits the properties to just those requested on each returned event - /// - /// - /// The number of items to skip over before returning events - /// - /// - /// The number of events to return - /// - /// - /// Format for the returned events - /// - /// - /// Request a count of matching items included with the returned events - /// - /// - /// An expression used for aggregation over returned events - /// - /// - /// The cancellation token. - /// - public static async Task GetByTypeAsync(this IEvents operations, string appId, string eventType, string timespan = default(string), string filter = default(string), string search = default(string), string orderby = default(string), string select = default(string), int? skip = default(int?), int? top = default(int?), string format = default(string), bool? count = default(bool?), string apply = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetByTypeWithHttpMessagesAsync(appId, eventType, timespan, filter, search, orderby, select, skip, top, format, count, apply, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get an event - /// - /// - /// Gets the data for a single event - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// ID of event. - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - public static EventsResults Get(this IEvents operations, string appId, string eventType, string eventId, string timespan = default(string)) - { - return operations.GetAsync(appId, eventType, eventId, timespan).GetAwaiter().GetResult(); - } - - /// - /// Get an event - /// - /// - /// Gets the data for a single event - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type (`traces`, - /// `customEvents`, `pageViews`, `requests`, `dependencies`, `exceptions`, - /// `availabilityResults`) or `$all` to query across all event types. Possible - /// values include: '$all', 'traces', 'customEvents', 'pageViews', - /// 'browserTimings', 'requests', 'dependencies', 'exceptions', - /// 'availabilityResults', 'performanceCounters', 'customMetrics' - /// - /// - /// ID of event. - /// - /// - /// Optional. The timespan over which to retrieve events. This is an ISO8601 - /// time period value. This timespan is applied in addition to any that are - /// specified in the Odata expression. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IEvents operations, string appId, string eventType, string eventId, string timespan = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(appId, eventType, eventId, timespan, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get OData metadata - /// - /// - /// Gets OData EDMX metadata describing the event data model - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - public static object GetOdataMetadata(this IEvents operations, string appId) - { - return operations.GetOdataMetadataAsync(appId).GetAwaiter().GetResult(); - } - - /// - /// Get OData metadata - /// - /// - /// Gets OData EDMX metadata describing the event data model - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The cancellation token. - /// - public static async Task GetOdataMetadataAsync(this IEvents operations, string appId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetOdataMetadataWithHttpMessagesAsync(appId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperations.cs new file mode 100644 index 000000000000..4098afb40040 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperations.cs @@ -0,0 +1,1242 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// ExportConfigurationsOperations operations. + /// + internal partial class ExportConfigurationsOperations : IServiceOperations, IExportConfigurationsOperations + { + /// + /// Initializes a new instance of the ExportConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ExportConfigurationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a Continuous Export + /// configuration of a Application Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponentExportRequest exportProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (exportProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("exportProperties", exportProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(exportProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(exportProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (exportId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("exportId", exportId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{exportId}", System.Uri.EscapeDataString(exportId)); + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 Continuous Export configuration for this export id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (exportId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("exportId", exportId); + 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.Insights/components/{resourceName}/exportconfiguration/{exportId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{exportId}", System.Uri.EscapeDataString(exportId)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the Continuous Export configuration for this export id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// Properties that need to be specified to update the Continuous Export + /// configuration. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, ApplicationInsightsComponentExportRequest exportProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (exportId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportId"); + } + if (exportProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "exportProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("exportId", exportId); + tracingParameters.Add("exportProperties", exportProperties); + 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.Insights/components/{resourceName}/exportconfiguration/{exportId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{exportId}", System.Uri.EscapeDataString(exportId)); + 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(exportProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(exportProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperationsExtensions.cs new file mode 100644 index 000000000000..538a59ebb4bc --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ExportConfigurationsOperationsExtensions.cs @@ -0,0 +1,273 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ExportConfigurationsOperations. + /// + public static partial class ExportConfigurationsOperationsExtensions + { + /// + /// Gets a list of Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IList List(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a Continuous Export + /// configuration of a Application Insights component. + /// + public static IList Create(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponentExportRequest exportProperties) + { + return operations.CreateAsync(resourceGroupName, resourceName, exportProperties).GetAwaiter().GetResult(); + } + + /// + /// Create a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a Continuous Export + /// configuration of a Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task> CreateAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponentExportRequest exportProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, exportProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + public static ApplicationInsightsComponentExportConfiguration Delete(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId) + { + return operations.DeleteAsync(resourceGroupName, resourceName, exportId).GetAwaiter().GetResult(); + } + + /// + /// Delete a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, exportId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the Continuous Export configuration for this export id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + public static ApplicationInsightsComponentExportConfiguration Get(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId) + { + return operations.GetAsync(resourceGroupName, resourceName, exportId).GetAwaiter().GetResult(); + } + + /// + /// Get the Continuous Export configuration for this export id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, exportId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the Continuous Export configuration for this export id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// Properties that need to be specified to update the Continuous Export + /// configuration. + /// + public static ApplicationInsightsComponentExportConfiguration Update(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId, ApplicationInsightsComponentExportRequest exportProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, exportId, exportProperties).GetAwaiter().GetResult(); + } + + /// + /// Update the Continuous Export configuration for this export id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a Application + /// Insights component. + /// + /// + /// Properties that need to be specified to update the Continuous Export + /// configuration. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IExportConfigurationsOperations operations, string resourceGroupName, string resourceName, string exportId, ApplicationInsightsComponentExportRequest exportProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, exportId, exportProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperations.cs new file mode 100644 index 000000000000..7cf406d1a60d --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperations.cs @@ -0,0 +1,1262 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// FavoritesOperations operations. + /// + internal partial class FavoritesOperations : IServiceOperations, IFavoritesOperations + { + /// + /// Initializes a new instance of the FavoritesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FavoritesOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of favorites defined within an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The type of favorite. Value can be either shared or user. Possible values + /// include: 'shared', 'user' + /// + /// + /// Source type of favorite to return. When left out, the source type defaults + /// to 'other' (not present in this enum). Possible values include: + /// 'retention', 'notebook', 'sessions', 'events', 'userflows', 'funnel', + /// 'impact', 'segmentation' + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable favorite. If false, only return summary content for favorites. + /// + /// + /// Tags that must be present on each favorite returned. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), bool? canFetchContent = default(bool?), IList tags = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteType", favoriteType); + tracingParameters.Add("sourceType", sourceType); + tracingParameters.Add("canFetchContent", canFetchContent); + tracingParameters.Add("tags", tags); + 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.Insights/components/{resourceName}/favorites").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (favoriteType != null) + { + _queryParameters.Add(string.Format("favoriteType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(favoriteType, Client.SerializationSettings).Trim('"')))); + } + if (sourceType != null) + { + _queryParameters.Add(string.Format("sourceType={0}", System.Uri.EscapeDataString(sourceType))); + } + if (canFetchContent != null) + { + _queryParameters.Add(string.Format("canFetchContent={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(canFetchContent, Client.SerializationSettings).Trim('"')))); + } + if (tags != null) + { + _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(string.Join(",", tags)))); + } + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a single favorite by its FavoriteId, defined within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (favoriteId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteId", favoriteId); + 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.Insights/components/{resourceName}/favorites/{favoriteId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{favoriteId}", System.Uri.EscapeDataString(favoriteId)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Adds a new favorites to an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to create a new favorite and add it to + /// an Application Insights component. + /// + /// + /// 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> AddWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (favoriteId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteId"); + } + if (favoriteProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteId", favoriteId); + tracingParameters.Add("favoriteProperties", favoriteProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Add", 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.Insights/components/{resourceName}/favorites/{favoriteId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{favoriteId}", System.Uri.EscapeDataString(favoriteId)); + 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(favoriteProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(favoriteProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a favorite that has already been added to an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to update the existing favorite. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (favoriteId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteId"); + } + if (favoriteProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteId", favoriteId); + tracingParameters.Add("favoriteProperties", favoriteProperties); + 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.Insights/components/{resourceName}/favorites/{favoriteId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{favoriteId}", System.Uri.EscapeDataString(favoriteId)); + 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(favoriteProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(favoriteProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Remove a favorite that is associated to an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (favoriteId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "favoriteId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("favoriteId", favoriteId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{favoriteId}", System.Uri.EscapeDataString(favoriteId)); + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperationsExtensions.cs new file mode 100644 index 000000000000..c4dd575d1884 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/FavoritesOperationsExtensions.cs @@ -0,0 +1,300 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FavoritesOperations. + /// + public static partial class FavoritesOperationsExtensions + { + /// + /// Gets a list of favorites defined within an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The type of favorite. Value can be either shared or user. Possible values + /// include: 'shared', 'user' + /// + /// + /// Source type of favorite to return. When left out, the source type defaults + /// to 'other' (not present in this enum). Possible values include: + /// 'retention', 'notebook', 'sessions', 'events', 'userflows', 'funnel', + /// 'impact', 'segmentation' + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable favorite. If false, only return summary content for favorites. + /// + /// + /// Tags that must be present on each favorite returned. + /// + public static IList List(this IFavoritesOperations operations, string resourceGroupName, string resourceName, FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), bool? canFetchContent = default(bool?), IList tags = default(IList)) + { + return operations.ListAsync(resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of favorites defined within an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The type of favorite. Value can be either shared or user. Possible values + /// include: 'shared', 'user' + /// + /// + /// Source type of favorite to return. When left out, the source type defaults + /// to 'other' (not present in this enum). Possible values include: + /// 'retention', 'notebook', 'sessions', 'events', 'userflows', 'funnel', + /// 'impact', 'segmentation' + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable favorite. If false, only return summary content for favorites. + /// + /// + /// Tags that must be present on each favorite returned. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), bool? canFetchContent = default(bool?), IList tags = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a single favorite by its FavoriteId, defined within an Application + /// Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + public static ApplicationInsightsComponentFavorite Get(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId) + { + return operations.GetAsync(resourceGroupName, resourceName, favoriteId).GetAwaiter().GetResult(); + } + + /// + /// Get a single favorite by its FavoriteId, defined within an Application + /// Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Adds a new favorites to an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to create a new favorite and add it to + /// an Application Insights component. + /// + public static ApplicationInsightsComponentFavorite Add(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties) + { + return operations.AddAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties).GetAwaiter().GetResult(); + } + + /// + /// Adds a new favorites to an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to create a new favorite and add it to + /// an Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task AddAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.AddWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a favorite that has already been added to an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to update the existing favorite. + /// + public static ApplicationInsightsComponentFavorite Update(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a favorite that has already been added to an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// Properties that need to be specified to update the existing favorite. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteId, favoriteProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Remove a favorite that is associated to an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + public static void Delete(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId) + { + operations.DeleteAsync(resourceGroupName, resourceName, favoriteId).GetAwaiter().GetResult(); + } + + /// + /// Remove a favorite that is associated to an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights component + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFavoritesOperations operations, string resourceGroupName, string resourceName, string favoriteId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, favoriteId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAPIKeysOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAPIKeysOperations.cs new file mode 100644 index 000000000000..203211c53916 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAPIKeysOperations.cs @@ -0,0 +1,139 @@ +// +// 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.ApplicationInsights.Management +{ + 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 + { + /// + /// Gets a list of API keys of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create an API Key of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an API key of a + /// Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, APIKeyRequest aPIKeyProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an API Key of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights + /// component. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string keyId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the API Key for this key id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The API Key ID. This is unique within a Application Insights + /// component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string keyId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnalyticsItemsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnalyticsItemsOperations.cs new file mode 100644 index 000000000000..32f75acc4604 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnalyticsItemsOperations.cs @@ -0,0 +1,189 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AnalyticsItemsOperations operations. + /// + public partial interface IAnalyticsItemsOperations + { + /// + /// Gets a list of Analytics Items defined within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'analyticsItems', + /// 'myanalyticsItems' + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'shared', 'user' + /// + /// + /// Enum indicating the type of the Analytics item. Possible values + /// include: 'none', 'query', 'function', 'folder', 'recent' + /// + /// + /// Flag indicating whether or not to return the content of each + /// applicable item. If false, only return the item information. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string scope = default(string), string type = default(string), bool? includeContent = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a specific Analytics Items defined within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'analyticsItems', + /// 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights + /// component + /// + /// + /// The name of a specific item defined in the Application Insights + /// component + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Adds or Updates a specific Analytics Item within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'analyticsItems', + /// 'myanalyticsItems' + /// + /// + /// Properties that need to be specified to create a new item and add + /// it to an Application Insights component. + /// + /// + /// Flag indicating whether or not to force save an item. This allows + /// overriding an item if it already exists. + /// + /// + /// 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> PutWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, ApplicationInsightsComponentAnalyticsItem itemProperties, bool? overrideItem = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a specific Analytics Items defined within an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Enum indicating if this item definition is owned by a specific user + /// or is shared between all users with access to the Application + /// Insights component. Possible values include: 'analyticsItems', + /// 'myanalyticsItems' + /// + /// + /// The Id of a specific item defined in the Application Insights + /// component + /// + /// + /// The name of a specific item defined in the Application Insights + /// component + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string scopePath, string id = default(string), string name = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnnotationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnnotationsOperations.cs new file mode 100644 index 000000000000..39371bb14b50 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IAnnotationsOperations.cs @@ -0,0 +1,143 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AnnotationsOperations operations. + /// + public partial interface IAnnotationsOperations + { + /// + /// Gets the list of annotations for a component for given time range + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The start time to query from for annotations, cannot be older than + /// 90 days from current date. + /// + /// + /// The end time to query for annotations. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, string start, string end, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create an Annotation of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an annotation of a + /// Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Annotation annotationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete an Annotation of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application + /// Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string annotationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the annotation for given id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique annotation ID. This is unique within a Application + /// Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string annotationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsDataClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsDataClient.cs deleted file mode 100644 index 319ec8bccd5f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsDataClient.cs +++ /dev/null @@ -1,60 +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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - - /// - /// Composite Swagger for Application Insights Data Client - /// - public partial interface IApplicationInsightsDataClient : System.IDisposable - { - /// - /// The base URI of the service. - /// - System.Uri BaseUri { get; set; } - - /// - /// Gets or sets json serialization settings. - /// - JsonSerializerSettings SerializationSettings { get; } - - /// - /// Gets or sets json deserialization settings. - /// - JsonSerializerSettings DeserializationSettings { get; } - - /// - /// Subscription credentials which uniquely identify client - /// subscription. - /// - ServiceClientCredentials Credentials { get; } - - - /// - /// Gets the IMetrics. - /// - IMetrics Metrics { get; } - - /// - /// Gets the IEvents. - /// - IEvents Events { get; } - - /// - /// Gets the IQueryOperations. - /// - IQueryOperations Query { get; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsManagementClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsManagementClient.cs new file mode 100644 index 000000000000..70b2824b1e9c --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IApplicationInsightsManagementClient.cs @@ -0,0 +1,153 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Composite Swagger for Application Insights Management Client + /// + public partial interface IApplicationInsightsManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// The ID of the target subscription. + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IAnnotationsOperations. + /// + IAnnotationsOperations Annotations { get; } + + /// + /// Gets the IAPIKeysOperations. + /// + IAPIKeysOperations APIKeys { get; } + + /// + /// Gets the IExportConfigurationsOperations. + /// + IExportConfigurationsOperations ExportConfigurations { get; } + + /// + /// Gets the IComponentCurrentBillingFeaturesOperations. + /// + IComponentCurrentBillingFeaturesOperations ComponentCurrentBillingFeatures { get; } + + /// + /// Gets the IComponentQuotaStatusOperations. + /// + IComponentQuotaStatusOperations ComponentQuotaStatus { get; } + + /// + /// Gets the IComponentFeatureCapabilitiesOperations. + /// + IComponentFeatureCapabilitiesOperations ComponentFeatureCapabilities { get; } + + /// + /// Gets the IComponentAvailableFeaturesOperations. + /// + IComponentAvailableFeaturesOperations ComponentAvailableFeatures { get; } + + /// + /// Gets the IProactiveDetectionConfigurationsOperations. + /// + IProactiveDetectionConfigurationsOperations ProactiveDetectionConfigurations { get; } + + /// + /// Gets the IComponentsOperations. + /// + IComponentsOperations Components { get; } + + /// + /// Gets the IWorkItemConfigurationsOperations. + /// + IWorkItemConfigurationsOperations WorkItemConfigurations { get; } + + /// + /// Gets the IFavoritesOperations. + /// + IFavoritesOperations Favorites { get; } + + /// + /// Gets the IWebTestLocationsOperations. + /// + IWebTestLocationsOperations WebTestLocations { get; } + + /// + /// Gets the IWebTestsOperations. + /// + IWebTestsOperations WebTests { get; } + + /// + /// Gets the IAnalyticsItemsOperations. + /// + IAnalyticsItemsOperations AnalyticsItems { get; } + + /// + /// Gets the IWorkbooksOperations. + /// + IWorkbooksOperations Workbooks { get; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentAvailableFeaturesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentAvailableFeaturesOperations.cs new file mode 100644 index 000000000000..6245ab851381 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentAvailableFeaturesOperations.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentAvailableFeaturesOperations operations. + /// + public partial interface IComponentAvailableFeaturesOperations + { + /// + /// Returns all available features of the application insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentCurrentBillingFeaturesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentCurrentBillingFeaturesOperations.cs new file mode 100644 index 000000000000..b4b0790c370e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentCurrentBillingFeaturesOperations.cs @@ -0,0 +1,83 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentCurrentBillingFeaturesOperations operations. + /// + public partial interface IComponentCurrentBillingFeaturesOperations + { + /// + /// Returns current billing features for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update current billing features for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to update billing features for + /// an Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponentBillingFeatures billingFeaturesProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentFeatureCapabilitiesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentFeatureCapabilitiesOperations.cs new file mode 100644 index 000000000000..d0ab332eba9e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentFeatureCapabilitiesOperations.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentFeatureCapabilitiesOperations operations. + /// + public partial interface IComponentFeatureCapabilitiesOperations + { + /// + /// Returns feature capabilities of the application insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentQuotaStatusOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentQuotaStatusOperations.cs new file mode 100644 index 000000000000..99f2abb19a76 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentQuotaStatusOperations.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentQuotaStatusOperations operations. + /// + public partial interface IComponentQuotaStatusOperations + { + /// + /// Returns daily data volume cap (quota) status for an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentsOperations.cs new file mode 100644 index 000000000000..08cdc0e3a58c --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IComponentsOperations.cs @@ -0,0 +1,282 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ComponentsOperations operations. + /// + public partial interface IComponentsOperations + { + /// + /// Gets a list of all Application Insights components within a + /// subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of Application Insights components within a resource + /// group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates (or updates) an Application Insights component. Note: You + /// cannot specify a different value for InstrumentationKey nor AppId + /// in the Put operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create an Application + /// Insights component. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates an existing component's tags. To update other fields use + /// the CreateOrUpdate method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Purges data in an Application Insights component by a set of + /// user-defined filters. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Describes the body of a request to purge data in a single table of + /// an Application Insights component + /// + /// + /// 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> PurgeWithHttpMessagesAsync(string resourceGroupName, string resourceName, ComponentPurgeBody body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get status for an ongoing purge operation. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// In a purge status request, this is the Id of the operation the + /// status of which is returned. + /// + /// + /// 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> GetPurgeStatusWithHttpMessagesAsync(string resourceGroupName, string resourceName, string purgeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of all Application Insights components within a + /// subscription. + /// + /// + /// 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)); + /// + /// Gets a list of Application Insights components within a resource + /// group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IEvents.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IEvents.cs deleted file mode 100644 index b84886dd994f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IEvents.cs +++ /dev/null @@ -1,165 +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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Events operations. - /// - public partial interface IEvents - { - /// - /// Execute OData query - /// - /// - /// Executes an OData query for events - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type - /// (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, - /// `exceptions`, `availabilityResults`) or `$all` to query across all - /// event types. Possible values include: '$all', 'traces', - /// 'customEvents', 'pageViews', 'browserTimings', 'requests', - /// 'dependencies', 'exceptions', 'availabilityResults', - /// 'performanceCounters', 'customMetrics' - /// - /// - /// Optional. The timespan over which to retrieve events. This is an - /// ISO8601 time period value. This timespan is applied in addition to - /// any that are specified in the Odata expression. - /// - /// - /// An expression used to filter the returned events - /// - /// - /// A free-text search expression to match for whether a particular - /// event should be returned - /// - /// - /// A comma-separated list of properties with \"asc\" (the default) or - /// \"desc\" to control the order of returned events - /// - /// - /// Limits the properties to just those requested on each returned - /// event - /// - /// - /// The number of items to skip over before returning events - /// - /// - /// The number of events to return - /// - /// - /// Format for the returned events - /// - /// - /// Request a count of matching items included with the returned events - /// - /// - /// An expression used for aggregation over returned events - /// - /// - /// 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> GetByTypeWithHttpMessagesAsync(string appId, string eventType, string timespan = default(string), string filter = default(string), string search = default(string), string orderby = default(string), string select = default(string), int? skip = default(int?), int? top = default(int?), string format = default(string), bool? count = default(bool?), string apply = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get an event - /// - /// - /// Gets the data for a single event - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// The type of events to query; either a standard event type - /// (`traces`, `customEvents`, `pageViews`, `requests`, `dependencies`, - /// `exceptions`, `availabilityResults`) or `$all` to query across all - /// event types. Possible values include: '$all', 'traces', - /// 'customEvents', 'pageViews', 'browserTimings', 'requests', - /// 'dependencies', 'exceptions', 'availabilityResults', - /// 'performanceCounters', 'customMetrics' - /// - /// - /// ID of event. - /// - /// - /// Optional. The timespan over which to retrieve events. This is an - /// ISO8601 time period value. This timespan is applied in addition to - /// any that are specified in the Odata expression. - /// - /// - /// 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 appId, string eventType, string eventId, string timespan = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get OData metadata - /// - /// - /// Gets OData EDMX metadata describing the event data model - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// 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> GetOdataMetadataWithHttpMessagesAsync(string appId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IExportConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IExportConfigurationsOperations.cs new file mode 100644 index 000000000000..2c0937a7033e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IExportConfigurationsOperations.cs @@ -0,0 +1,175 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ExportConfigurationsOperations operations. + /// + public partial interface IExportConfigurationsOperations + { + /// + /// Gets a list of Continuous Export configuration of an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a Continuous Export + /// configuration of a Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ApplicationInsightsComponentExportRequest exportProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Continuous Export configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the Continuous Export configuration for this export id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the Continuous Export configuration for this export id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Continuous Export configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the Continuous + /// Export configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string exportId, ApplicationInsightsComponentExportRequest exportProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IFavoritesOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IFavoritesOperations.cs new file mode 100644 index 000000000000..88410b28b122 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IFavoritesOperations.cs @@ -0,0 +1,195 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FavoritesOperations operations. + /// + public partial interface IFavoritesOperations + { + /// + /// Gets a list of favorites defined within an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The type of favorite. Value can be either shared or user. Possible + /// values include: 'shared', 'user' + /// + /// + /// Source type of favorite to return. When left out, the source type + /// defaults to 'other' (not present in this enum). Possible values + /// include: 'retention', 'notebook', 'sessions', 'events', + /// 'userflows', 'funnel', 'impact', 'segmentation' + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable favorite. If false, only return summary content for + /// favorites. + /// + /// + /// Tags that must be present on each favorite returned. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), bool? canFetchContent = default(bool?), IList tags = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a single favorite by its FavoriteId, defined within an + /// Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights + /// component + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Adds a new favorites to an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights + /// component + /// + /// + /// Properties that need to be specified to create a new favorite and + /// add it to an Application Insights component. + /// + /// + /// 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> AddWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a favorite that has already been added to an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights + /// component + /// + /// + /// Properties that need to be specified to update the existing + /// favorite. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, ApplicationInsightsComponentFavorite favoriteProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Remove a favorite that is associated to an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The Id of a specific favorite defined in the Application Insights + /// component + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string favoriteId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IMetrics.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IMetrics.cs deleted file mode 100644 index 657018f66eea..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IMetrics.cs +++ /dev/null @@ -1,173 +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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Metrics operations. - /// - public partial interface IMetrics - { - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for a single metric - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// ID of the metric. This is either a standard AI metric, or an - /// application-specific custom metric. Possible values include: - /// 'requests/count', 'requests/duration', 'requests/failed', - /// 'users/count', 'users/authenticated', 'pageViews/count', - /// 'pageViews/duration', 'client/processingDuration', - /// 'client/receiveDuration', 'client/networkDuration', - /// 'client/sendDuration', 'client/totalDuration', - /// 'dependencies/count', 'dependencies/failed', - /// 'dependencies/duration', 'exceptions/count', 'exceptions/browser', - /// 'exceptions/server', 'sessions/count', - /// 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - /// - /// The timespan over which to retrieve metric values. This is an - /// ISO8601 time period value. If timespan is omitted, a default time - /// range of `PT12H` ("last 12 hours") is used. The actual timespan - /// that is queried may be adjusted by the server based. In all cases, - /// the actual time span used for the query is included in the - /// response. - /// - /// - /// The time interval to use when retrieving metric values. This is an - /// ISO8601 duration. If interval is omitted, the metric value is - /// aggregated across the entire timespan. If interval is supplied, the - /// server may adjust the interval to a more appropriate size based on - /// the timespan used for the query. In all cases, the actual interval - /// used for the query is included in the response. - /// - /// - /// The aggregation to use when computing the metric values. To - /// retrieve more than one aggregation at a time, separate them with a - /// comma. If no aggregation is specified, then the default aggregation - /// for the metric is used. - /// - /// - /// The name of the dimension to segment the metric values by. This - /// dimension must be applicable to the metric you are retrieving. To - /// segment by more than one dimension at a time, separate them with a - /// comma (,). In this case, the metric data will be segmented in the - /// order the dimensions are listed in the parameter. - /// - /// - /// The number of segments to return. This value is only valid when - /// segment is specified. - /// - /// - /// The aggregation function and direction to sort the segments by. - /// This value is only valid when segment is specified. - /// - /// - /// An expression used to filter the results. This value should be a - /// valid OData filter expression where the keys of each clause should - /// be applicable dimensions for the metric you are retrieving. - /// - /// - /// 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 appId, string metricId, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), IList aggregation = default(IList), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for multiple metrics - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// The batched metrics query. - /// - /// - /// 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>> GetMultipleWithHttpMessagesAsync(string appId, IList body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve metric metatadata - /// - /// - /// Gets metadata describing the available metrics - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// 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> GetMetadataWithHttpMessagesAsync(string appId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IOperations.cs new file mode 100644 index 000000000000..fc3ceb0ca2bd --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IOperations.cs @@ -0,0 +1,68 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available insights REST API operations. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all of the available insights REST API operations. + /// + /// + /// 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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IProactiveDetectionConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IProactiveDetectionConfigurationsOperations.cs new file mode 100644 index 000000000000..4c6798aa9fdf --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IProactiveDetectionConfigurationsOperations.cs @@ -0,0 +1,116 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProactiveDetectionConfigurationsOperations operations. + /// + public partial interface IProactiveDetectionConfigurationsOperations + { + /// + /// Gets a list of ProactiveDetection configurations of an Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the ProactiveDetection configuration for this configuration id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string configurationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the ProactiveDetection configuration for this configuration + /// id. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the + /// ProactiveDetection configuration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string configurationId, ApplicationInsightsComponentProactiveDetectionConfiguration proactiveDetectionProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IQueryOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IQueryOperations.cs deleted file mode 100644 index fd2fbdd40d49..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IQueryOperations.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.ApplicationInsights.Query -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// QueryOperations operations. - /// - public partial interface IQueryOperations - { - /// - /// Execute an Analytics query - /// - /// - /// Executes an Analytics query for data. - /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) - /// is an example for using POST with an Analytics query. - /// - /// - /// ID of the application. This is Application ID from the API Access - /// settings blade in the Azure portal. - /// - /// - /// The query to execute. - /// - /// - /// Optional. The timespan over which to query data. This is an ISO8601 - /// time period value. This timespan is applied in addition to any - /// that are specified in the query expression. - /// - /// - /// A list of Application IDs for cross-application queries. - /// - /// - /// 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> ExecuteWithHttpMessagesAsync(string appId, string query, string timespan = default(string), IList applications = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestLocationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestLocationsOperations.cs new file mode 100644 index 000000000000..1f09ef7aef27 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestLocationsOperations.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WebTestLocationsOperations operations. + /// + public partial interface IWebTestLocationsOperations + { + /// + /// Gets a list of web test locations available to this Application + /// Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestsOperations.cs new file mode 100644 index 000000000000..779cc1bbd500 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWebTestsOperations.cs @@ -0,0 +1,269 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WebTestsOperations operations. + /// + public partial interface IWebTestsOperations + { + /// + /// Get all Application Insights web tests defined within a specified + /// resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string webTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Properties that need to be specified to create or update an + /// Application Insights web test definition. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string webTestName, WebTest webTestDefinition, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string webTestName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes an Application Insights web test. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string webTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web tests defined for the specified + /// component. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByComponentWithHttpMessagesAsync(string componentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web tests defined within a specified + /// resource group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// 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)); + /// + /// Get all Application Insights web tests defined for the specified + /// component. + /// + /// + /// 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>> ListByComponentNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkItemConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkItemConfigurationsOperations.cs new file mode 100644 index 000000000000..9df36927d135 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkItemConfigurationsOperations.cs @@ -0,0 +1,200 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkItemConfigurationsOperations operations. + /// + public partial interface IWorkItemConfigurationsOperations + { + /// + /// Gets the list work item configurations that exist for the + /// application + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a work item configuration for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a work item + /// configuration of a Application Insights component. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, WorkItemCreateConfiguration workItemConfigurationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets default work item configurations that exist for the + /// application + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetDefaultWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a work item configuration of an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly + /// name of connector as defined in connector configuration + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets specified work item configuration for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly + /// name of connector as defined in connector configuration + /// + /// + /// 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> GetItemWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a work item configuration for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly + /// name of connector as defined in connector configuration + /// + /// + /// Properties that need to be specified to update a work item + /// configuration for this Application Insights component. + /// + /// + /// 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> UpdateItemWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkbooksOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkbooksOperations.cs new file mode 100644 index 000000000000..57188f8ed4d5 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/IWorkbooksOperations.cs @@ -0,0 +1,165 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WorkbooksOperations operations. + /// + public partial interface IWorkbooksOperations + { + /// + /// Get all Workbooks defined within a specified resource group and + /// category. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Category of workbook to return. Possible values include: + /// 'workbook', 'TSG', 'performance', 'retention' + /// + /// + /// Tags presents on each workbook returned. + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable workbook. If false, only return summary content for + /// workbooks. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string category, IList tags = default(IList), bool? canFetchContent = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a single workbook by its resourceName. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a workbook. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a new workbook. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Workbook workbookProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a workbook that has already been added. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Workbook workbookProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/MetricsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/MetricsExtensions.cs deleted file mode 100644 index 0046d58892c3..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/MetricsExtensions.cs +++ /dev/null @@ -1,283 +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.ApplicationInsights.Query -{ - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Metrics. - /// - public static partial class MetricsExtensions - { - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for a single metric - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// ID of the metric. This is either a standard AI metric, or an - /// application-specific custom metric. Possible values include: - /// 'requests/count', 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', - /// 'dependencies/count', 'dependencies/failed', 'dependencies/duration', - /// 'exceptions/count', 'exceptions/browser', 'exceptions/server', - /// 'sessions/count', 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - /// - /// The timespan over which to retrieve metric values. This is an ISO8601 time - /// period value. If timespan is omitted, a default time range of `PT12H` - /// ("last 12 hours") is used. The actual timespan that is queried may be - /// adjusted by the server based. In all cases, the actual time span used for - /// the query is included in the response. - /// - /// - /// The time interval to use when retrieving metric values. This is an ISO8601 - /// duration. If interval is omitted, the metric value is aggregated across the - /// entire timespan. If interval is supplied, the server may adjust the - /// interval to a more appropriate size based on the timespan used for the - /// query. In all cases, the actual interval used for the query is included in - /// the response. - /// - /// - /// The aggregation to use when computing the metric values. To retrieve more - /// than one aggregation at a time, separate them with a comma. If no - /// aggregation is specified, then the default aggregation for the metric is - /// used. - /// - /// - /// The name of the dimension to segment the metric values by. This dimension - /// must be applicable to the metric you are retrieving. To segment by more - /// than one dimension at a time, separate them with a comma (,). In this case, - /// the metric data will be segmented in the order the dimensions are listed in - /// the parameter. - /// - /// - /// The number of segments to return. This value is only valid when segment is - /// specified. - /// - /// - /// The aggregation function and direction to sort the segments by. This value - /// is only valid when segment is specified. - /// - /// - /// An expression used to filter the results. This value should be a valid - /// OData filter expression where the keys of each clause should be applicable - /// dimensions for the metric you are retrieving. - /// - public static MetricsResult Get(this IMetrics operations, string appId, string metricId, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), IList aggregation = default(IList), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string)) - { - return operations.GetAsync(appId, metricId, timespan, interval, aggregation, segment, top, orderby, filter).GetAwaiter().GetResult(); - } - - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for a single metric - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// ID of the metric. This is either a standard AI metric, or an - /// application-specific custom metric. Possible values include: - /// 'requests/count', 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', - /// 'dependencies/count', 'dependencies/failed', 'dependencies/duration', - /// 'exceptions/count', 'exceptions/browser', 'exceptions/server', - /// 'sessions/count', 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - /// - /// The timespan over which to retrieve metric values. This is an ISO8601 time - /// period value. If timespan is omitted, a default time range of `PT12H` - /// ("last 12 hours") is used. The actual timespan that is queried may be - /// adjusted by the server based. In all cases, the actual time span used for - /// the query is included in the response. - /// - /// - /// The time interval to use when retrieving metric values. This is an ISO8601 - /// duration. If interval is omitted, the metric value is aggregated across the - /// entire timespan. If interval is supplied, the server may adjust the - /// interval to a more appropriate size based on the timespan used for the - /// query. In all cases, the actual interval used for the query is included in - /// the response. - /// - /// - /// The aggregation to use when computing the metric values. To retrieve more - /// than one aggregation at a time, separate them with a comma. If no - /// aggregation is specified, then the default aggregation for the metric is - /// used. - /// - /// - /// The name of the dimension to segment the metric values by. This dimension - /// must be applicable to the metric you are retrieving. To segment by more - /// than one dimension at a time, separate them with a comma (,). In this case, - /// the metric data will be segmented in the order the dimensions are listed in - /// the parameter. - /// - /// - /// The number of segments to return. This value is only valid when segment is - /// specified. - /// - /// - /// The aggregation function and direction to sort the segments by. This value - /// is only valid when segment is specified. - /// - /// - /// An expression used to filter the results. This value should be a valid - /// OData filter expression where the keys of each clause should be applicable - /// dimensions for the metric you are retrieving. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IMetrics operations, string appId, string metricId, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), IList aggregation = default(IList), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(appId, metricId, timespan, interval, aggregation, segment, top, orderby, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for multiple metrics - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The batched metrics query. - /// - public static IList GetMultiple(this IMetrics operations, string appId, IList body) - { - return operations.GetMultipleAsync(appId, body).GetAwaiter().GetResult(); - } - - /// - /// Retrieve metric data - /// - /// - /// Gets metric values for multiple metrics - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The batched metrics query. - /// - /// - /// The cancellation token. - /// - public static async Task> GetMultipleAsync(this IMetrics operations, string appId, IList body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetMultipleWithHttpMessagesAsync(appId, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve metric metatadata - /// - /// - /// Gets metadata describing the available metrics - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - public static object GetMetadata(this IMetrics operations, string appId) - { - return operations.GetMetadataAsync(appId).GetAwaiter().GetResult(); - } - - /// - /// Retrieve metric metatadata - /// - /// - /// Gets metadata describing the available metrics - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The cancellation token. - /// - public static async Task GetMetadataAsync(this IMetrics operations, string appId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetMetadataWithHttpMessagesAsync(appId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/APIKeyRequest.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/APIKeyRequest.cs new file mode 100644 index 000000000000..f59d679ecb97 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/APIKeyRequest.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component API Key creation request definition. + /// + public partial class APIKeyRequest + { + /// + /// Initializes a new instance of the APIKeyRequest class. + /// + public APIKeyRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the APIKeyRequest class. + /// + /// The name of the API Key. + /// The read access rights of this + /// API Key. + /// The write access rights of this + /// API Key. + public APIKeyRequest(string name = default(string), IList linkedReadProperties = default(IList), IList linkedWriteProperties = default(IList)) + { + Name = name; + LinkedReadProperties = linkedReadProperties; + LinkedWriteProperties = linkedWriteProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the API Key. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the read access rights of this API Key. + /// + [JsonProperty(PropertyName = "linkedReadProperties")] + public IList LinkedReadProperties { get; set; } + + /// + /// Gets or sets the write access rights of this API Key. + /// + [JsonProperty(PropertyName = "linkedWriteProperties")] + public IList LinkedWriteProperties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Annotation.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Annotation.cs new file mode 100644 index 000000000000..0f23f011b794 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Annotation.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Annotation associated with an application insights resource. + /// + public partial class Annotation + { + /// + /// Initializes a new instance of the Annotation class. + /// + public Annotation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Annotation class. + /// + /// Name of annotation + /// Category of annotation, free form + /// Time when event occurred + /// Unique Id for annotation + /// Serialized JSON object for detailed + /// properties + /// Related parent annotation if + /// any + public Annotation(string annotationName = default(string), string category = default(string), System.DateTime? eventTime = default(System.DateTime?), string id = default(string), string properties = default(string), string relatedAnnotation = default(string)) + { + AnnotationName = annotationName; + Category = category; + EventTime = eventTime; + Id = id; + Properties = properties; + RelatedAnnotation = relatedAnnotation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of annotation + /// + [JsonProperty(PropertyName = "AnnotationName")] + public string AnnotationName { get; set; } + + /// + /// Gets or sets category of annotation, free form + /// + [JsonProperty(PropertyName = "Category")] + public string Category { get; set; } + + /// + /// Gets or sets time when event occurred + /// + [JsonProperty(PropertyName = "EventTime")] + public System.DateTime? EventTime { get; set; } + + /// + /// Gets or sets unique Id for annotation + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; set; } + + /// + /// Gets or sets serialized JSON object for detailed properties + /// + [JsonProperty(PropertyName = "Properties")] + public string Properties { get; set; } + + /// + /// Gets or sets related parent annotation if any + /// + [JsonProperty(PropertyName = "RelatedAnnotation")] + public string RelatedAnnotation { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationError.cs similarity index 50% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceInfo.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationError.cs index 4f7f3c0774f0..6c19e30c6d96 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceInfo.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationError.cs @@ -8,33 +8,35 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; using System.Linq; /// - /// The trace information + /// Error associated with trying to create annotation with Id that already + /// exist /// - public partial class EventsTraceInfo + public partial class AnnotationError { /// - /// Initializes a new instance of the EventsTraceInfo class. + /// Initializes a new instance of the AnnotationError class. /// - public EventsTraceInfo() + public AnnotationError() { CustomInit(); } /// - /// Initializes a new instance of the EventsTraceInfo class. + /// Initializes a new instance of the AnnotationError class. /// - /// The trace message - /// The trace severity level - public EventsTraceInfo(string message = default(string), int? severityLevel = default(int?)) + /// Error detail code and explanation + /// Error message + public AnnotationError(string code = default(string), string message = default(string), InnerError innererror = default(InnerError)) { + Code = code; Message = message; - SeverityLevel = severityLevel; + Innererror = innererror; CustomInit(); } @@ -44,16 +46,21 @@ public EventsTraceInfo() partial void CustomInit(); /// - /// Gets or sets the trace message + /// Gets or sets error detail code and explanation + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message /// [JsonProperty(PropertyName = "message")] public string Message { get; set; } /// - /// Gets or sets the trace severity level /// - [JsonProperty(PropertyName = "severityLevel")] - public int? SeverityLevel { get; set; } + [JsonProperty(PropertyName = "innererror")] + public InnerError Innererror { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationErrorException.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationErrorException.cs new file mode 100644 index 000000000000..fb6e93a77587 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/AnnotationErrorException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with AnnotationError + /// information. + /// + public partial class AnnotationErrorException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public AnnotationError Body { get; set; } + + /// + /// Initializes a new instance of the AnnotationErrorException class. + /// + public AnnotationErrorException() + { + } + + /// + /// Initializes a new instance of the AnnotationErrorException class. + /// + /// The exception message. + public AnnotationErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the AnnotationErrorException class. + /// + /// The exception message. + /// Inner exception. + public AnnotationErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponent.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponent.cs new file mode 100644 index 000000000000..1156ea830240 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponent.cs @@ -0,0 +1,227 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class ApplicationInsightsComponent : ComponentsResource + { + /// + /// Initializes a new instance of the ApplicationInsightsComponent + /// class. + /// + public ApplicationInsightsComponent() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationInsightsComponent + /// class. + /// + /// Resource location + /// The kind of application that this component + /// refers to, used to customize UI. This value is a freeform string, + /// values should typically be one of the following: web, ios, other, + /// store, java, phone. + /// Type of application being monitored. + /// Possible values include: 'web', 'other' + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + /// The unique ID of your application. This + /// field mirrors the 'Name' field and cannot be changed. + /// Application Insights Unique ID for your + /// Application. + /// Used by the Application Insights system to + /// determine what kind of flow this component was created by. This is + /// to be set to 'Bluefield' when creating/updating a component via the + /// REST API. Possible values include: 'Bluefield' + /// Describes what tool created this + /// Application Insights component. Customers using this API should set + /// this to the default 'rest'. Possible values include: 'rest' + /// Application Insights + /// Instrumentation key. A read-only value that applications can use to + /// identify the destination for all telemetry sent to Azure + /// Application Insights. This value will be supplied upon construction + /// of each new Application Insights component. + /// Creation Date for the Application + /// Insights component, in ISO 8601 format. + /// Azure Tenant Id. + /// The unique application ID created when a + /// new application is added to HockeyApp, used for communications with + /// HockeyApp. + /// Token used to authenticate + /// communications with between Application Insights and + /// HockeyApp. + /// Current state of this component: + /// whether or not is has been provisioned within the resource group it + /// is defined. Users cannot change this value but are able to read + /// from it. Values will include Succeeded, Deploying, Canceled, and + /// Failed. + /// Percentage of the data produced by + /// the application being monitored that is being sampled for + /// Application Insights telemetry. + public ApplicationInsightsComponent(string location, string kind, string applicationType, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string applicationId = default(string), string appId = default(string), string flowType = default(string), string requestSource = default(string), string instrumentationKey = default(string), System.DateTime? creationDate = default(System.DateTime?), string tenantId = default(string), string hockeyAppId = default(string), string hockeyAppToken = default(string), string provisioningState = default(string), double? samplingPercentage = default(double?)) + : base(location, id, name, type, tags) + { + Kind = kind; + ApplicationId = applicationId; + AppId = appId; + ApplicationType = applicationType; + FlowType = flowType; + RequestSource = requestSource; + InstrumentationKey = instrumentationKey; + CreationDate = creationDate; + TenantId = tenantId; + HockeyAppId = hockeyAppId; + HockeyAppToken = hockeyAppToken; + ProvisioningState = provisioningState; + SamplingPercentage = samplingPercentage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of application that this component refers to, + /// used to customize UI. This value is a freeform string, values + /// should typically be one of the following: web, ios, other, store, + /// java, phone. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets the unique ID of your application. This field mirrors the + /// 'Name' field and cannot be changed. + /// + [JsonProperty(PropertyName = "properties.ApplicationId")] + public string ApplicationId { get; private set; } + + /// + /// Gets application Insights Unique ID for your Application. + /// + [JsonProperty(PropertyName = "properties.AppId")] + public string AppId { get; private set; } + + /// + /// Gets or sets type of application being monitored. Possible values + /// include: 'web', 'other' + /// + [JsonProperty(PropertyName = "properties.Application_Type")] + public string ApplicationType { get; set; } + + /// + /// Gets or sets used by the Application Insights system to determine + /// what kind of flow this component was created by. This is to be set + /// to 'Bluefield' when creating/updating a component via the REST API. + /// Possible values include: 'Bluefield' + /// + [JsonProperty(PropertyName = "properties.Flow_Type")] + public string FlowType { get; set; } + + /// + /// Gets or sets describes what tool created this Application Insights + /// component. Customers using this API should set this to the default + /// 'rest'. Possible values include: 'rest' + /// + [JsonProperty(PropertyName = "properties.Request_Source")] + public string RequestSource { get; set; } + + /// + /// Gets application Insights Instrumentation key. A read-only value + /// that applications can use to identify the destination for all + /// telemetry sent to Azure Application Insights. This value will be + /// supplied upon construction of each new Application Insights + /// component. + /// + [JsonProperty(PropertyName = "properties.InstrumentationKey")] + public string InstrumentationKey { get; private set; } + + /// + /// Gets creation Date for the Application Insights component, in ISO + /// 8601 format. + /// + [JsonProperty(PropertyName = "properties.CreationDate")] + public System.DateTime? CreationDate { get; private set; } + + /// + /// Gets azure Tenant Id. + /// + [JsonProperty(PropertyName = "properties.TenantId")] + public string TenantId { get; private set; } + + /// + /// Gets or sets the unique application ID created when a new + /// application is added to HockeyApp, used for communications with + /// HockeyApp. + /// + [JsonProperty(PropertyName = "properties.HockeyAppId")] + public string HockeyAppId { get; set; } + + /// + /// Gets token used to authenticate communications with between + /// Application Insights and HockeyApp. + /// + [JsonProperty(PropertyName = "properties.HockeyAppToken")] + public string HockeyAppToken { get; private set; } + + /// + /// Gets current state of this component: whether or not is has been + /// provisioned within the resource group it is defined. Users cannot + /// change this value but are able to read from it. Values will include + /// Succeeded, Deploying, Canceled, and Failed. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets percentage of the data produced by the application + /// being monitored that is being sampled for Application Insights + /// telemetry. + /// + [JsonProperty(PropertyName = "properties.SamplingPercentage")] + public double? SamplingPercentage { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + if (ApplicationType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ApplicationType"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs new file mode 100644 index 000000000000..b898c2527e28 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAPIKey.cs @@ -0,0 +1,102 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties that define an API key of an Application Insights Component. + /// + public partial class ApplicationInsightsComponentAPIKey + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAPIKey class. + /// + public ApplicationInsightsComponentAPIKey() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAPIKey class. + /// + /// The unique ID of the API key inside an Application + /// Insights component. It is auto generated when the API key is + /// created. + /// The API key value. It will be only return once + /// when the API Key was created. + /// The create date of this API key. + /// The name of the API key. + /// The read access rights of this + /// API Key. + /// The write access rights of this + /// API Key. + public ApplicationInsightsComponentAPIKey(string id = default(string), string apiKey = default(string), string createdDate = default(string), string name = default(string), IList linkedReadProperties = default(IList), IList linkedWriteProperties = default(IList)) + { + Id = id; + ApiKey = apiKey; + CreatedDate = createdDate; + Name = name; + LinkedReadProperties = linkedReadProperties; + LinkedWriteProperties = linkedWriteProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique ID of the API key inside an Application Insights + /// component. It is auto generated when the API key is created. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the API key value. It will be only return once when the API + /// Key was created. + /// + [JsonProperty(PropertyName = "apiKey")] + public string ApiKey { get; private set; } + + /// + /// Gets or sets the create date of this API key. + /// + [JsonProperty(PropertyName = "createdDate")] + public string CreatedDate { get; set; } + + /// + /// Gets or sets the name of the API key. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the read access rights of this API Key. + /// + [JsonProperty(PropertyName = "linkedReadProperties")] + public IList LinkedReadProperties { get; set; } + + /// + /// Gets or sets the write access rights of this API Key. + /// + [JsonProperty(PropertyName = "linkedWriteProperties")] + public IList LinkedWriteProperties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs new file mode 100644 index 000000000000..f4fe09df0b87 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItem.cs @@ -0,0 +1,131 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties that define an Analytics item that is associated to an + /// Application Insights component. + /// + public partial class ApplicationInsightsComponentAnalyticsItem + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAnalyticsItem class. + /// + public ApplicationInsightsComponentAnalyticsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAnalyticsItem class. + /// + /// Internally assigned unique id of the item + /// definition. + /// The user-defined name of the item. + /// The content of this item + /// This instance's version of the data model. + /// This can change as new features are added. + /// Enum indicating if this item definition is + /// owned by a specific user or is shared between all users with access + /// to the Application Insights component. Possible values include: + /// 'shared', 'user' + /// Enum indicating the type of the Analytics item. + /// Possible values include: 'query', 'function', 'folder', + /// 'recent' + /// Date and time in UTC when this item was + /// created. + /// Date and time in UTC of the last + /// modification that was made to this item. + public ApplicationInsightsComponentAnalyticsItem(string id = default(string), string name = default(string), string content = default(string), string version = default(string), string scope = default(string), string type = default(string), string timeCreated = default(string), string timeModified = default(string), ApplicationInsightsComponentAnalyticsItemProperties properties = default(ApplicationInsightsComponentAnalyticsItemProperties)) + { + Id = id; + Name = name; + Content = content; + Version = version; + Scope = scope; + Type = type; + TimeCreated = timeCreated; + TimeModified = timeModified; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets internally assigned unique id of the item definition. + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; set; } + + /// + /// Gets or sets the user-defined name of the item. + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// Gets or sets the content of this item + /// + [JsonProperty(PropertyName = "Content")] + public string Content { get; set; } + + /// + /// Gets this instance's version of the data model. This can change as + /// new features are added. + /// + [JsonProperty(PropertyName = "Version")] + public string Version { get; private set; } + + /// + /// Gets or sets enum indicating if this item definition is owned by a + /// specific user or is shared between all users with access to the + /// Application Insights component. Possible values include: 'shared', + /// 'user' + /// + [JsonProperty(PropertyName = "Scope")] + public string Scope { get; set; } + + /// + /// Gets or sets enum indicating the type of the Analytics item. + /// Possible values include: 'query', 'function', 'folder', 'recent' + /// + [JsonProperty(PropertyName = "Type")] + public string Type { get; set; } + + /// + /// Gets date and time in UTC when this item was created. + /// + [JsonProperty(PropertyName = "TimeCreated")] + public string TimeCreated { get; private set; } + + /// + /// Gets date and time in UTC of the last modification that was made to + /// this item. + /// + [JsonProperty(PropertyName = "TimeModified")] + public string TimeModified { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "Properties")] + public ApplicationInsightsComponentAnalyticsItemProperties Properties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs new file mode 100644 index 000000000000..a9eb6b1a2063 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAnalyticsItemProperties.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A set of properties that can be defined in the context of a specific + /// item type. Each type may have its own properties. + /// + public partial class ApplicationInsightsComponentAnalyticsItemProperties + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAnalyticsItemProperties class. + /// + public ApplicationInsightsComponentAnalyticsItemProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAnalyticsItemProperties class. + /// + /// A function alias, used when the type of + /// the item is Function + public ApplicationInsightsComponentAnalyticsItemProperties(string functionAlias = default(string)) + { + FunctionAlias = functionAlias; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a function alias, used when the type of the item is + /// Function + /// + [JsonProperty(PropertyName = "functionAlias")] + public string FunctionAlias { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs new file mode 100644 index 000000000000..2c0aa2d8411c --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentAvailableFeatures.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component available features. + /// + public partial class ApplicationInsightsComponentAvailableFeatures + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAvailableFeatures class. + /// + public ApplicationInsightsComponentAvailableFeatures() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentAvailableFeatures class. + /// + /// A list of Application Insights component + /// feature. + public ApplicationInsightsComponentAvailableFeatures(IList result = default(IList)) + { + Result = result; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a list of Application Insights component feature. + /// + [JsonProperty(PropertyName = "Result")] + public IList Result { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs new file mode 100644 index 000000000000..27c4f3f8b9a0 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs @@ -0,0 +1,69 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component billing features + /// + public partial class ApplicationInsightsComponentBillingFeatures + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentBillingFeatures class. + /// + public ApplicationInsightsComponentBillingFeatures() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentBillingFeatures class. + /// + /// An Application Insights component daily + /// data volume cap + /// Current enabled pricing plan. + /// When the component is in the Enterprise plan, this will list both + /// 'Basic' and 'Application Insights Enterprise'. + public ApplicationInsightsComponentBillingFeatures(ApplicationInsightsComponentDataVolumeCap dataVolumeCap = default(ApplicationInsightsComponentDataVolumeCap), IList currentBillingFeatures = default(IList)) + { + DataVolumeCap = dataVolumeCap; + CurrentBillingFeatures = currentBillingFeatures; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an Application Insights component daily data volume + /// cap + /// + [JsonProperty(PropertyName = "DataVolumeCap")] + public ApplicationInsightsComponentDataVolumeCap DataVolumeCap { get; set; } + + /// + /// Gets or sets current enabled pricing plan. When the component is in + /// the Enterprise plan, this will list both 'Basic' and 'Application + /// Insights Enterprise'. + /// + [JsonProperty(PropertyName = "CurrentBillingFeatures")] + public IList CurrentBillingFeatures { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs new file mode 100644 index 000000000000..8492b7665344 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs @@ -0,0 +1,99 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component daily data volume cap + /// + public partial class ApplicationInsightsComponentDataVolumeCap + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentDataVolumeCap class. + /// + public ApplicationInsightsComponentDataVolumeCap() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentDataVolumeCap class. + /// + /// Daily data volume cap in GB. + /// Daily data volume cap UTC reset + /// hour. + /// Reserved, not used for now. + /// Reserved, not + /// used for now. + /// Do not send a + /// notification email when the daily data volume cap is met. + /// Maximum daily data volume cap that the + /// user can set for this component. + public ApplicationInsightsComponentDataVolumeCap(double? cap = default(double?), int? resetTime = default(int?), int? warningThreshold = default(int?), bool? stopSendNotificationWhenHitThreshold = default(bool?), bool? stopSendNotificationWhenHitCap = default(bool?), double? maxHistoryCap = default(double?)) + { + Cap = cap; + ResetTime = resetTime; + WarningThreshold = warningThreshold; + StopSendNotificationWhenHitThreshold = stopSendNotificationWhenHitThreshold; + StopSendNotificationWhenHitCap = stopSendNotificationWhenHitCap; + MaxHistoryCap = maxHistoryCap; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets daily data volume cap in GB. + /// + [JsonProperty(PropertyName = "Cap")] + public double? Cap { get; set; } + + /// + /// Gets daily data volume cap UTC reset hour. + /// + [JsonProperty(PropertyName = "ResetTime")] + public int? ResetTime { get; private set; } + + /// + /// Gets or sets reserved, not used for now. + /// + [JsonProperty(PropertyName = "WarningThreshold")] + public int? WarningThreshold { get; set; } + + /// + /// Gets or sets reserved, not used for now. + /// + [JsonProperty(PropertyName = "StopSendNotificationWhenHitThreshold")] + public bool? StopSendNotificationWhenHitThreshold { get; set; } + + /// + /// Gets or sets do not send a notification email when the daily data + /// volume cap is met. + /// + [JsonProperty(PropertyName = "StopSendNotificationWhenHitCap")] + public bool? StopSendNotificationWhenHitCap { get; set; } + + /// + /// Gets maximum daily data volume cap that the user can set for this + /// component. + /// + [JsonProperty(PropertyName = "MaxHistoryCap")] + public double? MaxHistoryCap { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs new file mode 100644 index 000000000000..f72147caec09 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs @@ -0,0 +1,234 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties that define a Continuous Export configuration. + /// + public partial class ApplicationInsightsComponentExportConfiguration + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentExportConfiguration class. + /// + public ApplicationInsightsComponentExportConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentExportConfiguration class. + /// + /// The unique ID of the export configuration + /// inside an Application Insights component. It is auto generated when + /// the Continuous Export configuration is created. + /// The instrumentation key of the + /// Application Insights component. + /// This comma separated list of document + /// types that will be exported. The possible values include + /// 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', + /// 'PageViewPerformance', 'Rdd', 'PerformanceCounters', + /// 'Availability', 'Messages'. + /// The name of the Application Insights + /// component. + /// The subscription of the Application + /// Insights component. + /// The resource group of the Application + /// Insights component. + /// The destination + /// storage account subscription ID. + /// The destination account + /// location ID. + /// The name of destination + /// account. + /// The destination type. + /// This will be 'true' if the Continuous + /// Export configuration is enabled, otherwise it will be + /// 'false'. + /// Last time the Continuous Export + /// configuration was updated. + /// Deprecated + /// This indicates current Continuous Export + /// configuration status. The possible values are 'Preparing', + /// 'Success', 'Failure'. + /// The last time data was successfully + /// delivered to the destination storage container for this Continuous + /// Export configuration. + /// The last time the Continuous Export + /// configuration started failing. + /// This is the reason the + /// Continuous Export configuration started failing. It can be + /// 'AzureStorageNotFound' or 'AzureStorageAccessDenied'. + /// The name of the destination storage + /// account. + /// The name of the destination storage + /// container. + public ApplicationInsightsComponentExportConfiguration(string exportId = default(string), string instrumentationKey = default(string), string recordTypes = default(string), string applicationName = default(string), string subscriptionId = default(string), string resourceGroup = default(string), string destinationStorageSubscriptionId = default(string), string destinationStorageLocationId = default(string), string destinationAccountId = default(string), string destinationType = default(string), string isUserEnabled = default(string), string lastUserUpdate = default(string), string notificationQueueEnabled = default(string), string exportStatus = default(string), string lastSuccessTime = default(string), string lastGapTime = default(string), string permanentErrorReason = default(string), string storageName = default(string), string containerName = default(string)) + { + ExportId = exportId; + InstrumentationKey = instrumentationKey; + RecordTypes = recordTypes; + ApplicationName = applicationName; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + DestinationStorageSubscriptionId = destinationStorageSubscriptionId; + DestinationStorageLocationId = destinationStorageLocationId; + DestinationAccountId = destinationAccountId; + DestinationType = destinationType; + IsUserEnabled = isUserEnabled; + LastUserUpdate = lastUserUpdate; + NotificationQueueEnabled = notificationQueueEnabled; + ExportStatus = exportStatus; + LastSuccessTime = lastSuccessTime; + LastGapTime = lastGapTime; + PermanentErrorReason = permanentErrorReason; + StorageName = storageName; + ContainerName = containerName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the unique ID of the export configuration inside an + /// Application Insights component. It is auto generated when the + /// Continuous Export configuration is created. + /// + [JsonProperty(PropertyName = "ExportId")] + public string ExportId { get; private set; } + + /// + /// Gets the instrumentation key of the Application Insights component. + /// + [JsonProperty(PropertyName = "InstrumentationKey")] + public string InstrumentationKey { get; private set; } + + /// + /// Gets or sets this comma separated list of document types that will + /// be exported. The possible values include 'Requests', 'Event', + /// 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + /// 'PerformanceCounters', 'Availability', 'Messages'. + /// + [JsonProperty(PropertyName = "RecordTypes")] + public string RecordTypes { get; set; } + + /// + /// Gets the name of the Application Insights component. + /// + [JsonProperty(PropertyName = "ApplicationName")] + public string ApplicationName { get; private set; } + + /// + /// Gets the subscription of the Application Insights component. + /// + [JsonProperty(PropertyName = "SubscriptionId")] + public string SubscriptionId { get; private set; } + + /// + /// Gets the resource group of the Application Insights component. + /// + [JsonProperty(PropertyName = "ResourceGroup")] + public string ResourceGroup { get; private set; } + + /// + /// Gets the destination storage account subscription ID. + /// + [JsonProperty(PropertyName = "DestinationStorageSubscriptionId")] + public string DestinationStorageSubscriptionId { get; private set; } + + /// + /// Gets the destination account location ID. + /// + [JsonProperty(PropertyName = "DestinationStorageLocationId")] + public string DestinationStorageLocationId { get; private set; } + + /// + /// Gets the name of destination account. + /// + [JsonProperty(PropertyName = "DestinationAccountId")] + public string DestinationAccountId { get; private set; } + + /// + /// Gets the destination type. + /// + [JsonProperty(PropertyName = "DestinationType")] + public string DestinationType { get; private set; } + + /// + /// Gets this will be 'true' if the Continuous Export configuration is + /// enabled, otherwise it will be 'false'. + /// + [JsonProperty(PropertyName = "IsUserEnabled")] + public string IsUserEnabled { get; private set; } + + /// + /// Gets last time the Continuous Export configuration was updated. + /// + [JsonProperty(PropertyName = "LastUserUpdate")] + public string LastUserUpdate { get; private set; } + + /// + /// Gets or sets deprecated + /// + [JsonProperty(PropertyName = "NotificationQueueEnabled")] + public string NotificationQueueEnabled { get; set; } + + /// + /// Gets this indicates current Continuous Export configuration status. + /// The possible values are 'Preparing', 'Success', 'Failure'. + /// + [JsonProperty(PropertyName = "ExportStatus")] + public string ExportStatus { get; private set; } + + /// + /// Gets the last time data was successfully delivered to the + /// destination storage container for this Continuous Export + /// configuration. + /// + [JsonProperty(PropertyName = "LastSuccessTime")] + public string LastSuccessTime { get; private set; } + + /// + /// Gets the last time the Continuous Export configuration started + /// failing. + /// + [JsonProperty(PropertyName = "LastGapTime")] + public string LastGapTime { get; private set; } + + /// + /// Gets this is the reason the Continuous Export configuration started + /// failing. It can be 'AzureStorageNotFound' or + /// 'AzureStorageAccessDenied'. + /// + [JsonProperty(PropertyName = "PermanentErrorReason")] + public string PermanentErrorReason { get; private set; } + + /// + /// Gets the name of the destination storage account. + /// + [JsonProperty(PropertyName = "StorageName")] + public string StorageName { get; private set; } + + /// + /// Gets the name of the destination storage container. + /// + [JsonProperty(PropertyName = "ContainerName")] + public string ContainerName { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs new file mode 100644 index 000000000000..103e9334fde2 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentExportRequest.cs @@ -0,0 +1,134 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component Continuous Export configuration + /// request definition. + /// + public partial class ApplicationInsightsComponentExportRequest + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentExportRequest class. + /// + public ApplicationInsightsComponentExportRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentExportRequest class. + /// + /// The document types to be exported, as + /// comma separated values. Allowed values include 'Requests', 'Event', + /// 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + /// 'PerformanceCounters', 'Availability', 'Messages'. + /// The Continuous Export destination + /// type. This has to be 'Blob'. + /// The SAS URL for the destination + /// storage container. It must grant write permission. + /// Set to 'true' to create a Continuous Export + /// configuration as enabled, otherwise set it to 'false'. + /// Deprecated + /// Deprecated + /// The subscription ID + /// of the destination storage container. + /// The location ID of the + /// destination storage container. + /// The name of destination storage + /// account. + public ApplicationInsightsComponentExportRequest(string recordTypes = default(string), string destinationType = default(string), string destinationAddress = default(string), string isEnabled = default(string), string notificationQueueEnabled = default(string), string notificationQueueUri = default(string), string destinationStorageSubscriptionId = default(string), string destinationStorageLocationId = default(string), string destinationAccountId = default(string)) + { + RecordTypes = recordTypes; + DestinationType = destinationType; + DestinationAddress = destinationAddress; + IsEnabled = isEnabled; + NotificationQueueEnabled = notificationQueueEnabled; + NotificationQueueUri = notificationQueueUri; + DestinationStorageSubscriptionId = destinationStorageSubscriptionId; + DestinationStorageLocationId = destinationStorageLocationId; + DestinationAccountId = destinationAccountId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the document types to be exported, as comma separated + /// values. Allowed values include 'Requests', 'Event', 'Exceptions', + /// 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + /// 'PerformanceCounters', 'Availability', 'Messages'. + /// + [JsonProperty(PropertyName = "RecordTypes")] + public string RecordTypes { get; set; } + + /// + /// Gets or sets the Continuous Export destination type. This has to be + /// 'Blob'. + /// + [JsonProperty(PropertyName = "DestinationType")] + public string DestinationType { get; set; } + + /// + /// Gets or sets the SAS URL for the destination storage container. It + /// must grant write permission. + /// + [JsonProperty(PropertyName = "DestinationAddress")] + public string DestinationAddress { get; set; } + + /// + /// Gets or sets set to 'true' to create a Continuous Export + /// configuration as enabled, otherwise set it to 'false'. + /// + [JsonProperty(PropertyName = "IsEnabled")] + public string IsEnabled { get; set; } + + /// + /// Gets or sets deprecated + /// + [JsonProperty(PropertyName = "NotificationQueueEnabled")] + public string NotificationQueueEnabled { get; set; } + + /// + /// Gets or sets deprecated + /// + [JsonProperty(PropertyName = "NotificationQueueUri")] + public string NotificationQueueUri { get; set; } + + /// + /// Gets or sets the subscription ID of the destination storage + /// container. + /// + [JsonProperty(PropertyName = "DestinationStorageSubscriptionId")] + public string DestinationStorageSubscriptionId { get; set; } + + /// + /// Gets or sets the location ID of the destination storage container. + /// + [JsonProperty(PropertyName = "DestinationStorageLocationId")] + public string DestinationStorageLocationId { get; set; } + + /// + /// Gets or sets the name of destination storage account. + /// + [JsonProperty(PropertyName = "DestinationAccountId")] + public string DestinationAccountId { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs new file mode 100644 index 000000000000..8356da1aa70d --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFavorite.cs @@ -0,0 +1,162 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties that define a favorite that is associated to an Application + /// Insights component. + /// + public partial class ApplicationInsightsComponentFavorite + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFavorite class. + /// + public ApplicationInsightsComponentFavorite() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFavorite class. + /// + /// The user-defined name of the favorite. + /// Configuration of this particular favorite, + /// which are driven by the Azure portal UX. Configuration data is a + /// string containing valid JSON + /// This instance's version of the data model. + /// This can change as new features are added that can be marked + /// favorite. Current examples include MetricsExplorer (ME) and + /// Search. + /// Internally assigned unique id of the + /// favorite definition. + /// Enum indicating if this favorite + /// definition is owned by a specific user or is shared between all + /// users with access to the Application Insights component. Possible + /// values include: 'shared', 'user' + /// The source of the favorite + /// definition. + /// Date and time in UTC of the last + /// modification that was made to this favorite definition. + /// A list of 0 or more tags that are associated + /// with this favorite definition + /// Favorite category, as defined by the user at + /// creation time. + /// Flag denoting wether or not + /// this favorite was generated from a template. + /// Unique user id of the specific user that owns + /// this favorite. + public ApplicationInsightsComponentFavorite(string name = default(string), string config = default(string), string version = default(string), string favoriteId = default(string), FavoriteType? favoriteType = default(FavoriteType?), string sourceType = default(string), string timeModified = default(string), IList tags = default(IList), string category = default(string), bool? isGeneratedFromTemplate = default(bool?), string userId = default(string)) + { + Name = name; + Config = config; + Version = version; + FavoriteId = favoriteId; + FavoriteType = favoriteType; + SourceType = sourceType; + TimeModified = timeModified; + Tags = tags; + Category = category; + IsGeneratedFromTemplate = isGeneratedFromTemplate; + UserId = userId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the user-defined name of the favorite. + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// Gets or sets configuration of this particular favorite, which are + /// driven by the Azure portal UX. Configuration data is a string + /// containing valid JSON + /// + [JsonProperty(PropertyName = "Config")] + public string Config { get; set; } + + /// + /// Gets or sets this instance's version of the data model. This can + /// change as new features are added that can be marked favorite. + /// Current examples include MetricsExplorer (ME) and Search. + /// + [JsonProperty(PropertyName = "Version")] + public string Version { get; set; } + + /// + /// Gets internally assigned unique id of the favorite definition. + /// + [JsonProperty(PropertyName = "FavoriteId")] + public string FavoriteId { get; private set; } + + /// + /// Gets or sets enum indicating if this favorite definition is owned + /// by a specific user or is shared between all users with access to + /// the Application Insights component. Possible values include: + /// 'shared', 'user' + /// + [JsonProperty(PropertyName = "FavoriteType")] + public FavoriteType? FavoriteType { get; set; } + + /// + /// Gets or sets the source of the favorite definition. + /// + [JsonProperty(PropertyName = "SourceType")] + public string SourceType { get; set; } + + /// + /// Gets date and time in UTC of the last modification that was made to + /// this favorite definition. + /// + [JsonProperty(PropertyName = "TimeModified")] + public string TimeModified { get; private set; } + + /// + /// Gets or sets a list of 0 or more tags that are associated with this + /// favorite definition + /// + [JsonProperty(PropertyName = "Tags")] + public IList Tags { get; set; } + + /// + /// Gets or sets favorite category, as defined by the user at creation + /// time. + /// + [JsonProperty(PropertyName = "Category")] + public string Category { get; set; } + + /// + /// Gets or sets flag denoting wether or not this favorite was + /// generated from a template. + /// + [JsonProperty(PropertyName = "IsGeneratedFromTemplate")] + public bool? IsGeneratedFromTemplate { get; set; } + + /// + /// Gets unique user id of the specific user that owns this favorite. + /// + [JsonProperty(PropertyName = "UserId")] + public string UserId { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs new file mode 100644 index 000000000000..7d779fdac849 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeature.cs @@ -0,0 +1,123 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights component daily data volume cap status + /// + public partial class ApplicationInsightsComponentFeature + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeature class. + /// + public ApplicationInsightsComponentFeature() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeature class. + /// + /// The pricing feature name. + /// The meter id used for the feature. + /// The meter rate for the feature's + /// meter. + /// Reserved, not used now. + /// Reserved, not used now. + /// A list of Application Insights component + /// feature capability. + /// Display name of the feature. + /// Whether can apply addon feature on to + /// it. + /// The add on features on main + /// feature. + public ApplicationInsightsComponentFeature(string featureName = default(string), string meterId = default(string), string meterRateFrequency = default(string), string resouceId = default(string), bool? isHidden = default(bool?), IList capabilities = default(IList), string title = default(string), bool? isMainFeature = default(bool?), string supportedAddonFeatures = default(string)) + { + FeatureName = featureName; + MeterId = meterId; + MeterRateFrequency = meterRateFrequency; + ResouceId = resouceId; + IsHidden = isHidden; + Capabilities = capabilities; + Title = title; + IsMainFeature = isMainFeature; + SupportedAddonFeatures = supportedAddonFeatures; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the pricing feature name. + /// + [JsonProperty(PropertyName = "FeatureName")] + public string FeatureName { get; private set; } + + /// + /// Gets the meter id used for the feature. + /// + [JsonProperty(PropertyName = "MeterId")] + public string MeterId { get; private set; } + + /// + /// Gets the meter rate for the feature's meter. + /// + [JsonProperty(PropertyName = "MeterRateFrequency")] + public string MeterRateFrequency { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ResouceId")] + public string ResouceId { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "IsHidden")] + public bool? IsHidden { get; private set; } + + /// + /// Gets a list of Application Insights component feature capability. + /// + [JsonProperty(PropertyName = "Capabilities")] + public IList Capabilities { get; private set; } + + /// + /// Gets display name of the feature. + /// + [JsonProperty(PropertyName = "Title")] + public string Title { get; private set; } + + /// + /// Gets whether can apply addon feature on to it. + /// + [JsonProperty(PropertyName = "IsMainFeature")] + public bool? IsMainFeature { get; private set; } + + /// + /// Gets the add on features on main feature. + /// + [JsonProperty(PropertyName = "SupportedAddonFeatures")] + public string SupportedAddonFeatures { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs new file mode 100644 index 000000000000..5a7b1dcbf1f2 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapabilities.cs @@ -0,0 +1,178 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component feature capabilities + /// + public partial class ApplicationInsightsComponentFeatureCapabilities + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeatureCapabilities class. + /// + public ApplicationInsightsComponentFeatureCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeatureCapabilities class. + /// + /// Whether allow to use continuous + /// export feature. + /// Reserved, not used now. + /// Reserved, not used now. + /// Reserved, not used now. + /// Reserved, not used now. + /// Whether allow to use work item + /// integration feature. + /// Reserved, not used now. + /// Reserved, not used now. + /// Reserved, not used now. + /// Reserved, not used now. + /// Whether allow to use multiple + /// steps web test feature. + /// Reserved, not used now. + /// The application insights component used + /// tracking type. + /// Daily data volume cap in GB. + /// Daily data volume cap UTC reset + /// hour. + /// Reserved, not used now. + public ApplicationInsightsComponentFeatureCapabilities(bool? supportExportData = default(bool?), string burstThrottlePolicy = default(string), string metadataClass = default(string), bool? liveStreamMetrics = default(bool?), bool? applicationMap = default(bool?), bool? workItemIntegration = default(bool?), bool? powerBIIntegration = default(bool?), bool? openSchema = default(bool?), bool? proactiveDetection = default(bool?), bool? analyticsIntegration = default(bool?), bool? multipleStepWebTest = default(bool?), string apiAccessLevel = default(string), string trackingType = default(string), double? dailyCap = default(double?), double? dailyCapResetTime = default(double?), double? throttleRate = default(double?)) + { + SupportExportData = supportExportData; + BurstThrottlePolicy = burstThrottlePolicy; + MetadataClass = metadataClass; + LiveStreamMetrics = liveStreamMetrics; + ApplicationMap = applicationMap; + WorkItemIntegration = workItemIntegration; + PowerBIIntegration = powerBIIntegration; + OpenSchema = openSchema; + ProactiveDetection = proactiveDetection; + AnalyticsIntegration = analyticsIntegration; + MultipleStepWebTest = multipleStepWebTest; + ApiAccessLevel = apiAccessLevel; + TrackingType = trackingType; + DailyCap = dailyCap; + DailyCapResetTime = dailyCapResetTime; + ThrottleRate = throttleRate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets whether allow to use continuous export feature. + /// + [JsonProperty(PropertyName = "SupportExportData")] + public bool? SupportExportData { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "BurstThrottlePolicy")] + public string BurstThrottlePolicy { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "MetadataClass")] + public string MetadataClass { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "LiveStreamMetrics")] + public bool? LiveStreamMetrics { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ApplicationMap")] + public bool? ApplicationMap { get; private set; } + + /// + /// Gets whether allow to use work item integration feature. + /// + [JsonProperty(PropertyName = "WorkItemIntegration")] + public bool? WorkItemIntegration { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "PowerBIIntegration")] + public bool? PowerBIIntegration { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "OpenSchema")] + public bool? OpenSchema { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ProactiveDetection")] + public bool? ProactiveDetection { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "AnalyticsIntegration")] + public bool? AnalyticsIntegration { get; private set; } + + /// + /// Gets whether allow to use multiple steps web test feature. + /// + [JsonProperty(PropertyName = "MultipleStepWebTest")] + public bool? MultipleStepWebTest { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ApiAccessLevel")] + public string ApiAccessLevel { get; private set; } + + /// + /// Gets the application insights component used tracking type. + /// + [JsonProperty(PropertyName = "TrackingType")] + public string TrackingType { get; private set; } + + /// + /// Gets daily data volume cap in GB. + /// + [JsonProperty(PropertyName = "DailyCap")] + public double? DailyCap { get; private set; } + + /// + /// Gets daily data volume cap UTC reset hour. + /// + [JsonProperty(PropertyName = "DailyCapResetTime")] + public double? DailyCapResetTime { get; private set; } + + /// + /// Gets reserved, not used now. + /// + [JsonProperty(PropertyName = "ThrottleRate")] + public double? ThrottleRate { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs new file mode 100644 index 000000000000..8725afb35bb5 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentFeatureCapability.cs @@ -0,0 +1,95 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component feature capability + /// + public partial class ApplicationInsightsComponentFeatureCapability + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeatureCapability class. + /// + public ApplicationInsightsComponentFeatureCapability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentFeatureCapability class. + /// + /// The name of the capability. + /// The description of the + /// capability. + /// The value of the capability. + /// The unit of the capability. + /// The meter used for the capability. + /// The meter rate of the + /// meter. + public ApplicationInsightsComponentFeatureCapability(string name = default(string), string description = default(string), string value = default(string), string unit = default(string), string meterId = default(string), string meterRateFrequency = default(string)) + { + Name = name; + Description = description; + Value = value; + Unit = unit; + MeterId = meterId; + MeterRateFrequency = meterRateFrequency; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the capability. + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; private set; } + + /// + /// Gets the description of the capability. + /// + [JsonProperty(PropertyName = "Description")] + public string Description { get; private set; } + + /// + /// Gets the value of the capability. + /// + [JsonProperty(PropertyName = "Value")] + public string Value { get; private set; } + + /// + /// Gets the unit of the capability. + /// + [JsonProperty(PropertyName = "Unit")] + public string Unit { get; private set; } + + /// + /// Gets the meter used for the capability. + /// + [JsonProperty(PropertyName = "MeterId")] + public string MeterId { get; private set; } + + /// + /// Gets the meter rate of the meter. + /// + [JsonProperty(PropertyName = "MeterRateFrequency")] + public string MeterRateFrequency { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs new file mode 100644 index 000000000000..5b5eb49a6b8e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfiguration.cs @@ -0,0 +1,107 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties that define a ProactiveDetection configuration. + /// + public partial class ApplicationInsightsComponentProactiveDetectionConfiguration : IResource + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentProactiveDetectionConfiguration class. + /// + public ApplicationInsightsComponentProactiveDetectionConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentProactiveDetectionConfiguration class. + /// + /// The rule name + /// A flag that indicates whether this rule is + /// enabled by the user + /// A flag that indicated + /// whether notifications on this rule should be sent to subscription + /// owners + /// Custom email addresses for this rule + /// notifications + /// The last time this rule was + /// updated + /// Static definitions of the + /// ProactiveDetection configuration rule (same values for all + /// components). + public ApplicationInsightsComponentProactiveDetectionConfiguration(string name = default(string), bool? enabled = default(bool?), bool? sendEmailsToSubscriptionOwners = default(bool?), IList customEmails = default(IList), string lastUpdatedTime = default(string), ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions ruleDefinitions = default(ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions)) + { + Name = name; + Enabled = enabled; + SendEmailsToSubscriptionOwners = sendEmailsToSubscriptionOwners; + CustomEmails = customEmails; + LastUpdatedTime = lastUpdatedTime; + RuleDefinitions = ruleDefinitions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rule name + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// Gets or sets a flag that indicates whether this rule is enabled by + /// the user + /// + [JsonProperty(PropertyName = "Enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets a flag that indicated whether notifications on this + /// rule should be sent to subscription owners + /// + [JsonProperty(PropertyName = "SendEmailsToSubscriptionOwners")] + public bool? SendEmailsToSubscriptionOwners { get; set; } + + /// + /// Gets or sets custom email addresses for this rule notifications + /// + [JsonProperty(PropertyName = "CustomEmails")] + public IList CustomEmails { get; set; } + + /// + /// Gets or sets the last time this rule was updated + /// + [JsonProperty(PropertyName = "LastUpdatedTime")] + public string LastUpdatedTime { get; set; } + + /// + /// Gets or sets static definitions of the ProactiveDetection + /// configuration rule (same values for all components). + /// + [JsonProperty(PropertyName = "RuleDefinitions")] + public ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions RuleDefinitions { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs new file mode 100644 index 000000000000..7fe4fe181470 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions.cs @@ -0,0 +1,123 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Static definitions of the ProactiveDetection configuration rule (same + /// values for all components). + /// + public partial class ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + /// class. + /// + public ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + /// class. + /// + /// The rule name + /// The rule name as it is displayed in + /// UI + /// The rule description + /// URL which displays additional info about the + /// proactive detection rule + /// A flag indicating whether the rule is hidden + /// (from the UI) + /// A flag indicating whether the rule + /// is enabled by default + /// A flag indicating whether the rule is in + /// preview + /// A flag indicating whether + /// email notifications are supported for detections for this + /// rule + public ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions(string name = default(string), string displayName = default(string), string description = default(string), string helpUrl = default(string), bool? isHidden = default(bool?), bool? isEnabledByDefault = default(bool?), bool? isInPreview = default(bool?), bool? supportsEmailNotifications = default(bool?)) + { + Name = name; + DisplayName = displayName; + Description = description; + HelpUrl = helpUrl; + IsHidden = isHidden; + IsEnabledByDefault = isEnabledByDefault; + IsInPreview = isInPreview; + SupportsEmailNotifications = supportsEmailNotifications; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the rule name + /// + [JsonProperty(PropertyName = "Name")] + public string Name { get; set; } + + /// + /// Gets or sets the rule name as it is displayed in UI + /// + [JsonProperty(PropertyName = "DisplayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the rule description + /// + [JsonProperty(PropertyName = "Description")] + public string Description { get; set; } + + /// + /// Gets or sets URL which displays additional info about the proactive + /// detection rule + /// + [JsonProperty(PropertyName = "HelpUrl")] + public string HelpUrl { get; set; } + + /// + /// Gets or sets a flag indicating whether the rule is hidden (from the + /// UI) + /// + [JsonProperty(PropertyName = "IsHidden")] + public bool? IsHidden { get; set; } + + /// + /// Gets or sets a flag indicating whether the rule is enabled by + /// default + /// + [JsonProperty(PropertyName = "IsEnabledByDefault")] + public bool? IsEnabledByDefault { get; set; } + + /// + /// Gets or sets a flag indicating whether the rule is in preview + /// + [JsonProperty(PropertyName = "IsInPreview")] + public bool? IsInPreview { get; set; } + + /// + /// Gets or sets a flag indicating whether email notifications are + /// supported for detections for this rule + /// + [JsonProperty(PropertyName = "SupportsEmailNotifications")] + public bool? SupportsEmailNotifications { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs new file mode 100644 index 000000000000..8fe7951dc36e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs @@ -0,0 +1,74 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An Application Insights component daily data volume cap status + /// + public partial class ApplicationInsightsComponentQuotaStatus + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentQuotaStatus class. + /// + public ApplicationInsightsComponentQuotaStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentQuotaStatus class. + /// + /// The Application ID for the Application Insights + /// component. + /// The daily data volume cap is met, + /// and data ingestion will be stopped. + /// Date and time when the daily data + /// volume cap will be reset, and data ingestion will resume. + public ApplicationInsightsComponentQuotaStatus(string appId = default(string), bool? shouldBeThrottled = default(bool?), string expirationTime = default(string)) + { + AppId = appId; + ShouldBeThrottled = shouldBeThrottled; + ExpirationTime = expirationTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the Application ID for the Application Insights component. + /// + [JsonProperty(PropertyName = "AppId")] + public string AppId { get; private set; } + + /// + /// Gets the daily data volume cap is met, and data ingestion will be + /// stopped. + /// + [JsonProperty(PropertyName = "ShouldBeThrottled")] + public bool? ShouldBeThrottled { get; private set; } + + /// + /// Gets date and time when the daily data volume cap will be reset, + /// and data ingestion will resume. + /// + [JsonProperty(PropertyName = "ExpirationTime")] + public string ExpirationTime { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs new file mode 100644 index 000000000000..896db3859aba --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationInsightsComponentWebTestLocation.cs @@ -0,0 +1,64 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties that define a web test location available to an Application + /// Insights Component. + /// + public partial class ApplicationInsightsComponentWebTestLocation + { + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentWebTestLocation class. + /// + public ApplicationInsightsComponentWebTestLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ApplicationInsightsComponentWebTestLocation class. + /// + /// The display name of the web test + /// location. + /// Internally defined geographic location + /// tag. + public ApplicationInsightsComponentWebTestLocation(string displayName = default(string), string tag = default(string)) + { + DisplayName = displayName; + Tag = tag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the display name of the web test location. + /// + [JsonProperty(PropertyName = "DisplayName")] + public string DisplayName { get; private set; } + + /// + /// Gets internally defined geographic location tag. + /// + [JsonProperty(PropertyName = "Tag")] + public string Tag { get; private set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsAggregation.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationType.cs similarity index 50% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsAggregation.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationType.cs index c667cc0575b3..d381307a1069 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsAggregation.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ApplicationType.cs @@ -8,19 +8,15 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { /// - /// Defines values for MetricsAggregation. + /// Defines values for ApplicationType. /// - public static class MetricsAggregation + public static class ApplicationType { - public const string Min = "min"; - public const string Max = "max"; - public const string Avg = "avg"; - public const string Sum = "sum"; - public const string Count = "count"; - public const string Unique = "unique"; + public const string Web = "web"; + public const string Other = "other"; } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/CategoryType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/CategoryType.cs new file mode 100644 index 000000000000..9f20ace2fd37 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/CategoryType.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for CategoryType. + /// + public static class CategoryType + { + public const string Workbook = "workbook"; + public const string TSG = "TSG"; + public const string Performance = "performance"; + public const string Retention = "retention"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultsItem.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs similarity index 50% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultsItem.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs index 4854ca18c285..4d5d7af33f6f 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultsItem.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBody.cs @@ -8,34 +8,37 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; - public partial class MetricsResultsItem + /// + /// Describes the body of a purge request for an App Insights component + /// + public partial class ComponentPurgeBody { /// - /// Initializes a new instance of the MetricsResultsItem class. + /// Initializes a new instance of the ComponentPurgeBody class. /// - public MetricsResultsItem() + public ComponentPurgeBody() { CustomInit(); } /// - /// Initializes a new instance of the MetricsResultsItem class. + /// Initializes a new instance of the ComponentPurgeBody class. /// - /// The specified ID for this metric. - /// The HTTP status code of this metric - /// query. - /// The results of this metric query. - public MetricsResultsItem(string id, int status, MetricsResult body) + /// Table from which to purge data. + /// The set of columns and filters (queries) to + /// run over them to purge the resulting data. + public ComponentPurgeBody(string table, IList filters) { - Id = id; - Status = status; - Body = body; + Table = table; + Filters = filters; CustomInit(); } @@ -45,22 +48,17 @@ public MetricsResultsItem(string id, int status, MetricsResult body) partial void CustomInit(); /// - /// Gets or sets the specified ID for this metric. + /// Gets or sets table from which to purge data. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "table")] + public string Table { get; set; } /// - /// Gets or sets the HTTP status code of this metric query. + /// Gets or sets the set of columns and filters (queries) to run over + /// them to purge the resulting data. /// - [JsonProperty(PropertyName = "status")] - public int Status { get; set; } - - /// - /// Gets or sets the results of this metric query. - /// - [JsonProperty(PropertyName = "body")] - public MetricsResult Body { get; set; } + [JsonProperty(PropertyName = "filters")] + public IList Filters { get; set; } /// /// Validate the object. @@ -70,13 +68,13 @@ public MetricsResultsItem(string id, int status, MetricsResult body) /// public virtual void Validate() { - if (Id == null) + if (Table == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); + throw new ValidationException(ValidationRules.CannotBeNull, "Table"); } - if (Body == null) + if (Filters == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Body"); + throw new ValidationException(ValidationRules.CannotBeNull, "Filters"); } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs new file mode 100644 index 000000000000..83c4c5781afa --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeBodyFilters.cs @@ -0,0 +1,90 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User-defined filters to return data which will be purged from the + /// table. + /// + public partial class ComponentPurgeBodyFilters + { + /// + /// Initializes a new instance of the ComponentPurgeBodyFilters class. + /// + public ComponentPurgeBodyFilters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComponentPurgeBodyFilters class. + /// + /// The column of the table over which the given + /// query should run + /// A query operator to evaluate over + /// the provided column and value(s). Supported operators are ==, =~, + /// in, in~, >, >=, <, <=, between, and have the same + /// behavior as they would in a KQL query. + /// the value for the operator to function over. + /// This can be a number (e.g., > 100), a string (timestamp >= + /// '2017-09-01') or array of values. + /// When filtering over custom dimensions, this key + /// will be used as the name of the custom dimension. + public ComponentPurgeBodyFilters(string column = default(string), string operatorProperty = default(string), object value = default(object), string key = default(string)) + { + Column = column; + OperatorProperty = operatorProperty; + Value = value; + Key = key; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the column of the table over which the given query + /// should run + /// + [JsonProperty(PropertyName = "column")] + public string Column { get; set; } + + /// + /// Gets or sets a query operator to evaluate over the provided column + /// and value(s). Supported operators are ==, =~, in, in~, &gt;, + /// &gt;=, &lt;, &lt;=, between, and have the same behavior + /// as they would in a KQL query. + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets the value for the operator to function over. This can + /// be a number (e.g., &gt; 100), a string (timestamp &gt;= + /// '2017-09-01') or array of values. + /// + [JsonProperty(PropertyName = "value")] + public object Value { get; set; } + + /// + /// Gets or sets when filtering over custom dimensions, this key will + /// be used as the name of the custom dimension. + /// + [JsonProperty(PropertyName = "key")] + public string Key { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryResults.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs similarity index 52% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryResults.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs index 6499270222b3..1a73a04e91af 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryResults.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeResponse.cs @@ -8,37 +8,33 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Microsoft.Rest; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// A query response. + /// Response containing operationId for a specific purge action. /// - /// - /// Contains the tables, columns & rows resulting from a query. - /// - public partial class QueryResults + public partial class ComponentPurgeResponse { /// - /// Initializes a new instance of the QueryResults class. + /// Initializes a new instance of the ComponentPurgeResponse class. /// - public QueryResults() + public ComponentPurgeResponse() { CustomInit(); } /// - /// Initializes a new instance of the QueryResults class. + /// Initializes a new instance of the ComponentPurgeResponse class. /// - /// The list of tables, columns and rows. - public QueryResults(IList tables) + /// Id to use when querying for status for a + /// particular purge operation. + public ComponentPurgeResponse(string operationId) { - Tables = tables; + OperationId = operationId; CustomInit(); } @@ -48,10 +44,11 @@ public QueryResults(IList
tables) partial void CustomInit(); /// - /// Gets or sets the list of tables, columns and rows. + /// Gets or sets id to use when querying for status for a particular + /// purge operation. /// - [JsonProperty(PropertyName = "tables")] - public IList
Tables { get; set; } + [JsonProperty(PropertyName = "operationId")] + public string OperationId { get; set; } /// /// Validate the object. @@ -61,19 +58,9 @@ public QueryResults(IList
tables) /// public virtual void Validate() { - if (Tables == null) + if (OperationId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Tables"); - } - if (Tables != null) - { - foreach (var element in Tables) - { - if (element != null) - { - element.Validate(); - } - } + throw new ValidationException(ValidationRules.CannotBeNull, "OperationId"); } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs new file mode 100644 index 000000000000..a5be50fb1bdd --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentPurgeStatusResponse.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Response containing status for a specific purge operation. + /// + public partial class ComponentPurgeStatusResponse + { + /// + /// Initializes a new instance of the ComponentPurgeStatusResponse + /// class. + /// + public ComponentPurgeStatusResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComponentPurgeStatusResponse + /// class. + /// + /// Status of the operation represented by the + /// requested Id. Possible values include: 'pending', + /// 'completed' + public ComponentPurgeStatusResponse(string status) + { + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets status of the operation represented by the requested + /// Id. Possible values include: 'pending', 'completed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentsResource.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentsResource.cs new file mode 100644 index 000000000000..55614a169114 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ComponentsResource.cs @@ -0,0 +1,100 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class ComponentsResource : IResource + { + /// + /// Initializes a new instance of the ComponentsResource class. + /// + public ComponentsResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComponentsResource class. + /// + /// Resource location + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + public ComponentsResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorDetail.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorDetail.cs deleted file mode 100644 index cae8a394487d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorDetail.cs +++ /dev/null @@ -1,115 +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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Error details. - /// - 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's code. - /// A human readable error message. - /// Indicates which property in the request is - /// responsible for the error. - /// Indicates which value in 'target' is - /// responsible for the error. - /// Indicates resources which were responsible - /// for the error. - public ErrorDetail(string code, string message, string target = default(string), string value = default(string), IList resources = default(IList), object additionalProperties = default(object)) - { - Code = code; - Message = message; - Target = target; - Value = value; - Resources = resources; - AdditionalProperties = additionalProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the error's code. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets a human readable error message. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets indicates which property in the request is responsible - /// for the error. - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; set; } - - /// - /// Gets or sets indicates which value in 'target' is responsible for - /// the error. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets indicates resources which were responsible for the - /// error. - /// - [JsonProperty(PropertyName = "resources")] - public IList Resources { get; set; } - - /// - /// - [JsonProperty(PropertyName = "additionalProperties")] - public object AdditionalProperties { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Code == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Code"); - } - if (Message == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Message"); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorFieldContract.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorFieldContract.cs new file mode 100644 index 000000000000..b17d0fb7ef8f --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorFieldContract.cs @@ -0,0 +1,68 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error Field contract. + /// + public partial class ErrorFieldContract + { + /// + /// Initializes a new instance of the ErrorFieldContract class. + /// + public ErrorFieldContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorFieldContract class. + /// + /// Property level error code. + /// Human-readable representation of + /// property-level error. + /// Property name. + public ErrorFieldContract(string code = default(string), string message = default(string), string target = default(string)) + { + Code = code; + Message = message; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets property level error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets human-readable representation of property-level error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets property name. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorInfo.cs deleted file mode 100644 index d3b389d18f10..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorInfo.cs +++ /dev/null @@ -1,115 +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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The code and message for an error. - /// - public partial class ErrorInfo - { - /// - /// Initializes a new instance of the ErrorInfo class. - /// - public ErrorInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorInfo class. - /// - /// A machine readable error code. - /// A human readable error message. - /// error details. - /// Inner error details if they exist. - public ErrorInfo(string code, string message, IList details = default(IList), ErrorInfo innererror = default(ErrorInfo), object additionalProperties = default(object)) - { - Code = code; - Message = message; - Details = details; - Innererror = innererror; - AdditionalProperties = additionalProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a machine readable error code. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets a human readable error message. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets error details. - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } - - /// - /// Gets or sets inner error details if they exist. - /// - [JsonProperty(PropertyName = "innererror")] - public ErrorInfo Innererror { get; set; } - - /// - /// - [JsonProperty(PropertyName = "additionalProperties")] - public object AdditionalProperties { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Code == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Code"); - } - if (Message == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Message"); - } - if (Details != null) - { - foreach (var element in Details) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Innererror != null) - { - Innererror.Validate(); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponse.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponse.cs index 843ea17a4381..61da390886a7 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponse.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponse.cs @@ -8,18 +8,15 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// - /// Error details. + /// Error response indicates Insights service is not able to process the + /// incoming request. The reason is provided in the error message. /// - /// - /// Contains details when the response code indicates an error. - /// public partial class ErrorResponse { /// @@ -33,10 +30,13 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// The error details. - public ErrorResponse(ErrorInfo error) + /// Error code. + /// Error message indicating why the operation + /// failed. + public ErrorResponse(string code = default(string), string message = default(string)) { - Error = error; + Code = code; + Message = message; CustomInit(); } @@ -46,27 +46,16 @@ public ErrorResponse(ErrorInfo error) partial void CustomInit(); /// - /// Gets or sets the error details. + /// Gets or sets error code. /// - [JsonProperty(PropertyName = "error")] - public ErrorInfo Error { get; set; } + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } /// - /// Validate the object. + /// Gets or sets error message indicating why the operation failed. /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Error == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Error"); - } - if (Error != null) - { - Error.Validate(); - } - } + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponseException.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponseException.cs index d4570b52c567..494ab6ae4f2c 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponseException.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ErrorResponseException.cs @@ -8,7 +8,7 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Microsoft.Rest; diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventType.cs deleted file mode 100644 index 1f52b80aa438..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventType.cs +++ /dev/null @@ -1,31 +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.ApplicationInsights.Query.Models -{ - - /// - /// Defines values for EventType. - /// - public static class EventType - { - public const string All = "$all"; - public const string Traces = "traces"; - public const string CustomEvents = "customEvents"; - public const string PageViews = "pageViews"; - public const string BrowserTimings = "browserTimings"; - public const string Requests = "requests"; - public const string Dependencies = "dependencies"; - public const string Exceptions = "exceptions"; - public const string AvailabilityResults = "availabilityResults"; - public const string PerformanceCounters = "performanceCounters"; - public const string CustomMetrics = "customMetrics"; - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAiInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAiInfo.cs deleted file mode 100644 index 5d871ba17974..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAiInfo.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// AI related application info for an event result - /// - public partial class EventsAiInfo - { - /// - /// Initializes a new instance of the EventsAiInfo class. - /// - public EventsAiInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsAiInfo class. - /// - /// iKey of the app - /// Name of the application - /// ID of the application - /// SDK version of the application - public EventsAiInfo(string iKey = default(string), string appName = default(string), string appId = default(string), string sdkVersion = default(string)) - { - IKey = iKey; - AppName = appName; - AppId = appId; - SdkVersion = sdkVersion; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets iKey of the app - /// - [JsonProperty(PropertyName = "iKey")] - public string IKey { get; set; } - - /// - /// Gets or sets name of the application - /// - [JsonProperty(PropertyName = "appName")] - public string AppName { get; set; } - - /// - /// Gets or sets ID of the application - /// - [JsonProperty(PropertyName = "appId")] - public string AppId { get; set; } - - /// - /// Gets or sets SDK version of the application - /// - [JsonProperty(PropertyName = "sdkVersion")] - public string SdkVersion { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultInfo.cs deleted file mode 100644 index 0aac297d7413..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultInfo.cs +++ /dev/null @@ -1,114 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The availability result info - /// - public partial class EventsAvailabilityResultInfo - { - /// - /// Initializes a new instance of the EventsAvailabilityResultInfo - /// class. - /// - public EventsAvailabilityResultInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsAvailabilityResultInfo - /// class. - /// - /// The name of the availability result - /// Indicates if the availability result was - /// successful - /// The duration of the availability - /// result - /// The performance bucket of the - /// availability result - /// The message of the availability - /// result - /// The location of the availability - /// result - /// The ID of the availability result - /// The size of the availability result - public EventsAvailabilityResultInfo(string name = default(string), string success = default(string), long? duration = default(long?), string performanceBucket = default(string), string message = default(string), string location = default(string), string id = default(string), string size = default(string)) - { - Name = name; - Success = success; - Duration = duration; - PerformanceBucket = performanceBucket; - Message = message; - Location = location; - Id = id; - Size = size; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the availability result - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets indicates if the availability result was successful - /// - [JsonProperty(PropertyName = "success")] - public string Success { get; set; } - - /// - /// Gets or sets the duration of the availability result - /// - [JsonProperty(PropertyName = "duration")] - public long? Duration { get; set; } - - /// - /// Gets or sets the performance bucket of the availability result - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - /// - /// Gets or sets the message of the availability result - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets the location of the availability result - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets the ID of the availability result - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the size of the availability result - /// - [JsonProperty(PropertyName = "size")] - public string Size { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultResult.cs deleted file mode 100644 index 0dc6ebc3ac6f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsAvailabilityResultResult.cs +++ /dev/null @@ -1,67 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An availability result result - /// - [Newtonsoft.Json.JsonObject("availabilityResult")] - public partial class EventsAvailabilityResultResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsAvailabilityResultResult - /// class. - /// - public EventsAvailabilityResultResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsAvailabilityResultResult - /// class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsAvailabilityResultResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsAvailabilityResultInfo availabilityResult = default(EventsAvailabilityResultInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - AvailabilityResult = availabilityResult; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "availabilityResult")] - public EventsAvailabilityResultInfo AvailabilityResult { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingInfo.cs deleted file mode 100644 index a0e771b11ddb..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingInfo.cs +++ /dev/null @@ -1,127 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The browser timing information - /// - public partial class EventsBrowserTimingInfo - { - /// - /// Initializes a new instance of the EventsBrowserTimingInfo class. - /// - public EventsBrowserTimingInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsBrowserTimingInfo class. - /// - /// The path of the URL - /// The host of the URL - /// The name of the page - /// The url of the page - /// The total duration of the load - /// The performance bucket of the - /// load - /// The network duration of the - /// load - /// The send duration of the load - /// The receive duration of the - /// load - /// The processing duration of the - /// load - public EventsBrowserTimingInfo(string urlPath = default(string), string urlHost = default(string), string name = default(string), string url = default(string), long? totalDuration = default(long?), string performanceBucket = default(string), long? networkDuration = default(long?), long? sendDuration = default(long?), long? receiveDuration = default(long?), long? processingDuration = default(long?)) - { - UrlPath = urlPath; - UrlHost = urlHost; - Name = name; - Url = url; - TotalDuration = totalDuration; - PerformanceBucket = performanceBucket; - NetworkDuration = networkDuration; - SendDuration = sendDuration; - ReceiveDuration = receiveDuration; - ProcessingDuration = processingDuration; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the path of the URL - /// - [JsonProperty(PropertyName = "urlPath")] - public string UrlPath { get; set; } - - /// - /// Gets or sets the host of the URL - /// - [JsonProperty(PropertyName = "urlHost")] - public string UrlHost { get; set; } - - /// - /// Gets or sets the name of the page - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the url of the page - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// Gets or sets the total duration of the load - /// - [JsonProperty(PropertyName = "totalDuration")] - public long? TotalDuration { get; set; } - - /// - /// Gets or sets the performance bucket of the load - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - /// - /// Gets or sets the network duration of the load - /// - [JsonProperty(PropertyName = "networkDuration")] - public long? NetworkDuration { get; set; } - - /// - /// Gets or sets the send duration of the load - /// - [JsonProperty(PropertyName = "sendDuration")] - public long? SendDuration { get; set; } - - /// - /// Gets or sets the receive duration of the load - /// - [JsonProperty(PropertyName = "receiveDuration")] - public long? ReceiveDuration { get; set; } - - /// - /// Gets or sets the processing duration of the load - /// - [JsonProperty(PropertyName = "processingDuration")] - public long? ProcessingDuration { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingResult.cs deleted file mode 100644 index 4f1009a32542..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsBrowserTimingResult.cs +++ /dev/null @@ -1,71 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A browser timing result - /// - [Newtonsoft.Json.JsonObject("browserTiming")] - public partial class EventsBrowserTimingResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsBrowserTimingResult class. - /// - public EventsBrowserTimingResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsBrowserTimingResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsBrowserTimingResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsBrowserTimingInfo browserTiming = default(EventsBrowserTimingInfo), EventsClientPerformanceInfo clientPerformance = default(EventsClientPerformanceInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - BrowserTiming = browserTiming; - ClientPerformance = clientPerformance; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "browserTiming")] - public EventsBrowserTimingInfo BrowserTiming { get; set; } - - /// - /// - [JsonProperty(PropertyName = "clientPerformance")] - public EventsClientPerformanceInfo ClientPerformance { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientInfo.cs deleted file mode 100644 index 6858451c96a8..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientInfo.cs +++ /dev/null @@ -1,109 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Client info for an event result - /// - public partial class EventsClientInfo - { - /// - /// Initializes a new instance of the EventsClientInfo class. - /// - public EventsClientInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsClientInfo class. - /// - /// Model of the client - /// Operating system of the client - /// Type of the client - /// Browser of the client - /// IP address of the client - /// City of the client - /// State or province of the - /// client - /// Country or region of the - /// client - public EventsClientInfo(string model = default(string), string os = default(string), string type = default(string), string browser = default(string), string ip = default(string), string city = default(string), string stateOrProvince = default(string), string countryOrRegion = default(string)) - { - Model = model; - Os = os; - Type = type; - Browser = browser; - Ip = ip; - City = city; - StateOrProvince = stateOrProvince; - CountryOrRegion = countryOrRegion; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets model of the client - /// - [JsonProperty(PropertyName = "model")] - public string Model { get; set; } - - /// - /// Gets or sets operating system of the client - /// - [JsonProperty(PropertyName = "os")] - public string Os { get; set; } - - /// - /// Gets or sets type of the client - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets browser of the client - /// - [JsonProperty(PropertyName = "browser")] - public string Browser { get; set; } - - /// - /// Gets or sets IP address of the client - /// - [JsonProperty(PropertyName = "ip")] - public string Ip { get; set; } - - /// - /// Gets or sets city of the client - /// - [JsonProperty(PropertyName = "city")] - public string City { get; set; } - - /// - /// Gets or sets state or province of the client - /// - [JsonProperty(PropertyName = "stateOrProvince")] - public string StateOrProvince { get; set; } - - /// - /// Gets or sets country or region of the client - /// - [JsonProperty(PropertyName = "countryOrRegion")] - public string CountryOrRegion { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCloudInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCloudInfo.cs deleted file mode 100644 index da37f8475c6d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCloudInfo.cs +++ /dev/null @@ -1,59 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Cloud info for an event result - /// - public partial class EventsCloudInfo - { - /// - /// Initializes a new instance of the EventsCloudInfo class. - /// - public EventsCloudInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCloudInfo class. - /// - /// Role name of the cloud - /// Role instance of the cloud - public EventsCloudInfo(string roleName = default(string), string roleInstance = default(string)) - { - RoleName = roleName; - RoleInstance = roleInstance; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets role name of the cloud - /// - [JsonProperty(PropertyName = "roleName")] - public string RoleName { get; set; } - - /// - /// Gets or sets role instance of the cloud - /// - [JsonProperty(PropertyName = "roleInstance")] - public string RoleInstance { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventInfo.cs deleted file mode 100644 index 20a0297d31bb..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventInfo.cs +++ /dev/null @@ -1,51 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The custom event information - /// - public partial class EventsCustomEventInfo - { - /// - /// Initializes a new instance of the EventsCustomEventInfo class. - /// - public EventsCustomEventInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCustomEventInfo class. - /// - /// The name of the custom event - public EventsCustomEventInfo(string name = default(string)) - { - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the custom event - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventResult.cs deleted file mode 100644 index 5d8c33e7c31b..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomEventResult.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A custom event result - /// - [Newtonsoft.Json.JsonObject("customEvent")] - public partial class EventsCustomEventResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsCustomEventResult class. - /// - public EventsCustomEventResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCustomEventResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsCustomEventResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsCustomEventInfo customEvent = default(EventsCustomEventInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - CustomEvent = customEvent; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "customEvent")] - public EventsCustomEventInfo CustomEvent { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricInfo.cs deleted file mode 100644 index fc99acc002c0..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricInfo.cs +++ /dev/null @@ -1,102 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The custom metric info - /// - public partial class EventsCustomMetricInfo - { - /// - /// Initializes a new instance of the EventsCustomMetricInfo class. - /// - public EventsCustomMetricInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCustomMetricInfo class. - /// - /// The name of the custom metric - /// The value of the custom metric - /// The sum of the custom metric - /// The count of the custom metric - /// The minimum value of the custom - /// metric - /// The maximum value of the custom - /// metric - /// The standard deviation of the custom - /// metric - public EventsCustomMetricInfo(string name = default(string), double? value = default(double?), double? valueSum = default(double?), int? valueCount = default(int?), double? valueMin = default(double?), double? valueMax = default(double?), double? valueStdDev = default(double?)) - { - Name = name; - Value = value; - ValueSum = valueSum; - ValueCount = valueCount; - ValueMin = valueMin; - ValueMax = valueMax; - ValueStdDev = valueStdDev; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the custom metric - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the value of the custom metric - /// - [JsonProperty(PropertyName = "value")] - public double? Value { get; set; } - - /// - /// Gets or sets the sum of the custom metric - /// - [JsonProperty(PropertyName = "valueSum")] - public double? ValueSum { get; set; } - - /// - /// Gets or sets the count of the custom metric - /// - [JsonProperty(PropertyName = "valueCount")] - public int? ValueCount { get; set; } - - /// - /// Gets or sets the minimum value of the custom metric - /// - [JsonProperty(PropertyName = "valueMin")] - public double? ValueMin { get; set; } - - /// - /// Gets or sets the maximum value of the custom metric - /// - [JsonProperty(PropertyName = "valueMax")] - public double? ValueMax { get; set; } - - /// - /// Gets or sets the standard deviation of the custom metric - /// - [JsonProperty(PropertyName = "valueStdDev")] - public double? ValueStdDev { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricResult.cs deleted file mode 100644 index 9d7379f5e15d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsCustomMetricResult.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A custom metric result - /// - [Newtonsoft.Json.JsonObject("customMetric")] - public partial class EventsCustomMetricResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsCustomMetricResult class. - /// - public EventsCustomMetricResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsCustomMetricResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsCustomMetricResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsCustomMetricInfo customMetric = default(EventsCustomMetricInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - CustomMetric = customMetric; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "customMetric")] - public EventsCustomMetricInfo CustomMetric { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyInfo.cs deleted file mode 100644 index 27fe20462c70..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyInfo.cs +++ /dev/null @@ -1,117 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The dependency info - /// - public partial class EventsDependencyInfo - { - /// - /// Initializes a new instance of the EventsDependencyInfo class. - /// - public EventsDependencyInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsDependencyInfo class. - /// - /// The target of the dependency - /// The data of the dependency - /// Indicates if the dependency was - /// successful - /// The duration of the dependency - /// The performance bucket of the - /// dependency - /// The result code of the dependency - /// The type of the dependency - /// The name of the dependency - /// The ID of the dependency - public EventsDependencyInfo(string target = default(string), string data = default(string), string success = default(string), long? duration = default(long?), string performanceBucket = default(string), string resultCode = default(string), string type = default(string), string name = default(string), string id = default(string)) - { - Target = target; - Data = data; - Success = success; - Duration = duration; - PerformanceBucket = performanceBucket; - ResultCode = resultCode; - Type = type; - Name = name; - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the target of the dependency - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; set; } - - /// - /// Gets or sets the data of the dependency - /// - [JsonProperty(PropertyName = "data")] - public string Data { get; set; } - - /// - /// Gets or sets indicates if the dependency was successful - /// - [JsonProperty(PropertyName = "success")] - public string Success { get; set; } - - /// - /// Gets or sets the duration of the dependency - /// - [JsonProperty(PropertyName = "duration")] - public long? Duration { get; set; } - - /// - /// Gets or sets the performance bucket of the dependency - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - /// - /// Gets or sets the result code of the dependency - /// - [JsonProperty(PropertyName = "resultCode")] - public string ResultCode { get; set; } - - /// - /// Gets or sets the type of the dependency - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the name of the dependency - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the ID of the dependency - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyResult.cs deleted file mode 100644 index d18cdef03e7a..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsDependencyResult.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A dependency result - /// - [Newtonsoft.Json.JsonObject("dependency")] - public partial class EventsDependencyResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsDependencyResult class. - /// - public EventsDependencyResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsDependencyResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsDependencyResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsDependencyInfo dependency = default(EventsDependencyInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - Dependency = dependency; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "dependency")] - public EventsDependencyInfo Dependency { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetail.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetail.cs deleted file mode 100644 index f86799dd812d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetail.cs +++ /dev/null @@ -1,94 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Exception details - /// - public partial class EventsExceptionDetail - { - /// - /// Initializes a new instance of the EventsExceptionDetail class. - /// - public EventsExceptionDetail() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsExceptionDetail class. - /// - /// The severity level of the exception - /// detail - /// The outer ID of the exception detail - /// The message of the exception detail - /// The type of the exception detail - /// The ID of the exception detail - /// The parsed stack - public EventsExceptionDetail(string severityLevel = default(string), string outerId = default(string), string message = default(string), string type = default(string), string id = default(string), IList parsedStack = default(IList)) - { - SeverityLevel = severityLevel; - OuterId = outerId; - Message = message; - Type = type; - Id = id; - ParsedStack = parsedStack; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the severity level of the exception detail - /// - [JsonProperty(PropertyName = "severityLevel")] - public string SeverityLevel { get; set; } - - /// - /// Gets or sets the outer ID of the exception detail - /// - [JsonProperty(PropertyName = "outerId")] - public string OuterId { get; set; } - - /// - /// Gets or sets the message of the exception detail - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets the type of the exception detail - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the ID of the exception detail - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the parsed stack - /// - [JsonProperty(PropertyName = "parsedStack")] - public IList ParsedStack { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetailsParsedStack.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetailsParsedStack.cs deleted file mode 100644 index 4a2d29bc027c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionDetailsParsedStack.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A parsed stack entry - /// - public partial class EventsExceptionDetailsParsedStack - { - /// - /// Initializes a new instance of the EventsExceptionDetailsParsedStack - /// class. - /// - public EventsExceptionDetailsParsedStack() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsExceptionDetailsParsedStack - /// class. - /// - /// The assembly of the stack entry - /// The method of the stack entry - /// The level of the stack entry - /// The line of the stack entry - public EventsExceptionDetailsParsedStack(string assembly = default(string), string method = default(string), long? level = default(long?), long? line = default(long?)) - { - Assembly = assembly; - Method = method; - Level = level; - Line = line; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the assembly of the stack entry - /// - [JsonProperty(PropertyName = "assembly")] - public string Assembly { get; set; } - - /// - /// Gets or sets the method of the stack entry - /// - [JsonProperty(PropertyName = "method")] - public string Method { get; set; } - - /// - /// Gets or sets the level of the stack entry - /// - [JsonProperty(PropertyName = "level")] - public long? Level { get; set; } - - /// - /// Gets or sets the line of the stack entry - /// - [JsonProperty(PropertyName = "line")] - public long? Line { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionInfo.cs deleted file mode 100644 index 95e1131bd001..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionInfo.cs +++ /dev/null @@ -1,182 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The exception info - /// - public partial class EventsExceptionInfo - { - /// - /// Initializes a new instance of the EventsExceptionInfo class. - /// - public EventsExceptionInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsExceptionInfo class. - /// - /// The severity level of the - /// exception - /// The problem ID of the exception - /// Indicates where the exception was handled - /// at - /// The assembly which threw the - /// exception - /// The method that threw the exception - /// The message of the exception - /// The type of the exception - /// The outer type of the exception - /// The outer method of the exception - /// The outer assmebly of the - /// exception - /// The outer message of the - /// exception - /// The inner most type of the - /// exception - /// The inner most message of the - /// exception - /// The inner most method of the - /// exception - /// The inner most assembly of the - /// exception - /// The details of the exception - public EventsExceptionInfo(int? severityLevel = default(int?), string problemId = default(string), string handledAt = default(string), string assembly = default(string), string method = default(string), string message = default(string), string type = default(string), string outerType = default(string), string outerMethod = default(string), string outerAssembly = default(string), string outerMessage = default(string), string innermostType = default(string), string innermostMessage = default(string), string innermostMethod = default(string), string innermostAssembly = default(string), IList details = default(IList)) - { - SeverityLevel = severityLevel; - ProblemId = problemId; - HandledAt = handledAt; - Assembly = assembly; - Method = method; - Message = message; - Type = type; - OuterType = outerType; - OuterMethod = outerMethod; - OuterAssembly = outerAssembly; - OuterMessage = outerMessage; - InnermostType = innermostType; - InnermostMessage = innermostMessage; - InnermostMethod = innermostMethod; - InnermostAssembly = innermostAssembly; - Details = details; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the severity level of the exception - /// - [JsonProperty(PropertyName = "severityLevel")] - public int? SeverityLevel { get; set; } - - /// - /// Gets or sets the problem ID of the exception - /// - [JsonProperty(PropertyName = "problemId")] - public string ProblemId { get; set; } - - /// - /// Gets or sets indicates where the exception was handled at - /// - [JsonProperty(PropertyName = "handledAt")] - public string HandledAt { get; set; } - - /// - /// Gets or sets the assembly which threw the exception - /// - [JsonProperty(PropertyName = "assembly")] - public string Assembly { get; set; } - - /// - /// Gets or sets the method that threw the exception - /// - [JsonProperty(PropertyName = "method")] - public string Method { get; set; } - - /// - /// Gets or sets the message of the exception - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Gets or sets the type of the exception - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the outer type of the exception - /// - [JsonProperty(PropertyName = "outerType")] - public string OuterType { get; set; } - - /// - /// Gets or sets the outer method of the exception - /// - [JsonProperty(PropertyName = "outerMethod")] - public string OuterMethod { get; set; } - - /// - /// Gets or sets the outer assmebly of the exception - /// - [JsonProperty(PropertyName = "outerAssembly")] - public string OuterAssembly { get; set; } - - /// - /// Gets or sets the outer message of the exception - /// - [JsonProperty(PropertyName = "outerMessage")] - public string OuterMessage { get; set; } - - /// - /// Gets or sets the inner most type of the exception - /// - [JsonProperty(PropertyName = "innermostType")] - public string InnermostType { get; set; } - - /// - /// Gets or sets the inner most message of the exception - /// - [JsonProperty(PropertyName = "innermostMessage")] - public string InnermostMessage { get; set; } - - /// - /// Gets or sets the inner most method of the exception - /// - [JsonProperty(PropertyName = "innermostMethod")] - public string InnermostMethod { get; set; } - - /// - /// Gets or sets the inner most assembly of the exception - /// - [JsonProperty(PropertyName = "innermostAssembly")] - public string InnermostAssembly { get; set; } - - /// - /// Gets or sets the details of the exception - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionResult.cs deleted file mode 100644 index e4d5764de21c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsExceptionResult.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An exception result - /// - [Newtonsoft.Json.JsonObject("exception")] - public partial class EventsExceptionResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsExceptionResult class. - /// - public EventsExceptionResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsExceptionResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsExceptionResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsExceptionInfo exception = default(EventsExceptionInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - Exception = exception; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "exception")] - public EventsExceptionInfo Exception { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsOperationInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsOperationInfo.cs deleted file mode 100644 index 64928c4ea818..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsOperationInfo.cs +++ /dev/null @@ -1,76 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Operation info for an event result - /// - public partial class EventsOperationInfo - { - /// - /// Initializes a new instance of the EventsOperationInfo class. - /// - public EventsOperationInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsOperationInfo class. - /// - /// Name of the operation - /// ID of the operation - /// Parent ID of the operation - /// Synthetic source of the - /// operation - public EventsOperationInfo(string name = default(string), string id = default(string), string parentId = default(string), string syntheticSource = default(string)) - { - Name = name; - Id = id; - ParentId = parentId; - SyntheticSource = syntheticSource; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the operation - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets ID of the operation - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets parent ID of the operation - /// - [JsonProperty(PropertyName = "parentId")] - public string ParentId { get; set; } - - /// - /// Gets or sets synthetic source of the operation - /// - [JsonProperty(PropertyName = "syntheticSource")] - public string SyntheticSource { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewInfo.cs deleted file mode 100644 index eadd40831e56..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewInfo.cs +++ /dev/null @@ -1,76 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The page view information - /// - public partial class EventsPageViewInfo - { - /// - /// Initializes a new instance of the EventsPageViewInfo class. - /// - public EventsPageViewInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsPageViewInfo class. - /// - /// The name of the page - /// The URL of the page - /// The duration of the page view - /// The performance bucket of the page - /// view - public EventsPageViewInfo(string name = default(string), string url = default(string), string duration = default(string), string performanceBucket = default(string)) - { - Name = name; - Url = url; - Duration = duration; - PerformanceBucket = performanceBucket; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the page - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the URL of the page - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// Gets or sets the duration of the page view - /// - [JsonProperty(PropertyName = "duration")] - public string Duration { get; set; } - - /// - /// Gets or sets the performance bucket of the page view - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewResult.cs deleted file mode 100644 index 0ec11c2dbd6b..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPageViewResult.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A page view result - /// - [Newtonsoft.Json.JsonObject("pageView")] - public partial class EventsPageViewResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsPageViewResult class. - /// - public EventsPageViewResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsPageViewResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsPageViewResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsPageViewInfo pageView = default(EventsPageViewInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - PageView = pageView; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "pageView")] - public EventsPageViewInfo PageView { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterInfo.cs deleted file mode 100644 index 9ed4ad144c40..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterInfo.cs +++ /dev/null @@ -1,97 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The performance counter info - /// - public partial class EventsPerformanceCounterInfo - { - /// - /// Initializes a new instance of the EventsPerformanceCounterInfo - /// class. - /// - public EventsPerformanceCounterInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsPerformanceCounterInfo - /// class. - /// - /// The value of the performance counter - /// The name of the performance counter - /// The category of the performance - /// counter - /// The counter of the performance - /// counter - /// The instance name of the performance - /// counter - /// The instance of the performance - /// counter - public EventsPerformanceCounterInfo(double? value = default(double?), string name = default(string), string category = default(string), string counter = default(string), string instanceName = default(string), string instance = default(string)) - { - Value = value; - Name = name; - Category = category; - Counter = counter; - InstanceName = instanceName; - Instance = instance; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the value of the performance counter - /// - [JsonProperty(PropertyName = "value")] - public double? Value { get; set; } - - /// - /// Gets or sets the name of the performance counter - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the category of the performance counter - /// - [JsonProperty(PropertyName = "category")] - public string Category { get; set; } - - /// - /// Gets or sets the counter of the performance counter - /// - [JsonProperty(PropertyName = "counter")] - public string Counter { get; set; } - - /// - /// Gets or sets the instance name of the performance counter - /// - [JsonProperty(PropertyName = "instanceName")] - public string InstanceName { get; set; } - - /// - /// Gets or sets the instance of the performance counter - /// - [JsonProperty(PropertyName = "instance")] - public string Instance { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterResult.cs deleted file mode 100644 index ff6c0e98fa1d..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsPerformanceCounterResult.cs +++ /dev/null @@ -1,67 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A performance counter result - /// - [Newtonsoft.Json.JsonObject("performanceCounter")] - public partial class EventsPerformanceCounterResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsPerformanceCounterResult - /// class. - /// - public EventsPerformanceCounterResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsPerformanceCounterResult - /// class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsPerformanceCounterResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsPerformanceCounterInfo performanceCounter = default(EventsPerformanceCounterInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - PerformanceCounter = performanceCounter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "performanceCounter")] - public EventsPerformanceCounterInfo PerformanceCounter { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestInfo.cs deleted file mode 100644 index ca053cd89d3f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestInfo.cs +++ /dev/null @@ -1,109 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The request info - /// - public partial class EventsRequestInfo - { - /// - /// Initializes a new instance of the EventsRequestInfo class. - /// - public EventsRequestInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsRequestInfo class. - /// - /// The name of the request - /// The URL of the request - /// Indicates if the request was - /// successful - /// The duration of the request - /// The performance bucket of the - /// request - /// The result code of the request - /// The source of the request - /// The ID of the request - public EventsRequestInfo(string name = default(string), string url = default(string), string success = default(string), double? duration = default(double?), string performanceBucket = default(string), string resultCode = default(string), string source = default(string), string id = default(string)) - { - Name = name; - Url = url; - Success = success; - Duration = duration; - PerformanceBucket = performanceBucket; - ResultCode = resultCode; - Source = source; - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the request - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the URL of the request - /// - [JsonProperty(PropertyName = "url")] - public string Url { get; set; } - - /// - /// Gets or sets indicates if the request was successful - /// - [JsonProperty(PropertyName = "success")] - public string Success { get; set; } - - /// - /// Gets or sets the duration of the request - /// - [JsonProperty(PropertyName = "duration")] - public double? Duration { get; set; } - - /// - /// Gets or sets the performance bucket of the request - /// - [JsonProperty(PropertyName = "performanceBucket")] - public string PerformanceBucket { get; set; } - - /// - /// Gets or sets the result code of the request - /// - [JsonProperty(PropertyName = "resultCode")] - public string ResultCode { get; set; } - - /// - /// Gets or sets the source of the request - /// - [JsonProperty(PropertyName = "source")] - public string Source { get; set; } - - /// - /// Gets or sets the ID of the request - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestResult.cs deleted file mode 100644 index 822223ed9e90..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsRequestResult.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A request result - /// - [Newtonsoft.Json.JsonObject("request")] - public partial class EventsRequestResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsRequestResult class. - /// - public EventsRequestResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsRequestResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsRequestResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsRequestInfo request = default(EventsRequestInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - Request = request; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "request")] - public EventsRequestInfo Request { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResult.cs deleted file mode 100644 index 2f7b3ae2ade9..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResult.cs +++ /dev/null @@ -1,59 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An event query result. - /// - public partial class EventsResult - { - /// - /// Initializes a new instance of the EventsResult class. - /// - public EventsResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsResult class. - /// - /// OData messages for this response. - public EventsResult(IList aimessages = default(IList), EventsResultData value = default(EventsResultData)) - { - Aimessages = aimessages; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets oData messages for this response. - /// - [JsonProperty(PropertyName = "@ai.messages")] - public IList Aimessages { get; set; } - - /// - /// - [JsonProperty(PropertyName = "value")] - public EventsResultData Value { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultData.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultData.cs deleted file mode 100644 index 8df84051c7de..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultData.cs +++ /dev/null @@ -1,142 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Events query result data. - /// - [Newtonsoft.Json.JsonObject("eventsResultData")] - public partial class EventsResultData - { - /// - /// Initializes a new instance of the EventsResultData class. - /// - public EventsResultData() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsResultData class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsResultData(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo)) - { - Id = id; - Count = count; - Timestamp = timestamp; - CustomDimensions = customDimensions; - CustomMeasurements = customMeasurements; - Operation = operation; - Session = session; - User = user; - Cloud = cloud; - Ai = ai; - Application = application; - Client = client; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the unique ID for this event. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets count of the event - /// - [JsonProperty(PropertyName = "count")] - public long? Count { get; set; } - - /// - /// Gets or sets timestamp of the event - /// - [JsonProperty(PropertyName = "timestamp")] - public System.DateTime? Timestamp { get; set; } - - /// - /// Gets or sets custom dimensions of the event - /// - [JsonProperty(PropertyName = "customDimensions")] - public EventsResultDataCustomDimensions CustomDimensions { get; set; } - - /// - /// Gets or sets custom measurements of the event - /// - [JsonProperty(PropertyName = "customMeasurements")] - public EventsResultDataCustomMeasurements CustomMeasurements { get; set; } - - /// - /// Gets or sets operation info of the event - /// - [JsonProperty(PropertyName = "operation")] - public EventsOperationInfo Operation { get; set; } - - /// - /// Gets or sets session info of the event - /// - [JsonProperty(PropertyName = "session")] - public EventsSessionInfo Session { get; set; } - - /// - /// Gets or sets user info of the event - /// - [JsonProperty(PropertyName = "user")] - public EventsUserInfo User { get; set; } - - /// - /// Gets or sets cloud info of the event - /// - [JsonProperty(PropertyName = "cloud")] - public EventsCloudInfo Cloud { get; set; } - - /// - /// Gets or sets AI info of the event - /// - [JsonProperty(PropertyName = "ai")] - public EventsAiInfo Ai { get; set; } - - /// - /// Gets or sets application info of the event - /// - [JsonProperty(PropertyName = "application")] - public EventsApplicationInfo Application { get; set; } - - /// - /// Gets or sets client info of the event - /// - [JsonProperty(PropertyName = "client")] - public EventsClientInfo Client { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomMeasurements.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomMeasurements.cs deleted file mode 100644 index 9367b757121b..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomMeasurements.cs +++ /dev/null @@ -1,51 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Custom measurements of the event - /// - public partial class EventsResultDataCustomMeasurements - { - /// - /// Initializes a new instance of the - /// EventsResultDataCustomMeasurements class. - /// - public EventsResultDataCustomMeasurements() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// EventsResultDataCustomMeasurements class. - /// - public EventsResultDataCustomMeasurements(object additionalProperties = default(object)) - { - AdditionalProperties = additionalProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "additionalProperties")] - public object AdditionalProperties { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResults.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResults.cs deleted file mode 100644 index 4c3d89f90d69..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResults.cs +++ /dev/null @@ -1,70 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An events query result. - /// - public partial class EventsResults - { - /// - /// Initializes a new instance of the EventsResults class. - /// - public EventsResults() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsResults class. - /// - /// OData context metadata endpoint for this - /// response - /// OData messages for this response. - /// Contents of the events query result. - public EventsResults(string odatacontext = default(string), IList aimessages = default(IList), IList value = default(IList)) - { - Odatacontext = odatacontext; - Aimessages = aimessages; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets oData context metadata endpoint for this response - /// - [JsonProperty(PropertyName = "@odata.context")] - public string Odatacontext { get; set; } - - /// - /// Gets or sets oData messages for this response. - /// - [JsonProperty(PropertyName = "@ai.messages")] - public IList Aimessages { get; set; } - - /// - /// Gets or sets contents of the events query result. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsSessionInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsSessionInfo.cs deleted file mode 100644 index 2ef24da78661..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsSessionInfo.cs +++ /dev/null @@ -1,51 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Session info for an event result - /// - public partial class EventsSessionInfo - { - /// - /// Initializes a new instance of the EventsSessionInfo class. - /// - public EventsSessionInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsSessionInfo class. - /// - /// ID of the session - public EventsSessionInfo(string id = default(string)) - { - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets ID of the session - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceResult.cs deleted file mode 100644 index 901cd594a5e9..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsTraceResult.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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A trace result - /// - [Newtonsoft.Json.JsonObject("trace")] - public partial class EventsTraceResult : EventsResultData - { - /// - /// Initializes a new instance of the EventsTraceResult class. - /// - public EventsTraceResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsTraceResult class. - /// - /// The unique ID for this event. - /// Count of the event - /// Timestamp of the event - /// Custom dimensions of the - /// event - /// Custom measurements of the - /// event - /// Operation info of the event - /// Session info of the event - /// User info of the event - /// Cloud info of the event - /// AI info of the event - /// Application info of the event - /// Client info of the event - public EventsTraceResult(string id = default(string), long? count = default(long?), System.DateTime? timestamp = default(System.DateTime?), EventsResultDataCustomDimensions customDimensions = default(EventsResultDataCustomDimensions), EventsResultDataCustomMeasurements customMeasurements = default(EventsResultDataCustomMeasurements), EventsOperationInfo operation = default(EventsOperationInfo), EventsSessionInfo session = default(EventsSessionInfo), EventsUserInfo user = default(EventsUserInfo), EventsCloudInfo cloud = default(EventsCloudInfo), EventsAiInfo ai = default(EventsAiInfo), EventsApplicationInfo application = default(EventsApplicationInfo), EventsClientInfo client = default(EventsClientInfo), EventsTraceInfo trace = default(EventsTraceInfo)) - : base(id, count, timestamp, customDimensions, customMeasurements, operation, session, user, cloud, ai, application, client) - { - Trace = trace; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "trace")] - public EventsTraceInfo Trace { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsUserInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsUserInfo.cs deleted file mode 100644 index 2414f185dac9..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsUserInfo.cs +++ /dev/null @@ -1,67 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// User info for an event result - /// - public partial class EventsUserInfo - { - /// - /// Initializes a new instance of the EventsUserInfo class. - /// - public EventsUserInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventsUserInfo class. - /// - /// ID of the user - /// Account ID of the user - /// Authenticated ID of the user - public EventsUserInfo(string id = default(string), string accountId = default(string), string authenticatedId = default(string)) - { - Id = id; - AccountId = accountId; - AuthenticatedId = authenticatedId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets ID of the user - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets account ID of the user - /// - [JsonProperty(PropertyName = "accountId")] - public string AccountId { get; set; } - - /// - /// Gets or sets authenticated ID of the user - /// - [JsonProperty(PropertyName = "authenticatedId")] - public string AuthenticatedId { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteSourceType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteSourceType.cs new file mode 100644 index 000000000000..ebbba70acb19 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteSourceType.cs @@ -0,0 +1,28 @@ +// +// 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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for FavoriteSourceType. + /// + public static class FavoriteSourceType + { + public const string Retention = "retention"; + public const string Notebook = "notebook"; + public const string Sessions = "sessions"; + public const string Events = "events"; + public const string Userflows = "userflows"; + public const string Funnel = "funnel"; + public const string Impact = "impact"; + public const string Segmentation = "segmentation"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteType.cs new file mode 100644 index 000000000000..3693183a0855 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FavoriteType.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for FavoriteType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum FavoriteType + { + [EnumMember(Value = "shared")] + Shared, + [EnumMember(Value = "user")] + User + } + internal static class FavoriteTypeEnumExtension + { + internal static string ToSerializedValue(this FavoriteType? value) + { + return value == null ? null : ((FavoriteType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this FavoriteType value) + { + switch( value ) + { + case FavoriteType.Shared: + return "shared"; + case FavoriteType.User: + return "user"; + } + return null; + } + + internal static FavoriteType? ParseFavoriteType(this string value) + { + switch( value ) + { + case "shared": + return FavoriteType.Shared; + case "user": + return FavoriteType.User; + } + return null; + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FlowType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FlowType.cs new file mode 100644 index 000000000000..f16f6c5caf29 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/FlowType.cs @@ -0,0 +1,21 @@ +// +// 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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for FlowType. + /// + public static class FlowType + { + public const string Bluefield = "Bluefield"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/InnerError.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/InnerError.cs new file mode 100644 index 000000000000..cdf083b22996 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/InnerError.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Inner error + /// + public partial class InnerError + { + /// + /// Initializes a new instance of the InnerError class. + /// + public InnerError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InnerError class. + /// + /// Provides correlation for + /// request + /// Request time + public InnerError(string diagnosticcontext = default(string), System.DateTime? time = default(System.DateTime?)) + { + Diagnosticcontext = diagnosticcontext; + Time = time; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets provides correlation for request + /// + [JsonProperty(PropertyName = "diagnosticcontext")] + public string Diagnosticcontext { get; set; } + + /// + /// Gets or sets request time + /// + [JsonProperty(PropertyName = "time")] + public System.DateTime? Time { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScope.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScope.cs new file mode 100644 index 000000000000..d71e2c9644be --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScope.cs @@ -0,0 +1,22 @@ +// +// 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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for ItemScope. + /// + public static class ItemScope + { + public const string Shared = "shared"; + public const string User = "user"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScopePath.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScopePath.cs new file mode 100644 index 000000000000..ad0a1c470d92 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemScopePath.cs @@ -0,0 +1,22 @@ +// +// 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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for ItemScopePath. + /// + public static class ItemScopePath + { + public const string AnalyticsItems = "analyticsItems"; + public const string MyanalyticsItems = "myanalyticsItems"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemType.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemType.cs new file mode 100644 index 000000000000..401e7582c5af --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemType.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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for ItemType. + /// + public static class ItemType + { + public const string Query = "query"; + public const string Function = "function"; + public const string Folder = "folder"; + public const string Recent = "recent"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemTypeParameter.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemTypeParameter.cs new file mode 100644 index 000000000000..9e22126acc72 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/ItemTypeParameter.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for ItemTypeParameter. + /// + public static class ItemTypeParameter + { + public const string None = "none"; + public const string Query = "query"; + public const string Function = "function"; + public const string Folder = "folder"; + public const string Recent = "recent"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/LinkProperties.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/LinkProperties.cs new file mode 100644 index 000000000000..ed5c5d2cf6ad --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/LinkProperties.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains a sourceId and workbook resource id to link two resources. + /// + public partial class LinkProperties + { + /// + /// Initializes a new instance of the LinkProperties class. + /// + public LinkProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LinkProperties class. + /// + /// The source Azure resource id + /// The workbook Azure resource id + /// The category of workbook + public LinkProperties(string sourceId = default(string), string targetId = default(string), string category = default(string)) + { + SourceId = sourceId; + TargetId = targetId; + Category = category; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the source Azure resource id + /// + [JsonProperty(PropertyName = "sourceId")] + public string SourceId { get; set; } + + /// + /// Gets or sets the workbook Azure resource id + /// + [JsonProperty(PropertyName = "targetId")] + public string TargetId { get; set; } + + /// + /// Gets or sets the category of workbook + /// + [JsonProperty(PropertyName = "category")] + public string Category { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricId.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricId.cs deleted file mode 100644 index ff8f0db4fd0c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricId.cs +++ /dev/null @@ -1,52 +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.ApplicationInsights.Query.Models -{ - - /// - /// Defines values for MetricId. - /// - public static class MetricId - { - public const string RequestsCount = "requests/count"; - public const string RequestsDuration = "requests/duration"; - public const string RequestsFailed = "requests/failed"; - public const string UsersCount = "users/count"; - public const string UsersAuthenticated = "users/authenticated"; - public const string PageViewsCount = "pageViews/count"; - public const string PageViewsDuration = "pageViews/duration"; - public const string ClientProcessingDuration = "client/processingDuration"; - public const string ClientReceiveDuration = "client/receiveDuration"; - public const string ClientNetworkDuration = "client/networkDuration"; - public const string ClientSendDuration = "client/sendDuration"; - public const string ClientTotalDuration = "client/totalDuration"; - public const string DependenciesCount = "dependencies/count"; - public const string DependenciesFailed = "dependencies/failed"; - public const string DependenciesDuration = "dependencies/duration"; - public const string ExceptionsCount = "exceptions/count"; - public const string ExceptionsBrowser = "exceptions/browser"; - public const string ExceptionsServer = "exceptions/server"; - public const string SessionsCount = "sessions/count"; - public const string PerformanceCountersRequestExecutionTime = "performanceCounters/requestExecutionTime"; - public const string PerformanceCountersRequestsPerSecond = "performanceCounters/requestsPerSecond"; - public const string PerformanceCountersRequestsInQueue = "performanceCounters/requestsInQueue"; - public const string PerformanceCountersMemoryAvailableBytes = "performanceCounters/memoryAvailableBytes"; - public const string PerformanceCountersExceptionsPerSecond = "performanceCounters/exceptionsPerSecond"; - public const string PerformanceCountersProcessCpuPercentage = "performanceCounters/processCpuPercentage"; - public const string PerformanceCountersProcessIOBytesPerSecond = "performanceCounters/processIOBytesPerSecond"; - public const string PerformanceCountersProcessPrivateBytes = "performanceCounters/processPrivateBytes"; - public const string PerformanceCountersProcessorCpuPercentage = "performanceCounters/processorCpuPercentage"; - public const string AvailabilityResultsAvailabilityPercentage = "availabilityResults/availabilityPercentage"; - public const string AvailabilityResultsDuration = "availabilityResults/duration"; - public const string BillingTelemetryCount = "billing/telemetryCount"; - public const string CustomEventsCount = "customEvents/count"; - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchema.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchema.cs deleted file mode 100644 index 7e069eb4ec04..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchema.cs +++ /dev/null @@ -1,87 +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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A metric request - /// - public partial class MetricsPostBodySchema - { - /// - /// Initializes a new instance of the MetricsPostBodySchema class. - /// - public MetricsPostBodySchema() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsPostBodySchema class. - /// - /// An identifier for this query. Must be unique - /// within the post body of the request. This identifier will be the - /// 'id' property of the response object representing this - /// query. - /// The parameters for a single metrics - /// query - public MetricsPostBodySchema(string id, MetricsPostBodySchemaParameters parameters) - { - Id = id; - Parameters = parameters; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets an identifier for this query. Must be unique within - /// the post body of the request. This identifier will be the 'id' - /// property of the response object representing this query. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the parameters for a single metrics query - /// - [JsonProperty(PropertyName = "parameters")] - public MetricsPostBodySchemaParameters Parameters { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Parameters"); - } - if (Parameters != null) - { - Parameters.Validate(); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchemaParameters.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchemaParameters.cs deleted file mode 100644 index 0d1b62589f4a..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsPostBodySchemaParameters.cs +++ /dev/null @@ -1,149 +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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The parameters for a single metrics query - /// - public partial class MetricsPostBodySchemaParameters - { - /// - /// Initializes a new instance of the MetricsPostBodySchemaParameters - /// class. - /// - public MetricsPostBodySchemaParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsPostBodySchemaParameters - /// class. - /// - /// Possible values include: 'requests/count', - /// 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', - /// 'client/totalDuration', 'dependencies/count', - /// 'dependencies/failed', 'dependencies/duration', 'exceptions/count', - /// 'exceptions/browser', 'exceptions/server', 'sessions/count', - /// 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - public MetricsPostBodySchemaParameters(string metricId, string timespan = default(string), IList aggregation = default(IList), System.TimeSpan? interval = default(System.TimeSpan?), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string)) - { - MetricId = metricId; - Timespan = timespan; - Aggregation = aggregation; - Interval = interval; - Segment = segment; - Top = top; - Orderby = orderby; - Filter = filter; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets possible values include: 'requests/count', - /// 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', - /// 'client/totalDuration', 'dependencies/count', - /// 'dependencies/failed', 'dependencies/duration', 'exceptions/count', - /// 'exceptions/browser', 'exceptions/server', 'sessions/count', - /// 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - [JsonProperty(PropertyName = "metricId")] - public string MetricId { get; set; } - - /// - /// - [JsonProperty(PropertyName = "timespan")] - public string Timespan { get; set; } - - /// - /// - [JsonProperty(PropertyName = "aggregation")] - public IList Aggregation { get; set; } - - /// - /// - [JsonProperty(PropertyName = "interval")] - public System.TimeSpan? Interval { get; set; } - - /// - /// - [JsonProperty(PropertyName = "segment")] - public IList Segment { get; set; } - - /// - /// - [JsonProperty(PropertyName = "top")] - public int? Top { get; set; } - - /// - /// - [JsonProperty(PropertyName = "orderby")] - public string Orderby { get; set; } - - /// - /// - [JsonProperty(PropertyName = "filter")] - public string Filter { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (MetricId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricId"); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResult.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResult.cs deleted file mode 100644 index 5d2eca4c2bc6..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResult.cs +++ /dev/null @@ -1,49 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A metric result. - /// - public partial class MetricsResult - { - /// - /// Initializes a new instance of the MetricsResult class. - /// - public MetricsResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsResult class. - /// - public MetricsResult(MetricsResultInfo value = default(MetricsResultInfo)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "value")] - public MetricsResultInfo Value { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultInfo.cs deleted file mode 100644 index 1c05fcdb2b77..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsResultInfo.cs +++ /dev/null @@ -1,89 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A metric result data. - /// - public partial class MetricsResultInfo - { - /// - /// Initializes a new instance of the MetricsResultInfo class. - /// - public MetricsResultInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsResultInfo class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// Start time of the metric. - /// Start time of the metric. - /// The interval used to segment the metric - /// data. - /// Segmented metric data (if - /// segmented). - public MetricsResultInfo(IDictionary additionalProperties = default(IDictionary), System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), System.TimeSpan? interval = default(System.TimeSpan?), IList segments = default(IList)) - { - AdditionalProperties = additionalProperties; - Start = start; - End = end; - Interval = interval; - Segments = segments; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets start time of the metric. - /// - [JsonProperty(PropertyName = "start")] - public System.DateTime? Start { get; set; } - - /// - /// Gets or sets start time of the metric. - /// - [JsonProperty(PropertyName = "end")] - public System.DateTime? End { get; set; } - - /// - /// Gets or sets the interval used to segment the metric data. - /// - [JsonProperty(PropertyName = "interval")] - public System.TimeSpan? Interval { get; set; } - - /// - /// Gets or sets segmented metric data (if segmented). - /// - [JsonProperty(PropertyName = "segments")] - public IList Segments { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegment.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegment.cs deleted file mode 100644 index 873e368e9c45..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegment.cs +++ /dev/null @@ -1,36 +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.ApplicationInsights.Query.Models -{ - - /// - /// Defines values for MetricsSegment. - /// - public static class MetricsSegment - { - public const string ApplicationBuild = "applicationBuild"; - public const string ApplicationVersion = "applicationVersion"; - public const string AuthenticatedOrAnonymousTraffic = "authenticatedOrAnonymousTraffic"; - public const string Browser = "browser"; - public const string BrowserVersion = "browserVersion"; - public const string City = "city"; - public const string CloudRoleName = "cloudRoleName"; - public const string CloudServiceName = "cloudServiceName"; - public const string Continent = "continent"; - public const string CountryOrRegion = "countryOrRegion"; - public const string DeploymentId = "deploymentId"; - public const string DeploymentUnit = "deploymentUnit"; - public const string DeviceType = "deviceType"; - public const string Environment = "environment"; - public const string HostingLocation = "hostingLocation"; - public const string InstanceName = "instanceName"; - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegmentInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegmentInfo.cs deleted file mode 100644 index ee67de58eb8f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/MetricsSegmentInfo.cs +++ /dev/null @@ -1,84 +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.ApplicationInsights.Query.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A metric segment - /// - public partial class MetricsSegmentInfo - { - /// - /// Initializes a new instance of the MetricsSegmentInfo class. - /// - public MetricsSegmentInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricsSegmentInfo class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// Start time of the metric segment (only when an - /// interval was specified). - /// Start time of the metric segment (only when an - /// interval was specified). - /// Segmented metric data (if further - /// segmented). - public MetricsSegmentInfo(IDictionary additionalProperties = default(IDictionary), System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?), IList segments = default(IList)) - { - AdditionalProperties = additionalProperties; - Start = start; - End = end; - Segments = segments; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets start time of the metric segment (only when an - /// interval was specified). - /// - [JsonProperty(PropertyName = "start")] - public System.DateTime? Start { get; set; } - - /// - /// Gets or sets start time of the metric segment (only when an - /// interval was specified). - /// - [JsonProperty(PropertyName = "end")] - public System.DateTime? End { get; set; } - - /// - /// Gets or sets segmented metric data (if further segmented). - /// - [JsonProperty(PropertyName = "segments")] - public IList Segments { get; set; } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Column.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Operation.cs similarity index 53% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Column.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Operation.cs index 6e64adf4efa7..4a28c2e8724a 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Column.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Operation.cs @@ -8,36 +8,35 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; using System.Linq; /// - /// A table column. + /// CDN REST API operation /// - /// - /// A column in a table. - /// - public partial class Column + public partial class Operation { /// - /// Initializes a new instance of the Column class. + /// Initializes a new instance of the Operation class. /// - public Column() + public Operation() { CustomInit(); } /// - /// Initializes a new instance of the Column class. + /// Initializes a new instance of the Operation class. /// - /// The name of this column. - /// The data type of this column. - public Column(string name = default(string), string type = default(string)) + /// Operation name: + /// {provider}/{resource}/{operation} + /// The object that represents the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) { Name = name; - Type = type; + Display = display; CustomInit(); } @@ -47,16 +46,16 @@ public Column() partial void CustomInit(); /// - /// Gets or sets the name of this column. + /// Gets or sets operation name: {provider}/{resource}/{operation} /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// - /// Gets or sets the data type of this column. + /// Gets or sets the object that represents the operation. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/OperationDisplay.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..60452c458c9f --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,70 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The object that represents the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Service provider: Microsoft.Cdn + /// Resource on which the operation is + /// performed: Profile, endpoint, etc. + /// Operation type: Read, write, delete, + /// etc. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service provider: Microsoft.Cdn + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource on which the operation is performed: Profile, + /// endpoint, etc. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets operation type: Read, write, delete, etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page.cs new file mode 100644 index 000000000000..b4a80108bd88 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page1.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page1.cs new file mode 100644 index 000000000000..bfbe0bc45ecd --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Page1.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page1 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/PurgeState.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/PurgeState.cs new file mode 100644 index 000000000000..0d19db6cc161 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/PurgeState.cs @@ -0,0 +1,22 @@ +// +// 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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for PurgeState. + /// + public static class PurgeState + { + public const string Pending = "pending"; + public const string Completed = "completed"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryBody.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryBody.cs deleted file mode 100644 index 10fe2636ceee..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/QueryBody.cs +++ /dev/null @@ -1,91 +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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The Analytics query. Learn more about the [Analytics query - /// syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) - /// - public partial class QueryBody - { - /// - /// Initializes a new instance of the QueryBody class. - /// - public QueryBody() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QueryBody class. - /// - /// The query to execute. - /// Optional. The timespan over which to query - /// data. This is an ISO8601 time period value. This timespan is - /// applied in addition to any that are specified in the query - /// expression. - /// A list of Application IDs for - /// cross-application queries. - public QueryBody(string query, string timespan = default(string), IList applications = default(IList)) - { - Query = query; - Timespan = timespan; - Applications = applications; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the query to execute. - /// - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - - /// - /// Gets or sets optional. The timespan over which to query data. This - /// is an ISO8601 time period value. This timespan is applied in - /// addition to any that are specified in the query expression. - /// - [JsonProperty(PropertyName = "timespan")] - public string Timespan { get; set; } - - /// - /// Gets or sets a list of Application IDs for cross-application - /// queries. - /// - [JsonProperty(PropertyName = "applications")] - public IList Applications { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Query == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Query"); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/RequestSource.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/RequestSource.cs new file mode 100644 index 000000000000..f660747e7420 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/RequestSource.cs @@ -0,0 +1,21 @@ +// +// 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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for RequestSource. + /// + public static class RequestSource + { + public const string Rest = "rest"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/SharedTypeKind.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/SharedTypeKind.cs new file mode 100644 index 000000000000..aa9e3c156fcd --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/SharedTypeKind.cs @@ -0,0 +1,22 @@ +// +// 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.ApplicationInsights.Management.Models +{ + + /// + /// Defines values for SharedTypeKind. + /// + public static class SharedTypeKind + { + public const string User = "user"; + public const string Shared = "shared"; + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Table.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Table.cs deleted file mode 100644 index b6f5f206255b..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Table.cs +++ /dev/null @@ -1,94 +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.ApplicationInsights.Query.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A query response table. - /// - /// - /// Contains the columns and rows for one table in a query response. - /// - public partial class Table - { - /// - /// Initializes a new instance of the Table class. - /// - public Table() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Table class. - /// - /// The name of the table. - /// The list of columns in this table. - /// The resulting rows from this query. - public Table(string name, IList columns, IList> rows) - { - Name = name; - Columns = columns; - Rows = rows; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the table. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the list of columns in this table. - /// - [JsonProperty(PropertyName = "columns")] - public IList Columns { get; set; } - - /// - /// Gets or sets the resulting rows from this query. - /// - [JsonProperty(PropertyName = "rows")] - public IList> Rows { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Columns == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Columns"); - } - if (Rows == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Rows"); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsApplicationInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/TagsResource.cs similarity index 51% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsApplicationInfo.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/TagsResource.cs index 5319e14b6840..748400d45cc7 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsApplicationInfo.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/TagsResource.cs @@ -8,31 +8,34 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Application info for an event result + /// A container holding only the Tags for a resource, allowing the user to + /// update the tags on a WebTest instance. /// - public partial class EventsApplicationInfo + public partial class TagsResource { /// - /// Initializes a new instance of the EventsApplicationInfo class. + /// Initializes a new instance of the TagsResource class. /// - public EventsApplicationInfo() + public TagsResource() { CustomInit(); } /// - /// Initializes a new instance of the EventsApplicationInfo class. + /// Initializes a new instance of the TagsResource class. /// - /// Version of the application - public EventsApplicationInfo(string version = default(string)) + /// Resource tags + public TagsResource(IDictionary tags = default(IDictionary)) { - Version = version; + Tags = tags; CustomInit(); } @@ -42,10 +45,10 @@ public EventsApplicationInfo() partial void CustomInit(); /// - /// Gets or sets version of the application + /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTest.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTest.cs new file mode 100644 index 000000000000..79165da65619 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTest.cs @@ -0,0 +1,200 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights web test definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class WebTest : WebtestsResource + { + /// + /// Initializes a new instance of the WebTest class. + /// + public WebTest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebTest class. + /// + /// Resource location + /// Unique ID of this WebTest. This is + /// typically the same value as the Name field. + /// User defined name if this + /// WebTest. + /// The kind of web test this is, valid + /// choices are ping and multistep. Possible values include: 'ping', + /// 'multistep' + /// A list of where to physically run the tests + /// from to give global coverage for accessibility of your + /// application. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + /// The kind of web test that this web test watches. + /// Choices are ping and multistep. Possible values include: 'ping', + /// 'multistep' + /// Purpose/user defined descriptive test for + /// this WebTest. + /// Is the test actively being monitored. + /// Interval in seconds between test runs for + /// this WebTest. Default value is 300. + /// Seconds until this WebTest will timeout and + /// fail. Default value is 30. + /// Allow for retries should this WebTest + /// fail. + /// An XML configuration specification for + /// a WebTest. + /// Current state of this component, + /// whether or not is has been provisioned within the resource group it + /// is defined. Users cannot change this value but are able to read + /// from it. Values will include Succeeded, Deploying, Canceled, and + /// Failed. + public WebTest(string location, string syntheticMonitorId, string webTestName, WebTestKind webTestKind, IList locations, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), WebTestKind? kind = default(WebTestKind?), string description = default(string), bool? enabled = default(bool?), int? frequency = default(int?), int? timeout = default(int?), bool? retryEnabled = default(bool?), WebTestPropertiesConfiguration configuration = default(WebTestPropertiesConfiguration), string provisioningState = default(string)) + : base(location, id, name, type, tags) + { + Kind = kind; + SyntheticMonitorId = syntheticMonitorId; + WebTestName = webTestName; + Description = description; + Enabled = enabled; + Frequency = frequency; + Timeout = timeout; + WebTestKind = webTestKind; + RetryEnabled = retryEnabled; + Locations = locations; + Configuration = configuration; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of web test that this web test watches. + /// Choices are ping and multistep. Possible values include: 'ping', + /// 'multistep' + /// + [JsonProperty(PropertyName = "kind")] + public WebTestKind? Kind { get; set; } + + /// + /// Gets or sets unique ID of this WebTest. This is typically the same + /// value as the Name field. + /// + [JsonProperty(PropertyName = "properties.SyntheticMonitorId")] + public string SyntheticMonitorId { get; set; } + + /// + /// Gets or sets user defined name if this WebTest. + /// + [JsonProperty(PropertyName = "properties.Name")] + public string WebTestName { get; set; } + + /// + /// Gets or sets purpose/user defined descriptive test for this + /// WebTest. + /// + [JsonProperty(PropertyName = "properties.Description")] + public string Description { get; set; } + + /// + /// Gets or sets is the test actively being monitored. + /// + [JsonProperty(PropertyName = "properties.Enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets interval in seconds between test runs for this + /// WebTest. Default value is 300. + /// + [JsonProperty(PropertyName = "properties.Frequency")] + public int? Frequency { get; set; } + + /// + /// Gets or sets seconds until this WebTest will timeout and fail. + /// Default value is 30. + /// + [JsonProperty(PropertyName = "properties.Timeout")] + public int? Timeout { get; set; } + + /// + /// Gets or sets the kind of web test this is, valid choices are ping + /// and multistep. Possible values include: 'ping', 'multistep' + /// + [JsonProperty(PropertyName = "properties.Kind")] + public WebTestKind WebTestKind { get; set; } + + /// + /// Gets or sets allow for retries should this WebTest fail. + /// + [JsonProperty(PropertyName = "properties.RetryEnabled")] + public bool? RetryEnabled { get; set; } + + /// + /// Gets or sets a list of where to physically run the tests from to + /// give global coverage for accessibility of your application. + /// + [JsonProperty(PropertyName = "properties.Locations")] + public IList Locations { get; set; } + + /// + /// Gets or sets an XML configuration specification for a WebTest. + /// + [JsonProperty(PropertyName = "properties.Configuration")] + public WebTestPropertiesConfiguration Configuration { get; set; } + + /// + /// Gets current state of this component, whether or not is has been + /// provisioned within the resource group it is defined. Users cannot + /// change this value but are able to read from it. Values will include + /// Succeeded, Deploying, Canceled, and Failed. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (SyntheticMonitorId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SyntheticMonitorId"); + } + if (WebTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WebTestName"); + } + if (Locations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Locations"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientPerformanceInfo.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs similarity index 52% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientPerformanceInfo.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs index e3cb5c4a0740..62c4065a616d 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsClientPerformanceInfo.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestGeolocation.cs @@ -8,33 +8,33 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; using System.Linq; /// - /// Client performance information + /// Geo-physical location to run a web test from. You must specify one or + /// more locations for the test to run from. /// - public partial class EventsClientPerformanceInfo + public partial class WebTestGeolocation { /// - /// Initializes a new instance of the EventsClientPerformanceInfo - /// class. + /// Initializes a new instance of the WebTestGeolocation class. /// - public EventsClientPerformanceInfo() + public WebTestGeolocation() { CustomInit(); } /// - /// Initializes a new instance of the EventsClientPerformanceInfo - /// class. + /// Initializes a new instance of the WebTestGeolocation class. /// - /// The name of the client performance - public EventsClientPerformanceInfo(string name = default(string)) + /// Location ID for the webtest to run + /// from. + public WebTestGeolocation(string location = default(string)) { - Name = name; + Location = location; CustomInit(); } @@ -44,10 +44,10 @@ public EventsClientPerformanceInfo() partial void CustomInit(); /// - /// Gets or sets the name of the client performance + /// Gets or sets location ID for the webtest to run from. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [JsonProperty(PropertyName = "Id")] + public string Location { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestKind.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestKind.cs new file mode 100644 index 000000000000..07afe0084b30 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestKind.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for WebTestKind. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum WebTestKind + { + [EnumMember(Value = "ping")] + Ping, + [EnumMember(Value = "multistep")] + Multistep + } + internal static class WebTestKindEnumExtension + { + internal static string ToSerializedValue(this WebTestKind? value) + { + return value == null ? null : ((WebTestKind)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this WebTestKind value) + { + switch( value ) + { + case WebTestKind.Ping: + return "ping"; + case WebTestKind.Multistep: + return "multistep"; + } + return null; + } + + internal static WebTestKind? ParseWebTestKind(this string value) + { + switch( value ) + { + case "ping": + return WebTestKind.Ping; + case "multistep": + return WebTestKind.Multistep; + } + return null; + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomDimensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs similarity index 52% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomDimensions.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs index f7f0cdffafc4..82adbd44dd34 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/EventsResultDataCustomDimensions.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebTestPropertiesConfiguration.cs @@ -8,32 +8,34 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query.Models +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models { using Newtonsoft.Json; using System.Linq; /// - /// Custom dimensions of the event + /// An XML configuration specification for a WebTest. /// - public partial class EventsResultDataCustomDimensions + public partial class WebTestPropertiesConfiguration { /// - /// Initializes a new instance of the EventsResultDataCustomDimensions + /// Initializes a new instance of the WebTestPropertiesConfiguration /// class. /// - public EventsResultDataCustomDimensions() + public WebTestPropertiesConfiguration() { CustomInit(); } /// - /// Initializes a new instance of the EventsResultDataCustomDimensions + /// Initializes a new instance of the WebTestPropertiesConfiguration /// class. /// - public EventsResultDataCustomDimensions(object additionalProperties = default(object)) + /// The XML specification of a WebTest to run + /// against an application. + public WebTestPropertiesConfiguration(string webTest = default(string)) { - AdditionalProperties = additionalProperties; + WebTest = webTest; CustomInit(); } @@ -43,9 +45,11 @@ public EventsResultDataCustomDimensions() partial void CustomInit(); /// + /// Gets or sets the XML specification of a WebTest to run against an + /// application. /// - [JsonProperty(PropertyName = "additionalProperties")] - public object AdditionalProperties { get; set; } + [JsonProperty(PropertyName = "WebTest")] + public string WebTest { get; set; } } } diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebtestsResource.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebtestsResource.cs new file mode 100644 index 000000000000..e7b5a24a74ed --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WebtestsResource.cs @@ -0,0 +1,100 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class WebtestsResource : IResource + { + /// + /// Initializes a new instance of the WebtestsResource class. + /// + public WebtestsResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebtestsResource class. + /// + /// Resource location + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource tags + public WebtestsResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs new file mode 100644 index 000000000000..8e8a500cfd9d --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfiguration.cs @@ -0,0 +1,88 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Work item configuration associated with an application insights + /// resource. + /// + public partial class WorkItemConfiguration + { + /// + /// Initializes a new instance of the WorkItemConfiguration class. + /// + public WorkItemConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkItemConfiguration class. + /// + /// Connector identifier where work item is + /// created + /// Configuration friendly name + /// Boolean value indicating whether + /// configuration is default + /// Unique Id for work item + /// Serialized JSON object for detailed + /// properties + public WorkItemConfiguration(string connectorId = default(string), string configDisplayName = default(string), bool? isDefault = default(bool?), string id = default(string), string configProperties = default(string)) + { + ConnectorId = connectorId; + ConfigDisplayName = configDisplayName; + IsDefault = isDefault; + Id = id; + ConfigProperties = configProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets connector identifier where work item is created + /// + [JsonProperty(PropertyName = "ConnectorId")] + public string ConnectorId { get; set; } + + /// + /// Gets or sets configuration friendly name + /// + [JsonProperty(PropertyName = "ConfigDisplayName")] + public string ConfigDisplayName { get; set; } + + /// + /// Gets or sets boolean value indicating whether configuration is + /// default + /// + [JsonProperty(PropertyName = "IsDefault")] + public bool? IsDefault { get; set; } + + /// + /// Gets or sets unique Id for work item + /// + [JsonProperty(PropertyName = "Id")] + public string Id { get; set; } + + /// + /// Gets or sets serialized JSON object for detailed properties + /// + [JsonProperty(PropertyName = "ConfigProperties")] + public string ConfigProperties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationError.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationError.cs new file mode 100644 index 000000000000..b20a34449024 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationError.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error associated with trying to get work item configuration or + /// configurations + /// + public partial class WorkItemConfigurationError + { + /// + /// Initializes a new instance of the WorkItemConfigurationError class. + /// + public WorkItemConfigurationError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkItemConfigurationError class. + /// + /// Error detail code and explanation + /// Error message + public WorkItemConfigurationError(string code = default(string), string message = default(string), InnerError innererror = default(InnerError)) + { + Code = code; + Message = message; + Innererror = innererror; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error detail code and explanation + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets error message + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// + [JsonProperty(PropertyName = "innererror")] + public InnerError Innererror { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationErrorException.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationErrorException.cs new file mode 100644 index 000000000000..d804d471e0d7 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemConfigurationErrorException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with + /// WorkItemConfigurationError information. + /// + public partial class WorkItemConfigurationErrorException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public WorkItemConfigurationError Body { get; set; } + + /// + /// Initializes a new instance of the WorkItemConfigurationErrorException class. + /// + public WorkItemConfigurationErrorException() + { + } + + /// + /// Initializes a new instance of the WorkItemConfigurationErrorException class. + /// + /// The exception message. + public WorkItemConfigurationErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the WorkItemConfigurationErrorException class. + /// + /// The exception message. + /// Inner exception. + public WorkItemConfigurationErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.cs new file mode 100644 index 000000000000..c91b8774a5eb --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkItemCreateConfiguration.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.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Work item configuration creation payload + /// + public partial class WorkItemCreateConfiguration + { + /// + /// Initializes a new instance of the WorkItemCreateConfiguration + /// class. + /// + public WorkItemCreateConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkItemCreateConfiguration + /// class. + /// + /// Unique connector id + /// Serialized JSON object for + /// detailed properties + /// Boolean indicating validate only + /// Custom work item + /// properties + public WorkItemCreateConfiguration(string connectorId = default(string), string connectorDataConfiguration = default(string), bool? validateOnly = default(bool?), IDictionary workItemProperties = default(IDictionary)) + { + ConnectorId = connectorId; + ConnectorDataConfiguration = connectorDataConfiguration; + ValidateOnly = validateOnly; + WorkItemProperties = workItemProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets unique connector id + /// + [JsonProperty(PropertyName = "ConnectorId")] + public string ConnectorId { get; set; } + + /// + /// Gets or sets serialized JSON object for detailed properties + /// + [JsonProperty(PropertyName = "ConnectorDataConfiguration")] + public string ConnectorDataConfiguration { get; set; } + + /// + /// Gets or sets boolean indicating validate only + /// + [JsonProperty(PropertyName = "ValidateOnly")] + public bool? ValidateOnly { get; set; } + + /// + /// Gets or sets custom work item properties + /// + [JsonProperty(PropertyName = "WorkItemProperties")] + public IDictionary WorkItemProperties { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Workbook.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Workbook.cs new file mode 100644 index 000000000000..d4a10828ffc5 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/Workbook.cs @@ -0,0 +1,201 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Application Insights workbook definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class Workbook : WorkbookResource + { + /// + /// Initializes a new instance of the Workbook class. + /// + public Workbook() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Workbook class. + /// + /// The user-defined name of the + /// workbook. + /// Configuration of this particular + /// workbook. Configuration data is a string containing valid + /// JSON + /// Internally assigned unique id of the + /// workbook definition. + /// Enum indicating if this workbook + /// definition is owned by a specific user or is shared between all + /// users with access to the Application Insights component. Possible + /// values include: 'user', 'shared' + /// Workbook category, as defined by the user at + /// creation time. + /// Unique user id of the specific user that owns + /// this workbook. + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource location + /// Resource tags + /// The kind of workbook. Choices are user and + /// shared. Possible values include: 'user', 'shared' + /// This instance's version of the data model. + /// This can change as new features are added that can be marked + /// workbook. + /// Date and time in UTC of the last + /// modification that was made to this workbook definition. + /// A list of 0 or more tags that are + /// associated with this workbook definition + /// Optional resourceId for a source + /// resource. + public Workbook(string workbookName, string serializedData, string workbookId, string sharedTypeKind, string category, string userId, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string kind = default(string), string version = default(string), string timeModified = default(string), IList workbookTags = default(IList), string sourceResourceId = default(string)) + : base(id, name, type, location, tags) + { + Kind = kind; + WorkbookName = workbookName; + SerializedData = serializedData; + Version = version; + WorkbookId = workbookId; + SharedTypeKind = sharedTypeKind; + TimeModified = timeModified; + Category = category; + WorkbookTags = workbookTags; + UserId = userId; + SourceResourceId = sourceResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of workbook. Choices are user and shared. + /// Possible values include: 'user', 'shared' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the user-defined name of the workbook. + /// + [JsonProperty(PropertyName = "properties.name")] + public string WorkbookName { get; set; } + + /// + /// Gets or sets configuration of this particular workbook. + /// Configuration data is a string containing valid JSON + /// + [JsonProperty(PropertyName = "properties.serializedData")] + public string SerializedData { get; set; } + + /// + /// Gets or sets this instance's version of the data model. This can + /// change as new features are added that can be marked workbook. + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets or sets internally assigned unique id of the workbook + /// definition. + /// + [JsonProperty(PropertyName = "properties.workbookId")] + public string WorkbookId { get; set; } + + /// + /// Gets or sets enum indicating if this workbook definition is owned + /// by a specific user or is shared between all users with access to + /// the Application Insights component. Possible values include: + /// 'user', 'shared' + /// + [JsonProperty(PropertyName = "properties.kind")] + public string SharedTypeKind { get; set; } + + /// + /// Gets date and time in UTC of the last modification that was made to + /// this workbook definition. + /// + [JsonProperty(PropertyName = "properties.timeModified")] + public string TimeModified { get; private set; } + + /// + /// Gets or sets workbook category, as defined by the user at creation + /// time. + /// + [JsonProperty(PropertyName = "properties.category")] + public string Category { get; set; } + + /// + /// Gets or sets a list of 0 or more tags that are associated with this + /// workbook definition + /// + [JsonProperty(PropertyName = "properties.tags")] + public IList WorkbookTags { get; set; } + + /// + /// Gets or sets unique user id of the specific user that owns this + /// workbook. + /// + [JsonProperty(PropertyName = "properties.userId")] + public string UserId { get; set; } + + /// + /// Gets or sets optional resourceId for a source resource. + /// + [JsonProperty(PropertyName = "properties.sourceResourceId")] + public string SourceResourceId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (WorkbookName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WorkbookName"); + } + if (SerializedData == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SerializedData"); + } + if (WorkbookId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "WorkbookId"); + } + if (SharedTypeKind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SharedTypeKind"); + } + if (Category == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Category"); + } + if (UserId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UserId"); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookError.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookError.cs new file mode 100644 index 000000000000..ee0478def290 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookError.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Error message body that will indicate why the operation failed. + /// + public partial class WorkbookError + { + /// + /// Initializes a new instance of the WorkbookError class. + /// + public WorkbookError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkbookError class. + /// + /// Service-defined error code. This code serves as + /// a sub-status for the HTTP error code specified in the + /// response. + /// Human-readable representation of the + /// error. + /// The list of invalid fields send in request, + /// in case of validation error. + public WorkbookError(string code = default(string), string message = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service-defined error code. This code serves as a + /// sub-status for the HTTP error code specified in the response. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets human-readable representation of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the list of invalid fields send in request, in case of + /// validation error. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookErrorException.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookErrorException.cs new file mode 100644 index 000000000000..5cc227dbc9e4 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookErrorException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with WorkbookError + /// information. + /// + public partial class WorkbookErrorException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public WorkbookError Body { get; set; } + + /// + /// Initializes a new instance of the WorkbookErrorException class. + /// + public WorkbookErrorException() + { + } + + /// + /// Initializes a new instance of the WorkbookErrorException class. + /// + /// The exception message. + public WorkbookErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the WorkbookErrorException class. + /// + /// The exception message. + /// Inner exception. + public WorkbookErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookResource.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookResource.cs new file mode 100644 index 000000000000..5cba7bcd9e3e --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Models/WorkbookResource.cs @@ -0,0 +1,87 @@ +// +// 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.ApplicationInsights.Management.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An azure resource object + /// + public partial class WorkbookResource : IResource + { + /// + /// Initializes a new instance of the WorkbookResource class. + /// + public WorkbookResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkbookResource class. + /// + /// Azure resource Id + /// Azure resource name + /// Azure resource type + /// Resource location + /// Resource tags + public WorkbookResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) + { + Id = id; + Name = name; + Type = type; + Location = location; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets azure resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets azure resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets azure resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets or sets resource location + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Gets or sets resource tags + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Operations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Operations.cs new file mode 100644 index 000000000000..2e469050f442 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Operations.cs @@ -0,0 +1,397 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Lists all of the available insights REST API operations. + /// + /// + /// 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.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("/") ? "" : "/")), "providers/Microsoft.Insights/operations").ToString(); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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; + } + + /// + /// Lists all of the available insights REST API operations. + /// + /// + /// 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("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; + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/OperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..75d869166e9b --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available insights REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available insights REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available insights REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available insights REST API operations. + /// + /// + /// 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 IOperations 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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Metrics.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperations.cs similarity index 51% rename from sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Metrics.cs rename to sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperations.cs index 74ceeca5567c..ed242de42dc2 100644 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/Metrics.cs +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperations.cs @@ -8,14 +8,14 @@ // regenerated. // -namespace Microsoft.Azure.ApplicationInsights.Query +namespace Microsoft.Azure.Management.ApplicationInsights.Management { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; - using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -23,12 +23,12 @@ namespace Microsoft.Azure.ApplicationInsights.Query using System.Threading.Tasks; /// - /// Metrics operations. + /// ProactiveDetectionConfigurationsOperations operations. /// - public partial class Metrics : IServiceOperations, IMetrics + internal partial class ProactiveDetectionConfigurationsOperations : IServiceOperations, IProactiveDetectionConfigurationsOperations { /// - /// Initializes a new instance of the Metrics class. + /// Initializes a new instance of the ProactiveDetectionConfigurationsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ public partial class Metrics : IServiceOperations /// /// Thrown when a required parameter is null /// - public Metrics(ApplicationInsightsDataClient client) + internal ProactiveDetectionConfigurationsOperations(ApplicationInsightsManagementClient client) { if (client == null) { @@ -46,82 +46,19 @@ public Metrics(ApplicationInsightsDataClient client) } /// - /// Gets a reference to the ApplicationInsightsDataClient + /// Gets a reference to the ApplicationInsightsManagementClient /// - public ApplicationInsightsDataClient Client { get; private set; } + public ApplicationInsightsManagementClient Client { get; private set; } /// - /// Retrieve metric data + /// Gets a list of ProactiveDetection configurations of an Application Insights + /// component. /// - /// - /// Gets metric values for a single metric - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// The name of the resource group. The name is case insensitive. /// - /// - /// ID of the metric. This is either a standard AI metric, or an - /// application-specific custom metric. Possible values include: - /// 'requests/count', 'requests/duration', 'requests/failed', 'users/count', - /// 'users/authenticated', 'pageViews/count', 'pageViews/duration', - /// 'client/processingDuration', 'client/receiveDuration', - /// 'client/networkDuration', 'client/sendDuration', 'client/totalDuration', - /// 'dependencies/count', 'dependencies/failed', 'dependencies/duration', - /// 'exceptions/count', 'exceptions/browser', 'exceptions/server', - /// 'sessions/count', 'performanceCounters/requestExecutionTime', - /// 'performanceCounters/requestsPerSecond', - /// 'performanceCounters/requestsInQueue', - /// 'performanceCounters/memoryAvailableBytes', - /// 'performanceCounters/exceptionsPerSecond', - /// 'performanceCounters/processCpuPercentage', - /// 'performanceCounters/processIOBytesPerSecond', - /// 'performanceCounters/processPrivateBytes', - /// 'performanceCounters/processorCpuPercentage', - /// 'availabilityResults/availabilityPercentage', - /// 'availabilityResults/duration', 'billing/telemetryCount', - /// 'customEvents/count' - /// - /// - /// The timespan over which to retrieve metric values. This is an ISO8601 time - /// period value. If timespan is omitted, a default time range of `PT12H` - /// ("last 12 hours") is used. The actual timespan that is queried may be - /// adjusted by the server based. In all cases, the actual time span used for - /// the query is included in the response. - /// - /// - /// The time interval to use when retrieving metric values. This is an ISO8601 - /// duration. If interval is omitted, the metric value is aggregated across the - /// entire timespan. If interval is supplied, the server may adjust the - /// interval to a more appropriate size based on the timespan used for the - /// query. In all cases, the actual interval used for the query is included in - /// the response. - /// - /// - /// The aggregation to use when computing the metric values. To retrieve more - /// than one aggregation at a time, separate them with a comma. If no - /// aggregation is specified, then the default aggregation for the metric is - /// used. - /// - /// - /// The name of the dimension to segment the metric values by. This dimension - /// must be applicable to the metric you are retrieving. To segment by more - /// than one dimension at a time, separate them with a comma (,). In this case, - /// the metric data will be segmented in the order the dimensions are listed in - /// the parameter. - /// - /// - /// The number of segments to return. This value is only valid when segment is - /// specified. - /// - /// - /// The aggregation function and direction to sort the segments by. This value - /// is only valid when segment is specified. - /// - /// - /// An expression used to filter the results. This value should be a valid - /// OData filter expression where the keys of each clause should be applicable - /// dimensions for the metric you are retrieving. + /// + /// The name of the Application Insights component resource. /// /// /// Headers that will be added to request. @@ -129,7 +66,7 @@ public Metrics(ApplicationInsightsDataClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -144,30 +81,53 @@ public Metrics(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string appId, string metricId, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), IList aggregation = default(IList), IList segment = default(IList), int? top = default(int?), string orderby = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (metricId == null) + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "metricId"); + 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 (aggregation != null) + if (Client.ApiVersion == null) { - if (aggregation.Count < 1) + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) { - throw new ValidationException(ValidationRules.MinItems, "aggregation", 1); + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); } } - if (segment != null) + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) { - if (segment.Count < 1) + if (Client.SubscriptionId.Length < 1) { - throw new ValidationException(ValidationRules.MinItems, "segment", 1); + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -175,55 +135,25 @@ public Metrics(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("metricId", metricId); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("interval", interval); - tracingParameters.Add("aggregation", aggregation); - tracingParameters.Add("segment", segment); - tracingParameters.Add("top", top); - tracingParameters.Add("orderby", orderby); - tracingParameters.Add("filter", filter); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/metrics/{metricId}").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); - _url = _url.Replace("{metricId}", System.Uri.EscapeDataString(metricId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); - if (timespan != null) - { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); - } - if (interval != null) - { - _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); - } - if (aggregation != null) - { - _queryParameters.Add(string.Format("aggregation={0}", System.Uri.EscapeDataString(string.Join(",", aggregation)))); - } - if (segment != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("segment={0}", System.Uri.EscapeDataString(string.Join(",", segment)))); - } - if (top != null) - { - _queryParameters.Add(string.Format("top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (orderby != null) - { - _queryParameters.Add(string.Format("orderby={0}", System.Uri.EscapeDataString(orderby))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("filter={0}", System.Uri.EscapeDataString(filter))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { - _url += "?" + string.Join("&", _queryParameters); + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); } // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); @@ -231,6 +161,18 @@ public Metrics(ApplicationInsightsDataClient client) _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) @@ -269,13 +211,14 @@ public Metrics(ApplicationInsightsDataClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -285,6 +228,10 @@ public Metrics(ApplicationInsightsDataClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -297,16 +244,20 @@ public Metrics(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -326,17 +277,17 @@ public Metrics(ApplicationInsightsDataClient client) } /// - /// Retrieve metric data + /// Get the ProactiveDetection configuration for this configuration id. /// - /// - /// Gets metric values for multiple metrics - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. /// - /// - /// The batched metrics query. + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. /// /// /// Headers that will be added to request. @@ -344,7 +295,7 @@ public Metrics(ApplicationInsightsDataClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -359,26 +310,57 @@ public Metrics(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> GetMultipleWithHttpMessagesAsync(string appId, IList body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string configurationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + 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, "appId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (body == null) + if (Client.ApiVersion != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } } - if (body != null) + if (Client.SubscriptionId == null) { - foreach (var element in body) + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) { - if (element != null) - { - element.Validate(); - } + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (configurationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -386,21 +368,46 @@ public Metrics(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); - tracingParameters.Add("body", body); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("configurationId", configurationId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetMultiple", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/metrics").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{ConfigurationId}", System.Uri.EscapeDataString(configurationId)); + 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.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) @@ -417,12 +424,6 @@ public Metrics(ApplicationInsightsDataClient 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) { @@ -445,13 +446,14 @@ public Metrics(ApplicationInsightsDataClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -461,6 +463,10 @@ public Metrics(ApplicationInsightsDataClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -473,16 +479,20 @@ public Metrics(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse>(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -502,14 +512,21 @@ public Metrics(ApplicationInsightsDataClient client) } /// - /// Retrieve metric metatadata + /// Update the ProactiveDetection configuration for this configuration id. /// - /// - /// Gets metadata describing the available metrics - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the ProactiveDetection + /// configuration. /// /// /// Headers that will be added to request. @@ -517,7 +534,7 @@ public Metrics(ApplicationInsightsDataClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -532,11 +549,60 @@ public Metrics(ApplicationInsightsDataClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetMetadataWithHttpMessagesAsync(string appId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string configurationId, ApplicationInsightsComponentProactiveDetectionConfiguration proactiveDetectionProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (appId == null) + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "appId"); + 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (configurationId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "configurationId"); + } + if (proactiveDetectionProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "proactiveDetectionProperties"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -545,20 +611,47 @@ public Metrics(ApplicationInsightsDataClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("appId", appId); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("configurationId", configurationId); + tracingParameters.Add("proactiveDetectionProperties", proactiveDetectionProperties); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetMetadata", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "apps/{appId}/metrics/metadata").ToString(); - _url = _url.Replace("{appId}", System.Uri.EscapeDataString(appId)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{ConfigurationId}", System.Uri.EscapeDataString(configurationId)); + 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.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) @@ -575,6 +668,12 @@ public Metrics(ApplicationInsightsDataClient client) // Serialize Request string _requestContent = null; + if(proactiveDetectionProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(proactiveDetectionProperties, 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) { @@ -597,13 +696,14 @@ public Metrics(ApplicationInsightsDataClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -613,6 +713,10 @@ public Metrics(ApplicationInsightsDataClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -625,16 +729,20 @@ public Metrics(ApplicationInsightsDataClient client) throw ex; } // Create Result - var _result = new HttpOperationResponse(); + 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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperationsExtensions.cs new file mode 100644 index 000000000000..26a34263ada5 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/ProactiveDetectionConfigurationsOperationsExtensions.cs @@ -0,0 +1,173 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ProactiveDetectionConfigurationsOperations. + /// + public static partial class ProactiveDetectionConfigurationsOperationsExtensions + { + /// + /// Gets a list of ProactiveDetection configurations of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IList List(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of ProactiveDetection configurations of an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the ProactiveDetection configuration for this configuration id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + public static ApplicationInsightsComponentProactiveDetectionConfiguration Get(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, string configurationId) + { + return operations.GetAsync(resourceGroupName, resourceName, configurationId).GetAwaiter().GetResult(); + } + + /// + /// Get the ProactiveDetection configuration for this configuration id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, string configurationId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, configurationId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the ProactiveDetection configuration for this configuration id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the ProactiveDetection + /// configuration. + /// + public static ApplicationInsightsComponentProactiveDetectionConfiguration Update(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, string configurationId, ApplicationInsightsComponentProactiveDetectionConfiguration proactiveDetectionProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, configurationId, proactiveDetectionProperties).GetAwaiter().GetResult(); + } + + /// + /// Update the ProactiveDetection configuration for this configuration id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The ProactiveDetection configuration ID. This is unique within a + /// Application Insights component. + /// + /// + /// Properties that need to be specified to update the ProactiveDetection + /// configuration. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IProactiveDetectionConfigurationsOperations operations, string resourceGroupName, string resourceName, string configurationId, ApplicationInsightsComponentProactiveDetectionConfiguration proactiveDetectionProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, configurationId, proactiveDetectionProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperationsExtensions.cs deleted file mode 100644 index b056b6b2d48c..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/QueryOperationsExtensions.cs +++ /dev/null @@ -1,93 +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.ApplicationInsights.Query -{ - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for QueryOperations. - /// - public static partial class QueryOperationsExtensions - { - /// - /// Execute an Analytics query - /// - /// - /// Executes an Analytics query for data. - /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) - /// is an example for using POST with an Analytics query. - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The query to execute. - /// - /// - /// Optional. The timespan over which to query data. This is an ISO8601 time - /// period value. This timespan is applied in addition to any that are - /// specified in the query expression. - /// - /// - /// A list of Application IDs for cross-application queries. - /// - public static QueryResults Execute(this IQueryOperations operations, string appId, string query, string timespan = default(string), IList applications = default(IList)) - { - return operations.ExecuteAsync(appId, query, timespan, applications).GetAwaiter().GetResult(); - } - - /// - /// Execute an Analytics query - /// - /// - /// Executes an Analytics query for data. - /// [Here](https://dev.applicationinsights.io/documentation/Using-the-API/Query) - /// is an example for using POST with an Analytics query. - /// - /// - /// The operations group for this extension method. - /// - /// - /// ID of the application. This is Application ID from the API Access settings - /// blade in the Azure portal. - /// - /// - /// The query to execute. - /// - /// - /// Optional. The timespan over which to query data. This is an ISO8601 time - /// period value. This timespan is applied in addition to any that are - /// specified in the query expression. - /// - /// - /// A list of Application IDs for cross-application queries. - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteAsync(this IQueryOperations operations, string appId, string query, string timespan = default(string), IList applications = default(IList), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ExecuteWithHttpMessagesAsync(appId, query, timespan, applications, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsDataClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsDataClient.cs deleted file mode 100644 index 690be7cf7f1f..000000000000 --- a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsDataClient.cs +++ /dev/null @@ -1,29 +0,0 @@ - -// -// 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.ApplicationInsights.Query -{ - using System; - using System.Collections.Generic; - using System.Linq; - - internal static partial class SdkInfo - { - public static IEnumerable> ApiInfo_ApplicationInsightsDataClient - { - get - { - return new Tuple[] - { - new Tuple("ApplicationInsightsDataClient", "Events", "v1"), - new Tuple("ApplicationInsightsDataClient", "Metrics", "v1"), - new Tuple("ApplicationInsightsDataClient", "Query", "v1"), - }.AsEnumerable(); - } - } - } -} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsManagementClient.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsManagementClient.cs new file mode 100644 index 000000000000..7913ef24174c --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/SdkInfo_ApplicationInsightsManagementClient.cs @@ -0,0 +1,42 @@ + +// +// 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.ApplicationInsights.Management +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_ApplicationInsightsManagementClient + { + get + { + return new Tuple[] + { + new Tuple("Insights", "APIKeys", "2015-05-01"), + new Tuple("Insights", "Annotations", "2015-05-01"), + new Tuple("Insights", "ComponentAvailableFeatures", "2015-05-01"), + new Tuple("Insights", "ComponentCurrentBillingFeatures", "2015-05-01"), + new Tuple("Insights", "ComponentFeatureCapabilities", "2015-05-01"), + new Tuple("Insights", "ComponentQuotaStatus", "2015-05-01"), + new Tuple("Insights", "Components", "2015-05-01"), + new Tuple("Insights", "ExportConfigurations", "2015-05-01"), + new Tuple("Insights", "Favorites", "2015-05-01"), + new Tuple("Insights", "Operations", "2015-05-01"), + new Tuple("Insights", "ProactiveDetectionConfigurations", "2015-05-01"), + new Tuple("Insights", "WebTests", "2015-05-01"), + new Tuple("Insights", "WorkItemConfigurations", "2015-05-01"), + new Tuple("Insights", "webTestLocations", "2015-05-01"), + new Tuple("insights", "AnalyticsItems", "2015-05-01"), + new Tuple("insights", "Workbooks", "2015-05-01"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperations.cs new file mode 100644 index 000000000000..3e417f85e638 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperations.cs @@ -0,0 +1,280 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// WebTestLocationsOperations operations. + /// + internal partial class WebTestLocationsOperations : IServiceOperations, IWebTestLocationsOperations + { + /// + /// Initializes a new instance of the WebTestLocationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WebTestLocationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets a list of web test locations available to this Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/syntheticmonitorlocations").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperationsExtensions.cs new file mode 100644 index 000000000000..ab7e4e9f97bc --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestLocationsOperationsExtensions.cs @@ -0,0 +1,69 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WebTestLocationsOperations. + /// + public static partial class WebTestLocationsOperationsExtensions + { + /// + /// Gets a list of web test locations available to this Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IEnumerable List(this IWebTestLocationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of web test locations available to this Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWebTestLocationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperations.cs new file mode 100644 index 000000000000..ed5eededf6d6 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperations.cs @@ -0,0 +1,2123 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// WebTestsOperations operations. + /// + internal partial class WebTestsOperations : IServiceOperations, IWebTestsOperations + { + /// + /// Initializes a new instance of the WebTestsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WebTestsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Get all Application Insights web tests defined within a 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 (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); + } + } + 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); + } + } + // 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.Insights/webtests").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string webTestName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (webTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("webTestName", webTestName); + 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.Insights/webtests/{webTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{webTestName}", System.Uri.EscapeDataString(webTestName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Properties that need to be specified to create or update an Application + /// Insights web test definition. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string webTestName, WebTest webTestDefinition, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (webTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestName"); + } + if (webTestDefinition == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestDefinition"); + } + if (webTestDefinition != null) + { + webTestDefinition.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("webTestName", webTestName); + tracingParameters.Add("webTestDefinition", webTestDefinition); + tracingParameters.Add("cancellationToken", cancellationToken); + 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.Insights/webtests/{webTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{webTestName}", System.Uri.EscapeDataString(webTestName)); + 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(webTestDefinition != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(webTestDefinition, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Resource tags + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string webTestName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (webTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestName"); + } + TagsResource webTestTags = new TagsResource(); + if (tags != null) + { + webTestTags.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("webTestName", webTestName); + tracingParameters.Add("webTestTags", webTestTags); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", 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.Insights/webtests/{webTestName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{webTestName}", System.Uri.EscapeDataString(webTestName)); + 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(webTestTags != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(webTestTags, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes an Application Insights web test. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string webTestName, 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 (webTestName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "webTestName"); + } + 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("webTestName", webTestName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{webTestName}", System.Uri.EscapeDataString(webTestName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// 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.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 (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); + } + } + // 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.Insights/webtests").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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 all Application Insights web tests defined for the specified component. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// 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>> ListByComponentWithHttpMessagesAsync(string componentName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (componentName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "componentName"); + } + 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); + } + } + 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); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("componentName", componentName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByComponent", 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.Insights/components/{componentName}/webtests").ToString(); + _url = _url.Replace("{componentName}", System.Uri.EscapeDataString(componentName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// 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("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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 all Application Insights web tests defined for the specified component. + /// + /// + /// 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>> ListByComponentNextWithHttpMessagesAsync(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, "ListByComponentNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperationsExtensions.cs new file mode 100644 index 000000000000..8bb6c1710157 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WebTestsOperationsExtensions.cs @@ -0,0 +1,410 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WebTestsOperations. + /// + public static partial class WebTestsOperationsExtensions + { + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IWebTestsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IWebTestsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + public static WebTest Get(this IWebTestsOperations operations, string resourceGroupName, string webTestName) + { + return operations.GetAsync(resourceGroupName, webTestName).GetAwaiter().GetResult(); + } + + /// + /// Get a specific Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWebTestsOperations operations, string resourceGroupName, string webTestName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, webTestName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Properties that need to be specified to create or update an Application + /// Insights web test definition. + /// + public static WebTest CreateOrUpdate(this IWebTestsOperations operations, string resourceGroupName, string webTestName, WebTest webTestDefinition) + { + return operations.CreateOrUpdateAsync(resourceGroupName, webTestName, webTestDefinition).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Properties that need to be specified to create or update an Application + /// Insights web test definition. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWebTestsOperations operations, string resourceGroupName, string webTestName, WebTest webTestDefinition, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, webTestName, webTestDefinition, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Resource tags + /// + public static WebTest UpdateTags(this IWebTestsOperations operations, string resourceGroupName, string webTestName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateTagsAsync(resourceGroupName, webTestName, tags).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an Application Insights web test definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// Resource tags + /// + /// + /// The cancellation token. + /// + public static async Task UpdateTagsAsync(this IWebTestsOperations operations, string resourceGroupName, string webTestName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, webTestName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes an Application Insights web test. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + public static void Delete(this IWebTestsOperations operations, string resourceGroupName, string webTestName) + { + operations.DeleteAsync(resourceGroupName, webTestName).GetAwaiter().GetResult(); + } + + /// + /// Deletes an Application Insights web test. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights webtest resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWebTestsOperations operations, string resourceGroupName, string webTestName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, webTestName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IWebTestsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWebTestsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByComponent(this IWebTestsOperations operations, string componentName, string resourceGroupName) + { + return operations.ListByComponentAsync(componentName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByComponentAsync(this IWebTestsOperations operations, string componentName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByComponentWithHttpMessagesAsync(componentName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IWebTestsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web tests defined within a specified resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IWebTestsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IWebTestsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web test alerts definitions within a + /// 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 IWebTestsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByComponentNext(this IWebTestsOperations operations, string nextPageLink) + { + return operations.ListByComponentNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all Application Insights web tests defined for the specified component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByComponentNextAsync(this IWebTestsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByComponentNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperations.cs new file mode 100644 index 000000000000..71caa7caf5e3 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperations.cs @@ -0,0 +1,1439 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// WorkItemConfigurationsOperations operations. + /// + internal partial class WorkItemConfigurationsOperations : IServiceOperations, IWorkItemConfigurationsOperations + { + /// + /// Initializes a new instance of the WorkItemConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkItemConfigurationsOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Gets the list work item configurations that exist for the application + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 WorkItemConfigurationErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkItemConfigurationError _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 work item configuration for an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a work item configuration of + /// a Application Insights component. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, WorkItemCreateConfiguration workItemConfigurationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (workItemConfigurationProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigurationProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workItemConfigurationProperties", workItemConfigurationProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(workItemConfigurationProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workItemConfigurationProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets default work item configurations that exist for the application + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDefaultWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 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); + } + } + 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDefault", 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.Insights/components/{resourceName}/DefaultWorkItemConfig").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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 work item configuration of an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (workItemConfigId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workItemConfigId", workItemConfigId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{workItemConfigId}", System.Uri.EscapeDataString(workItemConfigId)); + 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Gets specified work item configuration for an Application Insights + /// component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// 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> GetItemWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (workItemConfigId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workItemConfigId", workItemConfigId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetItem", 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.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{workItemConfigId}", System.Uri.EscapeDataString(workItemConfigId)); + 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update a work item configuration for an Application Insights component. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// Properties that need to be specified to update a work item configuration + /// for this Application Insights component. + /// + /// + /// 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> UpdateItemWithHttpMessagesAsync(string resourceGroupName, string resourceName, string workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (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 (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (workItemConfigId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigId"); + } + if (workItemConfigurationProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workItemConfigurationProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workItemConfigId", workItemConfigId); + tracingParameters.Add("workItemConfigurationProperties", workItemConfigurationProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateItem", 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.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{workItemConfigId}", System.Uri.EscapeDataString(workItemConfigId)); + 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(workItemConfigurationProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workItemConfigurationProperties, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperationsExtensions.cs new file mode 100644 index 000000000000..9e27b35b09e1 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkItemConfigurationsOperationsExtensions.cs @@ -0,0 +1,306 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkItemConfigurationsOperations. + /// + public static partial class WorkItemConfigurationsOperationsExtensions + { + /// + /// Gets the list work item configurations that exist for the application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static IEnumerable List(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list work item configurations that exist for the application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a work item configuration for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a work item configuration of + /// a Application Insights component. + /// + public static WorkItemConfiguration Create(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, WorkItemCreateConfiguration workItemConfigurationProperties) + { + return operations.CreateAsync(resourceGroupName, resourceName, workItemConfigurationProperties).GetAwaiter().GetResult(); + } + + /// + /// Create a work item configuration for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a work item configuration of + /// a Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, WorkItemCreateConfiguration workItemConfigurationProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, workItemConfigurationProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets default work item configurations that exist for the application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static WorkItemConfiguration GetDefault(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetDefaultAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets default work item configurations that exist for the application + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetDefaultAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDefaultWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a work item configuration of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + public static void Delete(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId) + { + operations.DeleteAsync(resourceGroupName, resourceName, workItemConfigId).GetAwaiter().GetResult(); + } + + /// + /// Delete a work item configuration of an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, workItemConfigId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets specified work item configuration for an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + public static WorkItemConfiguration GetItem(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId) + { + return operations.GetItemAsync(resourceGroupName, resourceName, workItemConfigId).GetAwaiter().GetResult(); + } + + /// + /// Gets specified work item configuration for an Application Insights + /// component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// The cancellation token. + /// + public static async Task GetItemAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetItemWithHttpMessagesAsync(resourceGroupName, resourceName, workItemConfigId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a work item configuration for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// Properties that need to be specified to update a work item configuration + /// for this Application Insights component. + /// + public static WorkItemConfiguration UpdateItem(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties) + { + return operations.UpdateItemAsync(resourceGroupName, resourceName, workItemConfigId, workItemConfigurationProperties).GetAwaiter().GetResult(); + } + + /// + /// Update a work item configuration for an Application Insights component. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The unique work item configuration Id. This can be either friendly name of + /// connector as defined in connector configuration + /// + /// + /// Properties that need to be specified to update a work item configuration + /// for this Application Insights component. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateItemAsync(this IWorkItemConfigurationsOperations operations, string resourceGroupName, string resourceName, string workItemConfigId, WorkItemCreateConfiguration workItemConfigurationProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateItemWithHttpMessagesAsync(resourceGroupName, resourceName, workItemConfigId, workItemConfigurationProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperations.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperations.cs new file mode 100644 index 000000000000..05f28e66b81a --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperations.cs @@ -0,0 +1,1204 @@ +// +// 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.ApplicationInsights.Management +{ + 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; + + /// + /// WorkbooksOperations operations. + /// + internal partial class WorkbooksOperations : IServiceOperations, IWorkbooksOperations + { + /// + /// Initializes a new instance of the WorkbooksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkbooksOperations(ApplicationInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApplicationInsightsManagementClient + /// + public ApplicationInsightsManagementClient Client { get; private set; } + + /// + /// Get all Workbooks defined within a specified resource group and category. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Category of workbook to return. Possible values include: 'workbook', 'TSG', + /// 'performance', 'retention' + /// + /// + /// Tags presents on each workbook returned. + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable workbook. If false, only return summary content for workbooks. + /// + /// + /// 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, string category, IList tags = default(IList), bool? canFetchContent = default(bool?), 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 (category == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "category"); + } + 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("category", category); + tracingParameters.Add("tags", tags); + tracingParameters.Add("canFetchContent", canFetchContent); + 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}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (category != null) + { + _queryParameters.Add(string.Format("category={0}", System.Uri.EscapeDataString(category))); + } + if (tags != null) + { + _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(string.Join(",", tags)))); + } + if (canFetchContent != null) + { + _queryParameters.Add(string.Format("canFetchContent={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(canFetchContent, Client.SerializationSettings).Trim('"')))); + } + 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 WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a single workbook by its resourceName. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + 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("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _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 workbook. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + 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("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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 != 201 && (int)_statusCode != 204) + { + var ex = new WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _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; + } + + /// + /// Create a new workbook. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Workbook workbookProperties, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + 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 (workbookProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workbookProperties"); + } + if (workbookProperties != null) + { + workbookProperties.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workbookProperties", workbookProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + 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}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(workbookProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workbookProperties, 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 WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates a workbook that has already been added. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, Workbook workbookProperties, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + 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 (workbookProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workbookProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("workbookProperties", workbookProperties); + 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}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + 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(workbookProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workbookProperties, 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 WorkbookErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + WorkbookError _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/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperationsExtensions.cs b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperationsExtensions.cs new file mode 100644 index 000000000000..d249300d42f0 --- /dev/null +++ b/sdk/applicationinsights/Microsoft.Azure.ApplicationInsights/src/Generated/WorkbooksOperationsExtensions.cs @@ -0,0 +1,252 @@ +// +// 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.ApplicationInsights.Management +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for WorkbooksOperations. + /// + public static partial class WorkbooksOperationsExtensions + { + /// + /// Get all Workbooks defined within a specified resource group and category. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Category of workbook to return. Possible values include: 'workbook', 'TSG', + /// 'performance', 'retention' + /// + /// + /// Tags presents on each workbook returned. + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable workbook. If false, only return summary content for workbooks. + /// + public static IEnumerable ListByResourceGroup(this IWorkbooksOperations operations, string resourceGroupName, string category, IList tags = default(IList), bool? canFetchContent = default(bool?)) + { + return operations.ListByResourceGroupAsync(resourceGroupName, category, tags, canFetchContent).GetAwaiter().GetResult(); + } + + /// + /// Get all Workbooks defined within a specified resource group and category. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Category of workbook to return. Possible values include: 'workbook', 'TSG', + /// 'performance', 'retention' + /// + /// + /// Tags presents on each workbook returned. + /// + /// + /// Flag indicating whether or not to return the full content for each + /// applicable workbook. If false, only return summary content for workbooks. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IWorkbooksOperations operations, string resourceGroupName, string category, IList tags = default(IList), bool? canFetchContent = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, category, tags, canFetchContent, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a single workbook by its resourceName. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static Workbook Get(this IWorkbooksOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Get a single workbook by its resourceName. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a workbook. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + public static void Delete(this IWorkbooksOperations operations, string resourceGroupName, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Delete a workbook. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a new workbook. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + public static Workbook CreateOrUpdate(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, Workbook workbookProperties) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, workbookProperties).GetAwaiter().GetResult(); + } + + /// + /// Create a new workbook. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, Workbook workbookProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, workbookProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a workbook that has already been added. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + public static Workbook Update(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, Workbook workbookProperties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, workbookProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a workbook that has already been added. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Application Insights component resource. + /// + /// + /// Properties that need to be specified to create a new workbook. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IWorkbooksOperations operations, string resourceGroupName, string resourceName, Workbook workbookProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, workbookProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} From 6f5c4b8401b6360ab1b31d782333fe5b81ea488d Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2019 03:13:24 +0000 Subject: [PATCH 14/16] [AutoPR Microsoft.Azure.Management.Storage] Add change feed properties to 2019-04-01 Storage. (#153) * Generated from cce264ba7c751076c58518d67e19b9e469832c0c (#136) Update ListLegacyPeerings.json * Generated from 774367438889ac553def1957b72b8ba63ad877e5 Add change feed properties to 2019-04-01 Storage. Add change feed properties to Storage Blob Services. --- .../src/Generated/FileServicesOperations.cs | 782 +++++++++ .../FileServicesOperationsExtensions.cs | 179 +++ .../src/Generated/FileSharesOperations.cs | 1399 +++++++++++++++++ .../FileSharesOperationsExtensions.cs | 360 +++++ .../src/Generated/IFileServicesOperations.cs | 119 ++ .../src/Generated/IFileSharesOperations.cs | 222 +++ ...{ISKUsOperations.cs => ISkusOperations.cs} | 0 .../src/Generated/IStorageManagementClient.cs | 10 + .../Generated/Models/BlobServiceProperties.cs | 11 +- .../src/Generated/Models/ChangeFeed.cs | 53 + .../Models/ErrorResponseException.cs | 62 + .../src/Generated/Models/FileServiceItems.cs | 50 + .../Generated/Models/FileServiceProperties.cs | 68 + .../src/Generated/Models/FileShare.cs | 104 ++ .../src/Generated/Models/FileShareItem.cs | 103 ++ .../src/Generated/Models/FileShareItems.cs | 66 + .../Generated/Models/{IpRule.cs => IPRule.cs} | 0 .../{signedResource.cs => SignedResource.cs} | 0 .../SdkInfo_StorageManagementClient.cs | 13 +- .../{SKUsOperations.cs => SkusOperations.cs} | 0 ...ensions.cs => SkusOperationsExtensions.cs} | 0 .../src/Generated/StorageManagementClient.cs | 12 + 22 files changed, 3601 insertions(+), 12 deletions(-) create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs rename sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/{ISKUsOperations.cs => ISkusOperations.cs} (100%) create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ChangeFeed.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceItems.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceProperties.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShare.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItem.cs create mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItems.cs rename sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/{IpRule.cs => IPRule.cs} (100%) rename sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/{signedResource.cs => SignedResource.cs} (100%) rename sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/{SKUsOperations.cs => SkusOperations.cs} (100%) rename sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/{SKUsOperationsExtensions.cs => SkusOperationsExtensions.cs} (100%) diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs new file mode 100644 index 000000000000..d72b5d860330 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs @@ -0,0 +1,782 @@ +// +// 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.Storage +{ + 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; + + /// + /// FileServicesOperations operations. + /// + internal partial class FileServicesOperations : IServiceOperations, IFileServicesOperations + { + /// + /// Initializes a new instance of the FileServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FileServicesOperations(StorageManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorageManagementClient + /// + public StorageManagementClient Client { get; private set; } + + /// + /// List all file services in storage accounts + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// 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 accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + 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 (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); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + 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.Storage/storageAccounts/{accountName}/fileServices").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _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; + } + + /// + /// Sets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Specifies CORS rules for the File service. You can include up to five + /// CorsRule elements in the request. If no CorsRule elements are included in + /// the request body, all CORS rules will be deleted, and CORS will be disabled + /// for the File service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> PutServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + 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 (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); + } + } + string fileServicesName = "default"; + FileServiceProperties parameters = new FileServiceProperties(); + if (cors != null) + { + parameters.Cors = cors; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("fileServicesName", fileServicesName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PutServiceProperties", 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.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{FileServicesName}", System.Uri.EscapeDataString(fileServicesName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + 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; + } + + /// + /// Gets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// 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> GetServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + 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 (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); + } + } + string fileServicesName = "default"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("fileServicesName", fileServicesName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetServiceProperties", 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.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{FileServicesName}", System.Uri.EscapeDataString(fileServicesName)); + 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; + } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs new file mode 100644 index 000000000000..4bdb921f0b88 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs @@ -0,0 +1,179 @@ +// +// 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.Storage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FileServicesOperations. + /// + public static partial class FileServicesOperationsExtensions + { + /// + /// List all file services in storage accounts + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + public static FileServiceItems List(this IFileServicesOperations operations, string resourceGroupName, string accountName) + { + return operations.ListAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// List all file services in storage accounts + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IFileServicesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Sets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Specifies CORS rules for the File service. You can include up to five + /// CorsRule elements in the request. If no CorsRule elements are included in + /// the request body, all CORS rules will be deleted, and CORS will be disabled + /// for the File service. + /// + public static FileServiceProperties PutServiceProperties(this IFileServicesOperations operations, string resourceGroupName, string accountName, CorsRules cors = default(CorsRules)) + { + return operations.PutServicePropertiesAsync(resourceGroupName, accountName, cors).GetAwaiter().GetResult(); + } + + /// + /// Sets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Specifies CORS rules for the File service. You can include up to five + /// CorsRule elements in the request. If no CorsRule elements are included in + /// the request body, all CORS rules will be deleted, and CORS will be disabled + /// for the File service. + /// + /// + /// The cancellation token. + /// + public static async Task PutServicePropertiesAsync(this IFileServicesOperations operations, string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutServicePropertiesWithHttpMessagesAsync(resourceGroupName, accountName, cors, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + public static FileServiceProperties GetServiceProperties(this IFileServicesOperations operations, string resourceGroupName, string accountName) + { + return operations.GetServicePropertiesAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Gets the properties of file services in storage accounts, including CORS + /// (Cross-Origin Resource Sharing) rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The cancellation token. + /// + public static async Task GetServicePropertiesAsync(this IFileServicesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetServicePropertiesWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs new file mode 100644 index 000000000000..0ce82f296db1 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs @@ -0,0 +1,1399 @@ +// +// 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.Storage +{ + 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; + + /// + /// FileSharesOperations operations. + /// + internal partial class FileSharesOperations : IServiceOperations, IFileSharesOperations + { + /// + /// Initializes a new instance of the FileSharesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FileSharesOperations(StorageManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the StorageManagementClient + /// + public StorageManagementClient Client { get; private set; } + + /// + /// Lists all shares. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Optional. Continuation token for the list operation. + /// + /// + /// Optional. Specified maximum number of shares that can be included in the + /// list. + /// + /// + /// Optional. When specified, only share names starting with the filter will be + /// listed. + /// + /// + /// 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 accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + 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 (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); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("maxpagesize", maxpagesize); + tracingParameters.Add("filter", filter); + 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.Storage/storageAccounts/{accountName}/fileServices/default/shares").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _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 (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } + if (maxpagesize != null) + { + _queryParameters.Add(string.Format("$maxpagesize={0}", System.Uri.EscapeDataString(maxpagesize))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + 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; + } + + /// + /// Creates a new share under the specified account as described by request + /// body. The share resource includes metadata and properties for that share. + /// It does not include a list of the files contained by the share. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (shareName != null) + { + if (shareName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "shareName", 63); + } + if (shareName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "shareName", 3); + } + } + 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 (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 (shareQuota > 5120) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "shareQuota", 5120); + } + if (shareQuota < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "shareQuota", 1); + } + FileShare fileShare = new FileShare(); + if (metadata != null || shareQuota != null) + { + fileShare.Metadata = metadata; + fileShare.ShareQuota = shareQuota; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("fileShare", fileShare); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(fileShare != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fileShare, 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; + } + + /// + /// Updates share properties as specified in request body. Properties not + /// mentioned in the request will not be changed. Update fails if the specified + /// share does not already exist. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + /// + /// 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 accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (shareName != null) + { + if (shareName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "shareName", 63); + } + if (shareName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "shareName", 3); + } + } + 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 (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 (shareQuota > 5120) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "shareQuota", 5120); + } + if (shareQuota < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "shareQuota", 1); + } + FileShare fileShare = new FileShare(); + if (metadata != null || shareQuota != null) + { + fileShare.Metadata = metadata; + fileShare.ShareQuota = shareQuota; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("fileShare", fileShare); + 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.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(fileShare != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(fileShare, 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; + } + + /// + /// Gets properties of a specified share. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// 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 accountName, string shareName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (shareName != null) + { + if (shareName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "shareName", 63); + } + if (shareName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "shareName", 3); + } + } + 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 (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); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("shareName", shareName); + 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.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _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; + } + + /// + /// Deletes specified share under its account. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (accountName != null) + { + if (accountName.Length > 24) + { + throw new ValidationException(ValidationRules.MaxLength, "accountName", 24); + } + if (accountName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "accountName", 3); + } + } + if (shareName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "shareName"); + } + if (shareName != null) + { + if (shareName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "shareName", 63); + } + if (shareName.Length < 3) + { + throw new ValidationException(ValidationRules.MinLength, "shareName", 3); + } + } + 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 (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); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("shareName", shareName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{shareName}", System.Uri.EscapeDataString(shareName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new 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; + } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs new file mode 100644 index 000000000000..513a98837ea7 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs @@ -0,0 +1,360 @@ +// +// 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.Storage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FileSharesOperations. + /// + public static partial class FileSharesOperationsExtensions + { + /// + /// Lists all shares. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Optional. Continuation token for the list operation. + /// + /// + /// Optional. Specified maximum number of shares that can be included in the + /// list. + /// + /// + /// Optional. When specified, only share names starting with the filter will be + /// listed. + /// + public static FileShareItems List(this IFileSharesOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string)) + { + return operations.ListAsync(resourceGroupName, accountName, skipToken, maxpagesize, filter).GetAwaiter().GetResult(); + } + + /// + /// Lists all shares. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// Optional. Continuation token for the list operation. + /// + /// + /// Optional. Specified maximum number of shares that can be included in the + /// list. + /// + /// + /// Optional. When specified, only share names starting with the filter will be + /// listed. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, skipToken, maxpagesize, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new share under the specified account as described by request + /// body. The share resource includes metadata and properties for that share. + /// It does not include a list of the files contained by the share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + public static FileShare Create(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?)) + { + return operations.CreateAsync(resourceGroupName, accountName, shareName, metadata, shareQuota).GetAwaiter().GetResult(); + } + + /// + /// Creates a new share under the specified account as described by request + /// body. The share resource includes metadata and properties for that share. + /// It does not include a list of the files contained by the share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, accountName, shareName, metadata, shareQuota, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates share properties as specified in request body. Properties not + /// mentioned in the request will not be changed. Update fails if the specified + /// share does not already exist. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + public static FileShare Update(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?)) + { + return operations.UpdateAsync(resourceGroupName, accountName, shareName, metadata, shareQuota).GetAwaiter().GetResult(); + } + + /// + /// Updates share properties as specified in request body. Properties not + /// mentioned in the request will not be changed. Update fails if the specified + /// share does not already exist. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than 0, and + /// less than or equal to 5TB (5120). + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, accountName, shareName, metadata, shareQuota, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets properties of a specified share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + public static FileShare Get(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName) + { + return operations.GetAsync(resourceGroupName, accountName, shareName).GetAwaiter().GetResult(); + } + + /// + /// Gets properties of a specified share. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, shareName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes specified share under its account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + public static void Delete(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName) + { + operations.DeleteAsync(resourceGroupName, accountName, shareName).GetAwaiter().GetResult(); + } + + /// + /// Deletes specified share under its account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the storage account within the specified resource group. + /// Storage account names must be between 3 and 24 characters in length and use + /// numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. File share + /// names must be between 3 and 63 characters in length and use numbers, + /// lower-case letters and dash (-) only. Every dash (-) character must be + /// immediately preceded and followed by a letter or number. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string shareName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, shareName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs new file mode 100644 index 000000000000..6b087c69a856 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs @@ -0,0 +1,119 @@ +// +// 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.Storage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FileServicesOperations operations. + /// + public partial interface IFileServicesOperations + { + /// + /// List all file services in storage accounts + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// 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 accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Sets the properties of file services in storage accounts, including + /// CORS (Cross-Origin Resource Sharing) rules. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// Specifies CORS rules for the File service. You can include up to + /// five CorsRule elements in the request. If no CorsRule elements are + /// included in the request body, all CORS rules will be deleted, and + /// CORS will be disabled for the File service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> PutServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the properties of file services in storage accounts, including + /// CORS (Cross-Origin Resource Sharing) rules. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// 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> GetServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs new file mode 100644 index 000000000000..8761f3cdec29 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs @@ -0,0 +1,222 @@ +// +// 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.Storage +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FileSharesOperations operations. + /// + public partial interface IFileSharesOperations + { + /// + /// Lists all shares. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// Optional. Continuation token for the list operation. + /// + /// + /// Optional. Specified maximum number of shares that can be included + /// in the list. + /// + /// + /// Optional. When specified, only share names starting with the filter + /// will be listed. + /// + /// + /// 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 accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new share under the specified account as described by + /// request body. The share resource includes metadata and properties + /// for that share. It does not include a list of the files contained + /// by the share. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. + /// File share names must be between 3 and 63 characters in length and + /// use numbers, lower-case letters and dash (-) only. Every dash (-) + /// character must be immediately preceded and followed by a letter or + /// number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than + /// 0, and less than or equal to 5TB (5120). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates share properties as specified in request body. Properties + /// not mentioned in the request will not be changed. Update fails if + /// the specified share does not already exist. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. + /// File share names must be between 3 and 63 characters in length and + /// use numbers, lower-case letters and dash (-) only. Every dash (-) + /// character must be immediately preceded and followed by a letter or + /// number. + /// + /// + /// A name-value pair to associate with the share as metadata. + /// + /// + /// The maximum size of the share, in gigabytes. Must be greater than + /// 0, and less than or equal to 5TB (5120). + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, IDictionary metadata = default(IDictionary), int? shareQuota = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets properties of a specified share. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. + /// File share names must be between 3 and 63 characters in length and + /// use numbers, lower-case letters and dash (-) only. Every dash (-) + /// character must be immediately preceded and followed by a letter or + /// number. + /// + /// + /// 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 accountName, string shareName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes specified share under its account. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the storage account within the specified resource + /// group. Storage account names must be between 3 and 24 characters in + /// length and use numbers and lower-case letters only. + /// + /// + /// The name of the file share within the specified storage account. + /// File share names must be between 3 and 63 characters in length and + /// use numbers, lower-case letters and dash (-) only. Every dash (-) + /// character must be immediately preceded and followed by a letter or + /// number. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISKUsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISkusOperations.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISKUsOperations.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/ISkusOperations.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageManagementClient.cs index f64d6b478444..54ad36c11da2 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IStorageManagementClient.cs @@ -104,5 +104,15 @@ public partial interface IStorageManagementClient : System.IDisposable /// IBlobContainersOperations BlobContainers { get; } + /// + /// Gets the IFileServicesOperations. + /// + IFileServicesOperations FileServices { get; } + + /// + /// Gets the IFileSharesOperations. + /// + IFileSharesOperations FileShares { get; } + } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobServiceProperties.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobServiceProperties.cs index 641e73627c08..53de67e58d01 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobServiceProperties.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/BlobServiceProperties.cs @@ -51,13 +51,16 @@ public BlobServiceProperties() /// soft delete. /// Automatic Snapshot is /// enabled if set to true. - public BlobServiceProperties(string id = default(string), string name = default(string), string type = default(string), CorsRules cors = default(CorsRules), string defaultServiceVersion = default(string), DeleteRetentionPolicy deleteRetentionPolicy = default(DeleteRetentionPolicy), bool? automaticSnapshotPolicyEnabled = default(bool?)) + /// The blob service properties for change + /// feed events. + public BlobServiceProperties(string id = default(string), string name = default(string), string type = default(string), CorsRules cors = default(CorsRules), string defaultServiceVersion = default(string), DeleteRetentionPolicy deleteRetentionPolicy = default(DeleteRetentionPolicy), bool? automaticSnapshotPolicyEnabled = default(bool?), ChangeFeed changeFeed = default(ChangeFeed)) : base(id, name, type) { Cors = cors; DefaultServiceVersion = defaultServiceVersion; DeleteRetentionPolicy = deleteRetentionPolicy; AutomaticSnapshotPolicyEnabled = automaticSnapshotPolicyEnabled; + ChangeFeed = changeFeed; CustomInit(); } @@ -96,6 +99,12 @@ public BlobServiceProperties() [JsonProperty(PropertyName = "properties.automaticSnapshotPolicyEnabled")] public bool? AutomaticSnapshotPolicyEnabled { get; set; } + /// + /// Gets or sets the blob service properties for change feed events. + /// + [JsonProperty(PropertyName = "properties.changeFeed")] + public ChangeFeed ChangeFeed { get; set; } + /// /// Validate the object. /// diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ChangeFeed.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ChangeFeed.cs new file mode 100644 index 000000000000..39234a57af5f --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ChangeFeed.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Storage.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The blob service properties for change feed events. + /// + public partial class ChangeFeed + { + /// + /// Initializes a new instance of the ChangeFeed class. + /// + public ChangeFeed() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ChangeFeed class. + /// + /// Indicates whether change feed event logging + /// is enabled for the Blob service. + public ChangeFeed(bool? enabled = default(bool?)) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether change feed event logging is enabled + /// for the Blob service. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ErrorResponseException.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..df95c8e08975 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Storage.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceItems.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceItems.cs new file mode 100644 index 000000000000..b53826168db1 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceItems.cs @@ -0,0 +1,50 @@ +// +// 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.Storage.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class FileServiceItems + { + /// + /// Initializes a new instance of the FileServiceItems class. + /// + public FileServiceItems() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileServiceItems class. + /// + /// List of file services returned. + public FileServiceItems(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of file services returned. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceProperties.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceProperties.cs new file mode 100644 index 000000000000..99f762c6efcf --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileServiceProperties.cs @@ -0,0 +1,68 @@ +// +// 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.Storage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of File services in storage account. + /// + [Rest.Serialization.JsonTransformation] + public partial class FileServiceProperties : Resource + { + /// + /// Initializes a new instance of the FileServiceProperties class. + /// + public FileServiceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileServiceProperties class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Specifies CORS rules for the File service. You + /// can include up to five CorsRule elements in the request. If no + /// CorsRule elements are included in the request body, all CORS rules + /// will be deleted, and CORS will be disabled for the File + /// service. + public FileServiceProperties(string id = default(string), string name = default(string), string type = default(string), CorsRules cors = default(CorsRules)) + : base(id, name, type) + { + Cors = cors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies CORS rules for the File service. You can + /// include up to five CorsRule elements in the request. If no CorsRule + /// elements are included in the request body, all CORS rules will be + /// deleted, and CORS will be disabled for the File service. + /// + [JsonProperty(PropertyName = "properties.cors")] + public CorsRules Cors { get; set; } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShare.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShare.cs new file mode 100644 index 000000000000..dc868af4e1fc --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShare.cs @@ -0,0 +1,104 @@ +// +// 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.Storage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of the file share, including Id, resource name, resource + /// type, Etag. + /// + [Rest.Serialization.JsonTransformation] + public partial class FileShare : AzureEntityResource + { + /// + /// Initializes a new instance of the FileShare class. + /// + public FileShare() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileShare class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource Etag. + /// Returns the date and time the share + /// was last modified. + /// A name-value pair to associate with the + /// share as metadata. + /// The maximum size of the share, in + /// gigabytes. Must be greater than 0, and less than or equal to 5TB + /// (5120). + public FileShare(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IDictionary metadata = default(IDictionary), int? shareQuota = default(int?)) + : base(id, name, type, etag) + { + LastModifiedTime = lastModifiedTime; + Metadata = metadata; + ShareQuota = shareQuota; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets returns the date and time the share was last modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedTime")] + public System.DateTime? LastModifiedTime { get; private set; } + + /// + /// Gets or sets a name-value pair to associate with the share as + /// metadata. + /// + [JsonProperty(PropertyName = "properties.metadata")] + public IDictionary Metadata { get; set; } + + /// + /// Gets or sets the maximum size of the share, in gigabytes. Must be + /// greater than 0, and less than or equal to 5TB (5120). + /// + [JsonProperty(PropertyName = "properties.shareQuota")] + public int? ShareQuota { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ShareQuota > 5120) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "ShareQuota", 5120); + } + if (ShareQuota < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ShareQuota", 1); + } + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItem.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItem.cs new file mode 100644 index 000000000000..4e7bc69bde8e --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItem.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.Storage.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The file share properties be listed out. + /// + [Rest.Serialization.JsonTransformation] + public partial class FileShareItem : AzureEntityResource + { + /// + /// Initializes a new instance of the FileShareItem class. + /// + public FileShareItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileShareItem class. + /// + /// Fully qualified resource Id for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. Ex- + /// Microsoft.Compute/virtualMachines or + /// Microsoft.Storage/storageAccounts. + /// Resource Etag. + /// Returns the date and time the share + /// was last modified. + /// A name-value pair to associate with the + /// share as metadata. + /// The maximum size of the share, in + /// gigabytes. Must be greater than 0, and less than or equal to 5TB + /// (5120). + public FileShareItem(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), System.DateTime? lastModifiedTime = default(System.DateTime?), IDictionary metadata = default(IDictionary), int? shareQuota = default(int?)) + : base(id, name, type, etag) + { + LastModifiedTime = lastModifiedTime; + Metadata = metadata; + ShareQuota = shareQuota; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets returns the date and time the share was last modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedTime")] + public System.DateTime? LastModifiedTime { get; private set; } + + /// + /// Gets or sets a name-value pair to associate with the share as + /// metadata. + /// + [JsonProperty(PropertyName = "properties.metadata")] + public IDictionary Metadata { get; set; } + + /// + /// Gets or sets the maximum size of the share, in gigabytes. Must be + /// greater than 0, and less than or equal to 5TB (5120). + /// + [JsonProperty(PropertyName = "properties.shareQuota")] + public int? ShareQuota { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ShareQuota > 5120) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "ShareQuota", 5120); + } + if (ShareQuota < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ShareQuota", 1); + } + } + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItems.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItems.cs new file mode 100644 index 000000000000..ae180a560952 --- /dev/null +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItems.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Storage.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Response schema. Contains list of shares returned, and if paging is + /// requested or required, a URL to next page of shares. + /// + public partial class FileShareItems + { + /// + /// Initializes a new instance of the FileShareItems class. + /// + public FileShareItems() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileShareItems class. + /// + /// List of file shares returned. + /// Request URL that can be used to query next + /// page of shares. Returned when total number of requested shares + /// exceed maximum page size. + public FileShareItems(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of file shares returned. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } + + /// + /// Gets request URL that can be used to query next page of shares. + /// Returned when total number of requested shares exceed maximum page + /// size. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; private set; } + + } +} diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IpRule.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IPRule.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IpRule.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/IPRule.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/signedResource.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/SignedResource.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/signedResource.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/SignedResource.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs index 2e6668fd3764..ade321fb01d3 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SdkInfo_StorageManagementClient.cs @@ -21,6 +21,8 @@ public static IEnumerable> ApiInfo_StorageManageme { new Tuple("Storage", "BlobContainers", "2019-04-01"), new Tuple("Storage", "BlobServices", "2019-04-01"), + new Tuple("Storage", "FileServices", "2019-04-01"), + new Tuple("Storage", "FileShares", "2019-04-01"), new Tuple("Storage", "ManagementPolicies", "2019-04-01"), new Tuple("Storage", "Operations", "2019-04-01"), new Tuple("Storage", "Skus", "2019-04-01"), @@ -29,16 +31,5 @@ public static IEnumerable> ApiInfo_StorageManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/storage/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=C:\\code\\srpsdk\\sdk\\storage\\Microsoft.Azure.Management.Storage\\src\\Generated"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "d753d28f32643d8062e1f7863d8f8e188dac9556"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperations.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperations.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperations.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperationsExtensions.cs similarity index 100% rename from sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SKUsOperationsExtensions.cs rename to sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/SkusOperationsExtensions.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageManagementClient.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageManagementClient.cs index 52c34d78383d..c89f3a08d112 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageManagementClient.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/StorageManagementClient.cs @@ -109,6 +109,16 @@ public partial class StorageManagementClient : ServiceClient public virtual IBlobContainersOperations BlobContainers { get; private set; } + /// + /// Gets the IFileServicesOperations. + /// + public virtual IFileServicesOperations FileServices { get; private set; } + + /// + /// Gets the IFileSharesOperations. + /// + public virtual IFileSharesOperations FileShares { get; private set; } + /// /// Initializes a new instance of the StorageManagementClient class. /// @@ -357,6 +367,8 @@ private void Initialize() ManagementPolicies = new ManagementPoliciesOperations(this); BlobServices = new BlobServicesOperations(this); BlobContainers = new BlobContainersOperations(this); + FileServices = new FileServicesOperations(this); + FileShares = new FileSharesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2019-04-01"; AcceptLanguage = "en-US"; From 1197afb3984efd6e4dd0fc6470f605984e10ea33 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2019 05:15:53 +0000 Subject: [PATCH 15/16] Generated from 8a6ece51ce3e11abf40c7c78bb9343a93a80874c (#176) chore: jsonfmt storage --- .../src/Generated/FileServicesOperations.cs | 4 +- .../FileServicesOperationsExtensions.cs | 8 +- .../src/Generated/FileSharesOperations.cs | 174 +++++++++++++++++- .../FileSharesOperationsExtensions.cs | 38 +++- .../src/Generated/IFileServicesOperations.cs | 2 +- .../src/Generated/IFileSharesOperations.cs | 24 ++- .../src/Generated/Models/FileShareItems.cs | 66 ------- 7 files changed, 237 insertions(+), 79 deletions(-) delete mode 100644 sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItems.cs diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs index d72b5d860330..b911d1f74c85 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperations.cs @@ -324,7 +324,7 @@ internal FileServicesOperations(StorageManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> PutServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> SetServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -400,7 +400,7 @@ internal FileServicesOperations(StorageManagementClient client) tracingParameters.Add("fileServicesName", fileServicesName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PutServiceProperties", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "SetServiceProperties", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs index 4bdb921f0b88..ed383c8eccbf 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileServicesOperationsExtensions.cs @@ -89,9 +89,9 @@ public static FileServiceItems List(this IFileServicesOperations operations, str /// the request body, all CORS rules will be deleted, and CORS will be disabled /// for the File service. /// - public static FileServiceProperties PutServiceProperties(this IFileServicesOperations operations, string resourceGroupName, string accountName, CorsRules cors = default(CorsRules)) + public static FileServiceProperties SetServiceProperties(this IFileServicesOperations operations, string resourceGroupName, string accountName, CorsRules cors = default(CorsRules)) { - return operations.PutServicePropertiesAsync(resourceGroupName, accountName, cors).GetAwaiter().GetResult(); + return operations.SetServicePropertiesAsync(resourceGroupName, accountName, cors).GetAwaiter().GetResult(); } /// @@ -119,9 +119,9 @@ public static FileServiceItems List(this IFileServicesOperations operations, str /// /// The cancellation token. /// - public static async Task PutServicePropertiesAsync(this IFileServicesOperations operations, string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task SetServicePropertiesAsync(this IFileServicesOperations operations, string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PutServicePropertiesWithHttpMessagesAsync(resourceGroupName, accountName, cors, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.SetServicePropertiesWithHttpMessagesAsync(resourceGroupName, accountName, cors, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs index 0ce82f296db1..77a3cfd49c8e 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperations.cs @@ -94,7 +94,7 @@ internal FileSharesOperations(StorageManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -278,7 +278,7 @@ internal FileSharesOperations(StorageManagementClient 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")) @@ -291,7 +291,7 @@ internal FileSharesOperations(StorageManagementClient 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) { @@ -1395,5 +1395,173 @@ internal FileSharesOperations(StorageManagementClient client) return _result; } + /// + /// Lists all shares. + /// + /// + /// 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("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; + } + } } diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs index 513a98837ea7..a0b40883752a 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/FileSharesOperationsExtensions.cs @@ -49,7 +49,7 @@ public static partial class FileSharesOperationsExtensions /// Optional. When specified, only share names starting with the filter will be /// listed. /// - public static FileShareItems List(this IFileSharesOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string)) + public static IPage List(this IFileSharesOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string)) { return operations.ListAsync(resourceGroupName, accountName, skipToken, maxpagesize, filter).GetAwaiter().GetResult(); } @@ -83,7 +83,7 @@ public static partial class FileSharesOperationsExtensions /// /// The cancellation token. /// - public static async Task ListAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IFileSharesOperations operations, string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, accountName, skipToken, maxpagesize, filter, null, cancellationToken).ConfigureAwait(false)) { @@ -356,5 +356,39 @@ public static void Delete(this IFileSharesOperations operations, string resource (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, shareName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Lists all shares. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IFileSharesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all shares. + /// + /// + /// 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 IFileSharesOperations 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/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs index 6b087c69a856..be7be372292c 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileServicesOperations.cs @@ -85,7 +85,7 @@ public partial interface IFileServicesOperations /// /// Thrown when a required parameter is null /// - Task> PutServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> SetServicePropertiesWithHttpMessagesAsync(string resourceGroupName, string accountName, CorsRules cors = default(CorsRules), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the properties of file services in storage accounts, including /// CORS (Cross-Origin Resource Sharing) rules. diff --git a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs index 8761f3cdec29..027572ac803a 100644 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs +++ b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/IFileSharesOperations.cs @@ -61,7 +61,7 @@ public partial interface IFileSharesOperations /// /// Thrown when a required parameter is null /// - Task> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string accountName, string skipToken = default(string), string maxpagesize = default(string), string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a new share under the specified account as described by /// request body. The share resource includes metadata and properties @@ -218,5 +218,27 @@ public partial interface IFileSharesOperations /// Thrown when a required parameter is null /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string shareName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all shares. + /// + /// + /// 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/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItems.cs b/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItems.cs deleted file mode 100644 index ae180a560952..000000000000 --- a/sdk/storage/Microsoft.Azure.Management.Storage/src/Generated/Models/FileShareItems.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.Storage.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Response schema. Contains list of shares returned, and if paging is - /// requested or required, a URL to next page of shares. - /// - public partial class FileShareItems - { - /// - /// Initializes a new instance of the FileShareItems class. - /// - public FileShareItems() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the FileShareItems class. - /// - /// List of file shares returned. - /// Request URL that can be used to query next - /// page of shares. Returned when total number of requested shares - /// exceed maximum page size. - public FileShareItems(IList value = default(IList), string nextLink = default(string)) - { - Value = value; - NextLink = nextLink; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets list of file shares returned. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } - - /// - /// Gets request URL that can be used to query next page of shares. - /// Returned when total number of requested shares exceed maximum page - /// size. - /// - [JsonProperty(PropertyName = "nextLink")] - public string NextLink { get; private set; } - - } -} From e8031bab6dd4ffd2ae1c93b966cbcf2ca0ce0f5b Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Sat, 7 Sep 2019 00:22:20 +0000 Subject: [PATCH 16/16] Generated from d0215e3e28bf88ac79e264ecec74268ce685965c update naming --- .../ContainerRegistryManagementClient.cs | 6 + .../IContainerRegistryManagementClient.cs | 5 + .../src/Generated/ITaskRunsOperations.cs | 285 ++++ ...OperationServiceSpecificationDefinition.cs | 2 +- .../src/Generated/Models/RetentionPolicy.cs | 8 +- .../src/Generated/Models/RunFilter.cs | 11 +- .../src/Generated/Models/TaskRun.cs | 107 ++ .../Models/TaskRunUpdateParameters.cs | 73 + ...kInfo_ContainerRegistryManagementClient.cs | 1 + .../src/Generated/TaskRunsOperations.cs | 1470 +++++++++++++++++ .../Generated/TaskRunsOperationsExtensions.cs | 438 +++++ 11 files changed, 2400 insertions(+), 6 deletions(-) create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ITaskRunsOperations.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TaskRun.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TaskRunUpdateParameters.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TaskRunsOperations.cs create mode 100644 sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TaskRunsOperationsExtensions.cs diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs index b8f5a8bb5e92..6da60573dad7 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ContainerRegistryManagementClient.cs @@ -91,6 +91,11 @@ public partial class ContainerRegistryManagementClient : ServiceClient public virtual IRunsOperations Runs { get; private set; } + /// + /// Gets the ITaskRunsOperations. + /// + public virtual ITaskRunsOperations TaskRuns { get; private set; } + /// /// Gets the ITasksOperations. /// @@ -342,6 +347,7 @@ private void Initialize() Replications = new ReplicationsOperations(this); Webhooks = new WebhooksOperations(this); Runs = new RunsOperations(this); + TaskRuns = new TaskRunsOperations(this); Tasks = new TasksOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs index e245c6061829..a50ee3a2a9c1 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/IContainerRegistryManagementClient.cs @@ -88,6 +88,11 @@ public partial interface IContainerRegistryManagementClient : System.IDisposable /// IRunsOperations Runs { get; } + /// + /// Gets the ITaskRunsOperations. + /// + ITaskRunsOperations TaskRuns { get; } + /// /// Gets the ITasksOperations. /// diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ITaskRunsOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ITaskRunsOperations.cs new file mode 100644 index 000000000000..46f4beb0426d --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/ITaskRunsOperations.cs @@ -0,0 +1,285 @@ +// +// 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.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + + /// + /// TaskRunsOperations operations. + /// + public partial interface ITaskRunsOperations + { + /// + /// Gets the detailed information for a given task run. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The run request 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 + /// + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a task run for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of task run. + /// + /// + /// The parameters of a run that needs to scheduled. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, TaskRun taskRun, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a specified task run resource. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run 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 + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a task run with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The parameters for updating a task run. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, TaskRunUpdateParameters updateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the task runs for a specified container registry. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a task run for a container registry with the specified + /// parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of task run. + /// + /// + /// The parameters of a run that needs to scheduled. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, TaskRun taskRun, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a specified task run resource. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run 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 + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a task run with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry + /// belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The parameters for updating a task run. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, TaskRunUpdateParameters updateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all the task runs for a specified container registry. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/OperationServiceSpecificationDefinition.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/OperationServiceSpecificationDefinition.cs index fd6a6d21b2cd..b38c70091a26 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/OperationServiceSpecificationDefinition.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/OperationServiceSpecificationDefinition.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.ContainerRegistry.Models using System.Linq; /// - /// The definition of Azure Monitoring metrics list. + /// The definition of Azure Monitoring list. /// public partial class OperationServiceSpecificationDefinition { diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RetentionPolicy.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RetentionPolicy.cs index 3d10bdffaa32..5e3f5459d802 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RetentionPolicy.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RetentionPolicy.cs @@ -29,8 +29,8 @@ public RetentionPolicy() /// /// Initializes a new instance of the RetentionPolicy class. /// - /// The number of days to retain manifest before it - /// expires. + /// The number of days to retain an untagged + /// manifest after which it gets purged. /// The timestamp when the policy was /// last updated. /// The value that indicates whether the policy is @@ -50,8 +50,8 @@ public RetentionPolicy() partial void CustomInit(); /// - /// Gets or sets the number of days to retain manifest before it - /// expires. + /// Gets or sets the number of days to retain an untagged manifest + /// after which it gets purged. /// [JsonProperty(PropertyName = "days")] public int? Days { get; set; } diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RunFilter.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RunFilter.cs index 19d86ef940a9..36e5f049e7b3 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RunFilter.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/RunFilter.cs @@ -32,6 +32,8 @@ public RunFilter() /// The unique identifier for the run. /// The type of run. Possible values include: /// 'QuickBuild', 'QuickRun', 'AutoBuild', 'AutoRun' + /// The name of task run associated with this + /// run. /// The current status of the run. Possible values /// include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', /// 'Canceled', 'Error', 'Timeout' @@ -45,10 +47,11 @@ public RunFilter() /// archiving is enabled or not. /// The name of the task that the run /// corresponds to. - public RunFilter(string runId = default(string), string runType = default(string), string status = default(string), System.DateTime? createTime = default(System.DateTime?), System.DateTime? finishTime = default(System.DateTime?), string outputImageManifests = default(string), bool? isArchiveEnabled = default(bool?), string taskName = default(string)) + public RunFilter(string runId = default(string), string runType = default(string), string taskRunName = default(string), string status = default(string), System.DateTime? createTime = default(System.DateTime?), System.DateTime? finishTime = default(System.DateTime?), string outputImageManifests = default(string), bool? isArchiveEnabled = default(bool?), string taskName = default(string)) { RunId = runId; RunType = runType; + TaskRunName = taskRunName; Status = status; CreateTime = createTime; FinishTime = finishTime; @@ -76,6 +79,12 @@ public RunFilter() [JsonProperty(PropertyName = "runType")] public string RunType { get; set; } + /// + /// Gets or sets the name of task run associated with this run. + /// + [JsonProperty(PropertyName = "taskRunName")] + public string TaskRunName { get; set; } + /// /// Gets or sets the current status of the run. Possible values /// include: 'Queued', 'Started', 'Running', 'Succeeded', 'Failed', diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TaskRun.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TaskRun.cs new file mode 100644 index 000000000000..6775c70bf8f2 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TaskRun.cs @@ -0,0 +1,107 @@ +// +// 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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The task run that has the ARM resource and properties. + /// The task run will have the information of request and result of a run. + /// + [Rest.Serialization.JsonTransformation] + public partial class TaskRun : Resource + { + /// + /// Initializes a new instance of the TaskRun class. + /// + public TaskRun() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TaskRun class. + /// + /// The location of the resource. This cannot be + /// changed after the resource is created. + /// The resource ID. + /// The name of the resource. + /// The type of the resource. + /// The tags of the resource. + /// Identity for the resource. + /// The provisioning state of this task + /// run. Possible values include: 'Creating', 'Updating', 'Deleting', + /// 'Succeeded', 'Failed', 'Canceled' + /// The request (parameters) for the + /// run + /// The result of this task run + public TaskRun(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IdentityProperties identity = default(IdentityProperties), string provisioningState = default(string), RunRequest runRequest = default(RunRequest), Run runResult = default(Run)) + : base(location, id, name, type, tags) + { + Identity = identity; + ProvisioningState = provisioningState; + RunRequest = runRequest; + RunResult = runResult; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets identity for the resource. + /// + [JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity { get; set; } + + /// + /// Gets the provisioning state of this task run. Possible values + /// include: 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed', + /// 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the request (parameters) for the run + /// + [JsonProperty(PropertyName = "properties.runRequest")] + public RunRequest RunRequest { get; set; } + + /// + /// Gets the result of this task run + /// + [JsonProperty(PropertyName = "properties.runResult")] + public Run RunResult { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (RunResult != null) + { + RunResult.Validate(); + } + } + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TaskRunUpdateParameters.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TaskRunUpdateParameters.cs new file mode 100644 index 000000000000..8035fbc5974e --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/Models/TaskRunUpdateParameters.cs @@ -0,0 +1,73 @@ +// +// 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.ContainerRegistry.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The parameters for updating a task run. + /// + [Rest.Serialization.JsonTransformation] + public partial class TaskRunUpdateParameters + { + /// + /// Initializes a new instance of the TaskRunUpdateParameters class. + /// + public TaskRunUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TaskRunUpdateParameters class. + /// + /// Identity for the resource. + /// The request (parameters) for the new + /// run + /// The ARM resource tags. + public TaskRunUpdateParameters(IdentityProperties identity = default(IdentityProperties), RunRequest runRequest = default(RunRequest), IDictionary tags = default(IDictionary)) + { + Identity = identity; + RunRequest = runRequest; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets identity for the resource. + /// + [JsonProperty(PropertyName = "identity")] + public IdentityProperties Identity { get; set; } + + /// + /// Gets or sets the request (parameters) for the new run + /// + [JsonProperty(PropertyName = "properties.runRequest")] + public RunRequest RunRequest { get; set; } + + /// + /// Gets or sets the ARM resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs index 3d8804e0c1f3..fe508ec7bf8a 100644 --- a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/SdkInfo_ContainerRegistryManagementClient.cs @@ -24,6 +24,7 @@ public static IEnumerable> ApiInfo_ContainerRegist new Tuple("ContainerRegistry", "Registries", "2019-06-01-preview"), new Tuple("ContainerRegistry", "Replications", "2019-05-01"), new Tuple("ContainerRegistry", "Runs", "2019-06-01-preview"), + new Tuple("ContainerRegistry", "TaskRuns", "2019-06-01-preview"), new Tuple("ContainerRegistry", "Tasks", "2019-06-01-preview"), new Tuple("ContainerRegistry", "Webhooks", "2019-05-01"), }.AsEnumerable(); diff --git a/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TaskRunsOperations.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TaskRunsOperations.cs new file mode 100644 index 000000000000..47426c7c43ac --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TaskRunsOperations.cs @@ -0,0 +1,1470 @@ +// +// 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.ContainerRegistry +{ + 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; + + /// + /// TaskRunsOperations operations. + /// + internal partial class TaskRunsOperations : IServiceOperations, ITaskRunsOperations + { + /// + /// Initializes a new instance of the TaskRunsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TaskRunsOperations(ContainerRegistryManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerRegistryManagementClient + /// + public ContainerRegistryManagementClient Client { get; private set; } + + /// + /// Gets the detailed information for a given task run. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The run request 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 System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (taskRunName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "taskRunName"); + } + string apiVersion = "2019-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("taskRunName", taskRunName); + 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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{taskRunName}", System.Uri.EscapeDataString(taskRunName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a task run for a container registry with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of task run. + /// + /// + /// The parameters of a run that needs to scheduled. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, TaskRun taskRun, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, taskRun, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a specified task run resource. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a task run with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The parameters for updating a task run. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, TaskRunUpdateParameters updateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, updateParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all the task runs for a specified container registry. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string registryName, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + string apiVersion = "2019-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("apiVersion", apiVersion); + 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.ContainerRegistry/registries/{registryName}/taskRuns").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates a task run for a container registry with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of task run. + /// + /// + /// The parameters of a run that needs to scheduled. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, TaskRun taskRun, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (taskRunName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "taskRunName"); + } + if (taskRun == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "taskRun"); + } + if (taskRun != null) + { + taskRun.Validate(); + } + string apiVersion = "2019-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("taskRunName", taskRunName); + tracingParameters.Add("taskRun", taskRun); + 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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{taskRunName}", System.Uri.EscapeDataString(taskRunName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(taskRun != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(taskRun, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a specified task run resource. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (taskRunName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "taskRunName"); + } + string apiVersion = "2019-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("taskRunName", taskRunName); + 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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{taskRunName}", System.Uri.EscapeDataString(taskRunName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Updates a task run with the specified parameters. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The parameters for updating a task run. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string registryName, string taskRunName, TaskRunUpdateParameters updateParameters, 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 (resourceGroupName != null) + { + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (registryName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "registryName"); + } + if (registryName != null) + { + if (registryName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "registryName", 50); + } + if (registryName.Length < 5) + { + throw new ValidationException(ValidationRules.MinLength, "registryName", 5); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(registryName, "^[a-zA-Z0-9]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "registryName", "^[a-zA-Z0-9]*$"); + } + } + if (taskRunName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "taskRunName"); + } + if (updateParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateParameters"); + } + string apiVersion = "2019-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("registryName", registryName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("taskRunName", taskRunName); + tracingParameters.Add("updateParameters", updateParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{registryName}", System.Uri.EscapeDataString(registryName)); + _url = _url.Replace("{taskRunName}", System.Uri.EscapeDataString(taskRunName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(updateParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateParameters, 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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; + } + + /// + /// Lists all the task runs for a specified container registry. + /// + /// + /// 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 System.Threading.Tasks.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("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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _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/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TaskRunsOperationsExtensions.cs b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TaskRunsOperationsExtensions.cs new file mode 100644 index 000000000000..cc25593df7f1 --- /dev/null +++ b/sdk/containerregistry/Microsoft.Azure.Management.ContainerRegistry/src/Generated/TaskRunsOperationsExtensions.cs @@ -0,0 +1,438 @@ +// +// 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.ContainerRegistry +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + + /// + /// Extension methods for TaskRunsOperations. + /// + public static partial class TaskRunsOperationsExtensions + { + /// + /// Gets the detailed information for a given task run. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The run request name. + /// + public static TaskRun Get(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName) + { + return operations.GetAsync(resourceGroupName, registryName, taskRunName).GetAwaiter().GetResult(); + } + + /// + /// Gets the detailed information for a given task run. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The run request name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a task run for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of task run. + /// + /// + /// The parameters of a run that needs to scheduled. + /// + public static TaskRun Create(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, TaskRun taskRun) + { + return operations.CreateAsync(resourceGroupName, registryName, taskRunName, taskRun).GetAwaiter().GetResult(); + } + + /// + /// Creates a task run for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of task run. + /// + /// + /// The parameters of a run that needs to scheduled. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, TaskRun taskRun, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, taskRun, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a specified task run resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + public static void Delete(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName) + { + operations.DeleteAsync(resourceGroupName, registryName, taskRunName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a specified task run resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a task run with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The parameters for updating a task run. + /// + public static TaskRun Update(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, TaskRunUpdateParameters updateParameters) + { + return operations.UpdateAsync(resourceGroupName, registryName, taskRunName, updateParameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a task run with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The parameters for updating a task run. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, TaskRunUpdateParameters updateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, updateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the task runs for a specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + public static IPage List(this ITaskRunsOperations operations, string resourceGroupName, string registryName) + { + return operations.ListAsync(resourceGroupName, registryName).GetAwaiter().GetResult(); + } + + /// + /// Lists all the task runs for a specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ITaskRunsOperations operations, string resourceGroupName, string registryName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, registryName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a task run for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of task run. + /// + /// + /// The parameters of a run that needs to scheduled. + /// + public static TaskRun BeginCreate(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, TaskRun taskRun) + { + return operations.BeginCreateAsync(resourceGroupName, registryName, taskRunName, taskRun).GetAwaiter().GetResult(); + } + + /// + /// Creates a task run for a container registry with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The name of task run. + /// + /// + /// The parameters of a run that needs to scheduled. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateAsync(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, TaskRun taskRun, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, taskRun, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a specified task run resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + public static void BeginDelete(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName) + { + operations.BeginDeleteAsync(resourceGroupName, registryName, taskRunName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a specified task run resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates a task run with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The parameters for updating a task run. + /// + public static TaskRun BeginUpdate(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, TaskRunUpdateParameters updateParameters) + { + return operations.BeginUpdateAsync(resourceGroupName, registryName, taskRunName, updateParameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a task run with the specified parameters. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group to which the container registry belongs. + /// + /// + /// The name of the container registry. + /// + /// + /// The task run name. + /// + /// + /// The parameters for updating a task run. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this ITaskRunsOperations operations, string resourceGroupName, string registryName, string taskRunName, TaskRunUpdateParameters updateParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, registryName, taskRunName, updateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all the task runs for a specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ITaskRunsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all the task runs for a specified container registry. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this ITaskRunsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}