All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azurenative.operationalinsights.Query Maven / Gradle / Ivy

There is a newer version: 2.78.0
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azurenative.operationalinsights;

import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.operationalinsights.QueryArgs;
import com.pulumi.azurenative.operationalinsights.outputs.LogAnalyticsQueryPackQueryPropertiesResponseRelated;
import com.pulumi.azurenative.operationalinsights.outputs.SystemDataResponse;
import com.pulumi.core.Alias;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Object;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * A Log Analytics QueryPack-Query definition.
 * Azure REST API version: 2019-09-01. Prior API version in Azure Native 1.x: 2019-09-01.
 * 
 * Other available API versions: 2019-09-01-preview, 2023-09-01.
 * 
 * ## Example Usage
 * ### QueryPut
 * 
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.operationalinsights.Query;
 * import com.pulumi.azurenative.operationalinsights.QueryArgs;
 * import com.pulumi.azurenative.operationalinsights.inputs.LogAnalyticsQueryPackQueryPropertiesRelatedArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var query = new Query("query", QueryArgs.builder()
 *             .body("""
 * let newExceptionsTimeRange = 1d;
 * let timeRangeToCheckBefore = 7d;
 * exceptions
 * | where timestamp < ago(timeRangeToCheckBefore)
 * | summarize count() by problemId
 * | join kind= rightanti (
 * exceptions
 * | where timestamp >= ago(newExceptionsTimeRange)
 * | extend stack = tostring(details[0].rawStack)
 * | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
 * ) on problemId 
 * | order by  count_ desc
 *             """)
 *             .description("my description")
 *             .displayName("Exceptions - New in the last 24 hours")
 *             .id("a449f8af-8e64-4b3a-9b16-5a7165ff98c4")
 *             .queryPackName("my-querypack")
 *             .related(LogAnalyticsQueryPackQueryPropertiesRelatedArgs.builder()
 *                 .categories("analytics")
 *                 .build())
 *             .resourceGroupName("my-resource-group")
 *             .tags(Map.ofEntries(
 *                 Map.entry("my-label", "label1"),
 *                 Map.entry("my-other-label", "label2")
 *             ))
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* * ## Import * * An existing resource can be imported using its type token, name, and identifier, e.g. * * ```sh * $ pulumi import azure-native:operationalinsights:Query a449f8af-8e64-4b3a-9b16-5a7165ff98c4 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/queryPacks/{queryPackName}/queries/{id} * ``` * */ @ResourceType(type="azure-native:operationalinsights:Query") public class Query extends com.pulumi.resources.CustomResource { /** * Object Id of user creating the query. * */ @Export(name="author", refs={String.class}, tree="[0]") private Output author; /** * @return Object Id of user creating the query. * */ public Output author() { return this.author; } /** * Body of the query. * */ @Export(name="body", refs={String.class}, tree="[0]") private Output body; /** * @return Body of the query. * */ public Output body() { return this.body; } /** * Description of the query. * */ @Export(name="description", refs={String.class}, tree="[0]") private Output description; /** * @return Description of the query. * */ public Output> description() { return Codegen.optional(this.description); } /** * Unique display name for your query within the Query Pack. * */ @Export(name="displayName", refs={String.class}, tree="[0]") private Output displayName; /** * @return Unique display name for your query within the Query Pack. * */ public Output displayName() { return this.displayName; } /** * Azure resource name * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return Azure resource name * */ public Output name() { return this.name; } /** * Additional properties that can be set for the query. * */ @Export(name="properties", refs={Object.class}, tree="[0]") private Output properties; /** * @return Additional properties that can be set for the query. * */ public Output properties() { return this.properties; } /** * The related metadata items for the function. * */ @Export(name="related", refs={LogAnalyticsQueryPackQueryPropertiesResponseRelated.class}, tree="[0]") private Output related; /** * @return The related metadata items for the function. * */ public Output> related() { return Codegen.optional(this.related); } /** * Read only system data * */ @Export(name="systemData", refs={SystemDataResponse.class}, tree="[0]") private Output systemData; /** * @return Read only system data * */ public Output systemData() { return this.systemData; } /** * Tags associated with the query. * */ @Export(name="tags", refs={Map.class,String.class,List.class}, tree="[0,1,[2,1]]") private Output>> tags; /** * @return Tags associated with the query. * */ public Output>>> tags() { return Codegen.optional(this.tags); } /** * Creation Date for the Log Analytics Query, in ISO 8601 format. * */ @Export(name="timeCreated", refs={String.class}, tree="[0]") private Output timeCreated; /** * @return Creation Date for the Log Analytics Query, in ISO 8601 format. * */ public Output timeCreated() { return this.timeCreated; } /** * Last modified date of the Log Analytics Query, in ISO 8601 format. * */ @Export(name="timeModified", refs={String.class}, tree="[0]") private Output timeModified; /** * @return Last modified date of the Log Analytics Query, in ISO 8601 format. * */ public Output timeModified() { return this.timeModified; } /** * Azure resource type * */ @Export(name="type", refs={String.class}, tree="[0]") private Output type; /** * @return Azure resource type * */ public Output type() { return this.type; } /** * * @param name The _unique_ name of the resulting resource. */ public Query(java.lang.String name) { this(name, QueryArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public Query(java.lang.String name, QueryArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public Query(java.lang.String name, QueryArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure-native:operationalinsights:Query", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private Query(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure-native:operationalinsights:Query", name, null, makeResourceOptions(options, id), false); } private static QueryArgs makeArgs(QueryArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? QueryArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .aliases(List.of( Output.of(Alias.builder().type("azure-native:operationalinsights/v20190901:Query").build()), Output.of(Alias.builder().type("azure-native:operationalinsights/v20190901preview:Query").build()), Output.of(Alias.builder().type("azure-native:operationalinsights/v20230901:Query").build()) )) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param options Optional settings to control the behavior of the CustomResource. */ public static Query get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new Query(name, id, options); } }