com.pulumi.aws.ec2.kotlin.SnapshotCreateVolumePermission.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.ec2.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [SnapshotCreateVolumePermission].
*/
@PulumiTagMarker
public class SnapshotCreateVolumePermissionResourceBuilder internal constructor() {
public var name: String? = null
public var args: SnapshotCreateVolumePermissionArgs = SnapshotCreateVolumePermissionArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend SnapshotCreateVolumePermissionArgsBuilder.() -> Unit) {
val builder = SnapshotCreateVolumePermissionArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): SnapshotCreateVolumePermission {
val builtJavaResource =
com.pulumi.aws.ec2.SnapshotCreateVolumePermission(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SnapshotCreateVolumePermission(builtJavaResource)
}
}
/**
* Adds permission to create volumes off of a given EBS Snapshot.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.ebs.Volume("example", {
* availabilityZone: "us-west-2a",
* size: 40,
* });
* const exampleSnapshot = new aws.ebs.Snapshot("example_snapshot", {volumeId: example.id});
* const examplePerm = new aws.ec2.SnapshotCreateVolumePermission("example_perm", {
* snapshotId: exampleSnapshot.id,
* accountId: "12345678",
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.ebs.Volume("example",
* availability_zone="us-west-2a",
* size=40)
* example_snapshot = aws.ebs.Snapshot("example_snapshot", volume_id=example.id)
* example_perm = aws.ec2.SnapshotCreateVolumePermission("example_perm",
* snapshot_id=example_snapshot.id,
* account_id="12345678")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Ebs.Volume("example", new()
* {
* AvailabilityZone = "us-west-2a",
* Size = 40,
* });
* var exampleSnapshot = new Aws.Ebs.Snapshot("example_snapshot", new()
* {
* VolumeId = example.Id,
* });
* var examplePerm = new Aws.Ec2.SnapshotCreateVolumePermission("example_perm", new()
* {
* SnapshotId = exampleSnapshot.Id,
* AccountId = "12345678",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ebs"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := ebs.NewVolume(ctx, "example", &ebs.VolumeArgs{
* AvailabilityZone: pulumi.String("us-west-2a"),
* Size: pulumi.Int(40),
* })
* if err != nil {
* return err
* }
* exampleSnapshot, err := ebs.NewSnapshot(ctx, "example_snapshot", &ebs.SnapshotArgs{
* VolumeId: example.ID(),
* })
* if err != nil {
* return err
* }
* _, err = ec2.NewSnapshotCreateVolumePermission(ctx, "example_perm", &ec2.SnapshotCreateVolumePermissionArgs{
* SnapshotId: exampleSnapshot.ID(),
* AccountId: pulumi.String("12345678"),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.ebs.Volume;
* import com.pulumi.aws.ebs.VolumeArgs;
* import com.pulumi.aws.ebs.Snapshot;
* import com.pulumi.aws.ebs.SnapshotArgs;
* import com.pulumi.aws.ec2.SnapshotCreateVolumePermission;
* import com.pulumi.aws.ec2.SnapshotCreateVolumePermissionArgs;
* 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 Volume("example", VolumeArgs.builder()
* .availabilityZone("us-west-2a")
* .size(40)
* .build());
* var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
* .volumeId(example.id())
* .build());
* var examplePerm = new SnapshotCreateVolumePermission("examplePerm", SnapshotCreateVolumePermissionArgs.builder()
* .snapshotId(exampleSnapshot.id())
* .accountId("12345678")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* examplePerm:
* type: aws:ec2:SnapshotCreateVolumePermission
* name: example_perm
* properties:
* snapshotId: ${exampleSnapshot.id}
* accountId: '12345678'
* example:
* type: aws:ebs:Volume
* properties:
* availabilityZone: us-west-2a
* size: 40
* exampleSnapshot:
* type: aws:ebs:Snapshot
* name: example_snapshot
* properties:
* volumeId: ${example.id}
* ```
*
*/
public class SnapshotCreateVolumePermission internal constructor(
override val javaResource: com.pulumi.aws.ec2.SnapshotCreateVolumePermission,
) : KotlinCustomResource(javaResource, SnapshotCreateVolumePermissionMapper) {
/**
* An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
*/
public val accountId: Output
get() = javaResource.accountId().applyValue({ args0 -> args0 })
/**
* A snapshot ID
*/
public val snapshotId: Output
get() = javaResource.snapshotId().applyValue({ args0 -> args0 })
}
public object SnapshotCreateVolumePermissionMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.ec2.SnapshotCreateVolumePermission::class == javaResource::class
override fun map(javaResource: Resource): SnapshotCreateVolumePermission =
SnapshotCreateVolumePermission(
javaResource as
com.pulumi.aws.ec2.SnapshotCreateVolumePermission,
)
}
/**
* @see [SnapshotCreateVolumePermission].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [SnapshotCreateVolumePermission].
*/
public suspend fun snapshotCreateVolumePermission(
name: String,
block: suspend SnapshotCreateVolumePermissionResourceBuilder.() -> Unit,
): SnapshotCreateVolumePermission {
val builder = SnapshotCreateVolumePermissionResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [SnapshotCreateVolumePermission].
* @param name The _unique_ name of the resulting resource.
*/
public fun snapshotCreateVolumePermission(name: String): SnapshotCreateVolumePermission {
val builder = SnapshotCreateVolumePermissionResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy