com.pulumi.aws.shield.kotlin.ProactiveEngagement.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.shield.kotlin
import com.pulumi.aws.shield.kotlin.outputs.ProactiveEngagementEmergencyContact
import com.pulumi.aws.shield.kotlin.outputs.ProactiveEngagementEmergencyContact.Companion.toKotlin
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
import kotlin.collections.List
/**
* Builder for [ProactiveEngagement].
*/
@PulumiTagMarker
public class ProactiveEngagementResourceBuilder internal constructor() {
public var name: String? = null
public var args: ProactiveEngagementArgs = ProactiveEngagementArgs()
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 ProactiveEngagementArgsBuilder.() -> Unit) {
val builder = ProactiveEngagementArgsBuilder()
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(): ProactiveEngagement {
val builtJavaResource = com.pulumi.aws.shield.ProactiveEngagement(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ProactiveEngagement(builtJavaResource)
}
}
/**
* Resource for managing a AWS Shield Proactive Engagement.
* Proactive engagement authorizes the Shield Response Team (SRT) to use email and phone to notify contacts about escalations to the SRT and to initiate proactive customer support.
* ## Example Usage
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const exampleRole = new aws.iam.Role("example", {
* name: "example-role",
* assumeRolePolicy: JSON.stringify({
* Version: "2012-10-17",
* Statement: [{
* Sid: "",
* Effect: "Allow",
* Principal: {
* Service: "drt.shield.amazonaws.com",
* },
* Action: "sts:AssumeRole",
* }],
* }),
* });
* const exampleDrtAccessRoleArnAssociation = new aws.shield.DrtAccessRoleArnAssociation("example", {roleArn: exampleRole.arn});
* const example = new aws.shield.ProactiveEngagement("example", {
* enabled: true,
* emergencyContacts: [
* {
* contactNotes: "Notes",
* emailAddress: "[email protected]",
* phoneNumber: "+12358132134",
* },
* {
* contactNotes: "Notes 2",
* emailAddress: "[email protected]",
* phoneNumber: "+12358132134",
* },
* ],
* }, {
* dependsOn: [exampleDrtAccessRoleArnAssociation],
* });
* const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", {
* role: exampleRole.name,
* policyArn: "arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy",
* });
* const exampleProtectionGroup = new aws.shield.ProtectionGroup("example", {
* protectionGroupId: "example",
* aggregation: "MAX",
* pattern: "ALL",
* });
* ```
* ```python
* import pulumi
* import json
* import pulumi_aws as aws
* example_role = aws.iam.Role("example",
* name="example-role",
* assume_role_policy=json.dumps({
* "Version": "2012-10-17",
* "Statement": [{
* "Sid": "",
* "Effect": "Allow",
* "Principal": {
* "Service": "drt.shield.amazonaws.com",
* },
* "Action": "sts:AssumeRole",
* }],
* }))
* example_drt_access_role_arn_association = aws.shield.DrtAccessRoleArnAssociation("example", role_arn=example_role.arn)
* example = aws.shield.ProactiveEngagement("example",
* enabled=True,
* emergency_contacts=[
* {
* "contact_notes": "Notes",
* "email_address": "[email protected]",
* "phone_number": "+12358132134",
* },
* {
* "contact_notes": "Notes 2",
* "email_address": "[email protected]",
* "phone_number": "+12358132134",
* },
* ],
* opts = pulumi.ResourceOptions(depends_on=[example_drt_access_role_arn_association]))
* example_role_policy_attachment = aws.iam.RolePolicyAttachment("example",
* role=example_role.name,
* policy_arn="arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy")
* example_protection_group = aws.shield.ProtectionGroup("example",
* protection_group_id="example",
* aggregation="MAX",
* pattern="ALL")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using System.Text.Json;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var exampleRole = new Aws.Iam.Role("example", new()
* {
* Name = "example-role",
* AssumeRolePolicy = JsonSerializer.Serialize(new Dictionary
* {
* ["Version"] = "2012-10-17",
* ["Statement"] = new[]
* {
* new Dictionary
* {
* ["Sid"] = "",
* ["Effect"] = "Allow",
* ["Principal"] = new Dictionary
* {
* ["Service"] = "drt.shield.amazonaws.com",
* },
* ["Action"] = "sts:AssumeRole",
* },
* },
* }),
* });
* var exampleDrtAccessRoleArnAssociation = new Aws.Shield.DrtAccessRoleArnAssociation("example", new()
* {
* RoleArn = exampleRole.Arn,
* });
* var example = new Aws.Shield.ProactiveEngagement("example", new()
* {
* Enabled = true,
* EmergencyContacts = new[]
* {
* new Aws.Shield.Inputs.ProactiveEngagementEmergencyContactArgs
* {
* ContactNotes = "Notes",
* EmailAddress = "[email protected]",
* PhoneNumber = "+12358132134",
* },
* new Aws.Shield.Inputs.ProactiveEngagementEmergencyContactArgs
* {
* ContactNotes = "Notes 2",
* EmailAddress = "[email protected]",
* PhoneNumber = "+12358132134",
* },
* },
* }, new CustomResourceOptions
* {
* DependsOn =
* {
* exampleDrtAccessRoleArnAssociation,
* },
* });
* var exampleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("example", new()
* {
* Role = exampleRole.Name,
* PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy",
* });
* var exampleProtectionGroup = new Aws.Shield.ProtectionGroup("example", new()
* {
* ProtectionGroupId = "example",
* Aggregation = "MAX",
* Pattern = "ALL",
* });
* });
* ```
* ```go
* package main
* import (
* "encoding/json"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/shield"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* tmpJSON0, err := json.Marshal(map[string]interface{}{
* "Version": "2012-10-17",
* "Statement": []map[string]interface{}{
* map[string]interface{}{
* "Sid": "",
* "Effect": "Allow",
* "Principal": map[string]interface{}{
* "Service": "drt.shield.amazonaws.com",
* },
* "Action": "sts:AssumeRole",
* },
* },
* })
* if err != nil {
* return err
* }
* json0 := string(tmpJSON0)
* exampleRole, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
* Name: pulumi.String("example-role"),
* AssumeRolePolicy: pulumi.String(json0),
* })
* if err != nil {
* return err
* }
* exampleDrtAccessRoleArnAssociation, err := shield.NewDrtAccessRoleArnAssociation(ctx, "example", &shield.DrtAccessRoleArnAssociationArgs{
* RoleArn: exampleRole.Arn,
* })
* if err != nil {
* return err
* }
* _, err = shield.NewProactiveEngagement(ctx, "example", &shield.ProactiveEngagementArgs{
* Enabled: pulumi.Bool(true),
* EmergencyContacts: shield.ProactiveEngagementEmergencyContactArray{
* &shield.ProactiveEngagementEmergencyContactArgs{
* ContactNotes: pulumi.String("Notes"),
* EmailAddress: pulumi.String("[email protected]"),
* PhoneNumber: pulumi.String("+12358132134"),
* },
* &shield.ProactiveEngagementEmergencyContactArgs{
* ContactNotes: pulumi.String("Notes 2"),
* EmailAddress: pulumi.String("[email protected]"),
* PhoneNumber: pulumi.String("+12358132134"),
* },
* },
* }, pulumi.DependsOn([]pulumi.Resource{
* exampleDrtAccessRoleArnAssociation,
* }))
* if err != nil {
* return err
* }
* _, err = iam.NewRolePolicyAttachment(ctx, "example", &iam.RolePolicyAttachmentArgs{
* Role: exampleRole.Name,
* PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy"),
* })
* if err != nil {
* return err
* }
* _, err = shield.NewProtectionGroup(ctx, "example", &shield.ProtectionGroupArgs{
* ProtectionGroupId: pulumi.String("example"),
* Aggregation: pulumi.String("MAX"),
* Pattern: 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.iam.Role;
* import com.pulumi.aws.iam.RoleArgs;
* import com.pulumi.aws.shield.DrtAccessRoleArnAssociation;
* import com.pulumi.aws.shield.DrtAccessRoleArnAssociationArgs;
* import com.pulumi.aws.shield.ProactiveEngagement;
* import com.pulumi.aws.shield.ProactiveEngagementArgs;
* import com.pulumi.aws.shield.inputs.ProactiveEngagementEmergencyContactArgs;
* import com.pulumi.aws.iam.RolePolicyAttachment;
* import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
* import com.pulumi.aws.shield.ProtectionGroup;
* import com.pulumi.aws.shield.ProtectionGroupArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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) {
* var exampleRole = new Role("exampleRole", RoleArgs.builder()
* .name("example-role")
* .assumeRolePolicy(serializeJson(
* jsonObject(
* jsonProperty("Version", "2012-10-17"),
* jsonProperty("Statement", jsonArray(jsonObject(
* jsonProperty("Sid", ""),
* jsonProperty("Effect", "Allow"),
* jsonProperty("Principal", jsonObject(
* jsonProperty("Service", "drt.shield.amazonaws.com")
* )),
* jsonProperty("Action", "sts:AssumeRole")
* )))
* )))
* .build());
* var exampleDrtAccessRoleArnAssociation = new DrtAccessRoleArnAssociation("exampleDrtAccessRoleArnAssociation", DrtAccessRoleArnAssociationArgs.builder()
* .roleArn(exampleRole.arn())
* .build());
* var example = new ProactiveEngagement("example", ProactiveEngagementArgs.builder()
* .enabled(true)
* .emergencyContacts(
* ProactiveEngagementEmergencyContactArgs.builder()
* .contactNotes("Notes")
* .emailAddress("[email protected]")
* .phoneNumber("+12358132134")
* .build(),
* ProactiveEngagementEmergencyContactArgs.builder()
* .contactNotes("Notes 2")
* .emailAddress("[email protected]")
* .phoneNumber("+12358132134")
* .build())
* .build(), CustomResourceOptions.builder()
* .dependsOn(exampleDrtAccessRoleArnAssociation)
* .build());
* var exampleRolePolicyAttachment = new RolePolicyAttachment("exampleRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
* .role(exampleRole.name())
* .policyArn("arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy")
* .build());
* var exampleProtectionGroup = new ProtectionGroup("exampleProtectionGroup", ProtectionGroupArgs.builder()
* .protectionGroupId("example")
* .aggregation("MAX")
* .pattern("ALL")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:shield:ProactiveEngagement
* properties:
* enabled: true
* emergencyContacts:
* - contactNotes: Notes
* emailAddress: [email protected]
* phoneNumber: '+12358132134'
* - contactNotes: Notes 2
* emailAddress: [email protected]
* phoneNumber: '+12358132134'
* options:
* dependson:
* - ${exampleDrtAccessRoleArnAssociation}
* exampleRole:
* type: aws:iam:Role
* name: example
* properties:
* name: example-role
* assumeRolePolicy:
* fn::toJSON:
* Version: 2012-10-17
* Statement:
* - Sid:
* Effect: Allow
* Principal:
* Service: drt.shield.amazonaws.com
* Action: sts:AssumeRole
* exampleRolePolicyAttachment:
* type: aws:iam:RolePolicyAttachment
* name: example
* properties:
* role: ${exampleRole.name}
* policyArn: arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy
* exampleDrtAccessRoleArnAssociation:
* type: aws:shield:DrtAccessRoleArnAssociation
* name: example
* properties:
* roleArn: ${exampleRole.arn}
* exampleProtectionGroup:
* type: aws:shield:ProtectionGroup
* name: example
* properties:
* protectionGroupId: example
* aggregation: MAX
* pattern: ALL
* ```
*
* ## Import
* Using `pulumi import`, import Shield proactive engagement using the AWS account ID. For example:
* ```sh
* $ pulumi import aws:shield/proactiveEngagement:ProactiveEngagement example 123456789012
* ```
*/
public class ProactiveEngagement internal constructor(
override val javaResource: com.pulumi.aws.shield.ProactiveEngagement,
) : KotlinCustomResource(javaResource, ProactiveEngagementMapper) {
/**
* One or more emergency contacts. You must provide at least one phone number in the emergency contact list. See `emergency_contacts`.
*/
public val emergencyContacts: Output>?
get() = javaResource.emergencyContacts().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
}).orElse(null)
})
/**
* Boolean value indicating if Proactive Engagement should be enabled or not.
*/
public val enabled: Output
get() = javaResource.enabled().applyValue({ args0 -> args0 })
}
public object ProactiveEngagementMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.shield.ProactiveEngagement::class == javaResource::class
override fun map(javaResource: Resource): ProactiveEngagement = ProactiveEngagement(
javaResource
as com.pulumi.aws.shield.ProactiveEngagement,
)
}
/**
* @see [ProactiveEngagement].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ProactiveEngagement].
*/
public suspend fun proactiveEngagement(
name: String,
block: suspend ProactiveEngagementResourceBuilder.() -> Unit,
): ProactiveEngagement {
val builder = ProactiveEngagementResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ProactiveEngagement].
* @param name The _unique_ name of the resulting resource.
*/
public fun proactiveEngagement(name: String): ProactiveEngagement {
val builder = ProactiveEngagementResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy