sdk/java/src/main/java/com/pulumi/ovh/CloudProject/Database.java
<filename>sdk/java/src/main/java/com/pulumi/ovh/CloudProject/Database.java// *** 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.ovh.CloudProject;

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.ovh.CloudProject.DatabaseArgs;
import com.pulumi.ovh.CloudProject.inputs.DatabaseState;
import com.pulumi.ovh.CloudProject.outputs.DatabaseEndpoint;
import com.pulumi.ovh.CloudProject.outputs.DatabaseNode;
import com.pulumi.ovh.Utilities;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * ## Example Usage
 * 
 * Minimum settings for each engine (region choice is up to the user):
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.ovh.CloudProject.Database;
 * import com.pulumi.ovh.CloudProject.DatabaseArgs;
 * import com.pulumi.ovh.CloudProject.inputs.DatabaseNodeArgs;
 * 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 cassandradb = new Database(&#34;cassandradb&#34;, DatabaseArgs.builder()        
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .description(&#34;my-first-cassandra&#34;)
 *             .engine(&#34;cassandra&#34;)
 *             .version(&#34;4.0&#34;)
 *             .plan(&#34;essential&#34;)
 *             .nodes(            
 *                 DatabaseNodeArgs.builder()
 *                     .region(&#34;BHS&#34;)
 *                     .build(),
 *                 DatabaseNodeArgs.builder()
 *                     .region(&#34;BHS&#34;)
 *                     .build(),
 *                 DatabaseNodeArgs.builder()
 *                     .region(&#34;BHS&#34;)
 *                     .build())
 *             .flavor(&#34;db1-4&#34;)
 *             .build());
 * 
 *         var kafkadb = new Database(&#34;kafkadb&#34;, DatabaseArgs.builder()        
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .description(&#34;my-first-kafka&#34;)
 *             .engine(&#34;kafka&#34;)
 *             .version(&#34;3.1&#34;)
 *             .plan(&#34;business&#34;)
 *             .kafkaRestApi(true)
 *             .nodes(            
 *                 DatabaseNodeArgs.builder()
 *                     .region(&#34;DE&#34;)
 *                     .build(),
 *                 DatabaseNodeArgs.builder()
 *                     .region(&#34;DE&#34;)
 *                     .build(),
 *                 DatabaseNodeArgs.builder()
 *                     .region(&#34;DE&#34;)
 *                     .build())
 *             .flavor(&#34;db1-4&#34;)
 *             .build());
 * 
 *         var m3db = new Database(&#34;m3db&#34;, DatabaseArgs.builder()        
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .description(&#34;my-first-m3db&#34;)
 *             .engine(&#34;m3db&#34;)
 *             .version(&#34;1.2&#34;)
 *             .plan(&#34;essential&#34;)
 *             .nodes(DatabaseNodeArgs.builder()
 *                 .region(&#34;BHS&#34;)
 *                 .build())
 *             .flavor(&#34;db1-7&#34;)
 *             .build());
 * 
 *         var mongodb = new Database(&#34;mongodb&#34;, DatabaseArgs.builder()        
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .description(&#34;my-first-mongodb&#34;)
 *             .engine(&#34;mongodb&#34;)
 *             .version(&#34;5.0&#34;)
 *             .plan(&#34;essential&#34;)
 *             .nodes(DatabaseNodeArgs.builder()
 *                 .region(&#34;GRA&#34;)
 *                 .build())
 *             .flavor(&#34;db1-2&#34;)
 *             .build());
 * 
 *         var mysqldb = new Database(&#34;mysqldb&#34;, DatabaseArgs.builder()        
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .description(&#34;my-first-mysql&#34;)
 *             .engine(&#34;mysql&#34;)
 *             .version(&#34;8&#34;)
 *             .plan(&#34;essential&#34;)
 *             .nodes(DatabaseNodeArgs.builder()
 *                 .region(&#34;SBG&#34;)
 *                 .build())
 *             .flavor(&#34;db1-4&#34;)
 *             .advancedConfiguration(Map.ofEntries(
 *                 Map.entry(&#34;mysql.sql_mode&#34;, &#34;ANSI,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES&#34;),
 *                 Map.entry(&#34;mysql.sql_require_primary_key&#34;, &#34;true&#34;)
 *             ))
 *             .build());
 * 
 *         var opensearchdb = new Database(&#34;opensearchdb&#34;, DatabaseArgs.builder()        
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .description(&#34;my-first-opensearch&#34;)
 *             .engine(&#34;opensearch&#34;)
 *             .version(&#34;1&#34;)
 *             .plan(&#34;essential&#34;)
 *             .opensearchAclsEnabled(true)
 *             .nodes(DatabaseNodeArgs.builder()
 *                 .region(&#34;UK&#34;)
 *                 .build())
 *             .flavor(&#34;db1-4&#34;)
 *             .build());
 * 
 *         var pgsqldb = new Database(&#34;pgsqldb&#34;, DatabaseArgs.builder()        
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .description(&#34;my-first-postgresql&#34;)
 *             .engine(&#34;postgresql&#34;)
 *             .version(&#34;14&#34;)
 *             .plan(&#34;essential&#34;)
 *             .nodes(DatabaseNodeArgs.builder()
 *                 .region(&#34;WAW&#34;)
 *                 .build())
 *             .flavor(&#34;db1-4&#34;)
 *             .build());
 * 
 *         var redisdb = new Database(&#34;redisdb&#34;, DatabaseArgs.builder()        
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .description(&#34;my-first-redis&#34;)
 *             .engine(&#34;redis&#34;)
 *             .version(&#34;6.2&#34;)
 *             .plan(&#34;essential&#34;)
 *             .nodes(DatabaseNodeArgs.builder()
 *                 .region(&#34;BHS&#34;)
 *                 .build())
 *             .flavor(&#34;db1-4&#34;)
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * To deploy a business PostgreSQL service with two nodes on public network:
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.ovh.CloudProject.Database;
 * import com.pulumi.ovh.CloudProject.DatabaseArgs;
 * import com.pulumi.ovh.CloudProject.inputs.DatabaseNodeArgs;
 * 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 postgresql = new Database(&#34;postgresql&#34;, DatabaseArgs.builder()        
 *             .description(&#34;my-first-postgresql&#34;)
 *             .engine(&#34;postgresql&#34;)
 *             .flavor(&#34;db1-15&#34;)
 *             .nodes(            
 *                 DatabaseNodeArgs.builder()
 *                     .region(&#34;GRA&#34;)
 *                     .build(),
 *                 DatabaseNodeArgs.builder()
 *                     .region(&#34;GRA&#34;)
 *                     .build())
 *             .plan(&#34;business&#34;)
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .version(&#34;14&#34;)
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * To deploy an enterprise MongoDB service with three nodes on private network:
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.ovh.CloudProject.Database;
 * import com.pulumi.ovh.CloudProject.DatabaseArgs;
 * import com.pulumi.ovh.CloudProject.inputs.DatabaseNodeArgs;
 * 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 mongodb = new Database(&#34;mongodb&#34;, DatabaseArgs.builder()        
 *             .description(&#34;my-first-mongodb&#34;)
 *             .engine(&#34;mongodb&#34;)
 *             .flavor(&#34;db1-30&#34;)
 *             .nodes(            
 *                 DatabaseNodeArgs.builder()
 *                     .networkId(&#34;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&#34;)
 *                     .region(&#34;SBG&#34;)
 *                     .subnetId(&#34;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&#34;)
 *                     .build(),
 *                 DatabaseNodeArgs.builder()
 *                     .networkId(&#34;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&#34;)
 *                     .region(&#34;SBG&#34;)
 *                     .subnetId(&#34;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&#34;)
 *                     .build(),
 *                 DatabaseNodeArgs.builder()
 *                     .networkId(&#34;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&#34;)
 *                     .region(&#34;SBG&#34;)
 *                     .subnetId(&#34;XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&#34;)
 *                     .build())
 *             .plan(&#34;enterprise&#34;)
 *             .serviceName(&#34;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#34;)
 *             .version(&#34;5.0&#34;)
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * OVHcloud Managed database clusters can be imported using the `service_name`, `engine`, `id` of the cluster, separated by &#34;/&#34; E.g., bash
 * 
 * ```sh
 *  $ pulumi import ovh:CloudProject/database:Database my_database_cluster service_name/engine/id
 * ```
 * 
 */
@ResourceType(type="ovh:CloudProject/database:Database")
public class Database extends com.pulumi.resources.CustomResource {
    /**
     * Advanced configuration key / value.
     * 
     */
    @Export(name="advancedConfiguration", refs={Map.class,String.class}, tree="[0,1,1]")
    private Output<Map<String,String>> advancedConfiguration;

    /**
     * @return Advanced configuration key / value.
     * 
     */
    public Output<Map<String,String>> advancedConfiguration() {
        return this.advancedConfiguration;
    }
    /**
     * Time on which backups start every day.
     * 
     */
    @Export(name="backupTime", refs={String.class}, tree="[0]")
    private Output<String> backupTime;

    /**
     * @return Time on which backups start every day.
     * 
     */
    public Output<String> backupTime() {
        return this.backupTime;
    }
    /**
     * Date of the creation of the cluster.
     * 
     */
    @Export(name="createdAt", refs={String.class}, tree="[0]")
    private Output<String> createdAt;

    /**
     * @return Date of the creation of the cluster.
     * 
     */
    public Output<String> createdAt() {
        return this.createdAt;
    }
    /**
     * Small description of the database service.
     * 
     */
    @Export(name="description", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> description;

    /**
     * @return Small description of the database service.
     * 
     */
    public Output<Optional<String>> description() {
        return Codegen.optional(this.description);
    }
    /**
     * The disk size (in GB) of the database service.
     * 
     */
    @Export(name="diskSize", refs={Integer.class}, tree="[0]")
    private Output<Integer> diskSize;

    /**
     * @return The disk size (in GB) of the database service.
     * 
     */
    public Output<Integer> diskSize() {
        return this.diskSize;
    }
    /**
     * Defines the disk type of the database service.
     * 
     */
    @Export(name="diskType", refs={String.class}, tree="[0]")
    private Output<String> diskType;

    /**
     * @return Defines the disk type of the database service.
     * 
     */
    public Output<String> diskType() {
        return this.diskType;
    }
    /**
     * List of all endpoints objects of the service.
     * 
     */
    @Export(name="endpoints", refs={List.class,DatabaseEndpoint.class}, tree="[0,1]")
    private Output<List<DatabaseEndpoint>> endpoints;

    /**
     * @return List of all endpoints objects of the service.
     * 
     */
    public Output<List<DatabaseEndpoint>> endpoints() {
        return this.endpoints;
    }
    /**
     * The database engine you want to deploy. To get a full list of available engine visit.
     * [public documentation](https://docs.ovh.com/gb/en/publiccloud/databases).
     * 
     */
    @Export(name="engine", refs={String.class}, tree="[0]")
    private Output<String> engine;

    /**
     * @return The database engine you want to deploy. To get a full list of available engine visit.
     * [public documentation](https://docs.ovh.com/gb/en/publiccloud/databases).
     * 
     */
    public Output<String> engine() {
        return this.engine;
    }
    /**
     * A valid OVHcloud public cloud database flavor name in which the nodes will be started.
     * Ex: &#34;db1-7&#34;. Changing this value upgrade the nodes with the new flavor.
     * You can find the list of flavor names: https://www.ovhcloud.com/fr/public-cloud/prices/
     * 
     */
    @Export(name="flavor", refs={String.class}, tree="[0]")
    private Output<String> flavor;

    /**
     * @return A valid OVHcloud public cloud database flavor name in which the nodes will be started.
     * Ex: &#34;db1-7&#34;. Changing this value upgrade the nodes with the new flavor.
     * You can find the list of flavor names: https://www.ovhcloud.com/fr/public-cloud/prices/
     * 
     */
    public Output<String> flavor() {
        return this.flavor;
    }
    /**
     * Defines whether the REST API is enabled on a kafka cluster
     * 
     */
    @Export(name="kafkaRestApi", refs={Boolean.class}, tree="[0]")
    private Output</* @Nullable */ Boolean> kafkaRestApi;

    /**
     * @return Defines whether the REST API is enabled on a kafka cluster
     * 
     */
    public Output<Optional<Boolean>> kafkaRestApi() {
        return Codegen.optional(this.kafkaRestApi);
    }
    /**
     * Time on which maintenances can start every day.
     * 
     */
    @Export(name="maintenanceTime", refs={String.class}, tree="[0]")
    private Output<String> maintenanceTime;

    /**
     * @return Time on which maintenances can start every day.
     * 
     */
    public Output<String> maintenanceTime() {
        return this.maintenanceTime;
    }
    /**
     * Type of network of the cluster.
     * 
     */
    @Export(name="networkType", refs={String.class}, tree="[0]")
    private Output<String> networkType;

    /**
     * @return Type of network of the cluster.
     * 
     */
    public Output<String> networkType() {
        return this.networkType;
    }
    /**
     * List of nodes object.
     * Multi region cluster are not yet available, all node should be identical.
     * 
     */
    @Export(name="nodes", refs={List.class,DatabaseNode.class}, tree="[0,1]")
    private Output<List<DatabaseNode>> nodes;

    /**
     * @return List of nodes object.
     * Multi region cluster are not yet available, all node should be identical.
     * 
     */
    public Output<List<DatabaseNode>> nodes() {
        return this.nodes;
    }
    /**
     * Defines whether the ACLs are enabled on an OpenSearch cluster
     * 
     */
    @Export(name="opensearchAclsEnabled", refs={Boolean.class}, tree="[0]")
    private Output</* @Nullable */ Boolean> opensearchAclsEnabled;

    /**
     * @return Defines whether the ACLs are enabled on an OpenSearch cluster
     * 
     */
    public Output<Optional<Boolean>> opensearchAclsEnabled() {
        return Codegen.optional(this.opensearchAclsEnabled);
    }
    /**
     * Plan of the cluster.
     * Enum: &#34;essential&#34;, &#34;business&#34;, &#34;enterprise&#34;.
     * 
     */
    @Export(name="plan", refs={String.class}, tree="[0]")
    private Output<String> plan;

    /**
     * @return Plan of the cluster.
     * Enum: &#34;essential&#34;, &#34;business&#34;, &#34;enterprise&#34;.
     * 
     */
    public Output<String> plan() {
        return this.plan;
    }
    /**
     * The id of the public cloud project. If omitted,
     * the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
     * 
     */
    @Export(name="serviceName", refs={String.class}, tree="[0]")
    private Output<String> serviceName;

    /**
     * @return The id of the public cloud project. If omitted,
     * the `OVH_CLOUD_PROJECT_SERVICE` environment variable is used.
     * 
     */
    public Output<String> serviceName() {
        return this.serviceName;
    }
    /**
     * Current status of the cluster.
     * 
     */
    @Export(name="status", refs={String.class}, tree="[0]")
    private Output<String> status;

    /**
     * @return Current status of the cluster.
     * 
     */
    public Output<String> status() {
        return this.status;
    }
    /**
     * The version of the engine in which the service should be deployed
     * 
     */
    @Export(name="version", refs={String.class}, tree="[0]")
    private Output<String> version;

    /**
     * @return The version of the engine in which the service should be deployed
     * 
     */
    public Output<String> version() {
        return this.version;
    }

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

    private Database(String name, Output<String> id, @Nullable DatabaseState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("ovh:CloudProject/database:Database", 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 Database get(String name, Output<String> id, @Nullable DatabaseState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new Database(name, id, state, options);
    }
}
