com.pulumi.azure.hpc.CacheNfsTarget 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.hpc;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.hpc.CacheNfsTargetArgs;
import com.pulumi.azure.hpc.inputs.CacheNfsTargetState;
import com.pulumi.azure.hpc.outputs.CacheNfsTargetNamespaceJunction;
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.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages a NFS Target within a HPC Cache.
*
* > **NOTE:**: By request of the service team the provider no longer automatically registering the `Microsoft.StorageCache` Resource Provider for this resource. To register it you can run `az provider register --namespace 'Microsoft.StorageCache'`.
*
* ## 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.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.network.VirtualNetwork;
* import com.pulumi.azure.network.VirtualNetworkArgs;
* import com.pulumi.azure.network.Subnet;
* import com.pulumi.azure.network.SubnetArgs;
* import com.pulumi.azure.hpc.Cache;
* import com.pulumi.azure.hpc.CacheArgs;
* import com.pulumi.azure.network.NetworkInterface;
* import com.pulumi.azure.network.NetworkInterfaceArgs;
* import com.pulumi.azure.network.inputs.NetworkInterfaceIpConfigurationArgs;
* import com.pulumi.azure.compute.LinuxVirtualMachine;
* import com.pulumi.azure.compute.LinuxVirtualMachineArgs;
* import com.pulumi.azure.compute.inputs.LinuxVirtualMachineAdminSshKeyArgs;
* import com.pulumi.azure.compute.inputs.LinuxVirtualMachineOsDiskArgs;
* import com.pulumi.azure.compute.inputs.LinuxVirtualMachineSourceImageReferenceArgs;
* import com.pulumi.azure.hpc.CacheNfsTarget;
* import com.pulumi.azure.hpc.CacheNfsTargetArgs;
* import com.pulumi.azure.hpc.inputs.CacheNfsTargetNamespaceJunctionArgs;
* 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
*
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("examplevn")
* .addressSpaces("10.0.0.0/16")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
*
* var exampleHpc = new Subnet("exampleHpc", SubnetArgs.builder()
* .name("examplesubnethpc")
* .resourceGroupName(example.name())
* .virtualNetworkName(exampleVirtualNetwork.name())
* .addressPrefixes("10.0.1.0/24")
* .build());
*
* var exampleCache = new Cache("exampleCache", CacheArgs.builder()
* .name("examplehpccache")
* .resourceGroupName(example.name())
* .location(example.location())
* .cacheSizeInGb(3072)
* .subnetId(exampleHpc.id())
* .skuName("Standard_2G")
* .build());
*
* var exampleVm = new Subnet("exampleVm", SubnetArgs.builder()
* .name("examplesubnetvm")
* .resourceGroupName(example.name())
* .virtualNetworkName(exampleVirtualNetwork.name())
* .addressPrefixes("10.0.2.0/24")
* .build());
*
* var exampleNetworkInterface = new NetworkInterface("exampleNetworkInterface", NetworkInterfaceArgs.builder()
* .name("examplenic")
* .location(example.location())
* .resourceGroupName(example.name())
* .ipConfigurations(NetworkInterfaceIpConfigurationArgs.builder()
* .name("internal")
* .subnetId(exampleVm.id())
* .privateIpAddressAllocation("Dynamic")
* .build())
* .build());
*
* final var customData = """
* #!/bin/bash
* sudo -i
* apt-get install -y nfs-kernel-server
* mkdir -p /export/a/1
* mkdir -p /export/a/2
* mkdir -p /export/b
* cat << EOF > /etc/exports
* /export/a *(rw,fsid=0,insecure,no_subtree_check,async)
* /export/b *(rw,fsid=0,insecure,no_subtree_check,async)
* EOF
* systemctl start nfs-server
* exportfs -arv
* """;
*
* var exampleLinuxVirtualMachine = new LinuxVirtualMachine("exampleLinuxVirtualMachine", LinuxVirtualMachineArgs.builder()
* .name("examplevm")
* .resourceGroupName(example.name())
* .location(example.location())
* .size("Standard_F2")
* .adminUsername("adminuser")
* .networkInterfaceIds(exampleNetworkInterface.id())
* .adminSshKeys(LinuxVirtualMachineAdminSshKeyArgs.builder()
* .username("adminuser")
* .publicKey(StdFunctions.file(FileArgs.builder()
* .input("~/.ssh/id_rsa.pub")
* .build()).result())
* .build())
* .osDisk(LinuxVirtualMachineOsDiskArgs.builder()
* .caching("ReadWrite")
* .storageAccountType("Standard_LRS")
* .build())
* .sourceImageReference(LinuxVirtualMachineSourceImageReferenceArgs.builder()
* .publisher("Canonical")
* .offer("0001-com-ubuntu-server-jammy")
* .sku("22_04-lts")
* .version("latest")
* .build())
* .customData(StdFunctions.base64encode(Base64encodeArgs.builder()
* .input(customData)
* .build()).result())
* .build());
*
* var exampleCacheNfsTarget = new CacheNfsTarget("exampleCacheNfsTarget", CacheNfsTargetArgs.builder()
* .name("examplehpcnfstarget")
* .resourceGroupName(example.name())
* .cacheName(exampleCache.name())
* .targetHostName(exampleLinuxVirtualMachine.privateIpAddress())
* .usageModel("READ_HEAVY_INFREQ")
* .namespaceJunctions(
* CacheNfsTargetNamespaceJunctionArgs.builder()
* .namespacePath("/nfs/a1")
* .nfsExport("/export/a")
* .targetPath("1")
* .build(),
* CacheNfsTargetNamespaceJunctionArgs.builder()
* .namespacePath("/nfs/b")
* .nfsExport("/export/b")
* .build())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* NFS Target within a HPC Cache can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:hpc/cacheNfsTarget:CacheNfsTarget example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StorageCache/caches/cache1/storageTargets/target1
* ```
*
*/
@ResourceType(type="azure:hpc/cacheNfsTarget:CacheNfsTarget")
public class CacheNfsTarget extends com.pulumi.resources.CustomResource {
/**
* The name HPC Cache, which the HPC Cache NFS Target will be added to. Changing this forces a new resource to be created.
*
*/
@Export(name="cacheName", refs={String.class}, tree="[0]")
private Output cacheName;
/**
* @return The name HPC Cache, which the HPC Cache NFS Target will be added to. Changing this forces a new resource to be created.
*
*/
public Output cacheName() {
return this.cacheName;
}
/**
* The name of the HPC Cache NFS Target. Changing this forces a new resource to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the HPC Cache NFS Target. Changing this forces a new resource to be created.
*
*/
public Output name() {
return this.name;
}
/**
* Can be specified multiple times to define multiple `namespace_junction`. Each `namespace_junction` block supports fields documented below.
*
*/
@Export(name="namespaceJunctions", refs={List.class,CacheNfsTargetNamespaceJunction.class}, tree="[0,1]")
private Output> namespaceJunctions;
/**
* @return Can be specified multiple times to define multiple `namespace_junction`. Each `namespace_junction` block supports fields documented below.
*
*/
public Output> namespaceJunctions() {
return this.namespaceJunctions;
}
/**
* The name of the Resource Group in which to create the HPC Cache NFS Target. 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 to create the HPC Cache NFS Target. Changing this forces a new resource to be created.
*
*/
public Output resourceGroupName() {
return this.resourceGroupName;
}
/**
* The IP address or fully qualified domain name (FQDN) of the HPC Cache NFS target. Changing this forces a new resource to be created.
*
*/
@Export(name="targetHostName", refs={String.class}, tree="[0]")
private Output targetHostName;
/**
* @return The IP address or fully qualified domain name (FQDN) of the HPC Cache NFS target. Changing this forces a new resource to be created.
*
*/
public Output targetHostName() {
return this.targetHostName;
}
/**
* The type of usage of the HPC Cache NFS Target. Possible values are: `READ_HEAVY_INFREQ`, `READ_HEAVY_CHECK_180`, `READ_ONLY`, `READ_WRITE`, `WRITE_WORKLOAD_15`, `WRITE_AROUND`, `WRITE_WORKLOAD_CHECK_30`, `WRITE_WORKLOAD_CHECK_60` and `WRITE_WORKLOAD_CLOUDWS`.
*
*/
@Export(name="usageModel", refs={String.class}, tree="[0]")
private Output usageModel;
/**
* @return The type of usage of the HPC Cache NFS Target. Possible values are: `READ_HEAVY_INFREQ`, `READ_HEAVY_CHECK_180`, `READ_ONLY`, `READ_WRITE`, `WRITE_WORKLOAD_15`, `WRITE_AROUND`, `WRITE_WORKLOAD_CHECK_30`, `WRITE_WORKLOAD_CHECK_60` and `WRITE_WORKLOAD_CLOUDWS`.
*
*/
public Output usageModel() {
return this.usageModel;
}
/**
* The amount of time the cache waits before it checks the back-end storage for file updates. Possible values are between `1` and `31536000`.
*
*/
@Export(name="verificationTimerInSeconds", refs={Integer.class}, tree="[0]")
private Output* @Nullable */ Integer> verificationTimerInSeconds;
/**
* @return The amount of time the cache waits before it checks the back-end storage for file updates. Possible values are between `1` and `31536000`.
*
*/
public Output> verificationTimerInSeconds() {
return Codegen.optional(this.verificationTimerInSeconds);
}
/**
* The amount of time the cache waits after the last file change before it copies the changed file to back-end storage. Possible values are between `1` and `31536000`.
*
*/
@Export(name="writeBackTimerInSeconds", refs={Integer.class}, tree="[0]")
private Output* @Nullable */ Integer> writeBackTimerInSeconds;
/**
* @return The amount of time the cache waits after the last file change before it copies the changed file to back-end storage. Possible values are between `1` and `31536000`.
*
*/
public Output> writeBackTimerInSeconds() {
return Codegen.optional(this.writeBackTimerInSeconds);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public CacheNfsTarget(java.lang.String name) {
this(name, CacheNfsTargetArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public CacheNfsTarget(java.lang.String name, CacheNfsTargetArgs 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 CacheNfsTarget(java.lang.String name, CacheNfsTargetArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:hpc/cacheNfsTarget:CacheNfsTarget", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private CacheNfsTarget(java.lang.String name, Output id, @Nullable CacheNfsTargetState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:hpc/cacheNfsTarget:CacheNfsTarget", name, state, makeResourceOptions(options, id), false);
}
private static CacheNfsTargetArgs makeArgs(CacheNfsTargetArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? CacheNfsTargetArgs.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 CacheNfsTarget get(java.lang.String name, Output id, @Nullable CacheNfsTargetState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new CacheNfsTarget(name, id, state, options);
}
}