From 81f990198184098dcb1209d25f3c210ed18adbdb Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Fri, 28 Sep 2018 13:17:47 -0700 Subject: [PATCH 1/2] Update appinsights & loganalytics runtime version --- applicationinsights/data-plane/pom.xml | 11 +++-------- loganalytics/data-plane/pom.xml | 9 ++------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/applicationinsights/data-plane/pom.xml b/applicationinsights/data-plane/pom.xml index ab91c8f8fa3d8..7a9e7b65ab7d5 100644 --- a/applicationinsights/data-plane/pom.xml +++ b/applicationinsights/data-plane/pom.xml @@ -29,7 +29,7 @@ UTF-8 - 1.6.1 + 1.6.3 record @@ -42,7 +42,7 @@ com.microsoft.azure azure-client-runtime - 1.6.1 + ${runtime.version} junit @@ -68,11 +68,6 @@ azure-arm-client-runtime ${runtime.version} - - com.microsoft.azure - azure-client-runtime - ${runtime.version} - @@ -166,4 +161,4 @@ - \ No newline at end of file + diff --git a/loganalytics/data-plane/pom.xml b/loganalytics/data-plane/pom.xml index 6e5cba4acf80e..1ccc97e1d303d 100644 --- a/loganalytics/data-plane/pom.xml +++ b/loganalytics/data-plane/pom.xml @@ -29,7 +29,7 @@ UTF-8 - 1.6.1 + 1.6.3 record @@ -42,7 +42,7 @@ com.microsoft.azure azure-client-runtime - 1.6.1 + ${runtime.version} junit @@ -68,11 +68,6 @@ azure-arm-client-runtime ${runtime.version} - - com.microsoft.azure - azure-client-runtime - ${runtime.version} - From be8edc2959e3db1d1423bae78ebea8364900c160 Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Mon, 1 Oct 2018 10:48:31 -0700 Subject: [PATCH 2/2] Move sample to correct location --- loganalytics/data-plane/samples/pom.xml | 76 +++++++++++++++++++ .../loganalytics/samples/BasicSample.java | 29 ++++--- .../session-records/firstTest.json | 28 ------- 3 files changed, 94 insertions(+), 39 deletions(-) create mode 100644 loganalytics/data-plane/samples/pom.xml rename loganalytics/data-plane/{ => samples}/src/main/java/com/microsoft/azure/loganalytics/samples/BasicSample.java (77%) delete mode 100644 loganalytics/data-plane/target/test-classes/session-records/firstTest.json diff --git a/loganalytics/data-plane/samples/pom.xml b/loganalytics/data-plane/samples/pom.xml new file mode 100644 index 0000000000000..525d6b6f06558 --- /dev/null +++ b/loganalytics/data-plane/samples/pom.xml @@ -0,0 +1,76 @@ + + + 4.0.0 + com.microsoft.azure + azure-loganalytics-sample + 1.0.0-Preview-1 + jar + Microsoft Azure SDK for Log Analytics Sample + This package contains Microsoft Log Analytics SDK Sample. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + 1.6.3 + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-loganalytics + ${version} + + + com.microsoft.azure + azure-client-authentication + ${runtime.version} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + + diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/samples/BasicSample.java b/loganalytics/data-plane/samples/src/main/java/com/microsoft/azure/loganalytics/samples/BasicSample.java similarity index 77% rename from loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/samples/BasicSample.java rename to loganalytics/data-plane/samples/src/main/java/com/microsoft/azure/loganalytics/samples/BasicSample.java index 69c0acd3a2959..1e4ca1f68b00e 100644 --- a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/samples/BasicSample.java +++ b/loganalytics/data-plane/samples/src/main/java/com/microsoft/azure/loganalytics/samples/BasicSample.java @@ -1,10 +1,21 @@ -import java.util.List; -import java.util.stream.Collectors; +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.loganalytics.samples; + import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.credentials.ApplicationTokenCredentials; import com.microsoft.azure.loganalytics.implementation.LogAnalyticsDataClientImpl; +import com.microsoft.azure.loganalytics.models.Column; import com.microsoft.azure.loganalytics.models.QueryBody; import com.microsoft.azure.loganalytics.models.QueryResults; -import com.microsoft.azure.credentials.ApplicationTokenCredentials; + +import java.util.List; /** * Basic query example @@ -34,19 +45,15 @@ public static void main( String[] args ) // Process and print results List row = queryResults.tables().get(0).rows().get(0); - List columnNames = queryResults + List columnNames = queryResults .tables() .get(0) - .columns() - .stream() - .map(elt -> elt.name()) - .collect(Collectors.toList()); + .columns(); for (int i = 0; i < row.size(); i++){ - System.out.println("The value of " + columnNames.get(i) + " is " + row.get(i)); + System.out.println("The value of " + columnNames.get(i).name() + " is " + row.get(i)); } return; } -} -``` \ No newline at end of file +} \ No newline at end of file diff --git a/loganalytics/data-plane/target/test-classes/session-records/firstTest.json b/loganalytics/data-plane/target/test-classes/session-records/firstTest.json deleted file mode 100644 index 416dfc85cc009..0000000000000 --- a/loganalytics/data-plane/target/test-classes/session-records/firstTest.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "http://localhost:1234/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query", - "Headers" : { - "User-Agent" : "Azure-SDK-For-Java/null OS:Windows 10/10.0 MacAddressHash:a868cd1346b534e1d19791216fab6df609d09c66b0f97bd640af4913ad89527e Java:10.0.1 (LogAnalyticsDataClient, v1)", - "Content-Type" : "application/json; charset=utf-8" - }, - "Response" : { - "date" : "Thu, 09 Aug 2018 19:35:54 GMT", - "server" : "nginx", - "content-length" : "1906", - "vary" : "Accept-Encoding", - "retry-after" : "0", - "StatusCode" : "200", - "strict-transport-security" : "max-age=31536000000; includeSubDomains", - "access-control-expose-headers" : "Retry-After,Age,WWW-Authenticate,x-resource-identities,x-ms-status-location", - "via" : "1.1 draft-oms-green.efbb771c-9c05-11e8-9972-70b3d5800001", - "access-control-allow-origin" : "*", - "x-content-type-options" : "nosniff", - "content-location" : "https://eastus.api.loganalytics.io/v1/workspaces/cab864ad-d0c1-496b-bc5e-4418315621bf/query", - "content-type" : "application/json; charset=utf-8", - "Body" : "{\"tables\":[{\"name\":\"PrimaryResult\",\"columns\":[{\"name\":\"TenantId\",\"type\":\"string\"},{\"name\":\"SourceSystem\",\"type\":\"string\"},{\"name\":\"TimeGenerated\",\"type\":\"datetime\"},{\"name\":\"MG\",\"type\":\"string\"},{\"name\":\"ManagementGroupName\",\"type\":\"string\"},{\"name\":\"SourceComputerId\",\"type\":\"string\"},{\"name\":\"ComputerIP\",\"type\":\"string\"},{\"name\":\"Computer\",\"type\":\"string\"},{\"name\":\"Category\",\"type\":\"string\"},{\"name\":\"OSType\",\"type\":\"string\"},{\"name\":\"OSName\",\"type\":\"string\"},{\"name\":\"OSMajorVersion\",\"type\":\"string\"},{\"name\":\"OSMinorVersion\",\"type\":\"string\"},{\"name\":\"Version\",\"type\":\"string\"},{\"name\":\"SCAgentChannel\",\"type\":\"string\"},{\"name\":\"IsGatewayInstalled\",\"type\":\"bool\"},{\"name\":\"RemoteIPLongitude\",\"type\":\"real\"},{\"name\":\"RemoteIPLatitude\",\"type\":\"real\"},{\"name\":\"RemoteIPCountry\",\"type\":\"string\"},{\"name\":\"SubscriptionId\",\"type\":\"string\"},{\"name\":\"ResourceGroup\",\"type\":\"string\"},{\"name\":\"ResourceProvider\",\"type\":\"string\"},{\"name\":\"Resource\",\"type\":\"string\"},{\"name\":\"ResourceId\",\"type\":\"string\"},{\"name\":\"ResourceType\",\"type\":\"string\"},{\"name\":\"ComputerEnvironment\",\"type\":\"string\"},{\"name\":\"Solutions\",\"type\":\"string\"},{\"name\":\"VMUUID\",\"type\":\"string\"},{\"name\":\"Type\",\"type\":\"string\"}],\"rows\":[[\"cab864ad-d0c1-496b-bc5e-4418315621bf\",\"OpsManager\",\"2018-07-19T06:16:53.32Z\",\"00000000-0000-0000-0000-000000000002\",\"\",\"54a48994-9f16-444b-8433-d7ba1f44f1c8\",\"104.42.118.149\",\"dcos-master-draftacs-int-green-0\",\"Direct Agent\",\"Linux\",\"Ubuntu\",\"16\",\"04\",\"1.6.0-42\",\"Direct\",null,-121.83,37.32,\"United States\",\"00000000-0000-0000-0000-000000000000\",\"draftacs-int-green\",\"microsoft.compute\",\"dcos-master-draftacs-int-green-0\",\"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/draftacs-int-green/providers/microsoft.compute/virtualmachines/dcos-master-draftacs-int-green-0\",\"virtualmachines\",\"Azure\",\"\\\"security\\\", \\\"securityCenterFree\\\"\",\"1bae5f16-d661-7347-9427-a26b391ae746\",\"Heartbeat\"]]}]}", - "age" : "36" - } - } ], - "variables" : [ ] -} \ No newline at end of file