github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ssmcontacts/contactChannel.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 ssmcontacts
     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 an AWS SSM Contacts Contact Channel.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### Basic Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmcontacts"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			_, err := ssmcontacts.NewContactChannel(ctx, "example", &ssmcontacts.ContactChannelArgs{
    35  //				ContactId: pulumi.String("arn:aws:ssm-contacts:us-west-2:123456789012:contact/contactalias"),
    36  //				DeliveryAddress: &ssmcontacts.ContactChannelDeliveryAddressArgs{
    37  //					SimpleAddress: pulumi.String("email@example.com"),
    38  //				},
    39  //				Name: pulumi.String("Example contact channel"),
    40  //				Type: pulumi.String("EMAIL"),
    41  //			})
    42  //			if err != nil {
    43  //				return err
    44  //			}
    45  //			return nil
    46  //		})
    47  //	}
    48  //
    49  // ```
    50  // <!--End PulumiCodeChooser -->
    51  //
    52  // ### Usage with SSM Contact
    53  //
    54  // <!--Start PulumiCodeChooser -->
    55  // ```go
    56  // package main
    57  //
    58  // import (
    59  //
    60  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssmcontacts"
    61  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    62  //
    63  // )
    64  //
    65  //	func main() {
    66  //		pulumi.Run(func(ctx *pulumi.Context) error {
    67  //			exampleContact, err := ssmcontacts.NewContact(ctx, "example_contact", &ssmcontacts.ContactArgs{
    68  //				Alias: pulumi.String("example_contact"),
    69  //				Type:  pulumi.String("PERSONAL"),
    70  //			})
    71  //			if err != nil {
    72  //				return err
    73  //			}
    74  //			_, err = ssmcontacts.NewContactChannel(ctx, "example", &ssmcontacts.ContactChannelArgs{
    75  //				ContactId: exampleContact.Arn,
    76  //				DeliveryAddress: &ssmcontacts.ContactChannelDeliveryAddressArgs{
    77  //					SimpleAddress: pulumi.String("email@example.com"),
    78  //				},
    79  //				Name: pulumi.String("Example contact channel"),
    80  //				Type: pulumi.String("EMAIL"),
    81  //			})
    82  //			if err != nil {
    83  //				return err
    84  //			}
    85  //			return nil
    86  //		})
    87  //	}
    88  //
    89  // ```
    90  // <!--End PulumiCodeChooser -->
    91  //
    92  // ## Import
    93  //
    94  // Using `pulumi import`, import SSM Contact Channel using the `ARN`. For example:
    95  //
    96  // ```sh
    97  // $ pulumi import aws:ssmcontacts/contactChannel:ContactChannel example arn:aws:ssm-contacts:us-west-2:123456789012:contact-channel/example
    98  // ```
    99  type ContactChannel struct {
   100  	pulumi.CustomResourceState
   101  
   102  	// Whether the contact channel is activated. The contact channel must be activated to use it to engage the contact. One of `ACTIVATED` or `NOT_ACTIVATED`.
   103  	ActivationStatus pulumi.StringOutput `pulumi:"activationStatus"`
   104  	// Amazon Resource Name (ARN) of the contact channel.
   105  	Arn pulumi.StringOutput `pulumi:"arn"`
   106  	// Amazon Resource Name (ARN) of the AWS SSM Contact that the contact channel belongs to.
   107  	ContactId pulumi.StringOutput `pulumi:"contactId"`
   108  	// Block that contains contact engagement details. See details below.
   109  	DeliveryAddress ContactChannelDeliveryAddressOutput `pulumi:"deliveryAddress"`
   110  	// Name of the contact channel. Must be between 1 and 255 characters, and may contain alphanumerics, underscores (`_`), hyphens (`-`), periods (`.`), and spaces.
   111  	Name pulumi.StringOutput `pulumi:"name"`
   112  	// Type of the contact channel. One of `SMS`, `VOICE` or `EMAIL`.
   113  	Type pulumi.StringOutput `pulumi:"type"`
   114  }
   115  
   116  // NewContactChannel registers a new resource with the given unique name, arguments, and options.
   117  func NewContactChannel(ctx *pulumi.Context,
   118  	name string, args *ContactChannelArgs, opts ...pulumi.ResourceOption) (*ContactChannel, error) {
   119  	if args == nil {
   120  		return nil, errors.New("missing one or more required arguments")
   121  	}
   122  
   123  	if args.ContactId == nil {
   124  		return nil, errors.New("invalid value for required argument 'ContactId'")
   125  	}
   126  	if args.DeliveryAddress == nil {
   127  		return nil, errors.New("invalid value for required argument 'DeliveryAddress'")
   128  	}
   129  	if args.Type == nil {
   130  		return nil, errors.New("invalid value for required argument 'Type'")
   131  	}
   132  	opts = internal.PkgResourceDefaultOpts(opts)
   133  	var resource ContactChannel
   134  	err := ctx.RegisterResource("aws:ssmcontacts/contactChannel:ContactChannel", name, args, &resource, opts...)
   135  	if err != nil {
   136  		return nil, err
   137  	}
   138  	return &resource, nil
   139  }
   140  
   141  // GetContactChannel gets an existing ContactChannel resource's state with the given name, ID, and optional
   142  // state properties that are used to uniquely qualify the lookup (nil if not required).
   143  func GetContactChannel(ctx *pulumi.Context,
   144  	name string, id pulumi.IDInput, state *ContactChannelState, opts ...pulumi.ResourceOption) (*ContactChannel, error) {
   145  	var resource ContactChannel
   146  	err := ctx.ReadResource("aws:ssmcontacts/contactChannel:ContactChannel", name, id, state, &resource, opts...)
   147  	if err != nil {
   148  		return nil, err
   149  	}
   150  	return &resource, nil
   151  }
   152  
   153  // Input properties used for looking up and filtering ContactChannel resources.
   154  type contactChannelState struct {
   155  	// Whether the contact channel is activated. The contact channel must be activated to use it to engage the contact. One of `ACTIVATED` or `NOT_ACTIVATED`.
   156  	ActivationStatus *string `pulumi:"activationStatus"`
   157  	// Amazon Resource Name (ARN) of the contact channel.
   158  	Arn *string `pulumi:"arn"`
   159  	// Amazon Resource Name (ARN) of the AWS SSM Contact that the contact channel belongs to.
   160  	ContactId *string `pulumi:"contactId"`
   161  	// Block that contains contact engagement details. See details below.
   162  	DeliveryAddress *ContactChannelDeliveryAddress `pulumi:"deliveryAddress"`
   163  	// Name of the contact channel. Must be between 1 and 255 characters, and may contain alphanumerics, underscores (`_`), hyphens (`-`), periods (`.`), and spaces.
   164  	Name *string `pulumi:"name"`
   165  	// Type of the contact channel. One of `SMS`, `VOICE` or `EMAIL`.
   166  	Type *string `pulumi:"type"`
   167  }
   168  
   169  type ContactChannelState struct {
   170  	// Whether the contact channel is activated. The contact channel must be activated to use it to engage the contact. One of `ACTIVATED` or `NOT_ACTIVATED`.
   171  	ActivationStatus pulumi.StringPtrInput
   172  	// Amazon Resource Name (ARN) of the contact channel.
   173  	Arn pulumi.StringPtrInput
   174  	// Amazon Resource Name (ARN) of the AWS SSM Contact that the contact channel belongs to.
   175  	ContactId pulumi.StringPtrInput
   176  	// Block that contains contact engagement details. See details below.
   177  	DeliveryAddress ContactChannelDeliveryAddressPtrInput
   178  	// Name of the contact channel. Must be between 1 and 255 characters, and may contain alphanumerics, underscores (`_`), hyphens (`-`), periods (`.`), and spaces.
   179  	Name pulumi.StringPtrInput
   180  	// Type of the contact channel. One of `SMS`, `VOICE` or `EMAIL`.
   181  	Type pulumi.StringPtrInput
   182  }
   183  
   184  func (ContactChannelState) ElementType() reflect.Type {
   185  	return reflect.TypeOf((*contactChannelState)(nil)).Elem()
   186  }
   187  
   188  type contactChannelArgs struct {
   189  	// Amazon Resource Name (ARN) of the AWS SSM Contact that the contact channel belongs to.
   190  	ContactId string `pulumi:"contactId"`
   191  	// Block that contains contact engagement details. See details below.
   192  	DeliveryAddress ContactChannelDeliveryAddress `pulumi:"deliveryAddress"`
   193  	// Name of the contact channel. Must be between 1 and 255 characters, and may contain alphanumerics, underscores (`_`), hyphens (`-`), periods (`.`), and spaces.
   194  	Name *string `pulumi:"name"`
   195  	// Type of the contact channel. One of `SMS`, `VOICE` or `EMAIL`.
   196  	Type string `pulumi:"type"`
   197  }
   198  
   199  // The set of arguments for constructing a ContactChannel resource.
   200  type ContactChannelArgs struct {
   201  	// Amazon Resource Name (ARN) of the AWS SSM Contact that the contact channel belongs to.
   202  	ContactId pulumi.StringInput
   203  	// Block that contains contact engagement details. See details below.
   204  	DeliveryAddress ContactChannelDeliveryAddressInput
   205  	// Name of the contact channel. Must be between 1 and 255 characters, and may contain alphanumerics, underscores (`_`), hyphens (`-`), periods (`.`), and spaces.
   206  	Name pulumi.StringPtrInput
   207  	// Type of the contact channel. One of `SMS`, `VOICE` or `EMAIL`.
   208  	Type pulumi.StringInput
   209  }
   210  
   211  func (ContactChannelArgs) ElementType() reflect.Type {
   212  	return reflect.TypeOf((*contactChannelArgs)(nil)).Elem()
   213  }
   214  
   215  type ContactChannelInput interface {
   216  	pulumi.Input
   217  
   218  	ToContactChannelOutput() ContactChannelOutput
   219  	ToContactChannelOutputWithContext(ctx context.Context) ContactChannelOutput
   220  }
   221  
   222  func (*ContactChannel) ElementType() reflect.Type {
   223  	return reflect.TypeOf((**ContactChannel)(nil)).Elem()
   224  }
   225  
   226  func (i *ContactChannel) ToContactChannelOutput() ContactChannelOutput {
   227  	return i.ToContactChannelOutputWithContext(context.Background())
   228  }
   229  
   230  func (i *ContactChannel) ToContactChannelOutputWithContext(ctx context.Context) ContactChannelOutput {
   231  	return pulumi.ToOutputWithContext(ctx, i).(ContactChannelOutput)
   232  }
   233  
   234  // ContactChannelArrayInput is an input type that accepts ContactChannelArray and ContactChannelArrayOutput values.
   235  // You can construct a concrete instance of `ContactChannelArrayInput` via:
   236  //
   237  //	ContactChannelArray{ ContactChannelArgs{...} }
   238  type ContactChannelArrayInput interface {
   239  	pulumi.Input
   240  
   241  	ToContactChannelArrayOutput() ContactChannelArrayOutput
   242  	ToContactChannelArrayOutputWithContext(context.Context) ContactChannelArrayOutput
   243  }
   244  
   245  type ContactChannelArray []ContactChannelInput
   246  
   247  func (ContactChannelArray) ElementType() reflect.Type {
   248  	return reflect.TypeOf((*[]*ContactChannel)(nil)).Elem()
   249  }
   250  
   251  func (i ContactChannelArray) ToContactChannelArrayOutput() ContactChannelArrayOutput {
   252  	return i.ToContactChannelArrayOutputWithContext(context.Background())
   253  }
   254  
   255  func (i ContactChannelArray) ToContactChannelArrayOutputWithContext(ctx context.Context) ContactChannelArrayOutput {
   256  	return pulumi.ToOutputWithContext(ctx, i).(ContactChannelArrayOutput)
   257  }
   258  
   259  // ContactChannelMapInput is an input type that accepts ContactChannelMap and ContactChannelMapOutput values.
   260  // You can construct a concrete instance of `ContactChannelMapInput` via:
   261  //
   262  //	ContactChannelMap{ "key": ContactChannelArgs{...} }
   263  type ContactChannelMapInput interface {
   264  	pulumi.Input
   265  
   266  	ToContactChannelMapOutput() ContactChannelMapOutput
   267  	ToContactChannelMapOutputWithContext(context.Context) ContactChannelMapOutput
   268  }
   269  
   270  type ContactChannelMap map[string]ContactChannelInput
   271  
   272  func (ContactChannelMap) ElementType() reflect.Type {
   273  	return reflect.TypeOf((*map[string]*ContactChannel)(nil)).Elem()
   274  }
   275  
   276  func (i ContactChannelMap) ToContactChannelMapOutput() ContactChannelMapOutput {
   277  	return i.ToContactChannelMapOutputWithContext(context.Background())
   278  }
   279  
   280  func (i ContactChannelMap) ToContactChannelMapOutputWithContext(ctx context.Context) ContactChannelMapOutput {
   281  	return pulumi.ToOutputWithContext(ctx, i).(ContactChannelMapOutput)
   282  }
   283  
   284  type ContactChannelOutput struct{ *pulumi.OutputState }
   285  
   286  func (ContactChannelOutput) ElementType() reflect.Type {
   287  	return reflect.TypeOf((**ContactChannel)(nil)).Elem()
   288  }
   289  
   290  func (o ContactChannelOutput) ToContactChannelOutput() ContactChannelOutput {
   291  	return o
   292  }
   293  
   294  func (o ContactChannelOutput) ToContactChannelOutputWithContext(ctx context.Context) ContactChannelOutput {
   295  	return o
   296  }
   297  
   298  // Whether the contact channel is activated. The contact channel must be activated to use it to engage the contact. One of `ACTIVATED` or `NOT_ACTIVATED`.
   299  func (o ContactChannelOutput) ActivationStatus() pulumi.StringOutput {
   300  	return o.ApplyT(func(v *ContactChannel) pulumi.StringOutput { return v.ActivationStatus }).(pulumi.StringOutput)
   301  }
   302  
   303  // Amazon Resource Name (ARN) of the contact channel.
   304  func (o ContactChannelOutput) Arn() pulumi.StringOutput {
   305  	return o.ApplyT(func(v *ContactChannel) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   306  }
   307  
   308  // Amazon Resource Name (ARN) of the AWS SSM Contact that the contact channel belongs to.
   309  func (o ContactChannelOutput) ContactId() pulumi.StringOutput {
   310  	return o.ApplyT(func(v *ContactChannel) pulumi.StringOutput { return v.ContactId }).(pulumi.StringOutput)
   311  }
   312  
   313  // Block that contains contact engagement details. See details below.
   314  func (o ContactChannelOutput) DeliveryAddress() ContactChannelDeliveryAddressOutput {
   315  	return o.ApplyT(func(v *ContactChannel) ContactChannelDeliveryAddressOutput { return v.DeliveryAddress }).(ContactChannelDeliveryAddressOutput)
   316  }
   317  
   318  // Name of the contact channel. Must be between 1 and 255 characters, and may contain alphanumerics, underscores (`_`), hyphens (`-`), periods (`.`), and spaces.
   319  func (o ContactChannelOutput) Name() pulumi.StringOutput {
   320  	return o.ApplyT(func(v *ContactChannel) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   321  }
   322  
   323  // Type of the contact channel. One of `SMS`, `VOICE` or `EMAIL`.
   324  func (o ContactChannelOutput) Type() pulumi.StringOutput {
   325  	return o.ApplyT(func(v *ContactChannel) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
   326  }
   327  
   328  type ContactChannelArrayOutput struct{ *pulumi.OutputState }
   329  
   330  func (ContactChannelArrayOutput) ElementType() reflect.Type {
   331  	return reflect.TypeOf((*[]*ContactChannel)(nil)).Elem()
   332  }
   333  
   334  func (o ContactChannelArrayOutput) ToContactChannelArrayOutput() ContactChannelArrayOutput {
   335  	return o
   336  }
   337  
   338  func (o ContactChannelArrayOutput) ToContactChannelArrayOutputWithContext(ctx context.Context) ContactChannelArrayOutput {
   339  	return o
   340  }
   341  
   342  func (o ContactChannelArrayOutput) Index(i pulumi.IntInput) ContactChannelOutput {
   343  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ContactChannel {
   344  		return vs[0].([]*ContactChannel)[vs[1].(int)]
   345  	}).(ContactChannelOutput)
   346  }
   347  
   348  type ContactChannelMapOutput struct{ *pulumi.OutputState }
   349  
   350  func (ContactChannelMapOutput) ElementType() reflect.Type {
   351  	return reflect.TypeOf((*map[string]*ContactChannel)(nil)).Elem()
   352  }
   353  
   354  func (o ContactChannelMapOutput) ToContactChannelMapOutput() ContactChannelMapOutput {
   355  	return o
   356  }
   357  
   358  func (o ContactChannelMapOutput) ToContactChannelMapOutputWithContext(ctx context.Context) ContactChannelMapOutput {
   359  	return o
   360  }
   361  
   362  func (o ContactChannelMapOutput) MapIndex(k pulumi.StringInput) ContactChannelOutput {
   363  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ContactChannel {
   364  		return vs[0].(map[string]*ContactChannel)[vs[1].(string)]
   365  	}).(ContactChannelOutput)
   366  }
   367  
   368  func init() {
   369  	pulumi.RegisterInputType(reflect.TypeOf((*ContactChannelInput)(nil)).Elem(), &ContactChannel{})
   370  	pulumi.RegisterInputType(reflect.TypeOf((*ContactChannelArrayInput)(nil)).Elem(), ContactChannelArray{})
   371  	pulumi.RegisterInputType(reflect.TypeOf((*ContactChannelMapInput)(nil)).Elem(), ContactChannelMap{})
   372  	pulumi.RegisterOutputType(ContactChannelOutput{})
   373  	pulumi.RegisterOutputType(ContactChannelArrayOutput{})
   374  	pulumi.RegisterOutputType(ContactChannelMapOutput{})
   375  }