// *** 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.PolicyArgs;
import com.pulumi.gcp.dns.inputs.PolicyState;
import com.pulumi.gcp.dns.outputs.PolicyAlternativeNameServerConfig;
import com.pulumi.gcp.dns.outputs.PolicyNetwork;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * A policy is a collection of DNS rules applied to one or more Virtual
 * Private Cloud resources.
 * 
 * To get more information about Policy, see:
 * 
 * * [API documentation](https://cloud.google.com/dns/docs/reference/v1beta2/policies)
 * * How-to Guides
 *     * [Using DNS server policies](https://cloud.google.com/dns/zones/#using-dns-server-policies)
 * 
 * ## Example Usage
 * ### Dns Policy 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.Policy;
 * import com.pulumi.gcp.dns.PolicyArgs;
 * import com.pulumi.gcp.dns.inputs.PolicyAlternativeNameServerConfigArgs;
 * import com.pulumi.gcp.dns.inputs.PolicyNetworkArgs;
 * 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 example_policy = new Policy(&#34;example-policy&#34;, PolicyArgs.builder()        
 *             .enableInboundForwarding(true)
 *             .enableLogging(true)
 *             .alternativeNameServerConfig(PolicyAlternativeNameServerConfigArgs.builder()
 *                 .targetNameServers(                
 *                     PolicyAlternativeNameServerConfigTargetNameServerArgs.builder()
 *                         .ipv4Address(&#34;172.16.1.10&#34;)
 *                         .forwardingPath(&#34;private&#34;)
 *                         .build(),
 *                     PolicyAlternativeNameServerConfigTargetNameServerArgs.builder()
 *                         .ipv4Address(&#34;172.16.1.20&#34;)
 *                         .build())
 *                 .build())
 *             .networks(            
 *                 PolicyNetworkArgs.builder()
 *                     .networkUrl(network_1.id())
 *                     .build(),
 *                 PolicyNetworkArgs.builder()
 *                     .networkUrl(network_2.id())
 *                     .build())
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * Policy can be imported using any of these accepted formats
 * 
 * ```sh
 *  $ pulumi import gcp:dns/policy:Policy default projects/{{project}}/policies/{{name}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:dns/policy:Policy default {{project}}/{{name}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:dns/policy:Policy default {{name}}
 * ```
 * 
 */
@ResourceType(type="gcp:dns/policy:Policy")
public class Policy extends com.pulumi.resources.CustomResource {
    /**
     * Sets an alternative name server for the associated networks.
     * When specified, all DNS queries are forwarded to a name server that you choose.
     * Names such as .internal are not available when an alternative name server is specified.
     * Structure is documented below.
     * 
     */
    @Export(name="alternativeNameServerConfig", type=PolicyAlternativeNameServerConfig.class, parameters={})
    private Output</* @Nullable */ PolicyAlternativeNameServerConfig> alternativeNameServerConfig;

    /**
     * @return Sets an alternative name server for the associated networks.
     * When specified, all DNS queries are forwarded to a name server that you choose.
     * Names such as .internal are not available when an alternative name server is specified.
     * Structure is documented below.
     * 
     */
    public Output<Optional<PolicyAlternativeNameServerConfig>> alternativeNameServerConfig() {
        return Codegen.optional(this.alternativeNameServerConfig);
    }
    /**
     * A textual description field. Defaults to &#39;Managed by Pulumi&#39;.
     * 
     */
    @Export(name="description", type=String.class, parameters={})
    private Output</* @Nullable */ String> description;

    /**
     * @return A textual description field. Defaults to &#39;Managed by Pulumi&#39;.
     * 
     */
    public Output<Optional<String>> description() {
        return Codegen.optional(this.description);
    }
    /**
     * Allows networks bound to this policy to receive DNS queries sent
     * by VMs or applications over VPN connections. When enabled, a
     * virtual IP address will be allocated from each of the sub-networks
     * that are bound to this policy.
     * 
     */
    @Export(name="enableInboundForwarding", type=Boolean.class, parameters={})
    private Output</* @Nullable */ Boolean> enableInboundForwarding;

    /**
     * @return Allows networks bound to this policy to receive DNS queries sent
     * by VMs or applications over VPN connections. When enabled, a
     * virtual IP address will be allocated from each of the sub-networks
     * that are bound to this policy.
     * 
     */
    public Output<Optional<Boolean>> enableInboundForwarding() {
        return Codegen.optional(this.enableInboundForwarding);
    }
    /**
     * Controls whether logging is enabled for the networks bound to this policy.
     * Defaults to no logging if not set.
     * 
     */
    @Export(name="enableLogging", type=Boolean.class, parameters={})
    private Output</* @Nullable */ Boolean> enableLogging;

    /**
     * @return Controls whether logging is enabled for the networks bound to this policy.
     * Defaults to no logging if not set.
     * 
     */
    public Output<Optional<Boolean>> enableLogging() {
        return Codegen.optional(this.enableLogging);
    }
    /**
     * User assigned name for this policy.
     * 
     * ***
     * 
     */
    @Export(name="name", type=String.class, parameters={})
    private Output<String> name;

    /**
     * @return User assigned name for this policy.
     * 
     * ***
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    /**
     * List of network names specifying networks to which this policy is applied.
     * Structure is documented below.
     * 
     */
    @Export(name="networks", type=List.class, parameters={PolicyNetwork.class})
    private Output</* @Nullable */ List<PolicyNetwork>> networks;

    /**
     * @return List of network names specifying networks to which this policy is applied.
     * Structure is documented below.
     * 
     */
    public Output<Optional<List<PolicyNetwork>>> networks() {
        return Codegen.optional(this.networks);
    }
    /**
     * 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;
    }

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

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