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

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.alloydb.ClusterArgs;
import com.pulumi.gcp.alloydb.inputs.ClusterState;
import com.pulumi.gcp.alloydb.outputs.ClusterAutomatedBackupPolicy;
import com.pulumi.gcp.alloydb.outputs.ClusterBackupSource;
import com.pulumi.gcp.alloydb.outputs.ClusterContinuousBackupConfig;
import com.pulumi.gcp.alloydb.outputs.ClusterContinuousBackupInfo;
import com.pulumi.gcp.alloydb.outputs.ClusterEncryptionConfig;
import com.pulumi.gcp.alloydb.outputs.ClusterEncryptionInfo;
import com.pulumi.gcp.alloydb.outputs.ClusterInitialUser;
import com.pulumi.gcp.alloydb.outputs.ClusterMigrationSource;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * A managed alloydb cluster.
 * 
 * To get more information about Cluster, see:
 * 
 * * [API documentation](https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.clusters/create)
 * * How-to Guides
 *     * [AlloyDB](https://cloud.google.com/alloydb/docs/)
 * 
 * &gt; **Warning:** All arguments including the following potentially sensitive
 * values will be stored in the raw state as plain text: `initial_user.password`.
 * Read more about sensitive data in state.
 * 
 * ## Example Usage
 * ### Alloydb Cluster 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.alloydb.Cluster;
 * import com.pulumi.gcp.alloydb.ClusterArgs;
 * import com.pulumi.gcp.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * 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 defaultNetwork = new Network(&#34;defaultNetwork&#34;);
 * 
 *         var defaultCluster = new Cluster(&#34;defaultCluster&#34;, ClusterArgs.builder()        
 *             .clusterId(&#34;alloydb-cluster&#34;)
 *             .location(&#34;us-central1&#34;)
 *             .network(defaultNetwork.id())
 *             .build());
 * 
 *         final var project = OrganizationsFunctions.getProject();
 * 
 *     }
 * }
 * ```
 * ### Alloydb Cluster Full
 * ```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.alloydb.Cluster;
 * import com.pulumi.gcp.alloydb.ClusterArgs;
 * import com.pulumi.gcp.alloydb.inputs.ClusterInitialUserArgs;
 * import com.pulumi.gcp.alloydb.inputs.ClusterContinuousBackupConfigArgs;
 * import com.pulumi.gcp.alloydb.inputs.ClusterAutomatedBackupPolicyArgs;
 * import com.pulumi.gcp.alloydb.inputs.ClusterAutomatedBackupPolicyWeeklyScheduleArgs;
 * import com.pulumi.gcp.alloydb.inputs.ClusterAutomatedBackupPolicyQuantityBasedRetentionArgs;
 * import com.pulumi.gcp.organizations.OrganizationsFunctions;
 * import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
 * 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 default_ = new Network(&#34;default&#34;);
 * 
 *         var full = new Cluster(&#34;full&#34;, ClusterArgs.builder()        
 *             .clusterId(&#34;alloydb-cluster-full&#34;)
 *             .location(&#34;us-central1&#34;)
 *             .network(default_.id())
 *             .initialUser(ClusterInitialUserArgs.builder()
 *                 .user(&#34;alloydb-cluster-full&#34;)
 *                 .password(&#34;alloydb-cluster-full&#34;)
 *                 .build())
 *             .continuousBackupConfig(ClusterContinuousBackupConfigArgs.builder()
 *                 .enabled(true)
 *                 .recoveryWindowDays(14)
 *                 .build())
 *             .automatedBackupPolicy(ClusterAutomatedBackupPolicyArgs.builder()
 *                 .location(&#34;us-central1&#34;)
 *                 .backupWindow(&#34;1800s&#34;)
 *                 .enabled(true)
 *                 .weeklySchedule(ClusterAutomatedBackupPolicyWeeklyScheduleArgs.builder()
 *                     .daysOfWeeks(&#34;MONDAY&#34;)
 *                     .startTimes(ClusterAutomatedBackupPolicyWeeklyScheduleStartTimeArgs.builder()
 *                         .hours(23)
 *                         .minutes(0)
 *                         .seconds(0)
 *                         .nanos(0)
 *                         .build())
 *                     .build())
 *                 .quantityBasedRetention(ClusterAutomatedBackupPolicyQuantityBasedRetentionArgs.builder()
 *                     .count(1)
 *                     .build())
 *                 .labels(Map.of(&#34;test&#34;, &#34;alloydb-cluster-full&#34;))
 *                 .build())
 *             .labels(Map.of(&#34;test&#34;, &#34;alloydb-cluster-full&#34;))
 *             .build());
 * 
 *         final var project = OrganizationsFunctions.getProject();
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * Cluster can be imported using any of these accepted formats
 * 
 * ```sh
 *  $ pulumi import gcp:alloydb/cluster:Cluster default projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:alloydb/cluster:Cluster default {{project}}/{{location}}/{{cluster_id}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:alloydb/cluster:Cluster default {{location}}/{{cluster_id}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:alloydb/cluster:Cluster default {{cluster_id}}
 * ```
 * 
 */
@ResourceType(type="gcp:alloydb/cluster:Cluster")
public class Cluster extends com.pulumi.resources.CustomResource {
    /**
     * The automated backup policy for this cluster. AutomatedBackupPolicy is disabled by default.
     * Structure is documented below.
     * 
     */
    @Export(name="automatedBackupPolicy", type=ClusterAutomatedBackupPolicy.class, parameters={})
    private Output<ClusterAutomatedBackupPolicy> automatedBackupPolicy;

    /**
     * @return The automated backup policy for this cluster. AutomatedBackupPolicy is disabled by default.
     * Structure is documented below.
     * 
     */
    public Output<ClusterAutomatedBackupPolicy> automatedBackupPolicy() {
        return this.automatedBackupPolicy;
    }
    /**
     * Cluster created from backup.
     * Structure is documented below.
     * 
     */
    @Export(name="backupSources", type=List.class, parameters={ClusterBackupSource.class})
    private Output<List<ClusterBackupSource>> backupSources;

    /**
     * @return Cluster created from backup.
     * Structure is documented below.
     * 
     */
    public Output<List<ClusterBackupSource>> backupSources() {
        return this.backupSources;
    }
    /**
     * The ID of the alloydb cluster.
     * 
     */
    @Export(name="clusterId", type=String.class, parameters={})
    private Output<String> clusterId;

    /**
     * @return The ID of the alloydb cluster.
     * 
     */
    public Output<String> clusterId() {
        return this.clusterId;
    }
    /**
     * The continuous backup config for this cluster.
     * If no policy is provided then the default policy will be used. The default policy takes one backup a day and retains backups for 14 days.
     * Structure is documented below.
     * 
     */
    @Export(name="continuousBackupConfig", type=ClusterContinuousBackupConfig.class, parameters={})
    private Output<ClusterContinuousBackupConfig> continuousBackupConfig;

    /**
     * @return The continuous backup config for this cluster.
     * If no policy is provided then the default policy will be used. The default policy takes one backup a day and retains backups for 14 days.
     * Structure is documented below.
     * 
     */
    public Output<ClusterContinuousBackupConfig> continuousBackupConfig() {
        return this.continuousBackupConfig;
    }
    /**
     * ContinuousBackupInfo describes the continuous backup properties of a cluster.
     * Structure is documented below.
     * 
     */
    @Export(name="continuousBackupInfos", type=List.class, parameters={ClusterContinuousBackupInfo.class})
    private Output<List<ClusterContinuousBackupInfo>> continuousBackupInfos;

    /**
     * @return ContinuousBackupInfo describes the continuous backup properties of a cluster.
     * Structure is documented below.
     * 
     */
    public Output<List<ClusterContinuousBackupInfo>> continuousBackupInfos() {
        return this.continuousBackupInfos;
    }
    /**
     * The database engine major version. This is an output-only field and it&#39;s populated at the Cluster creation time. This field cannot be changed after cluster creation.
     * 
     */
    @Export(name="databaseVersion", type=String.class, parameters={})
    private Output<String> databaseVersion;

    /**
     * @return The database engine major version. This is an output-only field and it&#39;s populated at the Cluster creation time. This field cannot be changed after cluster creation.
     * 
     */
    public Output<String> databaseVersion() {
        return this.databaseVersion;
    }
    /**
     * User-settable and human-readable display name for the Cluster.
     * 
     */
    @Export(name="displayName", type=String.class, parameters={})
    private Output</* @Nullable */ String> displayName;

    /**
     * @return User-settable and human-readable display name for the Cluster.
     * 
     */
    public Output<Optional<String>> displayName() {
        return Codegen.optional(this.displayName);
    }
    /**
     * EncryptionConfig describes the encryption config of a cluster or a backup that is encrypted with a CMEK (customer-managed encryption key).
     * Structure is documented below.
     * 
     */
    @Export(name="encryptionConfig", type=ClusterEncryptionConfig.class, parameters={})
    private Output</* @Nullable */ ClusterEncryptionConfig> encryptionConfig;

    /**
     * @return EncryptionConfig describes the encryption config of a cluster or a backup that is encrypted with a CMEK (customer-managed encryption key).
     * Structure is documented below.
     * 
     */
    public Output<Optional<ClusterEncryptionConfig>> encryptionConfig() {
        return Codegen.optional(this.encryptionConfig);
    }
    /**
     * (Output)
     * Output only. The encryption information for the WALs and backups required for ContinuousBackup.
     * Structure is documented below.
     * 
     */
    @Export(name="encryptionInfos", type=List.class, parameters={ClusterEncryptionInfo.class})
    private Output<List<ClusterEncryptionInfo>> encryptionInfos;

    /**
     * @return (Output)
     * Output only. The encryption information for the WALs and backups required for ContinuousBackup.
     * Structure is documented below.
     * 
     */
    public Output<List<ClusterEncryptionInfo>> encryptionInfos() {
        return this.encryptionInfos;
    }
    /**
     * Initial user to setup during cluster creation.
     * Structure is documented below.
     * 
     */
    @Export(name="initialUser", type=ClusterInitialUser.class, parameters={})
    private Output</* @Nullable */ ClusterInitialUser> initialUser;

    /**
     * @return Initial user to setup during cluster creation.
     * Structure is documented below.
     * 
     */
    public Output<Optional<ClusterInitialUser>> initialUser() {
        return Codegen.optional(this.initialUser);
    }
    /**
     * User-defined labels for the alloydb cluster.
     * 
     */
    @Export(name="labels", type=Map.class, parameters={String.class, String.class})
    private Output</* @Nullable */ Map<String,String>> labels;

    /**
     * @return User-defined labels for the alloydb cluster.
     * 
     */
    public Output<Optional<Map<String,String>>> labels() {
        return Codegen.optional(this.labels);
    }
    /**
     * The location where the alloydb cluster should reside.
     * 
     * ***
     * 
     */
    @Export(name="location", type=String.class, parameters={})
    private Output<String> location;

    /**
     * @return The location where the alloydb cluster should reside.
     * 
     * ***
     * 
     */
    public Output<String> location() {
        return this.location;
    }
    /**
     * Cluster created via DMS migration.
     * Structure is documented below.
     * 
     */
    @Export(name="migrationSources", type=List.class, parameters={ClusterMigrationSource.class})
    private Output<List<ClusterMigrationSource>> migrationSources;

    /**
     * @return Cluster created via DMS migration.
     * Structure is documented below.
     * 
     */
    public Output<List<ClusterMigrationSource>> migrationSources() {
        return this.migrationSources;
    }
    /**
     * The name of the cluster resource.
     * 
     */
    @Export(name="name", type=String.class, parameters={})
    private Output<String> name;

    /**
     * @return The name of the cluster resource.
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    /**
     * The relative resource name of the VPC network on which the instance can be accessed. It is specified in the following form:
     * &#34;projects/{projectNumber}/global/networks/{network_id}&#34;.
     * 
     */
    @Export(name="network", type=String.class, parameters={})
    private Output<String> network;

    /**
     * @return The relative resource name of the VPC network on which the instance can be accessed. It is specified in the following form:
     * &#34;projects/{projectNumber}/global/networks/{network_id}&#34;.
     * 
     */
    public Output<String> network() {
        return this.network;
    }
    /**
     * 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;
    }
    /**
     * The system-generated UID of the resource.
     * 
     */
    @Export(name="uid", type=String.class, parameters={})
    private Output<String> uid;

    /**
     * @return The system-generated UID of the resource.
     * 
     */
    public Output<String> uid() {
        return this.uid;
    }

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

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