github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ssmincidents/replicationSet.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 ssmincidents
     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  // Provides a resource for managing a replication set in AWS Systems Manager Incident Manager.
    16  //
    17  // > **NOTE:** Deleting a replication set also deletes all Incident Manager related data including response plans, incident records, contacts and escalation plans.
    18  //
    19  // ## Example Usage
    20  //
    21  // ### Basic Usage
    22  //
    23  // Create a replication set.
    24  //
    25  // <!--Start PulumiCodeChooser -->
    26  // ```go
    27  // package main
    28  //
    29  // import (
    30  //
    31  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmincidents"
    32  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    33  //
    34  // )
    35  //
    36  //	func main() {
    37  //		pulumi.Run(func(ctx *pulumi.Context) error {
    38  //			_, err := ssmincidents.NewReplicationSet(ctx, "replicationSetName", &ssmincidents.ReplicationSetArgs{
    39  //				Regions: ssmincidents.ReplicationSetRegionArray{
    40  //					&ssmincidents.ReplicationSetRegionArgs{
    41  //						Name: pulumi.String("us-west-2"),
    42  //					},
    43  //				},
    44  //				Tags: pulumi.StringMap{
    45  //					"exampleTag": pulumi.String("exampleValue"),
    46  //				},
    47  //			})
    48  //			if err != nil {
    49  //				return err
    50  //			}
    51  //			return nil
    52  //		})
    53  //	}
    54  //
    55  // ```
    56  // <!--End PulumiCodeChooser -->
    57  //
    58  // Add a Region to a replication set. (You can add only one Region at a time.)
    59  //
    60  // <!--Start PulumiCodeChooser -->
    61  // ```go
    62  // package main
    63  //
    64  // import (
    65  //
    66  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmincidents"
    67  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    68  //
    69  // )
    70  //
    71  //	func main() {
    72  //		pulumi.Run(func(ctx *pulumi.Context) error {
    73  //			_, err := ssmincidents.NewReplicationSet(ctx, "replicationSetName", &ssmincidents.ReplicationSetArgs{
    74  //				Regions: ssmincidents.ReplicationSetRegionArray{
    75  //					&ssmincidents.ReplicationSetRegionArgs{
    76  //						Name: pulumi.String("us-west-2"),
    77  //					},
    78  //					&ssmincidents.ReplicationSetRegionArgs{
    79  //						Name: pulumi.String("ap-southeast-2"),
    80  //					},
    81  //				},
    82  //			})
    83  //			if err != nil {
    84  //				return err
    85  //			}
    86  //			return nil
    87  //		})
    88  //	}
    89  //
    90  // ```
    91  // <!--End PulumiCodeChooser -->
    92  //
    93  // Delete a Region from a replication set. (You can delete only one Region at a time.)
    94  //
    95  // <!--Start PulumiCodeChooser -->
    96  // ```go
    97  // package main
    98  //
    99  // import (
   100  //
   101  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmincidents"
   102  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   103  //
   104  // )
   105  //
   106  //	func main() {
   107  //		pulumi.Run(func(ctx *pulumi.Context) error {
   108  //			_, err := ssmincidents.NewReplicationSet(ctx, "replicationSetName", &ssmincidents.ReplicationSetArgs{
   109  //				Regions: ssmincidents.ReplicationSetRegionArray{
   110  //					&ssmincidents.ReplicationSetRegionArgs{
   111  //						Name: pulumi.String("us-west-2"),
   112  //					},
   113  //				},
   114  //			})
   115  //			if err != nil {
   116  //				return err
   117  //			}
   118  //			return nil
   119  //		})
   120  //	}
   121  //
   122  // ```
   123  // <!--End PulumiCodeChooser -->
   124  //
   125  // ## Basic Usage with an AWS Customer Managed Key
   126  //
   127  // Create a replication set with an AWS Key Management Service (AWS KMS) customer manager key:
   128  //
   129  // <!--Start PulumiCodeChooser -->
   130  // ```go
   131  // package main
   132  //
   133  // import (
   134  //
   135  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
   136  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmincidents"
   137  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   138  //
   139  // )
   140  //
   141  //	func main() {
   142  //		pulumi.Run(func(ctx *pulumi.Context) error {
   143  //			exampleKey, err := kms.NewKey(ctx, "example_key", nil)
   144  //			if err != nil {
   145  //				return err
   146  //			}
   147  //			_, err = ssmincidents.NewReplicationSet(ctx, "replicationSetName", &ssmincidents.ReplicationSetArgs{
   148  //				Regions: ssmincidents.ReplicationSetRegionArray{
   149  //					&ssmincidents.ReplicationSetRegionArgs{
   150  //						Name:      pulumi.String("us-west-2"),
   151  //						KmsKeyArn: exampleKey.Arn,
   152  //					},
   153  //				},
   154  //				Tags: pulumi.StringMap{
   155  //					"exampleTag": pulumi.String("exampleValue"),
   156  //				},
   157  //			})
   158  //			if err != nil {
   159  //				return err
   160  //			}
   161  //			return nil
   162  //		})
   163  //	}
   164  //
   165  // ```
   166  // <!--End PulumiCodeChooser -->
   167  //
   168  // ## Import
   169  //
   170  // Using `pulumi import`, import an Incident Manager replication. For example:
   171  //
   172  // ```sh
   173  // $ pulumi import aws:ssmincidents/replicationSet:ReplicationSet replicationSetName import
   174  // ```
   175  type ReplicationSet struct {
   176  	pulumi.CustomResourceState
   177  
   178  	// The ARN of the replication set.
   179  	Arn pulumi.StringOutput `pulumi:"arn"`
   180  	// The ARN of the user who created the replication set.
   181  	CreatedBy pulumi.StringOutput `pulumi:"createdBy"`
   182  	// If `true`, the last region in a replication set cannot be deleted.
   183  	DeletionProtected pulumi.BoolOutput `pulumi:"deletionProtected"`
   184  	// A timestamp showing when the replication set was last modified.
   185  	LastModifiedBy pulumi.StringOutput             `pulumi:"lastModifiedBy"`
   186  	Regions        ReplicationSetRegionArrayOutput `pulumi:"regions"`
   187  	// The current status of the Region.
   188  	// * Valid Values: `ACTIVE` | `CREATING` | `UPDATING` | `DELETING` | `FAILED`
   189  	Status pulumi.StringOutput `pulumi:"status"`
   190  	// Tags applied to the replication set.
   191  	//
   192  	// For information about the maximum allowed number of Regions and tag value constraints, see [CreateReplicationSet in the *AWS Systems Manager Incident Manager API Reference*](https://docs.aws.amazon.com/incident-manager/latest/APIReference/API_CreateReplicationSet.html).
   193  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   194  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   195  	//
   196  	// Deprecated: Please use `tags` instead.
   197  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   198  }
   199  
   200  // NewReplicationSet registers a new resource with the given unique name, arguments, and options.
   201  func NewReplicationSet(ctx *pulumi.Context,
   202  	name string, args *ReplicationSetArgs, opts ...pulumi.ResourceOption) (*ReplicationSet, error) {
   203  	if args == nil {
   204  		return nil, errors.New("missing one or more required arguments")
   205  	}
   206  
   207  	if args.Regions == nil {
   208  		return nil, errors.New("invalid value for required argument 'Regions'")
   209  	}
   210  	opts = internal.PkgResourceDefaultOpts(opts)
   211  	var resource ReplicationSet
   212  	err := ctx.RegisterResource("aws:ssmincidents/replicationSet:ReplicationSet", name, args, &resource, opts...)
   213  	if err != nil {
   214  		return nil, err
   215  	}
   216  	return &resource, nil
   217  }
   218  
   219  // GetReplicationSet gets an existing ReplicationSet resource's state with the given name, ID, and optional
   220  // state properties that are used to uniquely qualify the lookup (nil if not required).
   221  func GetReplicationSet(ctx *pulumi.Context,
   222  	name string, id pulumi.IDInput, state *ReplicationSetState, opts ...pulumi.ResourceOption) (*ReplicationSet, error) {
   223  	var resource ReplicationSet
   224  	err := ctx.ReadResource("aws:ssmincidents/replicationSet:ReplicationSet", name, id, state, &resource, opts...)
   225  	if err != nil {
   226  		return nil, err
   227  	}
   228  	return &resource, nil
   229  }
   230  
   231  // Input properties used for looking up and filtering ReplicationSet resources.
   232  type replicationSetState struct {
   233  	// The ARN of the replication set.
   234  	Arn *string `pulumi:"arn"`
   235  	// The ARN of the user who created the replication set.
   236  	CreatedBy *string `pulumi:"createdBy"`
   237  	// If `true`, the last region in a replication set cannot be deleted.
   238  	DeletionProtected *bool `pulumi:"deletionProtected"`
   239  	// A timestamp showing when the replication set was last modified.
   240  	LastModifiedBy *string                `pulumi:"lastModifiedBy"`
   241  	Regions        []ReplicationSetRegion `pulumi:"regions"`
   242  	// The current status of the Region.
   243  	// * Valid Values: `ACTIVE` | `CREATING` | `UPDATING` | `DELETING` | `FAILED`
   244  	Status *string `pulumi:"status"`
   245  	// Tags applied to the replication set.
   246  	//
   247  	// For information about the maximum allowed number of Regions and tag value constraints, see [CreateReplicationSet in the *AWS Systems Manager Incident Manager API Reference*](https://docs.aws.amazon.com/incident-manager/latest/APIReference/API_CreateReplicationSet.html).
   248  	Tags map[string]string `pulumi:"tags"`
   249  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   250  	//
   251  	// Deprecated: Please use `tags` instead.
   252  	TagsAll map[string]string `pulumi:"tagsAll"`
   253  }
   254  
   255  type ReplicationSetState struct {
   256  	// The ARN of the replication set.
   257  	Arn pulumi.StringPtrInput
   258  	// The ARN of the user who created the replication set.
   259  	CreatedBy pulumi.StringPtrInput
   260  	// If `true`, the last region in a replication set cannot be deleted.
   261  	DeletionProtected pulumi.BoolPtrInput
   262  	// A timestamp showing when the replication set was last modified.
   263  	LastModifiedBy pulumi.StringPtrInput
   264  	Regions        ReplicationSetRegionArrayInput
   265  	// The current status of the Region.
   266  	// * Valid Values: `ACTIVE` | `CREATING` | `UPDATING` | `DELETING` | `FAILED`
   267  	Status pulumi.StringPtrInput
   268  	// Tags applied to the replication set.
   269  	//
   270  	// For information about the maximum allowed number of Regions and tag value constraints, see [CreateReplicationSet in the *AWS Systems Manager Incident Manager API Reference*](https://docs.aws.amazon.com/incident-manager/latest/APIReference/API_CreateReplicationSet.html).
   271  	Tags pulumi.StringMapInput
   272  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   273  	//
   274  	// Deprecated: Please use `tags` instead.
   275  	TagsAll pulumi.StringMapInput
   276  }
   277  
   278  func (ReplicationSetState) ElementType() reflect.Type {
   279  	return reflect.TypeOf((*replicationSetState)(nil)).Elem()
   280  }
   281  
   282  type replicationSetArgs struct {
   283  	Regions []ReplicationSetRegion `pulumi:"regions"`
   284  	// Tags applied to the replication set.
   285  	//
   286  	// For information about the maximum allowed number of Regions and tag value constraints, see [CreateReplicationSet in the *AWS Systems Manager Incident Manager API Reference*](https://docs.aws.amazon.com/incident-manager/latest/APIReference/API_CreateReplicationSet.html).
   287  	Tags map[string]string `pulumi:"tags"`
   288  }
   289  
   290  // The set of arguments for constructing a ReplicationSet resource.
   291  type ReplicationSetArgs struct {
   292  	Regions ReplicationSetRegionArrayInput
   293  	// Tags applied to the replication set.
   294  	//
   295  	// For information about the maximum allowed number of Regions and tag value constraints, see [CreateReplicationSet in the *AWS Systems Manager Incident Manager API Reference*](https://docs.aws.amazon.com/incident-manager/latest/APIReference/API_CreateReplicationSet.html).
   296  	Tags pulumi.StringMapInput
   297  }
   298  
   299  func (ReplicationSetArgs) ElementType() reflect.Type {
   300  	return reflect.TypeOf((*replicationSetArgs)(nil)).Elem()
   301  }
   302  
   303  type ReplicationSetInput interface {
   304  	pulumi.Input
   305  
   306  	ToReplicationSetOutput() ReplicationSetOutput
   307  	ToReplicationSetOutputWithContext(ctx context.Context) ReplicationSetOutput
   308  }
   309  
   310  func (*ReplicationSet) ElementType() reflect.Type {
   311  	return reflect.TypeOf((**ReplicationSet)(nil)).Elem()
   312  }
   313  
   314  func (i *ReplicationSet) ToReplicationSetOutput() ReplicationSetOutput {
   315  	return i.ToReplicationSetOutputWithContext(context.Background())
   316  }
   317  
   318  func (i *ReplicationSet) ToReplicationSetOutputWithContext(ctx context.Context) ReplicationSetOutput {
   319  	return pulumi.ToOutputWithContext(ctx, i).(ReplicationSetOutput)
   320  }
   321  
   322  // ReplicationSetArrayInput is an input type that accepts ReplicationSetArray and ReplicationSetArrayOutput values.
   323  // You can construct a concrete instance of `ReplicationSetArrayInput` via:
   324  //
   325  //	ReplicationSetArray{ ReplicationSetArgs{...} }
   326  type ReplicationSetArrayInput interface {
   327  	pulumi.Input
   328  
   329  	ToReplicationSetArrayOutput() ReplicationSetArrayOutput
   330  	ToReplicationSetArrayOutputWithContext(context.Context) ReplicationSetArrayOutput
   331  }
   332  
   333  type ReplicationSetArray []ReplicationSetInput
   334  
   335  func (ReplicationSetArray) ElementType() reflect.Type {
   336  	return reflect.TypeOf((*[]*ReplicationSet)(nil)).Elem()
   337  }
   338  
   339  func (i ReplicationSetArray) ToReplicationSetArrayOutput() ReplicationSetArrayOutput {
   340  	return i.ToReplicationSetArrayOutputWithContext(context.Background())
   341  }
   342  
   343  func (i ReplicationSetArray) ToReplicationSetArrayOutputWithContext(ctx context.Context) ReplicationSetArrayOutput {
   344  	return pulumi.ToOutputWithContext(ctx, i).(ReplicationSetArrayOutput)
   345  }
   346  
   347  // ReplicationSetMapInput is an input type that accepts ReplicationSetMap and ReplicationSetMapOutput values.
   348  // You can construct a concrete instance of `ReplicationSetMapInput` via:
   349  //
   350  //	ReplicationSetMap{ "key": ReplicationSetArgs{...} }
   351  type ReplicationSetMapInput interface {
   352  	pulumi.Input
   353  
   354  	ToReplicationSetMapOutput() ReplicationSetMapOutput
   355  	ToReplicationSetMapOutputWithContext(context.Context) ReplicationSetMapOutput
   356  }
   357  
   358  type ReplicationSetMap map[string]ReplicationSetInput
   359  
   360  func (ReplicationSetMap) ElementType() reflect.Type {
   361  	return reflect.TypeOf((*map[string]*ReplicationSet)(nil)).Elem()
   362  }
   363  
   364  func (i ReplicationSetMap) ToReplicationSetMapOutput() ReplicationSetMapOutput {
   365  	return i.ToReplicationSetMapOutputWithContext(context.Background())
   366  }
   367  
   368  func (i ReplicationSetMap) ToReplicationSetMapOutputWithContext(ctx context.Context) ReplicationSetMapOutput {
   369  	return pulumi.ToOutputWithContext(ctx, i).(ReplicationSetMapOutput)
   370  }
   371  
   372  type ReplicationSetOutput struct{ *pulumi.OutputState }
   373  
   374  func (ReplicationSetOutput) ElementType() reflect.Type {
   375  	return reflect.TypeOf((**ReplicationSet)(nil)).Elem()
   376  }
   377  
   378  func (o ReplicationSetOutput) ToReplicationSetOutput() ReplicationSetOutput {
   379  	return o
   380  }
   381  
   382  func (o ReplicationSetOutput) ToReplicationSetOutputWithContext(ctx context.Context) ReplicationSetOutput {
   383  	return o
   384  }
   385  
   386  // The ARN of the replication set.
   387  func (o ReplicationSetOutput) Arn() pulumi.StringOutput {
   388  	return o.ApplyT(func(v *ReplicationSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   389  }
   390  
   391  // The ARN of the user who created the replication set.
   392  func (o ReplicationSetOutput) CreatedBy() pulumi.StringOutput {
   393  	return o.ApplyT(func(v *ReplicationSet) pulumi.StringOutput { return v.CreatedBy }).(pulumi.StringOutput)
   394  }
   395  
   396  // If `true`, the last region in a replication set cannot be deleted.
   397  func (o ReplicationSetOutput) DeletionProtected() pulumi.BoolOutput {
   398  	return o.ApplyT(func(v *ReplicationSet) pulumi.BoolOutput { return v.DeletionProtected }).(pulumi.BoolOutput)
   399  }
   400  
   401  // A timestamp showing when the replication set was last modified.
   402  func (o ReplicationSetOutput) LastModifiedBy() pulumi.StringOutput {
   403  	return o.ApplyT(func(v *ReplicationSet) pulumi.StringOutput { return v.LastModifiedBy }).(pulumi.StringOutput)
   404  }
   405  
   406  func (o ReplicationSetOutput) Regions() ReplicationSetRegionArrayOutput {
   407  	return o.ApplyT(func(v *ReplicationSet) ReplicationSetRegionArrayOutput { return v.Regions }).(ReplicationSetRegionArrayOutput)
   408  }
   409  
   410  // The current status of the Region.
   411  // * Valid Values: `ACTIVE` | `CREATING` | `UPDATING` | `DELETING` | `FAILED`
   412  func (o ReplicationSetOutput) Status() pulumi.StringOutput {
   413  	return o.ApplyT(func(v *ReplicationSet) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   414  }
   415  
   416  // Tags applied to the replication set.
   417  //
   418  // For information about the maximum allowed number of Regions and tag value constraints, see [CreateReplicationSet in the *AWS Systems Manager Incident Manager API Reference*](https://docs.aws.amazon.com/incident-manager/latest/APIReference/API_CreateReplicationSet.html).
   419  func (o ReplicationSetOutput) Tags() pulumi.StringMapOutput {
   420  	return o.ApplyT(func(v *ReplicationSet) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   421  }
   422  
   423  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   424  //
   425  // Deprecated: Please use `tags` instead.
   426  func (o ReplicationSetOutput) TagsAll() pulumi.StringMapOutput {
   427  	return o.ApplyT(func(v *ReplicationSet) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   428  }
   429  
   430  type ReplicationSetArrayOutput struct{ *pulumi.OutputState }
   431  
   432  func (ReplicationSetArrayOutput) ElementType() reflect.Type {
   433  	return reflect.TypeOf((*[]*ReplicationSet)(nil)).Elem()
   434  }
   435  
   436  func (o ReplicationSetArrayOutput) ToReplicationSetArrayOutput() ReplicationSetArrayOutput {
   437  	return o
   438  }
   439  
   440  func (o ReplicationSetArrayOutput) ToReplicationSetArrayOutputWithContext(ctx context.Context) ReplicationSetArrayOutput {
   441  	return o
   442  }
   443  
   444  func (o ReplicationSetArrayOutput) Index(i pulumi.IntInput) ReplicationSetOutput {
   445  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ReplicationSet {
   446  		return vs[0].([]*ReplicationSet)[vs[1].(int)]
   447  	}).(ReplicationSetOutput)
   448  }
   449  
   450  type ReplicationSetMapOutput struct{ *pulumi.OutputState }
   451  
   452  func (ReplicationSetMapOutput) ElementType() reflect.Type {
   453  	return reflect.TypeOf((*map[string]*ReplicationSet)(nil)).Elem()
   454  }
   455  
   456  func (o ReplicationSetMapOutput) ToReplicationSetMapOutput() ReplicationSetMapOutput {
   457  	return o
   458  }
   459  
   460  func (o ReplicationSetMapOutput) ToReplicationSetMapOutputWithContext(ctx context.Context) ReplicationSetMapOutput {
   461  	return o
   462  }
   463  
   464  func (o ReplicationSetMapOutput) MapIndex(k pulumi.StringInput) ReplicationSetOutput {
   465  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ReplicationSet {
   466  		return vs[0].(map[string]*ReplicationSet)[vs[1].(string)]
   467  	}).(ReplicationSetOutput)
   468  }
   469  
   470  func init() {
   471  	pulumi.RegisterInputType(reflect.TypeOf((*ReplicationSetInput)(nil)).Elem(), &ReplicationSet{})
   472  	pulumi.RegisterInputType(reflect.TypeOf((*ReplicationSetArrayInput)(nil)).Elem(), ReplicationSetArray{})
   473  	pulumi.RegisterInputType(reflect.TypeOf((*ReplicationSetMapInput)(nil)).Elem(), ReplicationSetMap{})
   474  	pulumi.RegisterOutputType(ReplicationSetOutput{})
   475  	pulumi.RegisterOutputType(ReplicationSetArrayOutput{})
   476  	pulumi.RegisterOutputType(ReplicationSetMapOutput{})
   477  }