@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
158 lines • 8.15 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.CachesIscsiVolume = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an AWS Storage Gateway cached iSCSI volume.
*
* > **NOTE:** The gateway must have cache added (e.g., via the `aws.storagegateway.Cache` resource) before creating volumes otherwise the Storage Gateway API will return an error.
*
* > **NOTE:** The gateway must have an upload buffer added (e.g., via the `aws.storagegateway.UploadBuffer` resource) before the volume is operational to clients, however the Storage Gateway API will allow volume creation without error in that case and return volume status as `UPLOAD BUFFER NOT CONFIGURED`.
*
* ## Example Usage
*
* > **NOTE:** These examples are referencing the `aws.storagegateway.Cache` resource `gatewayArn` attribute to ensure this provider properly adds cache before creating the volume. If you are not using this method, you may need to declare an expicit dependency (e.g. via `dependsOn = [aws_storagegateway_cache.example]`) to ensure proper ordering.
*
* ### Create Empty Cached iSCSI Volume
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.storagegateway.CachesIscsiVolume("example", {
* gatewayArn: exampleAwsStoragegatewayCache.gatewayArn,
* networkInterfaceId: exampleAwsInstance.privateIp,
* targetName: "example",
* volumeSizeInBytes: 5368709120,
* });
* ```
*
* ### Create Cached iSCSI Volume From Snapshot
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.storagegateway.CachesIscsiVolume("example", {
* gatewayArn: exampleAwsStoragegatewayCache.gatewayArn,
* networkInterfaceId: exampleAwsInstance.privateIp,
* snapshotId: exampleAwsEbsSnapshot.id,
* targetName: "example",
* volumeSizeInBytes: exampleAwsEbsSnapshot.volumeSize * 1024 * 1024 * 1024,
* });
* ```
*
* ### Create Cached iSCSI Volume From Source Volume
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.storagegateway.CachesIscsiVolume("example", {
* gatewayArn: exampleAwsStoragegatewayCache.gatewayArn,
* networkInterfaceId: exampleAwsInstance.privateIp,
* sourceVolumeArn: existing.arn,
* targetName: "example",
* volumeSizeInBytes: existing.volumeSizeInBytes,
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_storagegateway_cached_iscsi_volume` using the volume Amazon Resource Name (ARN). For example:
*
* ```sh
* $ pulumi import aws:storagegateway/cachesIscsiVolume:CachesIscsiVolume example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/volume/vol-12345678
* ```
*/
class CachesIscsiVolume extends pulumi.CustomResource {
/**
* Get an existing CachesIscsiVolume 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 Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new CachesIscsiVolume(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of CachesIscsiVolume. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === CachesIscsiVolume.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["chapEnabled"] = state ? state.chapEnabled : undefined;
resourceInputs["gatewayArn"] = state ? state.gatewayArn : undefined;
resourceInputs["kmsEncrypted"] = state ? state.kmsEncrypted : undefined;
resourceInputs["kmsKey"] = state ? state.kmsKey : undefined;
resourceInputs["lunNumber"] = state ? state.lunNumber : undefined;
resourceInputs["networkInterfaceId"] = state ? state.networkInterfaceId : undefined;
resourceInputs["networkInterfacePort"] = state ? state.networkInterfacePort : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["snapshotId"] = state ? state.snapshotId : undefined;
resourceInputs["sourceVolumeArn"] = state ? state.sourceVolumeArn : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["targetArn"] = state ? state.targetArn : undefined;
resourceInputs["targetName"] = state ? state.targetName : undefined;
resourceInputs["volumeArn"] = state ? state.volumeArn : undefined;
resourceInputs["volumeId"] = state ? state.volumeId : undefined;
resourceInputs["volumeSizeInBytes"] = state ? state.volumeSizeInBytes : undefined;
}
else {
const args = argsOrState;
if ((!args || args.gatewayArn === undefined) && !opts.urn) {
throw new Error("Missing required property 'gatewayArn'");
}
if ((!args || args.networkInterfaceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'networkInterfaceId'");
}
if ((!args || args.targetName === undefined) && !opts.urn) {
throw new Error("Missing required property 'targetName'");
}
if ((!args || args.volumeSizeInBytes === undefined) && !opts.urn) {
throw new Error("Missing required property 'volumeSizeInBytes'");
}
resourceInputs["gatewayArn"] = args ? args.gatewayArn : undefined;
resourceInputs["kmsEncrypted"] = args ? args.kmsEncrypted : undefined;
resourceInputs["kmsKey"] = args ? args.kmsKey : undefined;
resourceInputs["networkInterfaceId"] = args ? args.networkInterfaceId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["snapshotId"] = args ? args.snapshotId : undefined;
resourceInputs["sourceVolumeArn"] = args ? args.sourceVolumeArn : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["targetName"] = args ? args.targetName : undefined;
resourceInputs["volumeSizeInBytes"] = args ? args.volumeSizeInBytes : undefined;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["chapEnabled"] = undefined /*out*/;
resourceInputs["lunNumber"] = undefined /*out*/;
resourceInputs["networkInterfacePort"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["targetArn"] = undefined /*out*/;
resourceInputs["volumeArn"] = undefined /*out*/;
resourceInputs["volumeId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CachesIscsiVolume.__pulumiType, name, resourceInputs, opts);
}
}
exports.CachesIscsiVolume = CachesIscsiVolume;
/** @internal */
CachesIscsiVolume.__pulumiType = 'aws:storagegateway/cachesIscsiVolume:CachesIscsiVolume';
//# sourceMappingURL=cachesIscsiVolume.js.map