github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/shield/proactiveEngagement.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package shield
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Resource for managing a AWS Shield Proactive Engagement.
    16  // 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.
    17  //
    18  // ## Example Usage
    19  //
    20  // ### Basic Usage
    21  //
    22  // <!--Start PulumiCodeChooser -->
    23  // ```go
    24  // package main
    25  //
    26  // import (
    27  //
    28  //	"encoding/json"
    29  //
    30  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    31  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/shield"
    32  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    33  //
    34  // )
    35  //
    36  //	func main() {
    37  //		pulumi.Run(func(ctx *pulumi.Context) error {
    38  //			tmpJSON0, err := json.Marshal(map[string]interface{}{
    39  //				"Version": "2012-10-17",
    40  //				"Statement": []map[string]interface{}{
    41  //					map[string]interface{}{
    42  //						"Sid":    "",
    43  //						"Effect": "Allow",
    44  //						"Principal": map[string]interface{}{
    45  //							"Service": "drt.shield.amazonaws.com",
    46  //						},
    47  //						"Action": "sts:AssumeRole",
    48  //					},
    49  //				},
    50  //			})
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			json0 := string(tmpJSON0)
    55  //			example, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
    56  //				Name:             pulumi.Any(awsShieldDrtAccessRoleArn),
    57  //				AssumeRolePolicy: pulumi.String(json0),
    58  //			})
    59  //			if err != nil {
    60  //				return err
    61  //			}
    62  //			_, err = iam.NewRolePolicyAttachment(ctx, "example", &iam.RolePolicyAttachmentArgs{
    63  //				Role:      example.Name,
    64  //				PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy"),
    65  //			})
    66  //			if err != nil {
    67  //				return err
    68  //			}
    69  //			_, err = shield.NewDrtAccessRoleArnAssociation(ctx, "example", &shield.DrtAccessRoleArnAssociationArgs{
    70  //				RoleArn: example.Arn,
    71  //			})
    72  //			if err != nil {
    73  //				return err
    74  //			}
    75  //			_, err = shield.NewProtectionGroup(ctx, "test", &shield.ProtectionGroupArgs{
    76  //				ProtectionGroupId: pulumi.String("example"),
    77  //				Aggregation:       pulumi.String("MAX"),
    78  //				Pattern:           pulumi.String("ALL"),
    79  //			})
    80  //			if err != nil {
    81  //				return err
    82  //			}
    83  //			_, err = shield.NewProactiveEngagement(ctx, "test", &shield.ProactiveEngagementArgs{
    84  //				Enabled: pulumi.Bool(true),
    85  //				EmergencyContacts: shield.ProactiveEngagementEmergencyContactArray{
    86  //					&shield.ProactiveEngagementEmergencyContactArgs{
    87  //						ContactNotes: pulumi.String("Notes"),
    88  //						EmailAddress: pulumi.String("test@company.com"),
    89  //						PhoneNumber:  pulumi.String("+12358132134"),
    90  //					},
    91  //					&shield.ProactiveEngagementEmergencyContactArgs{
    92  //						ContactNotes: pulumi.String("Notes 2"),
    93  //						EmailAddress: pulumi.String("test2@company.com"),
    94  //						PhoneNumber:  pulumi.String("+12358132134"),
    95  //					},
    96  //				},
    97  //			}, pulumi.DependsOn([]pulumi.Resource{
    98  //				testAwsShieldDrtAccessRoleArnAssociation,
    99  //			}))
   100  //			if err != nil {
   101  //				return err
   102  //			}
   103  //			return nil
   104  //		})
   105  //	}
   106  //
   107  // ```
   108  // <!--End PulumiCodeChooser -->
   109  //
   110  // ## Import
   111  //
   112  // Using `pulumi import`, import Shield proactive engagement using the AWS account ID. For example:
   113  //
   114  // ```sh
   115  // $ pulumi import aws:shield/proactiveEngagement:ProactiveEngagement example 123456789012
   116  // ```
   117  type ProactiveEngagement struct {
   118  	pulumi.CustomResourceState
   119  
   120  	// One or more emergency contacts. You must provide at least one phone number in the emergency contact list. See `emergencyContacts`.
   121  	EmergencyContacts ProactiveEngagementEmergencyContactArrayOutput `pulumi:"emergencyContacts"`
   122  	// Boolean value indicating if Proactive Engagement should be enabled or not.
   123  	Enabled pulumi.BoolOutput `pulumi:"enabled"`
   124  }
   125  
   126  // NewProactiveEngagement registers a new resource with the given unique name, arguments, and options.
   127  func NewProactiveEngagement(ctx *pulumi.Context,
   128  	name string, args *ProactiveEngagementArgs, opts ...pulumi.ResourceOption) (*ProactiveEngagement, error) {
   129  	if args == nil {
   130  		return nil, errors.New("missing one or more required arguments")
   131  	}
   132  
   133  	if args.Enabled == nil {
   134  		return nil, errors.New("invalid value for required argument 'Enabled'")
   135  	}
   136  	opts = internal.PkgResourceDefaultOpts(opts)
   137  	var resource ProactiveEngagement
   138  	err := ctx.RegisterResource("aws:shield/proactiveEngagement:ProactiveEngagement", name, args, &resource, opts...)
   139  	if err != nil {
   140  		return nil, err
   141  	}
   142  	return &resource, nil
   143  }
   144  
   145  // GetProactiveEngagement gets an existing ProactiveEngagement resource's state with the given name, ID, and optional
   146  // state properties that are used to uniquely qualify the lookup (nil if not required).
   147  func GetProactiveEngagement(ctx *pulumi.Context,
   148  	name string, id pulumi.IDInput, state *ProactiveEngagementState, opts ...pulumi.ResourceOption) (*ProactiveEngagement, error) {
   149  	var resource ProactiveEngagement
   150  	err := ctx.ReadResource("aws:shield/proactiveEngagement:ProactiveEngagement", name, id, state, &resource, opts...)
   151  	if err != nil {
   152  		return nil, err
   153  	}
   154  	return &resource, nil
   155  }
   156  
   157  // Input properties used for looking up and filtering ProactiveEngagement resources.
   158  type proactiveEngagementState struct {
   159  	// One or more emergency contacts. You must provide at least one phone number in the emergency contact list. See `emergencyContacts`.
   160  	EmergencyContacts []ProactiveEngagementEmergencyContact `pulumi:"emergencyContacts"`
   161  	// Boolean value indicating if Proactive Engagement should be enabled or not.
   162  	Enabled *bool `pulumi:"enabled"`
   163  }
   164  
   165  type ProactiveEngagementState struct {
   166  	// One or more emergency contacts. You must provide at least one phone number in the emergency contact list. See `emergencyContacts`.
   167  	EmergencyContacts ProactiveEngagementEmergencyContactArrayInput
   168  	// Boolean value indicating if Proactive Engagement should be enabled or not.
   169  	Enabled pulumi.BoolPtrInput
   170  }
   171  
   172  func (ProactiveEngagementState) ElementType() reflect.Type {
   173  	return reflect.TypeOf((*proactiveEngagementState)(nil)).Elem()
   174  }
   175  
   176  type proactiveEngagementArgs struct {
   177  	// One or more emergency contacts. You must provide at least one phone number in the emergency contact list. See `emergencyContacts`.
   178  	EmergencyContacts []ProactiveEngagementEmergencyContact `pulumi:"emergencyContacts"`
   179  	// Boolean value indicating if Proactive Engagement should be enabled or not.
   180  	Enabled bool `pulumi:"enabled"`
   181  }
   182  
   183  // The set of arguments for constructing a ProactiveEngagement resource.
   184  type ProactiveEngagementArgs struct {
   185  	// One or more emergency contacts. You must provide at least one phone number in the emergency contact list. See `emergencyContacts`.
   186  	EmergencyContacts ProactiveEngagementEmergencyContactArrayInput
   187  	// Boolean value indicating if Proactive Engagement should be enabled or not.
   188  	Enabled pulumi.BoolInput
   189  }
   190  
   191  func (ProactiveEngagementArgs) ElementType() reflect.Type {
   192  	return reflect.TypeOf((*proactiveEngagementArgs)(nil)).Elem()
   193  }
   194  
   195  type ProactiveEngagementInput interface {
   196  	pulumi.Input
   197  
   198  	ToProactiveEngagementOutput() ProactiveEngagementOutput
   199  	ToProactiveEngagementOutputWithContext(ctx context.Context) ProactiveEngagementOutput
   200  }
   201  
   202  func (*ProactiveEngagement) ElementType() reflect.Type {
   203  	return reflect.TypeOf((**ProactiveEngagement)(nil)).Elem()
   204  }
   205  
   206  func (i *ProactiveEngagement) ToProactiveEngagementOutput() ProactiveEngagementOutput {
   207  	return i.ToProactiveEngagementOutputWithContext(context.Background())
   208  }
   209  
   210  func (i *ProactiveEngagement) ToProactiveEngagementOutputWithContext(ctx context.Context) ProactiveEngagementOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(ProactiveEngagementOutput)
   212  }
   213  
   214  // ProactiveEngagementArrayInput is an input type that accepts ProactiveEngagementArray and ProactiveEngagementArrayOutput values.
   215  // You can construct a concrete instance of `ProactiveEngagementArrayInput` via:
   216  //
   217  //	ProactiveEngagementArray{ ProactiveEngagementArgs{...} }
   218  type ProactiveEngagementArrayInput interface {
   219  	pulumi.Input
   220  
   221  	ToProactiveEngagementArrayOutput() ProactiveEngagementArrayOutput
   222  	ToProactiveEngagementArrayOutputWithContext(context.Context) ProactiveEngagementArrayOutput
   223  }
   224  
   225  type ProactiveEngagementArray []ProactiveEngagementInput
   226  
   227  func (ProactiveEngagementArray) ElementType() reflect.Type {
   228  	return reflect.TypeOf((*[]*ProactiveEngagement)(nil)).Elem()
   229  }
   230  
   231  func (i ProactiveEngagementArray) ToProactiveEngagementArrayOutput() ProactiveEngagementArrayOutput {
   232  	return i.ToProactiveEngagementArrayOutputWithContext(context.Background())
   233  }
   234  
   235  func (i ProactiveEngagementArray) ToProactiveEngagementArrayOutputWithContext(ctx context.Context) ProactiveEngagementArrayOutput {
   236  	return pulumi.ToOutputWithContext(ctx, i).(ProactiveEngagementArrayOutput)
   237  }
   238  
   239  // ProactiveEngagementMapInput is an input type that accepts ProactiveEngagementMap and ProactiveEngagementMapOutput values.
   240  // You can construct a concrete instance of `ProactiveEngagementMapInput` via:
   241  //
   242  //	ProactiveEngagementMap{ "key": ProactiveEngagementArgs{...} }
   243  type ProactiveEngagementMapInput interface {
   244  	pulumi.Input
   245  
   246  	ToProactiveEngagementMapOutput() ProactiveEngagementMapOutput
   247  	ToProactiveEngagementMapOutputWithContext(context.Context) ProactiveEngagementMapOutput
   248  }
   249  
   250  type ProactiveEngagementMap map[string]ProactiveEngagementInput
   251  
   252  func (ProactiveEngagementMap) ElementType() reflect.Type {
   253  	return reflect.TypeOf((*map[string]*ProactiveEngagement)(nil)).Elem()
   254  }
   255  
   256  func (i ProactiveEngagementMap) ToProactiveEngagementMapOutput() ProactiveEngagementMapOutput {
   257  	return i.ToProactiveEngagementMapOutputWithContext(context.Background())
   258  }
   259  
   260  func (i ProactiveEngagementMap) ToProactiveEngagementMapOutputWithContext(ctx context.Context) ProactiveEngagementMapOutput {
   261  	return pulumi.ToOutputWithContext(ctx, i).(ProactiveEngagementMapOutput)
   262  }
   263  
   264  type ProactiveEngagementOutput struct{ *pulumi.OutputState }
   265  
   266  func (ProactiveEngagementOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((**ProactiveEngagement)(nil)).Elem()
   268  }
   269  
   270  func (o ProactiveEngagementOutput) ToProactiveEngagementOutput() ProactiveEngagementOutput {
   271  	return o
   272  }
   273  
   274  func (o ProactiveEngagementOutput) ToProactiveEngagementOutputWithContext(ctx context.Context) ProactiveEngagementOutput {
   275  	return o
   276  }
   277  
   278  // One or more emergency contacts. You must provide at least one phone number in the emergency contact list. See `emergencyContacts`.
   279  func (o ProactiveEngagementOutput) EmergencyContacts() ProactiveEngagementEmergencyContactArrayOutput {
   280  	return o.ApplyT(func(v *ProactiveEngagement) ProactiveEngagementEmergencyContactArrayOutput {
   281  		return v.EmergencyContacts
   282  	}).(ProactiveEngagementEmergencyContactArrayOutput)
   283  }
   284  
   285  // Boolean value indicating if Proactive Engagement should be enabled or not.
   286  func (o ProactiveEngagementOutput) Enabled() pulumi.BoolOutput {
   287  	return o.ApplyT(func(v *ProactiveEngagement) pulumi.BoolOutput { return v.Enabled }).(pulumi.BoolOutput)
   288  }
   289  
   290  type ProactiveEngagementArrayOutput struct{ *pulumi.OutputState }
   291  
   292  func (ProactiveEngagementArrayOutput) ElementType() reflect.Type {
   293  	return reflect.TypeOf((*[]*ProactiveEngagement)(nil)).Elem()
   294  }
   295  
   296  func (o ProactiveEngagementArrayOutput) ToProactiveEngagementArrayOutput() ProactiveEngagementArrayOutput {
   297  	return o
   298  }
   299  
   300  func (o ProactiveEngagementArrayOutput) ToProactiveEngagementArrayOutputWithContext(ctx context.Context) ProactiveEngagementArrayOutput {
   301  	return o
   302  }
   303  
   304  func (o ProactiveEngagementArrayOutput) Index(i pulumi.IntInput) ProactiveEngagementOutput {
   305  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ProactiveEngagement {
   306  		return vs[0].([]*ProactiveEngagement)[vs[1].(int)]
   307  	}).(ProactiveEngagementOutput)
   308  }
   309  
   310  type ProactiveEngagementMapOutput struct{ *pulumi.OutputState }
   311  
   312  func (ProactiveEngagementMapOutput) ElementType() reflect.Type {
   313  	return reflect.TypeOf((*map[string]*ProactiveEngagement)(nil)).Elem()
   314  }
   315  
   316  func (o ProactiveEngagementMapOutput) ToProactiveEngagementMapOutput() ProactiveEngagementMapOutput {
   317  	return o
   318  }
   319  
   320  func (o ProactiveEngagementMapOutput) ToProactiveEngagementMapOutputWithContext(ctx context.Context) ProactiveEngagementMapOutput {
   321  	return o
   322  }
   323  
   324  func (o ProactiveEngagementMapOutput) MapIndex(k pulumi.StringInput) ProactiveEngagementOutput {
   325  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ProactiveEngagement {
   326  		return vs[0].(map[string]*ProactiveEngagement)[vs[1].(string)]
   327  	}).(ProactiveEngagementOutput)
   328  }
   329  
   330  func init() {
   331  	pulumi.RegisterInputType(reflect.TypeOf((*ProactiveEngagementInput)(nil)).Elem(), &ProactiveEngagement{})
   332  	pulumi.RegisterInputType(reflect.TypeOf((*ProactiveEngagementArrayInput)(nil)).Elem(), ProactiveEngagementArray{})
   333  	pulumi.RegisterInputType(reflect.TypeOf((*ProactiveEngagementMapInput)(nil)).Elem(), ProactiveEngagementMap{})
   334  	pulumi.RegisterOutputType(ProactiveEngagementOutput{})
   335  	pulumi.RegisterOutputType(ProactiveEngagementArrayOutput{})
   336  	pulumi.RegisterOutputType(ProactiveEngagementMapOutput{})
   337  }