com.pulumi.azure.cosmosdb.MongoDatabase Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.
// *** 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.cosmosdb;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.cosmosdb.MongoDatabaseArgs;
import com.pulumi.azure.cosmosdb.inputs.MongoDatabaseState;
import com.pulumi.azure.cosmosdb.outputs.MongoDatabaseAutoscaleSettings;
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.Integer;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages a Mongo Database within a Cosmos DB Account.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.cosmosdb.CosmosdbFunctions;
* import com.pulumi.azure.cosmosdb.inputs.GetAccountArgs;
* import com.pulumi.azure.cosmosdb.MongoDatabase;
* import com.pulumi.azure.cosmosdb.MongoDatabaseArgs;
* 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) {
* final var example = CosmosdbFunctions.getAccount(GetAccountArgs.builder()
* .name("tfex-cosmosdb-account")
* .resourceGroupName("tfex-cosmosdb-account-rg")
* .build());
*
* var exampleMongoDatabase = new MongoDatabase("exampleMongoDatabase", MongoDatabaseArgs.builder()
* .name("tfex-cosmos-mongo-db")
* .resourceGroupName(example.applyValue(getAccountResult -> getAccountResult.resourceGroupName()))
* .accountName(example.applyValue(getAccountResult -> getAccountResult.name()))
* .throughput(400)
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Cosmos Mongo Database can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:cosmosdb/mongoDatabase:MongoDatabase db1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/account1/mongodbDatabases/db1
* ```
*
*/
@ResourceType(type="azure:cosmosdb/mongoDatabase:MongoDatabase")
public class MongoDatabase extends com.pulumi.resources.CustomResource {
/**
* The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
*
*/
@Export(name="accountName", refs={String.class}, tree="[0]")
private Output accountName;
/**
* @return The name of the Cosmos DB Mongo Database to create the table within. Changing this forces a new resource to be created.
*
*/
public Output accountName() {
return this.accountName;
}
/**
* An `autoscale_settings` block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.
*
* > **Note:** Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.
*
*/
@Export(name="autoscaleSettings", refs={MongoDatabaseAutoscaleSettings.class}, tree="[0]")
private Output* @Nullable */ MongoDatabaseAutoscaleSettings> autoscaleSettings;
/**
* @return An `autoscale_settings` block as defined below. This must be set upon database creation otherwise it cannot be updated without a manual destroy-apply.
*
* > **Note:** Switching between autoscale and manual throughput is not supported via this provider and must be completed via the Azure Portal and refreshed.
*
*/
public Output> autoscaleSettings() {
return Codegen.optional(this.autoscaleSettings);
}
/**
* Specifies the name of the Cosmos DB Mongo Database. Changing this forces a new resource to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return Specifies the name of the Cosmos DB Mongo Database. Changing this forces a new resource to be created.
*
*/
public Output name() {
return this.name;
}
/**
* The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
*
*/
@Export(name="resourceGroupName", refs={String.class}, tree="[0]")
private Output resourceGroupName;
/**
* @return The name of the resource group in which the Cosmos DB Mongo Database is created. Changing this forces a new resource to be created.
*
*/
public Output resourceGroupName() {
return this.resourceGroupName;
}
/**
* The throughput of the MongoDB collection (RU/s). Must be set in increments of `100`. The minimum value is `400`. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
*
* > **Note:** throughput has a maximum value of `1000000` unless a higher limit is requested via Azure Support.
*
*/
@Export(name="throughput", refs={Integer.class}, tree="[0]")
private Output throughput;
/**
* @return The throughput of the MongoDB collection (RU/s). Must be set in increments of `100`. The minimum value is `400`. This must be set upon database creation otherwise it cannot be updated without a manual resource destroy-apply.
*
* > **Note:** throughput has a maximum value of `1000000` unless a higher limit is requested via Azure Support.
*
*/
public Output throughput() {
return this.throughput;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public MongoDatabase(java.lang.String name) {
this(name, MongoDatabaseArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public MongoDatabase(java.lang.String name, MongoDatabaseArgs 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 MongoDatabase(java.lang.String name, MongoDatabaseArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:cosmosdb/mongoDatabase:MongoDatabase", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private MongoDatabase(java.lang.String name, Output id, @Nullable MongoDatabaseState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:cosmosdb/mongoDatabase:MongoDatabase", name, state, makeResourceOptions(options, id), false);
}
private static MongoDatabaseArgs makeArgs(MongoDatabaseArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? MongoDatabaseArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output 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 MongoDatabase get(java.lang.String name, Output id, @Nullable MongoDatabaseState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new MongoDatabase(name, id, state, options);
}
}