diff --git a/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/ScenarioTests/APIKeysTests.cs b/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/ScenarioTests/APIKeysTests.cs new file mode 100644 index 000000000000..59ec9cc469da --- /dev/null +++ b/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/ScenarioTests/APIKeysTests.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + + +using ApplicationInsights.Tests.Helpers; +using Microsoft.Azure.Management.ApplicationInsights.Management.Models; +using Microsoft.Rest.Azure; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using System.Linq; +using System.Net; +using Xunit; + +namespace ApplicationInsights.Tests.Scenarios +{ + public class APIKeysTests : TestBase + { + private const string ResourceGroupName = "swaggertest"; + private RecordedDelegatingHandler handler; + + + public APIKeysTests() + : base() + { + handler = new RecordedDelegatingHandler { SubsequentStatusCodeToReturn = HttpStatusCode.OK }; + } + + [Fact] + [Trait("Category", "Scenario")] + public void CreateGetListUpdateDeleteAPIKeys() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + var insightsClient = this.GetAppInsightsManagementClient(context, handler); + + //prepare a component + this.CreateAComponent(insightsClient, ResourceGroupName, nameof(CreateGetListUpdateDeleteAPIKeys)); + + //create an API key + var apiKeyProperties = GetCreateAPIKeyProperties(ResourceGroupName, nameof(CreateGetListUpdateDeleteAPIKeys)); + var createAPIKeyResponse = insightsClient + .APIKeys + .CreateWithHttpMessagesAsync( + ResourceGroupName, + nameof(CreateGetListUpdateDeleteAPIKeys), + apiKeyProperties) + .GetAwaiter() + .GetResult(); + AreEqual(apiKeyProperties, createAPIKeyResponse.Body); + + //get all API keys + var getAllAPIKeys = insightsClient + .APIKeys + .ListWithHttpMessagesAsync( + ResourceGroupName, + nameof(CreateGetListUpdateDeleteAPIKeys)) + .GetAwaiter() + .GetResult(); + + Assert.Equal(1, getAllAPIKeys.Body.Count()); + AreEqual(apiKeyProperties, getAllAPIKeys.Body.ElementAt(0)); + + string fullkeyId = getAllAPIKeys.Body.ElementAt(0).Id; + string keyId = fullkeyId.Split('/')[10]; + + //get specif API key + var getAPIKey = insightsClient + .APIKeys + .GetWithHttpMessagesAsync( + ResourceGroupName, + nameof(CreateGetListUpdateDeleteAPIKeys), + keyId) + .GetAwaiter() + .GetResult(); + + AreEqual(apiKeyProperties, getAPIKey.Body); + + //delete the API key + var deleteAPIKeyResponse = insightsClient + .APIKeys + .DeleteWithHttpMessagesAsync( + ResourceGroupName, + nameof(CreateGetListUpdateDeleteAPIKeys), + keyId) + .GetAwaiter() + .GetResult(); + + //get API again, should get an NOT found exception + Assert.Throws(typeof(CloudException), () => + { + getAPIKey = insightsClient + .APIKeys + .GetWithHttpMessagesAsync( + ResourceGroupName, + nameof(CreateGetListUpdateDeleteAPIKeys), + keyId) + .GetAwaiter() + .GetResult(); + }); + + //clean up component + this.DeleteAComponent(insightsClient, ResourceGroupName, nameof(CreateGetListUpdateDeleteAPIKeys)); + } + } + + private static void AreEqual(APIKeyRequest request, ApplicationInsightsComponentAPIKey response) + { + Assert.Equal(request.Name, response.Name, ignoreCase: true); + Assert.True(response.LinkedReadProperties.Count >= request.LinkedReadProperties.Count); + Assert.True(response.LinkedWriteProperties.Count >= request.LinkedWriteProperties.Count); + foreach (var readaccess in request.LinkedReadProperties) + { + Assert.True(response.LinkedReadProperties.Any(r => r == readaccess)); + } + + foreach (var writeaccess in request.LinkedWriteProperties) + { + Assert.True(response.LinkedWriteProperties.Any(w => w == writeaccess)); + } + } + + private APIKeyRequest GetCreateAPIKeyProperties(string resourceGroupName, string componentName) + { + return new APIKeyRequest() + { + Name = "test", + LinkedReadProperties = new string[] { + $"/subscriptions/{this.SubscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{componentName}/api", + $"/subscriptions/{this.SubscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{componentName}/agentconfig" + }, + LinkedWriteProperties = new string[] + { + $"/subscriptions/{this.SubscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{componentName}/annotations" + } + }; + } + + private static ApplicationInsightsComponent GetCreateComponentProperties() + { + return new ApplicationInsightsComponent( + name: nameof(CreateGetListUpdateDeleteAPIKeys), + location: "South Central US", + kind: "web", + applicationType: "web", + applicationId: nameof(CreateGetListUpdateDeleteAPIKeys), + flowType: "Bluefield", + requestSource: "rest" + ); + } + + } +} \ No newline at end of file diff --git a/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/ScenarioTests/TestBase.cs b/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/ScenarioTests/TestBase.cs index b6d34b7b83fe..b96aabab8e3e 100644 --- a/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/ScenarioTests/TestBase.cs +++ b/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/ScenarioTests/TestBase.cs @@ -16,11 +16,10 @@ namespace ApplicationInsights.Tests.Scenarios { public class TestBase { - protected bool IsRecording { get; set; } + protected string SubscriptionId { get; set; } public TestBase() { - this.IsRecording = false; } @@ -36,10 +35,9 @@ protected ApplicationInsightsManagementClient GetAppInsightsManagementClient(Moc if (string.Equals(testMode, "record", StringComparison.OrdinalIgnoreCase)) { - this.IsRecording = true; string subId = Environment.GetEnvironmentVariable("AZURE_TEST_SUBSCRIPTIONID"); - subId = string.IsNullOrWhiteSpace(subId) ? "b90b0dec-9b9a-4778-a84e-4ffb73bb17f6" : subId; + this.SubscriptionId = subId; TestEnvironment env = new TestEnvironment(connectionString: "SubscriptionId=" + subId); client = context.GetServiceClient( @@ -48,6 +46,7 @@ protected ApplicationInsightsManagementClient GetAppInsightsManagementClient(Moc } else { + this.SubscriptionId = "b90b0dec-9b9a-4778-a84e-4ffb73bb17f6"; client = context.GetServiceClient( handlers: handler ?? new RecordedDelegatingHandler { SubsequentStatusCodeToReturn = System.Net.HttpStatusCode.OK }); } diff --git a/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/SessionRecords/ApplicationInsights.Tests.Scenarios.APIKeysTests/CreateGetListUpdateDeleteAPIKeys.json b/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/SessionRecords/ApplicationInsights.Tests.Scenarios.APIKeysTests/CreateGetListUpdateDeleteAPIKeys.json new file mode 100644 index 000000000000..afdfea541c68 --- /dev/null +++ b/src/SDKs/ApplicationInsights/ApplicationInsights.Tests/SessionRecords/ApplicationInsights.Tests.Scenarios.APIKeysTests/CreateGetListUpdateDeleteAPIKeys.json @@ -0,0 +1,525 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys?api-version=2015-05-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYjkwYjBkZWMtOWI5YS00Nzc4LWE4NGUtNGZmYjczYmIxN2Y2L3Jlc291cmNlR3JvdXBzL3N3YWdnZXJ0ZXN0L3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvY29tcG9uZW50cy9DcmVhdGVHZXRMaXN0VXBkYXRlRGVsZXRlQVBJS2V5cz9hcGktdmVyc2lvbj0yMDE1LTA1LTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"kind\": \"web\",\r\n \"properties\": {\r\n \"Application_Type\": \"web\",\r\n \"Flow_Type\": \"Bluefield\",\r\n \"Request_Source\": \".NET SDK test\"\r\n },\r\n \"location\": \"South Central US\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "183" + ], + "x-ms-client-request-id": [ + "5d0f5e66-8124-460f-8452-8098531a3809" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.7.2110.0", + "OSName/Windows10Enterprise", + "OSVersion/6.3.15063", + "Microsoft.Azure.Management.ApplicationInsights.Management.ApplicationInsightsManagementClient/0.1.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys\",\r\n \"name\": \"CreateGetListUpdateDeleteAPIKeys\",\r\n \"type\": \"microsoft.insights/components\",\r\n \"location\": \"southcentralus\",\r\n \"tags\": {},\r\n \"kind\": \"web\",\r\n \"etag\": \"\\\"0100083f-0000-0000-0000-59ce76050000\\\"\",\r\n \"properties\": {\r\n \"Ver\": \"v2\",\r\n \"ApplicationId\": \"CreateGetListUpdateDeleteAPIKeys\",\r\n \"AppId\": \"74705cc0-5827-4b4f-b175-bb2d0aa9e78c\",\r\n \"Application_Type\": \"web\",\r\n \"Flow_Type\": \"Bluefield\",\r\n \"Request_Source\": \".NET SDK test\",\r\n \"InstrumentationKey\": \"b4152481-3765-49a5-8fea-91820b001631\",\r\n \"Name\": \"CreateGetListUpdateDeleteAPIKeys\",\r\n \"CreationDate\": \"2017-09-29T09:34:13.4813939-07:00\",\r\n \"PackageId\": null,\r\n \"TenantId\": \"8b41dbed-3445-4071-893b-0d78932d36df\",\r\n \"HockeyAppId\": null,\r\n \"HockeyAppToken\": null,\r\n \"provisioningState\": \"Succeeded\",\r\n \"SamplingPercentage\": null\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "867" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "5d0f5e66-8124-460f-8452-8098531a3809" + ], + "x-content-type-options": [ + "nosniff", + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "801a305d-8094-4aee-ba97-f7c9fa33a399" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20170929T163415Z:801a305d-8094-4aee-ba97-f7c9fa33a399" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 29 Sep 2017 16:34:15 GMT" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/ApiKeys?api-version=2015-05-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYjkwYjBkZWMtOWI5YS00Nzc4LWE4NGUtNGZmYjczYmIxN2Y2L3Jlc291cmNlR3JvdXBzL3N3YWdnZXJ0ZXN0L3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvY29tcG9uZW50cy9DcmVhdGVHZXRMaXN0VXBkYXRlRGVsZXRlQVBJS2V5cy9BcGlLZXlzP2FwaS12ZXJzaW9uPTIwMTUtMDUtMDE=", + "RequestMethod": "POST", + "RequestBody": "{\r\n \"name\": \"test\",\r\n \"linkedReadProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/api\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/agentconfig\"\r\n ],\r\n \"linkedWriteProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/annotations\"\r\n ]\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "599" + ], + "x-ms-client-request-id": [ + "e2d0ecf2-18c0-47a4-b97e-617e84b132bf" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.7.2110.0", + "OSName/Windows10Enterprise", + "OSVersion/6.3.15063", + "Microsoft.Azure.Management.ApplicationInsights.Management.ApplicationInsightsManagementClient/0.1.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourcegroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/apikeys/c3a0c744-356e-4463-a91a-4dddd1496a42\",\r\n \"name\": \"test\",\r\n \"linkedReadProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/api\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/agentconfig\"\r\n ],\r\n \"linkedWriteProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/annotations\"\r\n ],\r\n \"apiKey\": \"hrra68sd0xpaivnhy313doyjufjh83h7d6lzdpap\",\r\n \"createdDate\": \"Fri, 29 Sep 2017 16:34:16 GMT\",\r\n \"integrationType\": null,\r\n \"integrationProperty\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "908" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "e2d0ecf2-18c0-47a4-b97e-617e84b132bf" + ], + "x-content-type-options": [ + "nosniff", + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "02e714cd-aa18-406f-a5dc-c6c7a3377c0a" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20170929T163416Z:02e714cd-aa18-406f-a5dc-c6c7a3377c0a" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 29 Sep 2017 16:34:15 GMT" + ], + "Server": [ + "Microsoft-IIS/8.5" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/ApiKeys?api-version=2015-05-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYjkwYjBkZWMtOWI5YS00Nzc4LWE4NGUtNGZmYjczYmIxN2Y2L3Jlc291cmNlR3JvdXBzL3N3YWdnZXJ0ZXN0L3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvY29tcG9uZW50cy9DcmVhdGVHZXRMaXN0VXBkYXRlRGVsZXRlQVBJS2V5cy9BcGlLZXlzP2FwaS12ZXJzaW9uPTIwMTUtMDUtMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "43e6c25b-cf43-43ba-b2b7-43d460c5bb50" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.7.2110.0", + "OSName/Windows10Enterprise", + "OSVersion/6.3.15063", + "Microsoft.Azure.Management.ApplicationInsights.Management.ApplicationInsightsManagementClient/0.1.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourcegroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/apikeys/c3a0c744-356e-4463-a91a-4dddd1496a42\",\r\n \"name\": \"test\",\r\n \"linkedReadProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/api\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/draft\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/extendqueries\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/search\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/aggregate\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/agentconfig\"\r\n ],\r\n \"linkedWriteProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/annotations\"\r\n ],\r\n \"createdDate\": \"Fri, 29 Sep 2017 16:34:16 GMT\",\r\n \"integrationType\": null,\r\n \"integrationProperty\": null\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1521" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "43e6c25b-cf43-43ba-b2b7-43d460c5bb50" + ], + "x-content-type-options": [ + "nosniff", + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14981" + ], + "x-ms-correlation-request-id": [ + "16353fe6-4415-42bf-8c82-41a18144f63b" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20170929T163416Z:16353fe6-4415-42bf-8c82-41a18144f63b" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 29 Sep 2017 16:34:16 GMT" + ], + "Server": [ + "Microsoft-IIS/8.5" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/APIKeys/c3a0c744-356e-4463-a91a-4dddd1496a42?api-version=2015-05-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYjkwYjBkZWMtOWI5YS00Nzc4LWE4NGUtNGZmYjczYmIxN2Y2L3Jlc291cmNlR3JvdXBzL3N3YWdnZXJ0ZXN0L3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvY29tcG9uZW50cy9DcmVhdGVHZXRMaXN0VXBkYXRlRGVsZXRlQVBJS2V5cy9BUElLZXlzL2MzYTBjNzQ0LTM1NmUtNDQ2My1hOTFhLTRkZGRkMTQ5NmE0Mj9hcGktdmVyc2lvbj0yMDE1LTA1LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "7d3ae039-e42b-4510-80c8-b9a848d62985" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.7.2110.0", + "OSName/Windows10Enterprise", + "OSVersion/6.3.15063", + "Microsoft.Azure.Management.ApplicationInsights.Management.ApplicationInsightsManagementClient/0.1.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourcegroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/apikeys/c3a0c744-356e-4463-a91a-4dddd1496a42\",\r\n \"name\": \"test\",\r\n \"linkedReadProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/api\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/draft\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/extendqueries\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/search\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/aggregate\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/agentconfig\"\r\n ],\r\n \"linkedWriteProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/annotations\"\r\n ],\r\n \"createdDate\": \"Fri, 29 Sep 2017 16:34:16 GMT\",\r\n \"integrationType\": null,\r\n \"integrationProperty\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1509" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "7d3ae039-e42b-4510-80c8-b9a848d62985" + ], + "x-content-type-options": [ + "nosniff", + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14980" + ], + "x-ms-correlation-request-id": [ + "14f6375e-1350-4593-b750-f0bd37768089" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20170929T163416Z:14f6375e-1350-4593-b750-f0bd37768089" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 29 Sep 2017 16:34:16 GMT" + ], + "Server": [ + "Microsoft-IIS/8.5" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/APIKeys/c3a0c744-356e-4463-a91a-4dddd1496a42?api-version=2015-05-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYjkwYjBkZWMtOWI5YS00Nzc4LWE4NGUtNGZmYjczYmIxN2Y2L3Jlc291cmNlR3JvdXBzL3N3YWdnZXJ0ZXN0L3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvY29tcG9uZW50cy9DcmVhdGVHZXRMaXN0VXBkYXRlRGVsZXRlQVBJS2V5cy9BUElLZXlzL2MzYTBjNzQ0LTM1NmUtNDQ2My1hOTFhLTRkZGRkMTQ5NmE0Mj9hcGktdmVyc2lvbj0yMDE1LTA1LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "30d88cfa-38f9-4eb7-8c65-1d78c2170796" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.7.2110.0", + "OSName/Windows10Enterprise", + "OSVersion/6.3.15063", + "Microsoft.Azure.Management.ApplicationInsights.Management.ApplicationInsightsManagementClient/0.1.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "30d88cfa-38f9-4eb7-8c65-1d78c2170796" + ], + "x-content-type-options": [ + "nosniff", + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14979" + ], + "x-ms-correlation-request-id": [ + "85c36705-e5d1-430d-bc5f-d194661a2bc9" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20170929T163417Z:85c36705-e5d1-430d-bc5f-d194661a2bc9" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 29 Sep 2017 16:34:16 GMT" + ], + "Server": [ + "Microsoft-IIS/8.5" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/APIKeys/c3a0c744-356e-4463-a91a-4dddd1496a42?api-version=2015-05-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYjkwYjBkZWMtOWI5YS00Nzc4LWE4NGUtNGZmYjczYmIxN2Y2L3Jlc291cmNlR3JvdXBzL3N3YWdnZXJ0ZXN0L3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvY29tcG9uZW50cy9DcmVhdGVHZXRMaXN0VXBkYXRlRGVsZXRlQVBJS2V5cy9BUElLZXlzL2MzYTBjNzQ0LTM1NmUtNDQ2My1hOTFhLTRkZGRkMTQ5NmE0Mj9hcGktdmVyc2lvbj0yMDE1LTA1LTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "6a6f7f68-328f-4705-92b4-385a606c1ce5" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.7.2110.0", + "OSName/Windows10Enterprise", + "OSVersion/6.3.15063", + "Microsoft.Azure.Management.ApplicationInsights.Management.ApplicationInsightsManagementClient/0.1.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourcegroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/apikeys/c3a0c744-356e-4463-a91a-4dddd1496a42\",\r\n \"name\": \"test\",\r\n \"linkedReadProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/api\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/draft\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/extendqueries\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/search\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/aggregate\",\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/agentconfig\"\r\n ],\r\n \"linkedWriteProperties\": [\r\n \"/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys/annotations\"\r\n ],\r\n \"createdDate\": \"Fri, 29 Sep 2017 16:34:16 GMT\",\r\n \"integrationType\": null,\r\n \"integrationProperty\": null\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "1509" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "6a6f7f68-328f-4705-92b4-385a606c1ce5" + ], + "x-content-type-options": [ + "nosniff", + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-correlation-request-id": [ + "718d8f47-b323-4adb-9ca6-894508c80c8b" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20170929T163417Z:718d8f47-b323-4adb-9ca6-894508c80c8b" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 29 Sep 2017 16:34:16 GMT" + ], + "Server": [ + "Microsoft-IIS/8.5" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys?api-version=2015-05-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYjkwYjBkZWMtOWI5YS00Nzc4LWE4NGUtNGZmYjczYmIxN2Y2L3Jlc291cmNlR3JvdXBzL3N3YWdnZXJ0ZXN0L3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvY29tcG9uZW50cy9DcmVhdGVHZXRMaXN0VXBkYXRlRGVsZXRlQVBJS2V5cz9hcGktdmVyc2lvbj0yMDE1LTA1LTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "85327b76-8566-4a8b-a757-352c1653f0ad" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.7.2110.0", + "OSName/Windows10Enterprise", + "OSVersion/6.3.15063", + "Microsoft.Azure.Management.ApplicationInsights.Management.ApplicationInsightsManagementClient/0.1.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "85327b76-8566-4a8b-a757-352c1653f0ad" + ], + "x-content-type-options": [ + "nosniff", + "nosniff" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "5c575c5f-4b37-42d2-884e-50df44a2e31c" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20170929T163418Z:5c575c5f-4b37-42d2-884e-50df44a2e31c" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 29 Sep 2017 16:34:18 GMT" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "X-Powered-By": [ + "ASP.NET" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/b90b0dec-9b9a-4778-a84e-4ffb73bb17f6/resourceGroups/swaggertest/providers/microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys?api-version=2015-05-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvYjkwYjBkZWMtOWI5YS00Nzc4LWE4NGUtNGZmYjczYmIxN2Y2L3Jlc291cmNlR3JvdXBzL3N3YWdnZXJ0ZXN0L3Byb3ZpZGVycy9taWNyb3NvZnQuaW5zaWdodHMvY29tcG9uZW50cy9DcmVhdGVHZXRMaXN0VXBkYXRlRGVsZXRlQVBJS2V5cz9hcGktdmVyc2lvbj0yMDE1LTA1LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4b10c116-5ea9-4ef8-8d21-b0db9cacb37f" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.7.2110.0", + "OSName/Windows10Enterprise", + "OSVersion/6.3.15063", + "Microsoft.Azure.Management.ApplicationInsights.Management.ApplicationInsightsManagementClient/0.1.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceNotFound\",\r\n \"message\": \"The Resource 'microsoft.insights/components/CreateGetListUpdateDeleteAPIKeys' under resource group 'swaggertest' was not found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "177" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-failure-cause": [ + "gateway" + ], + "x-ms-request-id": [ + "7224e2b9-0e53-40be-87e6-dcd7ec7aafbb" + ], + "x-ms-correlation-request-id": [ + "7224e2b9-0e53-40be-87e6-dcd7ec7aafbb" + ], + "x-ms-routing-request-id": [ + "WESTUS2:20170929T163419Z:7224e2b9-0e53-40be-87e6-dcd7ec7aafbb" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Fri, 29 Sep 2017 16:34:18 GMT" + ] + }, + "StatusCode": 404 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "b90b0dec-9b9a-4778-a84e-4ffb73bb17f6" + } +} \ No newline at end of file diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/APIKeysOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/APIKeysOperations.cs new file mode 100644 index 000000000000..083df0b101d1 --- /dev/null +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/APIKeysOperations.cs @@ -0,0 +1,871 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + 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 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + 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 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + 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 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 (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + 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/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/APIKeysOperationsExtensions.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/APIKeysOperationsExtensions.cs new file mode 100644 index 000000000000..3e07f175b878 --- /dev/null +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/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 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 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 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 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 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 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 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 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/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ApplicationInsightsManagementClient.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ApplicationInsightsManagementClient.cs index 008963a7d507..a950fd6a57d8 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ApplicationInsightsManagementClient.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ApplicationInsightsManagementClient.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Microsoft.Rest.Serialization; @@ -104,6 +103,11 @@ public partial class ApplicationInsightsManagementClient : ServiceClient public virtual IComponentQuotaStatusOperations ComponentQuotaStatus { get; private set; } + /// + /// Gets the IAPIKeysOperations. + /// + public virtual IAPIKeysOperations APIKeys { get; private set; } + /// /// Initializes a new instance of the ApplicationInsightsManagementClient class. /// @@ -311,6 +315,7 @@ private void Initialize() ExportConfigurations = new ExportConfigurationsOperations(this); ComponentCurrentBillingFeatures = new ComponentCurrentBillingFeaturesOperations(this); ComponentQuotaStatus = new ComponentQuotaStatusOperations(this); + APIKeys = new APIKeysOperations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2015-05-01"; AcceptLanguage = "en-US"; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentCurrentBillingFeaturesOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentCurrentBillingFeaturesOperations.cs index 405e698aaf1f..a1f2abbe1505 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentCurrentBillingFeaturesOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentCurrentBillingFeaturesOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs index fc51a12a0125..955160463b76 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentCurrentBillingFeaturesOperationsExtensions.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentQuotaStatusOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentQuotaStatusOperations.cs index 9b9358e82dff..0ee8eec96f7a 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentQuotaStatusOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentQuotaStatusOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentQuotaStatusOperationsExtensions.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentQuotaStatusOperationsExtensions.cs index 72cff8be4db5..1ca721fde700 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentQuotaStatusOperationsExtensions.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentQuotaStatusOperationsExtensions.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentsOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentsOperations.cs index dd468f266e1c..95f9618ff910 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentsOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentsOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentsOperationsExtensions.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentsOperationsExtensions.cs index 04552f76ec9b..7424d44af57e 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentsOperationsExtensions.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ComponentsOperationsExtensions.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ExportConfigurationsOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ExportConfigurationsOperations.cs index 83fcded0d639..2c0470176aff 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ExportConfigurationsOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ExportConfigurationsOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ExportConfigurationsOperationsExtensions.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ExportConfigurationsOperationsExtensions.cs index 7cbb4d272eb7..cc57dd04065e 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ExportConfigurationsOperationsExtensions.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/ExportConfigurationsOperationsExtensions.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IAPIKeysOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IAPIKeysOperations.cs new file mode 100644 index 000000000000..1e20fa3661af --- /dev/null +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/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 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 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 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 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/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IApplicationInsightsManagementClient.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IApplicationInsightsManagementClient.cs index ef6dd58fa60e..0b322245755c 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IApplicationInsightsManagementClient.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IApplicationInsightsManagementClient.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; @@ -99,5 +98,10 @@ public partial interface IApplicationInsightsManagementClient : System.IDisposab /// IComponentQuotaStatusOperations ComponentQuotaStatus { get; } + /// + /// Gets the IAPIKeysOperations. + /// + IAPIKeysOperations APIKeys { get; } + } } diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentCurrentBillingFeaturesOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentCurrentBillingFeaturesOperations.cs index e4d9c05dfb35..3aef9880b7d4 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentCurrentBillingFeaturesOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentCurrentBillingFeaturesOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentQuotaStatusOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentQuotaStatusOperations.cs index 72ab97356fb4..9e7b866b57c4 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentQuotaStatusOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentQuotaStatusOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentsOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentsOperations.cs index 255feac501fc..8f1ebf111b0a 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentsOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IComponentsOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IExportConfigurationsOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IExportConfigurationsOperations.cs index 4858877a0c92..16a8a8d64a8b 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IExportConfigurationsOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IExportConfigurationsOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IOperations.cs index 5356cbf957b3..fc3ceb0ca2bd 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IWebTestsOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IWebTestsOperations.cs index 1e1d95902b9b..d182e2015a9f 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IWebTestsOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/IWebTestsOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/APIKeyRequest.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/APIKeyRequest.cs new file mode 100644 index 000000000000..f880624f2f1e --- /dev/null +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/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 createion 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/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponent.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponent.cs index eda135e2cc13..53b528f18881 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponent.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponent.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; @@ -31,7 +29,7 @@ public partial class ApplicationInsightsComponent : Resource /// public ApplicationInsightsComponent() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentAPIKey.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentAPIKey.cs new file mode 100644 index 000000000000..caad635fd13e --- /dev/null +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/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 Applciation + /// 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 Applciation 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/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs index 5af7b8618792..4672eb5c9396 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentBillingFeatures.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -28,7 +26,7 @@ public partial class ApplicationInsightsComponentBillingFeatures /// public ApplicationInsightsComponentBillingFeatures() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs index c56f815c5783..4c37e314c25c 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentDataVolumeCap.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -26,7 +24,7 @@ public partial class ApplicationInsightsComponentDataVolumeCap /// public ApplicationInsightsComponentDataVolumeCap() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs index 91fa3617933c..4d1054bf586b 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentExportConfiguration.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -26,7 +24,7 @@ public partial class ApplicationInsightsComponentExportConfiguration /// public ApplicationInsightsComponentExportConfiguration() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentExportRequest.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentExportRequest.cs index 91e030e458d8..103e9334fde2 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentExportRequest.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentExportRequest.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -27,7 +25,7 @@ public partial class ApplicationInsightsComponentExportRequest /// public ApplicationInsightsComponentExportRequest() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs index 3b89c118fa90..8fe7951dc36e 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationInsightsComponentQuotaStatus.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -26,7 +24,7 @@ public partial class ApplicationInsightsComponentQuotaStatus /// public ApplicationInsightsComponentQuotaStatus() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationType.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationType.cs index 99af082e5c38..d381307a1069 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationType.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ApplicationType.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; /// /// Defines values for ApplicationType. diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ErrorResponse.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ErrorResponse.cs index ea36104d4e17..e63c66dacfec 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ErrorResponse.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ErrorResponse.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -26,7 +24,7 @@ public partial class ErrorResponse /// public ErrorResponse() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ErrorResponseException.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ErrorResponseException.cs index f4c67971228d..7ebc57e52964 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ErrorResponseException.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/ErrorResponseException.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Microsoft.Rest; /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/FlowType.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/FlowType.cs index 684058388079..f16f6c5caf29 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/FlowType.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/FlowType.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; /// /// Defines values for FlowType. diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Operation.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Operation.cs index d45a1dd45118..4a28c2e8724a 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Operation.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Operation.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -25,7 +23,7 @@ public partial class Operation /// public Operation() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/OperationDisplay.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/OperationDisplay.cs index fce7c84bce33..60452c458c9f 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/OperationDisplay.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/OperationDisplay.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -25,7 +23,7 @@ public partial class OperationDisplay /// public OperationDisplay() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Page.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Page.cs index 58816b2d0c6d..b4a80108bd88 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Page.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Page.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Microsoft.Rest; using Microsoft.Rest.Azure; using Newtonsoft.Json; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Page1.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Page1.cs new file mode 100644 index 000000000000..bfbe0bc45ecd --- /dev/null +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/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/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/RequestSource.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/RequestSource.cs index e8c52397265e..f660747e7420 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/RequestSource.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/RequestSource.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; /// /// Defines values for RequestSource. diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Resource.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Resource.cs index d4b43525b89b..4d7f97c9a68b 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Resource.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/Resource.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Microsoft.Rest; using Microsoft.Rest.Azure; using Newtonsoft.Json; @@ -29,7 +27,7 @@ public partial class Resource : IResource /// public Resource() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/TagsResource.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/TagsResource.cs index ba4c0782d6e8..748400d45cc7 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/TagsResource.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/TagsResource.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -28,7 +26,7 @@ public partial class TagsResource /// public TagsResource() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTest.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTest.cs index 49bf2af0b533..73ea8a7ba870 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTest.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTest.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Microsoft.Rest; using Microsoft.Rest.Serialization; using Newtonsoft.Json; @@ -30,7 +28,7 @@ public partial class WebTest : Resource /// public WebTest() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestGeolocation.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestGeolocation.cs index c8f3681a621b..62c4065a616d 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestGeolocation.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestGeolocation.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -26,7 +24,7 @@ public partial class WebTestGeolocation /// public WebTestGeolocation() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestKind.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestKind.cs index ccc73acdcb56..07afe0084b30 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestKind.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestKind.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.Runtime; @@ -30,8 +28,10 @@ public enum WebTestKind } internal static class WebTestKindEnumExtension { - internal static string ToSerializedValue(this WebTestKind? value) => - value == null ? null : ((WebTestKind)value).ToSerializedValue(); + internal static string ToSerializedValue(this WebTestKind? value) + { + return value == null ? null : ((WebTestKind)value).ToSerializedValue(); + } internal static string ToSerializedValue(this WebTestKind value) { diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestPropertiesConfiguration.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestPropertiesConfiguration.cs index 818748ed49c6..82adbd44dd34 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestPropertiesConfiguration.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Models/WebTestPropertiesConfiguration.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,13 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; - using Microsoft.Azure.Management.ApplicationInsights.Management; using Newtonsoft.Json; using System.Linq; @@ -26,7 +24,7 @@ public partial class WebTestPropertiesConfiguration /// public WebTestPropertiesConfiguration() { - CustomInit(); + CustomInit(); } /// diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Operations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Operations.cs index 755cc7d34c33..8cf0a6a65662 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Operations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/Operations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/OperationsExtensions.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/OperationsExtensions.cs index c52645dc5aac..75d869166e9b 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/OperationsExtensions.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/OperationsExtensions.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/WebTestsOperations.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/WebTestsOperations.cs index 9718710f8712..9949a4ca9093 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/WebTestsOperations.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/WebTestsOperations.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/WebTestsOperationsExtensions.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/WebTestsOperationsExtensions.cs index e851d005aa8d..871a2686edfe 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/WebTestsOperationsExtensions.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Generated/WebTestsOperationsExtensions.cs @@ -1,3 +1,4 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. @@ -5,12 +6,10 @@ // Code generated 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.Azure; - using Microsoft.Azure.Management; - using Microsoft.Azure.Management.ApplicationInsights; using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Microsoft.Azure.Management.ApplicationInsights.csproj b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Microsoft.Azure.Management.ApplicationInsights.csproj index caa4137e8605..c51a0542629b 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Microsoft.Azure.Management.ApplicationInsights.csproj +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Microsoft.Azure.Management.ApplicationInsights.csproj @@ -2,7 +2,7 @@ Microsoft Azure Application Insights Library - 0.1.0-preview + 0.1.1-preview Microsoft.Azure.Management.ApplicationInsights Microsoft.Azure.Management.ApplicationInsights Management.ApplicationInsights; diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Properties/AssemblyInfo.cs b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Properties/AssemblyInfo.cs index 6b332942fcf0..ffbe2af78e90 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Properties/AssemblyInfo.cs +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Resources; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("Microsoft Azure Monitor Library")] -[assembly: AssemblyDescription("Provides Microsoft Azure Monitor operations.")] +[assembly: AssemblyTitle("Microsoft Azure Management Application Insights Library")] +[assembly: AssemblyDescription("Provides Microsoft Azure Management Application Insights operations.")] -[assembly: AssemblyVersion("0.1.0.0")] -[assembly: AssemblyFileVersion("0.1.0.0")] +[assembly: AssemblyVersion("0.1.0.1")] +[assembly: AssemblyFileVersion("0.1.0.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] diff --git a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/generate.cmd b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/generate.cmd index cbbc4dc9ba74..5f5d9191cb9e 100644 --- a/src/SDKs/ApplicationInsights/Management.ApplicationInsights/generate.cmd +++ b/src/SDKs/ApplicationInsights/Management.ApplicationInsights/generate.cmd @@ -4,4 +4,4 @@ :: @echo off -call %~dp0..\..\..\..\tools\generate.cmd ApplicationInsights/resource-manager %* +call %~dp0..\..\..\..\tools\generate.cmd applicationinsights/resource-manager %* diff --git a/src/SDKs/_metadata/ApplicationInsights_resource-manager.txt b/src/SDKs/_metadata/ApplicationInsights_resource-manager.txt new file mode 100644 index 000000000000..19d4e63c74d9 --- /dev/null +++ b/src/SDKs/_metadata/ApplicationInsights_resource-manager.txt @@ -0,0 +1,16 @@ +2017-10-09 22:52:13 UTC + +1) azure-rest-api-specs repository information +GitHub user: Azure +Branch: current +Commit: 7aa3a5247895ba34d6cfec73e036bb66dc907d20 + +2) AutoRest information +Requested version: latest +You cannot call a method on a null-valued expression. +At D:\Repo\Github\azure-sdk-for-net\tools\generateMetadata.ps1:19 char:1 ++ Write-Host "Latest version: " (autorest --list-installed | Where {$ ... ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + CategoryInfo : InvalidOperation: (:) [], RuntimeException + + FullyQualifiedErrorId : InvokeMethodOnNull +