From 2ccc96258e7d02ae6fb125763aa4da318097cb36 Mon Sep 17 00:00:00 2001 From: Ace Eldeib Date: Tue, 19 Jun 2018 14:05:42 -0700 Subject: [PATCH] adding log analytics data plane --- api-specs.json | 4 + loganalytics/data-plane/pom.xml | 115 ++++++++ .../loganalytics/LogAnalyticsDataClient.java | 138 +++++++++ .../LogAnalyticsDataClientImpl.java | 269 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../azure/loganalytics/models/Column.java | 70 +++++ .../loganalytics/models/ErrorDetail.java | 174 +++++++++++ .../azure/loganalytics/models/ErrorInfo.java | 148 ++++++++++ .../loganalytics/models/ErrorResponse.java | 44 +++ .../models/ErrorResponseException.java | 44 +++ .../azure/loganalytics/models/QueryBody.java | 99 +++++++ .../loganalytics/models/QueryResults.java | 45 +++ .../azure/loganalytics/models/Table.java | 97 +++++++ .../loganalytics/models/package-info.java | 11 + .../azure/loganalytics/package-info.java | 11 + 15 files changed, 1280 insertions(+) create mode 100644 loganalytics/data-plane/pom.xml create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/LogAnalyticsDataClient.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/LogAnalyticsDataClientImpl.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/package-info.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/Column.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorDetail.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorInfo.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorResponse.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorResponseException.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/QueryBody.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/QueryResults.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/Table.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/package-info.java create mode 100644 loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/package-info.java diff --git a/api-specs.json b/api-specs.json index b687e889781d6..aa9e558dfaa07 100644 --- a/api-specs.json +++ b/api-specs.json @@ -60,6 +60,10 @@ "source": "specification/logic/resource-manager/readme.md", "args": "--multiapi --fluent" }, + "loganalytics/data-plane": { + "source": "specification/operationalinsights/data-plane/readme.md", + "args": "--payload-flattening-threshold=1 --override-client-name=LogAnalyticsDataClient" + }, "mediaservices/resource-manager": { "source": "specification/mediaservices/resource-manager/readme.md", "args": "--multiapi --fluent" diff --git a/loganalytics/data-plane/pom.xml b/loganalytics/data-plane/pom.xml new file mode 100644 index 0000000000000..1ea55f7209416 --- /dev/null +++ b/loganalytics/data-plane/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + com.microsoft.azure + azure-loganalytics + 0.0.1-beta + jar + Microsoft Azure SDK for Log Analytics + This package contains Microsoft Log Analytics SDK. + 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 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + 1.5.0 + + + junit + junit + 4.12 + test + + + com.microsoft.azure + azure-client-authentication + 1.5.0 + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/LogAnalyticsDataClient.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/LogAnalyticsDataClient.java new file mode 100644 index 0000000000000..8f2a9a8896580 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/LogAnalyticsDataClient.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.loganalytics.models.ErrorResponseException; +import com.microsoft.azure.loganalytics.models.QueryBody; +import com.microsoft.azure.loganalytics.models.QueryResults; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import rx.Observable; + +/** + * The interface for LogAnalyticsDataClient class. + */ +public interface LogAnalyticsDataClient { + /** + * Gets the REST client. + * + * @return the {@link RestClient} object. + */ + RestClient restClient(); + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + AzureClient getAzureClient(); + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + String userAgent(); + + /** + * Gets Gets or sets the preferred language for the response.. + * + * @return the acceptLanguage value. + */ + String acceptLanguage(); + + /** + * Sets Gets or sets the preferred language for the response.. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + LogAnalyticsDataClient withAcceptLanguage(String acceptLanguage); + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @return the longRunningOperationRetryTimeout value. + */ + int longRunningOperationRetryTimeout(); + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + LogAnalyticsDataClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @return the generateClientRequestId value. + */ + boolean generateClientRequestId(); + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + LogAnalyticsDataClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * Execute an Analytics query. + * Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query. + * + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QueryResults object if successful. + */ + QueryResults query(String workspaceId, QueryBody body); + + /** + * Execute an Analytics query. + * Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query. + * + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + ServiceFuture queryAsync(String workspaceId, QueryBody body, final ServiceCallback serviceCallback); + + /** + * Execute an Analytics query. + * Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query. + * + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueryResults object + */ + Observable queryAsync(String workspaceId, QueryBody body); + + /** + * Execute an Analytics query. + * Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query. + * + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueryResults object + */ + Observable> queryWithServiceResponseAsync(String workspaceId, QueryBody body); + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/LogAnalyticsDataClientImpl.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/LogAnalyticsDataClientImpl.java new file mode 100644 index 0000000000000..b820dce30f5e5 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/LogAnalyticsDataClientImpl.java @@ -0,0 +1,269 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.loganalytics.implementation; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.loganalytics.LogAnalyticsDataClient; +import com.microsoft.azure.loganalytics.models.ErrorResponseException; +import com.microsoft.azure.loganalytics.models.QueryBody; +import com.microsoft.azure.loganalytics.models.QueryResults; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the LogAnalyticsDataClientImpl class. + */ +public class LogAnalyticsDataClientImpl extends AzureServiceClient implements LogAnalyticsDataClient { + /** The Retrofit service to perform REST calls. */ + private LogAnalyticsDataClientService service; + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public LogAnalyticsDataClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public LogAnalyticsDataClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public LogAnalyticsDataClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * Initializes an instance of LogAnalyticsDataClient client. + * + * @param credentials the management credentials for Azure + */ + public LogAnalyticsDataClientImpl(ServiceClientCredentials credentials) { + this("https://api.loganalytics.io/v1", credentials); + } + + /** + * Initializes an instance of LogAnalyticsDataClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public LogAnalyticsDataClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of LogAnalyticsDataClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public LogAnalyticsDataClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "LogAnalyticsDataClient", "v1"); + } + + private void initializeService() { + service = restClient().retrofit().create(LogAnalyticsDataClientService.class); + } + + /** + * The interface defining all the services for LogAnalyticsDataClient to be + * used by Retrofit to perform actually REST calls. + */ + interface LogAnalyticsDataClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.loganalytics.LogAnalyticsDataClient query" }) + @POST("workspaces/{workspaceId}/query") + Observable> query(@Path("workspaceId") String workspaceId, @Body QueryBody body, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Execute an Analytics query. + * Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query. + * + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the QueryResults object if successful. + */ + public QueryResults query(String workspaceId, QueryBody body) { + return queryWithServiceResponseAsync(workspaceId, body).toBlocking().single().body(); + } + + /** + * Execute an Analytics query. + * Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query. + * + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture queryAsync(String workspaceId, QueryBody body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(queryWithServiceResponseAsync(workspaceId, body), serviceCallback); + } + + /** + * Execute an Analytics query. + * Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query. + * + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueryResults object + */ + public Observable queryAsync(String workspaceId, QueryBody body) { + return queryWithServiceResponseAsync(workspaceId, body).map(new Func1, QueryResults>() { + @Override + public QueryResults call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Execute an Analytics query. + * Executes an Analytics query for data. [Here](https://dev.loganalytics.io/documentation/Using-the-API) is an example for using POST with an Analytics query. + * + * @param workspaceId ID of the workspace. This is Workspace ID from the Properties blade in the Azure portal. + * @param body The Analytics query. Learn more about the [Analytics query syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the QueryResults object + */ + public Observable> queryWithServiceResponseAsync(String workspaceId, QueryBody body) { + if (workspaceId == null) { + throw new IllegalArgumentException("Parameter workspaceId is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + return service.query(workspaceId, body, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = queryDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse queryDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/package-info.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/package-info.java new file mode 100644 index 0000000000000..265e5e521241a --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for LogAnalyticsDataClient. + * Log Analytics Data Plane Client. + */ +package com.microsoft.azure.loganalytics.implementation; diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/Column.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/Column.java new file mode 100644 index 0000000000000..4d2103234d74c --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/Column.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.loganalytics.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A table column. + * A column in a table. + */ +public class Column { + /** + * The name of this column. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The data type of this column. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name of this column. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of this column. + * + * @param name the name value to set + * @return the Column object itself. + */ + public Column withName(String name) { + this.name = name; + return this; + } + + /** + * Get the data type of this column. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the data type of this column. + * + * @param type the type value to set + * @return the Column object itself. + */ + public Column withType(String type) { + this.type = type; + return this; + } + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorDetail.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorDetail.java new file mode 100644 index 0000000000000..cc5a332d29133 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorDetail.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details. + */ +public class ErrorDetail { + /** + * The error's code. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /** + * A human readable error message. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /** + * Indicates which property in the request is responsible for the error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Indicates which value in 'target' is responsible for the error. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Indicates resources which were responsible for the error. + */ + @JsonProperty(value = "resources") + private List resources; + + /** + * The additionalProperties property. + */ + @JsonProperty(value = "additionalProperties") + private Object additionalProperties; + + /** + * Get the error's code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the error's code. + * + * @param code the code value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withCode(String code) { + this.code = code; + return this; + } + + /** + * Get a human readable error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a human readable error message. + * + * @param message the message value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get indicates which property in the request is responsible for the error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set indicates which property in the request is responsible for the error. + * + * @param target the target value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get indicates which value in 'target' is responsible for the error. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set indicates which value in 'target' is responsible for the error. + * + * @param value the value value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withValue(String value) { + this.value = value; + return this; + } + + /** + * Get indicates resources which were responsible for the error. + * + * @return the resources value + */ + public List resources() { + return this.resources; + } + + /** + * Set indicates resources which were responsible for the error. + * + * @param resources the resources value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Get the additionalProperties value. + * + * @return the additionalProperties value + */ + public Object additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties value. + * + * @param additionalProperties the additionalProperties value to set + * @return the ErrorDetail object itself. + */ + public ErrorDetail withAdditionalProperties(Object additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorInfo.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorInfo.java new file mode 100644 index 0000000000000..e65b218799356 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorInfo.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The code and message for an error. + */ +public class ErrorInfo { + /** + * A machine readable error code. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /** + * A human readable error message. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /** + * error details. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Inner error details if they exist. + */ + @JsonProperty(value = "innererror") + private ErrorInfo innererror; + + /** + * The additionalProperties property. + */ + @JsonProperty(value = "additionalProperties") + private Object additionalProperties; + + /** + * Get a machine readable error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set a machine readable error code. + * + * @param code the code value to set + * @return the ErrorInfo object itself. + */ + public ErrorInfo withCode(String code) { + this.code = code; + return this; + } + + /** + * Get a human readable error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a human readable error message. + * + * @param message the message value to set + * @return the ErrorInfo object itself. + */ + public ErrorInfo withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set error details. + * + * @param details the details value to set + * @return the ErrorInfo object itself. + */ + public ErrorInfo withDetails(List details) { + this.details = details; + return this; + } + + /** + * Get inner error details if they exist. + * + * @return the innererror value + */ + public ErrorInfo innererror() { + return this.innererror; + } + + /** + * Set inner error details if they exist. + * + * @param innererror the innererror value to set + * @return the ErrorInfo object itself. + */ + public ErrorInfo withInnererror(ErrorInfo innererror) { + this.innererror = innererror; + return this; + } + + /** + * Get the additionalProperties value. + * + * @return the additionalProperties value + */ + public Object additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties value. + * + * @param additionalProperties the additionalProperties value to set + * @return the ErrorInfo object itself. + */ + public ErrorInfo withAdditionalProperties(Object additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorResponse.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorResponse.java new file mode 100644 index 0000000000000..0a30e4e4dbf05 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details. + * Contains details when the response code indicates an error. + */ +public class ErrorResponse { + /** + * The error details. + */ + @JsonProperty(value = "error", required = true) + private ErrorInfo error; + + /** + * Get the error details. + * + * @return the error value + */ + public ErrorInfo error() { + return this.error; + } + + /** + * Set the error details. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorInfo error) { + this.error = error; + return this; + } + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorResponseException.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorResponseException.java new file mode 100644 index 0000000000000..7a8c7771d58d2 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.models; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/QueryBody.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/QueryBody.java new file mode 100644 index 0000000000000..1fceddac66241 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/QueryBody.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.loganalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Analytics query. Learn more about the [Analytics query + * syntax](https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/). + */ +public class QueryBody { + /** + * The query to execute. + */ + @JsonProperty(value = "query", required = true) + private String query; + + /** + * Optional. The timespan over which to query data. This is an ISO8601 time + * period value. This timespan is applied in addition to any that are + * specified in the query expression. + */ + @JsonProperty(value = "timespan") + private String timespan; + + /** + * A list of workspaces that are included in the query. + */ + @JsonProperty(value = "workspaces") + private List workspaces; + + /** + * Get the query to execute. + * + * @return the query value + */ + public String query() { + return this.query; + } + + /** + * Set the query to execute. + * + * @param query the query value to set + * @return the QueryBody object itself. + */ + public QueryBody withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get optional. The timespan over which to query data. This is an ISO8601 time period value. This timespan is applied in addition to any that are specified in the query expression. + * + * @return the timespan value + */ + public String timespan() { + return this.timespan; + } + + /** + * Set optional. The timespan over which to query data. This is an ISO8601 time period value. This timespan is applied in addition to any that are specified in the query expression. + * + * @param timespan the timespan value to set + * @return the QueryBody object itself. + */ + public QueryBody withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get a list of workspaces that are included in the query. + * + * @return the workspaces value + */ + public List workspaces() { + return this.workspaces; + } + + /** + * Set a list of workspaces that are included in the query. + * + * @param workspaces the workspaces value to set + * @return the QueryBody object itself. + */ + public QueryBody withWorkspaces(List workspaces) { + this.workspaces = workspaces; + return this; + } + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/QueryResults.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/QueryResults.java new file mode 100644 index 0000000000000..bde5f9b305edc --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/QueryResults.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A query response. + * Contains the tables, columns & rows resulting from a query. + */ +public class QueryResults { + /** + * The list of tables, columns and rows. + */ + @JsonProperty(value = "tables", required = true) + private List tables; + + /** + * Get the list of tables, columns and rows. + * + * @return the tables value + */ + public List
tables() { + return this.tables; + } + + /** + * Set the list of tables, columns and rows. + * + * @param tables the tables value to set + * @return the QueryResults object itself. + */ + public QueryResults withTables(List
tables) { + this.tables = tables; + return this; + } + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/Table.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/Table.java new file mode 100644 index 0000000000000..3ad5f09991888 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/Table.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.loganalytics.models; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A query response table. + * Contains the columns and rows for one table in a query response. + */ +public class Table { + /** + * The name of the table. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The list of columns in this table. + */ + @JsonProperty(value = "columns", required = true) + private List columns; + + /** + * The resulting rows from this query. + */ + @JsonProperty(value = "rows", required = true) + private List> rows; + + /** + * Get the name of the table. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the table. + * + * @param name the name value to set + * @return the Table object itself. + */ + public Table withName(String name) { + this.name = name; + return this; + } + + /** + * Get the list of columns in this table. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Set the list of columns in this table. + * + * @param columns the columns value to set + * @return the Table object itself. + */ + public Table withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get the resulting rows from this query. + * + * @return the rows value + */ + public List> rows() { + return this.rows; + } + + /** + * Set the resulting rows from this query. + * + * @param rows the rows value to set + * @return the Table object itself. + */ + public Table withRows(List> rows) { + this.rows = rows; + return this; + } + +} diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/package-info.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/package-info.java new file mode 100644 index 0000000000000..1cadbca8849c6 --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the models classes for LogAnalyticsDataClient. + * Log Analytics Data Plane Client. + */ +package com.microsoft.azure.loganalytics.models; diff --git a/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/package-info.java b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/package-info.java new file mode 100644 index 0000000000000..374e44497e9cf --- /dev/null +++ b/loganalytics/data-plane/src/main/java/com/microsoft/azure/loganalytics/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for LogAnalyticsDataClient. + * Log Analytics Data Plane Client. + */ +package com.microsoft.azure.loganalytics;