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

com.pulumi.aws.ssm.kotlin.ActivationArgs.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.ssm.kotlin

import com.pulumi.aws.ssm.ActivationArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Registers an on-premises server or virtual machine with Amazon EC2 so that it can be managed using Run Command.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const assumeRole = aws.iam.getPolicyDocument({
 *     statements: [{
 *         effect: "Allow",
 *         principals: [{
 *             type: "Service",
 *             identifiers: ["ssm.amazonaws.com"],
 *         }],
 *         actions: ["sts:AssumeRole"],
 *     }],
 * });
 * const testRole = new aws.iam.Role("test_role", {
 *     name: "test_role",
 *     assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
 * });
 * const testAttach = new aws.iam.RolePolicyAttachment("test_attach", {
 *     role: testRole.name,
 *     policyArn: "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
 * });
 * const foo = new aws.ssm.Activation("foo", {
 *     name: "test_ssm_activation",
 *     description: "Test",
 *     iamRole: testRole.id,
 *     registrationLimit: 5,
 * }, {
 *     dependsOn: [testAttach],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * assume_role = aws.iam.get_policy_document(statements=[{
 *     "effect": "Allow",
 *     "principals": [{
 *         "type": "Service",
 *         "identifiers": ["ssm.amazonaws.com"],
 *     }],
 *     "actions": ["sts:AssumeRole"],
 * }])
 * test_role = aws.iam.Role("test_role",
 *     name="test_role",
 *     assume_role_policy=assume_role.json)
 * test_attach = aws.iam.RolePolicyAttachment("test_attach",
 *     role=test_role.name,
 *     policy_arn="arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore")
 * foo = aws.ssm.Activation("foo",
 *     name="test_ssm_activation",
 *     description="Test",
 *     iam_role=test_role.id,
 *     registration_limit=5,
 *     opts = pulumi.ResourceOptions(depends_on=[test_attach]))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
 *     {
 *         Statements = new[]
 *         {
 *             new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
 *             {
 *                 Effect = "Allow",
 *                 Principals = new[]
 *                 {
 *                     new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
 *                     {
 *                         Type = "Service",
 *                         Identifiers = new[]
 *                         {
 *                             "ssm.amazonaws.com",
 *                         },
 *                     },
 *                 },
 *                 Actions = new[]
 *                 {
 *                     "sts:AssumeRole",
 *                 },
 *             },
 *         },
 *     });
 *     var testRole = new Aws.Iam.Role("test_role", new()
 *     {
 *         Name = "test_role",
 *         AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
 *     });
 *     var testAttach = new Aws.Iam.RolePolicyAttachment("test_attach", new()
 *     {
 *         Role = testRole.Name,
 *         PolicyArn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore",
 *     });
 *     var foo = new Aws.Ssm.Activation("foo", new()
 *     {
 *         Name = "test_ssm_activation",
 *         Description = "Test",
 *         IamRole = testRole.Id,
 *         RegistrationLimit = 5,
 *     }, new CustomResourceOptions
 *     {
 *         DependsOn =
 *         {
 *             testAttach,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
 * 			Statements: []iam.GetPolicyDocumentStatement{
 * 				{
 * 					Effect: pulumi.StringRef("Allow"),
 * 					Principals: []iam.GetPolicyDocumentStatementPrincipal{
 * 						{
 * 							Type: "Service",
 * 							Identifiers: []string{
 * 								"ssm.amazonaws.com",
 * 							},
 * 						},
 * 					},
 * 					Actions: []string{
 * 						"sts:AssumeRole",
 * 					},
 * 				},
 * 			},
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		testRole, err := iam.NewRole(ctx, "test_role", &iam.RoleArgs{
 * 			Name:             pulumi.String("test_role"),
 * 			AssumeRolePolicy: pulumi.String(assumeRole.Json),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		testAttach, err := iam.NewRolePolicyAttachment(ctx, "test_attach", &iam.RolePolicyAttachmentArgs{
 * 			Role:      testRole.Name,
 * 			PolicyArn: pulumi.String("arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = ssm.NewActivation(ctx, "foo", &ssm.ActivationArgs{
 * 			Name:              pulumi.String("test_ssm_activation"),
 * 			Description:       pulumi.String("Test"),
 * 			IamRole:           testRole.ID(),
 * 			RegistrationLimit: pulumi.Int(5),
 * 		}, pulumi.DependsOn([]pulumi.Resource{
 * 			testAttach,
 * 		}))
 * 		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.iam.IamFunctions;
 * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
 * import com.pulumi.aws.iam.Role;
 * import com.pulumi.aws.iam.RoleArgs;
 * import com.pulumi.aws.iam.RolePolicyAttachment;
 * import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
 * import com.pulumi.aws.ssm.Activation;
 * import com.pulumi.aws.ssm.ActivationArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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 assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
 *             .statements(GetPolicyDocumentStatementArgs.builder()
 *                 .effect("Allow")
 *                 .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
 *                     .type("Service")
 *                     .identifiers("ssm.amazonaws.com")
 *                     .build())
 *                 .actions("sts:AssumeRole")
 *                 .build())
 *             .build());
 *         var testRole = new Role("testRole", RoleArgs.builder()
 *             .name("test_role")
 *             .assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
 *             .build());
 *         var testAttach = new RolePolicyAttachment("testAttach", RolePolicyAttachmentArgs.builder()
 *             .role(testRole.name())
 *             .policyArn("arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore")
 *             .build());
 *         var foo = new Activation("foo", ActivationArgs.builder()
 *             .name("test_ssm_activation")
 *             .description("Test")
 *             .iamRole(testRole.id())
 *             .registrationLimit("5")
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(testAttach)
 *                 .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   testRole:
 *     type: aws:iam:Role
 *     name: test_role
 *     properties:
 *       name: test_role
 *       assumeRolePolicy: ${assumeRole.json}
 *   testAttach:
 *     type: aws:iam:RolePolicyAttachment
 *     name: test_attach
 *     properties:
 *       role: ${testRole.name}
 *       policyArn: arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore
 *   foo:
 *     type: aws:ssm:Activation
 *     properties:
 *       name: test_ssm_activation
 *       description: Test
 *       iamRole: ${testRole.id}
 *       registrationLimit: '5'
 *     options:
 *       dependson:
 *         - ${testAttach}
 * variables:
 *   assumeRole:
 *     fn::invoke:
 *       Function: aws:iam:getPolicyDocument
 *       Arguments:
 *         statements:
 *           - effect: Allow
 *             principals:
 *               - type: Service
 *                 identifiers:
 *                   - ssm.amazonaws.com
 *             actions:
 *               - sts:AssumeRole
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import AWS SSM Activation using the `id`. For example:
 * ```sh
 * $ pulumi import aws:ssm/activation:Activation example e488f2f6-e686-4afb-8a04-ef6dfEXAMPLE
 * ```
 * -> __Note:__ The `activation_code` attribute cannot be imported.
 * @property description The description of the resource that you want to register.
 * @property expirationDate UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
 * @property iamRole The IAM Role to attach to the managed instance.
 * @property name The default name of the registered managed instance.
 * @property registrationLimit The maximum number of managed instances you want to register. The default value is 1 instance.
 * @property tags A map of tags to assign to the object. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
 */
public data class ActivationArgs(
    public val description: Output? = null,
    public val expirationDate: Output? = null,
    public val iamRole: Output? = null,
    public val name: Output? = null,
    public val registrationLimit: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.ssm.ActivationArgs =
        com.pulumi.aws.ssm.ActivationArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .expirationDate(expirationDate?.applyValue({ args0 -> args0 }))
            .iamRole(iamRole?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .registrationLimit(registrationLimit?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

/**
 * Builder for [ActivationArgs].
 */
@PulumiTagMarker
public class ActivationArgsBuilder internal constructor() {
    private var description: Output? = null

    private var expirationDate: Output? = null

    private var iamRole: Output? = null

    private var name: Output? = null

    private var registrationLimit: Output? = null

    private var tags: Output>? = null

    /**
     * @param value The description of the resource that you want to register.
     */
    @JvmName("ukpppcpllbpcllie")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
     */
    @JvmName("wmjwwbtbagoplwja")
    public suspend fun expirationDate(`value`: Output) {
        this.expirationDate = value
    }

    /**
     * @param value The IAM Role to attach to the managed instance.
     */
    @JvmName("yxrmbuqaalxgdwty")
    public suspend fun iamRole(`value`: Output) {
        this.iamRole = value
    }

    /**
     * @param value The default name of the registered managed instance.
     */
    @JvmName("dfdqaewwsgeqldvs")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The maximum number of managed instances you want to register. The default value is 1 instance.
     */
    @JvmName("qbnvaovaadxdygck")
    public suspend fun registrationLimit(`value`: Output) {
        this.registrationLimit = value
    }

    /**
     * @param value A map of tags to assign to the object. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("yemwlgwdnxyflfcc")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value The description of the resource that you want to register.
     */
    @JvmName("piihowlhrqfbqvqn")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value UTC timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) by which this activation request should expire. The default value is 24 hours from resource creation time. This provider will only perform drift detection of its value when present in a configuration.
     */
    @JvmName("yxqmyqbbgjlurrwg")
    public suspend fun expirationDate(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.expirationDate = mapped
    }

    /**
     * @param value The IAM Role to attach to the managed instance.
     */
    @JvmName("nfomhemcekcimwnc")
    public suspend fun iamRole(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.iamRole = mapped
    }

    /**
     * @param value The default name of the registered managed instance.
     */
    @JvmName("wvnsmednpmwcjgln")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The maximum number of managed instances you want to register. The default value is 1 instance.
     */
    @JvmName("mwtyboavyvrfgrgl")
    public suspend fun registrationLimit(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.registrationLimit = mapped
    }

    /**
     * @param value A map of tags to assign to the object. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("dquoxxuuilkvljqy")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A map of tags to assign to the object. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("weatwbktouhtjcpb")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    internal fun build(): ActivationArgs = ActivationArgs(
        description = description,
        expirationDate = expirationDate,
        iamRole = iamRole,
        name = name,
        registrationLimit = registrationLimit,
        tags = tags,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy