// *** 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.azure.monitoring;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.monitoring.DataCollectionRuleAssociationArgs;
import com.pulumi.azure.monitoring.inputs.DataCollectionRuleAssociationState;
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.String;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages a Data Collection Rule Association.
 * 
 * ## Example Usage
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.network.NetworkInterface;
 * import com.pulumi.azure.network.NetworkInterfaceArgs;
 * import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
 * import com.pulumi.azure.compute.LinuxVirtualMachine;
 * import com.pulumi.azure.compute.LinuxVirtualMachineArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineOsDiskArgs;
 * import com.pulumi.azure.compute.inputs.LinuxVirtualMachineSourceImageReferenceArgs;
 * import com.pulumi.azure.monitoring.DataCollectionRule;
 * import com.pulumi.azure.monitoring.DataCollectionRuleArgs;
 * import com.pulumi.azure.monitoring.inputs.DataCollectionRuleDestinationsArgs;
 * import com.pulumi.azure.monitoring.inputs.DataCollectionRuleDestinationsAzureMonitorMetricsArgs;
 * import com.pulumi.azure.monitoring.inputs.DataCollectionRuleDataFlowArgs;
 * import com.pulumi.azure.monitoring.DataCollectionEndpoint;
 * import com.pulumi.azure.monitoring.DataCollectionEndpointArgs;
 * import com.pulumi.azure.monitoring.DataCollectionRuleAssociation;
 * import com.pulumi.azure.monitoring.DataCollectionRuleAssociationArgs;
 * 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 exampleResourceGroup = new ResourceGroup(&#34;exampleResourceGroup&#34;, ResourceGroupArgs.builder()        
 *             .location(&#34;West Europe&#34;)
 *             .build());
 * 
 *         var exampleVirtualNetwork = new VirtualNetwork(&#34;exampleVirtualNetwork&#34;, VirtualNetworkArgs.builder()        
 *             .addressSpaces(&#34;10.0.0.0/16&#34;)
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .build());
 * 
 *         var exampleSubnet = new Subnet(&#34;exampleSubnet&#34;, SubnetArgs.builder()        
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes(&#34;10.0.2.0/24&#34;)
 *             .build());
 * 
 *         var exampleNetworkInterface = new NetworkInterface(&#34;exampleNetworkInterface&#34;, NetworkInterfaceArgs.builder()        
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
 *                 .name(&#34;internal&#34;)
 *                 .subnetId(exampleSubnet.id())
 *                 .privateIpAddressAllocation(&#34;Dynamic&#34;)
 *                 .build())
 *             .build());
 * 
 *         var exampleLinuxVirtualMachine = new LinuxVirtualMachine(&#34;exampleLinuxVirtualMachine&#34;, LinuxVirtualMachineArgs.builder()        
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .size(&#34;Standard_B1ls&#34;)
 *             .adminUsername(&#34;adminuser&#34;)
 *             .networkInterfaceIds(exampleNetworkInterface.id())
 *             .adminPassword(&#34;example-Password@7890&#34;)
 *             .disablePasswordAuthentication(false)
 *             .osDisk(LinuxVirtualMachineOsDiskArgs.builder()
 *                 .caching(&#34;ReadWrite&#34;)
 *                 .storageAccountType(&#34;Standard_LRS&#34;)
 *                 .build())
 *             .sourceImageReference(LinuxVirtualMachineSourceImageReferenceArgs.builder()
 *                 .publisher(&#34;Canonical&#34;)
 *                 .offer(&#34;0001-com-ubuntu-server-focal&#34;)
 *                 .sku(&#34;20_04-lts&#34;)
 *                 .version(&#34;latest&#34;)
 *                 .build())
 *             .build());
 * 
 *         var exampleDataCollectionRule = new DataCollectionRule(&#34;exampleDataCollectionRule&#34;, DataCollectionRuleArgs.builder()        
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .destinations(DataCollectionRuleDestinationsArgs.builder()
 *                 .azureMonitorMetrics(DataCollectionRuleDestinationsAzureMonitorMetricsArgs.builder()
 *                     .name(&#34;example-destination-metrics&#34;)
 *                     .build())
 *                 .build())
 *             .dataFlows(DataCollectionRuleDataFlowArgs.builder()
 *                 .streams(&#34;Microsoft-InsightsMetrics&#34;)
 *                 .destinations(&#34;example-destination-metrics&#34;)
 *                 .build())
 *             .build());
 * 
 *         var exampleDataCollectionEndpoint = new DataCollectionEndpoint(&#34;exampleDataCollectionEndpoint&#34;, DataCollectionEndpointArgs.builder()        
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .build());
 * 
 *         var example1 = new DataCollectionRuleAssociation(&#34;example1&#34;, DataCollectionRuleAssociationArgs.builder()        
 *             .targetResourceId(exampleLinuxVirtualMachine.id())
 *             .dataCollectionRuleId(exampleDataCollectionRule.id())
 *             .description(&#34;example&#34;)
 *             .build());
 * 
 *         var example2 = new DataCollectionRuleAssociation(&#34;example2&#34;, DataCollectionRuleAssociationArgs.builder()        
 *             .targetResourceId(exampleLinuxVirtualMachine.id())
 *             .dataCollectionEndpointId(exampleDataCollectionEndpoint.id())
 *             .description(&#34;example&#34;)
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * Data Collection Rules Association can be imported using the `resource id`, e.g.
 * 
 * ```sh
 *  $ pulumi import azure:monitoring/dataCollectionRuleAssociation:DataCollectionRuleAssociation example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.Insights/dataCollectionRuleAssociations/dca1
 * ```
 * 
 */
@ResourceType(type="azure:monitoring/dataCollectionRuleAssociation:DataCollectionRuleAssociation")
public class DataCollectionRuleAssociation extends com.pulumi.resources.CustomResource {
    /**
     * The ID of the Data Collection Endpoint which will be associated to the target resource.
     * 
     */
    @Export(name="dataCollectionEndpointId", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> dataCollectionEndpointId;

    /**
     * @return The ID of the Data Collection Endpoint which will be associated to the target resource.
     * 
     */
    public Output<Optional<String>> dataCollectionEndpointId() {
        return Codegen.optional(this.dataCollectionEndpointId);
    }
    /**
     * The ID of the Data Collection Rule which will be associated to the target resource.
     * 
     * &gt; **NOTE** Exactly one of `data_collection_endpoint_id` and `data_collection_rule_id` blocks must be specified.
     * 
     */
    @Export(name="dataCollectionRuleId", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> dataCollectionRuleId;

    /**
     * @return The ID of the Data Collection Rule which will be associated to the target resource.
     * 
     * &gt; **NOTE** Exactly one of `data_collection_endpoint_id` and `data_collection_rule_id` blocks must be specified.
     * 
     */
    public Output<Optional<String>> dataCollectionRuleId() {
        return Codegen.optional(this.dataCollectionRuleId);
    }
    /**
     * The description of the Data Collection Rule Association.
     * 
     */
    @Export(name="description", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> description;

    /**
     * @return The description of the Data Collection Rule Association.
     * 
     */
    public Output<Optional<String>> description() {
        return Codegen.optional(this.description);
    }
    /**
     * The name which should be used for this Data Collection Rule Association. Changing this forces a new Data Collection Rule Association to be created. Defaults to `configurationAccessEndpoint`.
     * 
     * &gt; **NOTE** `name` is required when `data_collection_rule_id` is specified. And when `data_collection_endpoint_id` is specified, the `name` is populated with `configurationAccessEndpoint`.
     * 
     */
    @Export(name="name", refs={String.class}, tree="[0]")
    private Output<String> name;

    /**
     * @return The name which should be used for this Data Collection Rule Association. Changing this forces a new Data Collection Rule Association to be created. Defaults to `configurationAccessEndpoint`.
     * 
     * &gt; **NOTE** `name` is required when `data_collection_rule_id` is specified. And when `data_collection_endpoint_id` is specified, the `name` is populated with `configurationAccessEndpoint`.
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    /**
     * The ID of the Azure Resource which to associate to a Data Collection Rule or a Data Collection Endpoint. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="targetResourceId", refs={String.class}, tree="[0]")
    private Output<String> targetResourceId;

    /**
     * @return The ID of the Azure Resource which to associate to a Data Collection Rule or a Data Collection Endpoint. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> targetResourceId() {
        return this.targetResourceId;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public DataCollectionRuleAssociation(String name) {
        this(name, DataCollectionRuleAssociationArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public DataCollectionRuleAssociation(String name, DataCollectionRuleAssociationArgs 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 DataCollectionRuleAssociation(String name, DataCollectionRuleAssociationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:monitoring/dataCollectionRuleAssociation:DataCollectionRuleAssociation", name, args == null ? DataCollectionRuleAssociationArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private DataCollectionRuleAssociation(String name, Output<String> id, @Nullable DataCollectionRuleAssociationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:monitoring/dataCollectionRuleAssociation:DataCollectionRuleAssociation", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) {
        var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
            .version(Utilities.getVersion())
            .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 state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static DataCollectionRuleAssociation get(String name, Output<String> id, @Nullable DataCollectionRuleAssociationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new DataCollectionRuleAssociation(name, id, state, options);
    }
}
