// *** 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.gcp.dns;

import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import com.pulumi.gcp.Utilities;
import com.pulumi.gcp.dns.ResponsePolicyRuleArgs;
import com.pulumi.gcp.dns.inputs.ResponsePolicyRuleState;
import com.pulumi.gcp.dns.outputs.ResponsePolicyRuleLocalData;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * A Response Policy Rule is a selector that applies its behavior to queries that match the selector.
 * Selectors are DNS names, which may be wildcards or exact matches.
 * Each DNS query subject to a Response Policy matches at most one ResponsePolicyRule,
 * as identified by the dns_name field with the longest matching suffix.
 * 
 * ## Example Usage
 * ### Dns Response Policy Rule Basic
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.dns.ResponsePolicy;
 * import com.pulumi.gcp.dns.ResponsePolicyArgs;
 * import com.pulumi.gcp.dns.inputs.ResponsePolicyNetworkArgs;
 * import com.pulumi.gcp.dns.ResponsePolicyRule;
 * import com.pulumi.gcp.dns.ResponsePolicyRuleArgs;
 * import com.pulumi.gcp.dns.inputs.ResponsePolicyRuleLocalDataArgs;
 * 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 network_1 = new Network(&#34;network-1&#34;, NetworkArgs.builder()        
 *             .autoCreateSubnetworks(false)
 *             .build());
 * 
 *         var network_2 = new Network(&#34;network-2&#34;, NetworkArgs.builder()        
 *             .autoCreateSubnetworks(false)
 *             .build());
 * 
 *         var response_policy = new ResponsePolicy(&#34;response-policy&#34;, ResponsePolicyArgs.builder()        
 *             .responsePolicyName(&#34;example-response-policy&#34;)
 *             .networks(            
 *                 ResponsePolicyNetworkArgs.builder()
 *                     .networkUrl(network_1.id())
 *                     .build(),
 *                 ResponsePolicyNetworkArgs.builder()
 *                     .networkUrl(network_2.id())
 *                     .build())
 *             .build());
 * 
 *         var example_response_policy_rule = new ResponsePolicyRule(&#34;example-response-policy-rule&#34;, ResponsePolicyRuleArgs.builder()        
 *             .responsePolicy(response_policy.responsePolicyName())
 *             .ruleName(&#34;example-rule&#34;)
 *             .dnsName(&#34;dns.example.com.&#34;)
 *             .localData(ResponsePolicyRuleLocalDataArgs.builder()
 *                 .localDatas(ResponsePolicyRuleLocalDataLocalDataArgs.builder()
 *                     .name(&#34;dns.example.com.&#34;)
 *                     .type(&#34;A&#34;)
 *                     .ttl(300)
 *                     .rrdatas(&#34;192.0.2.91&#34;)
 *                     .build())
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * ResponsePolicyRule can be imported using any of these accepted formats
 * 
 * ```sh
 *  $ pulumi import gcp:dns/responsePolicyRule:ResponsePolicyRule default projects/{{project}}/responsePolicies/{{response_policy}}/rules/{{rule_name}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:dns/responsePolicyRule:ResponsePolicyRule default {{project}}/{{response_policy}}/{{rule_name}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:dns/responsePolicyRule:ResponsePolicyRule default {{response_policy}}/{{rule_name}}
 * ```
 * 
 */
@ResourceType(type="gcp:dns/responsePolicyRule:ResponsePolicyRule")
public class ResponsePolicyRule extends com.pulumi.resources.CustomResource {
    /**
     * Answer this query with a behavior rather than DNS data. Acceptable values are &#39;behaviorUnspecified&#39;, and
     * &#39;bypassResponsePolicy&#39;
     * 
     */
    @Export(name="behavior", type=String.class, parameters={})
    private Output</* @Nullable */ String> behavior;

    /**
     * @return Answer this query with a behavior rather than DNS data. Acceptable values are &#39;behaviorUnspecified&#39;, and
     * &#39;bypassResponsePolicy&#39;
     * 
     */
    public Output<Optional<String>> behavior() {
        return Codegen.optional(this.behavior);
    }
    /**
     * The DNS name (wildcard or exact) to apply this rule to. Must be unique within the Response Policy Rule.
     * 
     */
    @Export(name="dnsName", type=String.class, parameters={})
    private Output<String> dnsName;

    /**
     * @return The DNS name (wildcard or exact) to apply this rule to. Must be unique within the Response Policy Rule.
     * 
     */
    public Output<String> dnsName() {
        return this.dnsName;
    }
    /**
     * Answer this query directly with DNS data. These ResourceRecordSets override any other DNS behavior for the matched name;
     * in particular they override private zones, the public internet, and GCP internal DNS. No SOA nor NS types are allowed.
     * Structure is documented below.
     * 
     */
    @Export(name="localData", type=ResponsePolicyRuleLocalData.class, parameters={})
    private Output</* @Nullable */ ResponsePolicyRuleLocalData> localData;

    /**
     * @return Answer this query directly with DNS data. These ResourceRecordSets override any other DNS behavior for the matched name;
     * in particular they override private zones, the public internet, and GCP internal DNS. No SOA nor NS types are allowed.
     * Structure is documented below.
     * 
     */
    public Output<Optional<ResponsePolicyRuleLocalData>> localData() {
        return Codegen.optional(this.localData);
    }
    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     * 
     */
    @Export(name="project", type=String.class, parameters={})
    private Output<String> project;

    /**
     * @return The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     * 
     */
    public Output<String> project() {
        return this.project;
    }
    /**
     * Identifies the response policy addressed by this request.
     * 
     * ***
     * 
     */
    @Export(name="responsePolicy", type=String.class, parameters={})
    private Output<String> responsePolicy;

    /**
     * @return Identifies the response policy addressed by this request.
     * 
     * ***
     * 
     */
    public Output<String> responsePolicy() {
        return this.responsePolicy;
    }
    /**
     * An identifier for this rule. Must be unique with the ResponsePolicy.
     * 
     */
    @Export(name="ruleName", type=String.class, parameters={})
    private Output<String> ruleName;

    /**
     * @return An identifier for this rule. Must be unique with the ResponsePolicy.
     * 
     */
    public Output<String> ruleName() {
        return this.ruleName;
    }

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

    private ResponsePolicyRule(String name, Output<String> id, @Nullable ResponsePolicyRuleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gcp:dns/responsePolicyRule:ResponsePolicyRule", 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 ResponsePolicyRule get(String name, Output<String> id, @Nullable ResponsePolicyRuleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new ResponsePolicyRule(name, id, state, options);
    }
}
