com.pulumi.postgresql.Extension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of postgresql Show documentation
Show all versions of postgresql Show documentation
A Pulumi package for creating and managing postgresql cloud resources.
// *** 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.postgresql;
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.postgresql.ExtensionArgs;
import com.pulumi.postgresql.Utilities;
import com.pulumi.postgresql.inputs.ExtensionState;
import java.lang.Boolean;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* The ``postgresql.Extension`` resource creates and manages an extension on a PostgreSQL
* server.
*
* ## Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.postgresql.Extension;
* import com.pulumi.postgresql.ExtensionArgs;
* 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 myExtension = new Extension("myExtension", ExtensionArgs.builder()
* .name("pg_trgm")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* PostgreSQL Extensions can be imported using the database name and the extension's resource name, e.g.
*
* ```sh
* $ pulumi import postgresql:index/extension:Extension uuid_ossp example-database.uuid-ossp`
* ```
*
*/
@ResourceType(type="postgresql:index/extension:Extension")
public class Extension extends com.pulumi.resources.CustomResource {
/**
* When true, will also create any extensions that this extension depends on that are not already installed. (Default: false)
*
*/
@Export(name="createCascade", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> createCascade;
/**
* @return When true, will also create any extensions that this extension depends on that are not already installed. (Default: false)
*
*/
public Output> createCascade() {
return Codegen.optional(this.createCascade);
}
/**
* Which database to create the extension on. Defaults to provider database.
*
*/
@Export(name="database", refs={String.class}, tree="[0]")
private Output database;
/**
* @return Which database to create the extension on. Defaults to provider database.
*
*/
public Output database() {
return this.database;
}
/**
* When true, will also drop all the objects that depend on the extension, and in turn all objects that depend on those objects. (Default: false)
*
*/
@Export(name="dropCascade", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> dropCascade;
/**
* @return When true, will also drop all the objects that depend on the extension, and in turn all objects that depend on those objects. (Default: false)
*
*/
public Output> dropCascade() {
return Codegen.optional(this.dropCascade);
}
/**
* The name of the extension.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the extension.
*
*/
public Output name() {
return this.name;
}
/**
* Sets the schema of an extension.
*
*/
@Export(name="schema", refs={String.class}, tree="[0]")
private Output schema;
/**
* @return Sets the schema of an extension.
*
*/
public Output schema() {
return this.schema;
}
/**
* Sets the version number of the extension.
*
*/
@Export(name="version", refs={String.class}, tree="[0]")
private Output version;
/**
* @return Sets the version number of the extension.
*
*/
public Output version() {
return this.version;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Extension(java.lang.String name) {
this(name, ExtensionArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Extension(java.lang.String name, @Nullable ExtensionArgs 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 Extension(java.lang.String name, @Nullable ExtensionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("postgresql:index/extension:Extension", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Extension(java.lang.String name, Output id, @Nullable ExtensionState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("postgresql:index/extension:Extension", name, state, makeResourceOptions(options, id), false);
}
private static ExtensionArgs makeArgs(@Nullable ExtensionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ExtensionArgs.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 Extension get(java.lang.String name, Output id, @Nullable ExtensionState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Extension(name, id, state, options);
}
}