com.pulumi.azure.mssql.VirtualMachine 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.mssql;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.mssql.VirtualMachineArgs;
import com.pulumi.azure.mssql.inputs.VirtualMachineState;
import com.pulumi.azure.mssql.outputs.VirtualMachineAssessment;
import com.pulumi.azure.mssql.outputs.VirtualMachineAutoBackup;
import com.pulumi.azure.mssql.outputs.VirtualMachineAutoPatching;
import com.pulumi.azure.mssql.outputs.VirtualMachineKeyVaultCredential;
import com.pulumi.azure.mssql.outputs.VirtualMachineSqlInstance;
import com.pulumi.azure.mssql.outputs.VirtualMachineStorageConfiguration;
import com.pulumi.azure.mssql.outputs.VirtualMachineWsfcDomainCredential;
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.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;
/**
* Manages a Microsoft SQL Virtual Machine
*
* ## Example Usage
*
* This example provisions a brief Managed Microsoft SQL Virtual Machine.
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.compute.ComputeFunctions;
* import com.pulumi.azure.compute.inputs.GetVirtualMachineArgs;
* import com.pulumi.azure.mssql.VirtualMachine;
* import com.pulumi.azure.mssql.VirtualMachineArgs;
* import com.pulumi.azure.mssql.inputs.VirtualMachineAutoPatchingArgs;
* 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 = ComputeFunctions.getVirtualMachine(GetVirtualMachineArgs.builder()
* .name("example-vm")
* .resourceGroupName("example-resources")
* .build());
*
* var exampleVirtualMachine = new VirtualMachine("exampleVirtualMachine", VirtualMachineArgs.builder()
* .virtualMachineId(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.id()))
* .sqlLicenseType("PAYG")
* .rServicesEnabled(true)
* .sqlConnectivityPort(1433)
* .sqlConnectivityType("PRIVATE")
* .sqlConnectivityUpdatePassword("Password1234!")
* .sqlConnectivityUpdateUsername("sqllogin")
* .autoPatching(VirtualMachineAutoPatchingArgs.builder()
* .dayOfWeek("Sunday")
* .maintenanceWindowDurationInMinutes(60)
* .maintenanceWindowStartingHour(2)
* .build())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Microsoft SQL Virtual Machines can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:mssql/virtualMachine:VirtualMachine example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/example1
* ```
*
*/
@ResourceType(type="azure:mssql/virtualMachine:VirtualMachine")
public class VirtualMachine extends com.pulumi.resources.CustomResource {
/**
* An `assessment` block as defined below.
*
*/
@Export(name="assessment", refs={VirtualMachineAssessment.class}, tree="[0]")
private Output* @Nullable */ VirtualMachineAssessment> assessment;
/**
* @return An `assessment` block as defined below.
*
*/
public Output> assessment() {
return Codegen.optional(this.assessment);
}
/**
* An `auto_backup` block as defined below. This block can be added to an existing resource, but removing this block forces a new resource to be created.
*
*/
@Export(name="autoBackup", refs={VirtualMachineAutoBackup.class}, tree="[0]")
private Output* @Nullable */ VirtualMachineAutoBackup> autoBackup;
/**
* @return An `auto_backup` block as defined below. This block can be added to an existing resource, but removing this block forces a new resource to be created.
*
*/
public Output> autoBackup() {
return Codegen.optional(this.autoBackup);
}
/**
* An `auto_patching` block as defined below.
*
*/
@Export(name="autoPatching", refs={VirtualMachineAutoPatching.class}, tree="[0]")
private Output* @Nullable */ VirtualMachineAutoPatching> autoPatching;
/**
* @return An `auto_patching` block as defined below.
*
*/
public Output> autoPatching() {
return Codegen.optional(this.autoPatching);
}
/**
* An `key_vault_credential` block as defined below.
*
*/
@Export(name="keyVaultCredential", refs={VirtualMachineKeyVaultCredential.class}, tree="[0]")
private Output* @Nullable */ VirtualMachineKeyVaultCredential> keyVaultCredential;
/**
* @return An `key_vault_credential` block as defined below.
*
*/
public Output> keyVaultCredential() {
return Codegen.optional(this.keyVaultCredential);
}
/**
* Should R Services be enabled?
*
*/
@Export(name="rServicesEnabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> rServicesEnabled;
/**
* @return Should R Services be enabled?
*
*/
public Output> rServicesEnabled() {
return Codegen.optional(this.rServicesEnabled);
}
/**
* The SQL Server port. Defaults to `1433`.
*
*/
@Export(name="sqlConnectivityPort", refs={Integer.class}, tree="[0]")
private Output* @Nullable */ Integer> sqlConnectivityPort;
/**
* @return The SQL Server port. Defaults to `1433`.
*
*/
public Output> sqlConnectivityPort() {
return Codegen.optional(this.sqlConnectivityPort);
}
/**
* The connectivity type used for this SQL Server. Possible values are `LOCAL`, `PRIVATE` and `PUBLIC`. Defaults to `PRIVATE`.
*
*/
@Export(name="sqlConnectivityType", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sqlConnectivityType;
/**
* @return The connectivity type used for this SQL Server. Possible values are `LOCAL`, `PRIVATE` and `PUBLIC`. Defaults to `PRIVATE`.
*
*/
public Output> sqlConnectivityType() {
return Codegen.optional(this.sqlConnectivityType);
}
/**
* The SQL Server sysadmin login password.
*
*/
@Export(name="sqlConnectivityUpdatePassword", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sqlConnectivityUpdatePassword;
/**
* @return The SQL Server sysadmin login password.
*
*/
public Output> sqlConnectivityUpdatePassword() {
return Codegen.optional(this.sqlConnectivityUpdatePassword);
}
/**
* The SQL Server sysadmin login to create.
*
*/
@Export(name="sqlConnectivityUpdateUsername", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sqlConnectivityUpdateUsername;
/**
* @return The SQL Server sysadmin login to create.
*
*/
public Output> sqlConnectivityUpdateUsername() {
return Codegen.optional(this.sqlConnectivityUpdateUsername);
}
/**
* A `sql_instance` block as defined below.
*
*/
@Export(name="sqlInstance", refs={VirtualMachineSqlInstance.class}, tree="[0]")
private Output* @Nullable */ VirtualMachineSqlInstance> sqlInstance;
/**
* @return A `sql_instance` block as defined below.
*
*/
public Output> sqlInstance() {
return Codegen.optional(this.sqlInstance);
}
/**
* The SQL Server license type. Possible values are `AHUB` (Azure Hybrid Benefit), `DR` (Disaster Recovery), and `PAYG` (Pay-As-You-Go). Changing this forces a new resource to be created.
*
*/
@Export(name="sqlLicenseType", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sqlLicenseType;
/**
* @return The SQL Server license type. Possible values are `AHUB` (Azure Hybrid Benefit), `DR` (Disaster Recovery), and `PAYG` (Pay-As-You-Go). Changing this forces a new resource to be created.
*
*/
public Output> sqlLicenseType() {
return Codegen.optional(this.sqlLicenseType);
}
/**
* The ID of the SQL Virtual Machine Group that the SQL Virtual Machine belongs to.
*
*/
@Export(name="sqlVirtualMachineGroupId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> sqlVirtualMachineGroupId;
/**
* @return The ID of the SQL Virtual Machine Group that the SQL Virtual Machine belongs to.
*
*/
public Output> sqlVirtualMachineGroupId() {
return Codegen.optional(this.sqlVirtualMachineGroupId);
}
/**
* An `storage_configuration` block as defined below.
*
*/
@Export(name="storageConfiguration", refs={VirtualMachineStorageConfiguration.class}, tree="[0]")
private Output* @Nullable */ VirtualMachineStorageConfiguration> storageConfiguration;
/**
* @return An `storage_configuration` block as defined below.
*
*/
public Output> storageConfiguration() {
return Codegen.optional(this.storageConfiguration);
}
/**
* A mapping of tags to assign to the resource.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return A mapping of tags to assign to the resource.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* The ID of the Virtual Machine. Changing this forces a new resource to be created.
*
*/
@Export(name="virtualMachineId", refs={String.class}, tree="[0]")
private Output virtualMachineId;
/**
* @return The ID of the Virtual Machine. Changing this forces a new resource to be created.
*
*/
public Output virtualMachineId() {
return this.virtualMachineId;
}
/**
* A `wsfc_domain_credential` block as defined below
*
*/
@Export(name="wsfcDomainCredential", refs={VirtualMachineWsfcDomainCredential.class}, tree="[0]")
private Output* @Nullable */ VirtualMachineWsfcDomainCredential> wsfcDomainCredential;
/**
* @return A `wsfc_domain_credential` block as defined below
*
*/
public Output> wsfcDomainCredential() {
return Codegen.optional(this.wsfcDomainCredential);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public VirtualMachine(java.lang.String name) {
this(name, VirtualMachineArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public VirtualMachine(java.lang.String name, VirtualMachineArgs 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 VirtualMachine(java.lang.String name, VirtualMachineArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:mssql/virtualMachine:VirtualMachine", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private VirtualMachine(java.lang.String name, Output id, @Nullable VirtualMachineState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:mssql/virtualMachine:VirtualMachine", name, state, makeResourceOptions(options, id), false);
}
private static VirtualMachineArgs makeArgs(VirtualMachineArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? VirtualMachineArgs.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())
.additionalSecretOutputs(List.of(
"sqlConnectivityUpdatePassword",
"sqlConnectivityUpdateUsername"
))
.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 VirtualMachine get(java.lang.String name, Output id, @Nullable VirtualMachineState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new VirtualMachine(name, id, state, options);
}
}