All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.ec2.kotlin.AmiLaunchPermissionArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.ec2.kotlin

import com.pulumi.aws.ec2.AmiLaunchPermissionArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Adds a launch permission to an Amazon Machine Image (AMI).
 * ## Example Usage
 * ### AWS Account ID
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.ec2.AmiLaunchPermission("example", {
 *     imageId: "ami-12345678",
 *     accountId: "123456789012",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.ec2.AmiLaunchPermission("example",
 *     image_id="ami-12345678",
 *     account_id="123456789012")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Ec2.AmiLaunchPermission("example", new()
 *     {
 *         ImageId = "ami-12345678",
 *         AccountId = "123456789012",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		_, err := ec2.NewAmiLaunchPermission(ctx, "example", &ec2.AmiLaunchPermissionArgs{
 * 			ImageId:   pulumi.String("ami-12345678"),
 * 			AccountId: pulumi.String("123456789012"),
 * 		})
 * 		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.ec2.AmiLaunchPermission;
 * import com.pulumi.aws.ec2.AmiLaunchPermissionArgs;
 * 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 AmiLaunchPermission("example", AmiLaunchPermissionArgs.builder()
 *             .imageId("ami-12345678")
 *             .accountId("123456789012")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:ec2:AmiLaunchPermission
 *     properties:
 *       imageId: ami-12345678
 *       accountId: '123456789012'
 * ```
 * 
 * ### Public Access
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.ec2.AmiLaunchPermission("example", {
 *     imageId: "ami-12345678",
 *     group: "all",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.ec2.AmiLaunchPermission("example",
 *     image_id="ami-12345678",
 *     group="all")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.Ec2.AmiLaunchPermission("example", new()
 *     {
 *         ImageId = "ami-12345678",
 *         Group = "all",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		_, err := ec2.NewAmiLaunchPermission(ctx, "example", &ec2.AmiLaunchPermissionArgs{
 * 			ImageId: pulumi.String("ami-12345678"),
 * 			Group:   pulumi.String("all"),
 * 		})
 * 		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.ec2.AmiLaunchPermission;
 * import com.pulumi.aws.ec2.AmiLaunchPermissionArgs;
 * 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 AmiLaunchPermission("example", AmiLaunchPermissionArgs.builder()
 *             .imageId("ami-12345678")
 *             .group("all")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:ec2:AmiLaunchPermission
 *     properties:
 *       imageId: ami-12345678
 *       group: all
 * ```
 * 
 * ### Organization Access
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const current = aws.organizations.getOrganization({});
 * const example = new aws.ec2.AmiLaunchPermission("example", {
 *     imageId: "ami-12345678",
 *     organizationArn: current.then(current => current.arn),
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * current = aws.organizations.get_organization()
 * example = aws.ec2.AmiLaunchPermission("example",
 *     image_id="ami-12345678",
 *     organization_arn=current.arn)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var current = Aws.Organizations.GetOrganization.Invoke();
 *     var example = new Aws.Ec2.AmiLaunchPermission("example", new()
 *     {
 *         ImageId = "ami-12345678",
 *         OrganizationArn = current.Apply(getOrganizationResult => getOrganizationResult.Arn),
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		current, err := organizations.LookupOrganization(ctx, map[string]interface{}{}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = ec2.NewAmiLaunchPermission(ctx, "example", &ec2.AmiLaunchPermissionArgs{
 * 			ImageId:         pulumi.String("ami-12345678"),
 * 			OrganizationArn: pulumi.String(current.Arn),
 * 		})
 * 		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.organizations.OrganizationsFunctions;
 * import com.pulumi.aws.ec2.AmiLaunchPermission;
 * import com.pulumi.aws.ec2.AmiLaunchPermissionArgs;
 * 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 current = OrganizationsFunctions.getOrganization();
 *         var example = new AmiLaunchPermission("example", AmiLaunchPermissionArgs.builder()
 *             .imageId("ami-12345678")
 *             .organizationArn(current.applyValue(getOrganizationResult -> getOrganizationResult.arn()))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:ec2:AmiLaunchPermission
 *     properties:
 *       imageId: ami-12345678
 *       organizationArn: ${current.arn}
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: aws:organizations:getOrganization
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import AMI Launch Permissions using `[ACCOUNT-ID|GROUP-NAME|ORGANIZATION-ARN|ORGANIZATIONAL-UNIT-ARN]/IMAGE-ID`. For example:
 * ```sh
 * $ pulumi import aws:ec2/amiLaunchPermission:AmiLaunchPermission example 123456789012/ami-12345678
 * ```
 * @property accountId AWS account ID for the launch permission.
 * @property group Name of the group for the launch permission. Valid values: `"all"`.
 * @property imageId ID of the AMI.
 * @property organizationArn ARN of an organization for the launch permission.
 * @property organizationalUnitArn ARN of an organizational unit for the launch permission.
 */
public data class AmiLaunchPermissionArgs(
    public val accountId: Output? = null,
    public val group: Output? = null,
    public val imageId: Output? = null,
    public val organizationArn: Output? = null,
    public val organizationalUnitArn: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.ec2.AmiLaunchPermissionArgs =
        com.pulumi.aws.ec2.AmiLaunchPermissionArgs.builder()
            .accountId(accountId?.applyValue({ args0 -> args0 }))
            .group(group?.applyValue({ args0 -> args0 }))
            .imageId(imageId?.applyValue({ args0 -> args0 }))
            .organizationArn(organizationArn?.applyValue({ args0 -> args0 }))
            .organizationalUnitArn(organizationalUnitArn?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [AmiLaunchPermissionArgs].
 */
@PulumiTagMarker
public class AmiLaunchPermissionArgsBuilder internal constructor() {
    private var accountId: Output? = null

    private var group: Output? = null

    private var imageId: Output? = null

    private var organizationArn: Output? = null

    private var organizationalUnitArn: Output? = null

    /**
     * @param value AWS account ID for the launch permission.
     */
    @JvmName("dhcvdmwjhavgcsit")
    public suspend fun accountId(`value`: Output) {
        this.accountId = value
    }

    /**
     * @param value Name of the group for the launch permission. Valid values: `"all"`.
     */
    @JvmName("bxreonkaejlgjtfm")
    public suspend fun group(`value`: Output) {
        this.group = value
    }

    /**
     * @param value ID of the AMI.
     */
    @JvmName("fhgexhxevbnjdafd")
    public suspend fun imageId(`value`: Output) {
        this.imageId = value
    }

    /**
     * @param value ARN of an organization for the launch permission.
     */
    @JvmName("qiuqrljhxwjhvwxh")
    public suspend fun organizationArn(`value`: Output) {
        this.organizationArn = value
    }

    /**
     * @param value ARN of an organizational unit for the launch permission.
     */
    @JvmName("oycmsunjijakspjn")
    public suspend fun organizationalUnitArn(`value`: Output) {
        this.organizationalUnitArn = value
    }

    /**
     * @param value AWS account ID for the launch permission.
     */
    @JvmName("njgcnxwmcomfwwqj")
    public suspend fun accountId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.accountId = mapped
    }

    /**
     * @param value Name of the group for the launch permission. Valid values: `"all"`.
     */
    @JvmName("lqbakvwtnbjhlyur")
    public suspend fun group(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.group = mapped
    }

    /**
     * @param value ID of the AMI.
     */
    @JvmName("vybutnkjlknarali")
    public suspend fun imageId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.imageId = mapped
    }

    /**
     * @param value ARN of an organization for the launch permission.
     */
    @JvmName("aqtajadiydxxfjph")
    public suspend fun organizationArn(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.organizationArn = mapped
    }

    /**
     * @param value ARN of an organizational unit for the launch permission.
     */
    @JvmName("qfaeoccocwllafcp")
    public suspend fun organizationalUnitArn(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.organizationalUnitArn = mapped
    }

    internal fun build(): AmiLaunchPermissionArgs = AmiLaunchPermissionArgs(
        accountId = accountId,
        group = group,
        imageId = imageId,
        organizationArn = organizationArn,
        organizationalUnitArn = organizationalUnitArn,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy