github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/synthetics/groupAssociation.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 synthetics
     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 Synthetics Group Association resource.
    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/synthetics"
    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 := synthetics.NewGroupAssociation(ctx, "example", &synthetics.GroupAssociationArgs{
    35  //				GroupName: pulumi.Any(exampleAwsSyntheticsGroup.Name),
    36  //				CanaryArn: pulumi.Any(exampleAwsSyntheticsCanary.Arn),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ## Import
    49  //
    50  // Using `pulumi import`, import CloudWatch Synthetics Group Association using the `canary_arn,group_name`. For example:
    51  //
    52  // ```sh
    53  // $ pulumi import aws:synthetics/groupAssociation:GroupAssociation example arn:aws:synthetics:us-west-2:123456789012:canary:tf-acc-test-abcd1234,examplename
    54  // ```
    55  type GroupAssociation struct {
    56  	pulumi.CustomResourceState
    57  
    58  	// ARN of the canary.
    59  	CanaryArn pulumi.StringOutput `pulumi:"canaryArn"`
    60  	GroupArn  pulumi.StringOutput `pulumi:"groupArn"`
    61  	// ID of the Group.
    62  	GroupId pulumi.StringOutput `pulumi:"groupId"`
    63  	// Name of the group that the canary will be associated with.
    64  	GroupName pulumi.StringOutput `pulumi:"groupName"`
    65  }
    66  
    67  // NewGroupAssociation registers a new resource with the given unique name, arguments, and options.
    68  func NewGroupAssociation(ctx *pulumi.Context,
    69  	name string, args *GroupAssociationArgs, opts ...pulumi.ResourceOption) (*GroupAssociation, error) {
    70  	if args == nil {
    71  		return nil, errors.New("missing one or more required arguments")
    72  	}
    73  
    74  	if args.CanaryArn == nil {
    75  		return nil, errors.New("invalid value for required argument 'CanaryArn'")
    76  	}
    77  	if args.GroupName == nil {
    78  		return nil, errors.New("invalid value for required argument 'GroupName'")
    79  	}
    80  	opts = internal.PkgResourceDefaultOpts(opts)
    81  	var resource GroupAssociation
    82  	err := ctx.RegisterResource("aws:synthetics/groupAssociation:GroupAssociation", name, args, &resource, opts...)
    83  	if err != nil {
    84  		return nil, err
    85  	}
    86  	return &resource, nil
    87  }
    88  
    89  // GetGroupAssociation gets an existing GroupAssociation resource's state with the given name, ID, and optional
    90  // state properties that are used to uniquely qualify the lookup (nil if not required).
    91  func GetGroupAssociation(ctx *pulumi.Context,
    92  	name string, id pulumi.IDInput, state *GroupAssociationState, opts ...pulumi.ResourceOption) (*GroupAssociation, error) {
    93  	var resource GroupAssociation
    94  	err := ctx.ReadResource("aws:synthetics/groupAssociation:GroupAssociation", name, id, state, &resource, opts...)
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	return &resource, nil
    99  }
   100  
   101  // Input properties used for looking up and filtering GroupAssociation resources.
   102  type groupAssociationState struct {
   103  	// ARN of the canary.
   104  	CanaryArn *string `pulumi:"canaryArn"`
   105  	GroupArn  *string `pulumi:"groupArn"`
   106  	// ID of the Group.
   107  	GroupId *string `pulumi:"groupId"`
   108  	// Name of the group that the canary will be associated with.
   109  	GroupName *string `pulumi:"groupName"`
   110  }
   111  
   112  type GroupAssociationState struct {
   113  	// ARN of the canary.
   114  	CanaryArn pulumi.StringPtrInput
   115  	GroupArn  pulumi.StringPtrInput
   116  	// ID of the Group.
   117  	GroupId pulumi.StringPtrInput
   118  	// Name of the group that the canary will be associated with.
   119  	GroupName pulumi.StringPtrInput
   120  }
   121  
   122  func (GroupAssociationState) ElementType() reflect.Type {
   123  	return reflect.TypeOf((*groupAssociationState)(nil)).Elem()
   124  }
   125  
   126  type groupAssociationArgs struct {
   127  	// ARN of the canary.
   128  	CanaryArn string `pulumi:"canaryArn"`
   129  	// Name of the group that the canary will be associated with.
   130  	GroupName string `pulumi:"groupName"`
   131  }
   132  
   133  // The set of arguments for constructing a GroupAssociation resource.
   134  type GroupAssociationArgs struct {
   135  	// ARN of the canary.
   136  	CanaryArn pulumi.StringInput
   137  	// Name of the group that the canary will be associated with.
   138  	GroupName pulumi.StringInput
   139  }
   140  
   141  func (GroupAssociationArgs) ElementType() reflect.Type {
   142  	return reflect.TypeOf((*groupAssociationArgs)(nil)).Elem()
   143  }
   144  
   145  type GroupAssociationInput interface {
   146  	pulumi.Input
   147  
   148  	ToGroupAssociationOutput() GroupAssociationOutput
   149  	ToGroupAssociationOutputWithContext(ctx context.Context) GroupAssociationOutput
   150  }
   151  
   152  func (*GroupAssociation) ElementType() reflect.Type {
   153  	return reflect.TypeOf((**GroupAssociation)(nil)).Elem()
   154  }
   155  
   156  func (i *GroupAssociation) ToGroupAssociationOutput() GroupAssociationOutput {
   157  	return i.ToGroupAssociationOutputWithContext(context.Background())
   158  }
   159  
   160  func (i *GroupAssociation) ToGroupAssociationOutputWithContext(ctx context.Context) GroupAssociationOutput {
   161  	return pulumi.ToOutputWithContext(ctx, i).(GroupAssociationOutput)
   162  }
   163  
   164  // GroupAssociationArrayInput is an input type that accepts GroupAssociationArray and GroupAssociationArrayOutput values.
   165  // You can construct a concrete instance of `GroupAssociationArrayInput` via:
   166  //
   167  //	GroupAssociationArray{ GroupAssociationArgs{...} }
   168  type GroupAssociationArrayInput interface {
   169  	pulumi.Input
   170  
   171  	ToGroupAssociationArrayOutput() GroupAssociationArrayOutput
   172  	ToGroupAssociationArrayOutputWithContext(context.Context) GroupAssociationArrayOutput
   173  }
   174  
   175  type GroupAssociationArray []GroupAssociationInput
   176  
   177  func (GroupAssociationArray) ElementType() reflect.Type {
   178  	return reflect.TypeOf((*[]*GroupAssociation)(nil)).Elem()
   179  }
   180  
   181  func (i GroupAssociationArray) ToGroupAssociationArrayOutput() GroupAssociationArrayOutput {
   182  	return i.ToGroupAssociationArrayOutputWithContext(context.Background())
   183  }
   184  
   185  func (i GroupAssociationArray) ToGroupAssociationArrayOutputWithContext(ctx context.Context) GroupAssociationArrayOutput {
   186  	return pulumi.ToOutputWithContext(ctx, i).(GroupAssociationArrayOutput)
   187  }
   188  
   189  // GroupAssociationMapInput is an input type that accepts GroupAssociationMap and GroupAssociationMapOutput values.
   190  // You can construct a concrete instance of `GroupAssociationMapInput` via:
   191  //
   192  //	GroupAssociationMap{ "key": GroupAssociationArgs{...} }
   193  type GroupAssociationMapInput interface {
   194  	pulumi.Input
   195  
   196  	ToGroupAssociationMapOutput() GroupAssociationMapOutput
   197  	ToGroupAssociationMapOutputWithContext(context.Context) GroupAssociationMapOutput
   198  }
   199  
   200  type GroupAssociationMap map[string]GroupAssociationInput
   201  
   202  func (GroupAssociationMap) ElementType() reflect.Type {
   203  	return reflect.TypeOf((*map[string]*GroupAssociation)(nil)).Elem()
   204  }
   205  
   206  func (i GroupAssociationMap) ToGroupAssociationMapOutput() GroupAssociationMapOutput {
   207  	return i.ToGroupAssociationMapOutputWithContext(context.Background())
   208  }
   209  
   210  func (i GroupAssociationMap) ToGroupAssociationMapOutputWithContext(ctx context.Context) GroupAssociationMapOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(GroupAssociationMapOutput)
   212  }
   213  
   214  type GroupAssociationOutput struct{ *pulumi.OutputState }
   215  
   216  func (GroupAssociationOutput) ElementType() reflect.Type {
   217  	return reflect.TypeOf((**GroupAssociation)(nil)).Elem()
   218  }
   219  
   220  func (o GroupAssociationOutput) ToGroupAssociationOutput() GroupAssociationOutput {
   221  	return o
   222  }
   223  
   224  func (o GroupAssociationOutput) ToGroupAssociationOutputWithContext(ctx context.Context) GroupAssociationOutput {
   225  	return o
   226  }
   227  
   228  // ARN of the canary.
   229  func (o GroupAssociationOutput) CanaryArn() pulumi.StringOutput {
   230  	return o.ApplyT(func(v *GroupAssociation) pulumi.StringOutput { return v.CanaryArn }).(pulumi.StringOutput)
   231  }
   232  
   233  func (o GroupAssociationOutput) GroupArn() pulumi.StringOutput {
   234  	return o.ApplyT(func(v *GroupAssociation) pulumi.StringOutput { return v.GroupArn }).(pulumi.StringOutput)
   235  }
   236  
   237  // ID of the Group.
   238  func (o GroupAssociationOutput) GroupId() pulumi.StringOutput {
   239  	return o.ApplyT(func(v *GroupAssociation) pulumi.StringOutput { return v.GroupId }).(pulumi.StringOutput)
   240  }
   241  
   242  // Name of the group that the canary will be associated with.
   243  func (o GroupAssociationOutput) GroupName() pulumi.StringOutput {
   244  	return o.ApplyT(func(v *GroupAssociation) pulumi.StringOutput { return v.GroupName }).(pulumi.StringOutput)
   245  }
   246  
   247  type GroupAssociationArrayOutput struct{ *pulumi.OutputState }
   248  
   249  func (GroupAssociationArrayOutput) ElementType() reflect.Type {
   250  	return reflect.TypeOf((*[]*GroupAssociation)(nil)).Elem()
   251  }
   252  
   253  func (o GroupAssociationArrayOutput) ToGroupAssociationArrayOutput() GroupAssociationArrayOutput {
   254  	return o
   255  }
   256  
   257  func (o GroupAssociationArrayOutput) ToGroupAssociationArrayOutputWithContext(ctx context.Context) GroupAssociationArrayOutput {
   258  	return o
   259  }
   260  
   261  func (o GroupAssociationArrayOutput) Index(i pulumi.IntInput) GroupAssociationOutput {
   262  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *GroupAssociation {
   263  		return vs[0].([]*GroupAssociation)[vs[1].(int)]
   264  	}).(GroupAssociationOutput)
   265  }
   266  
   267  type GroupAssociationMapOutput struct{ *pulumi.OutputState }
   268  
   269  func (GroupAssociationMapOutput) ElementType() reflect.Type {
   270  	return reflect.TypeOf((*map[string]*GroupAssociation)(nil)).Elem()
   271  }
   272  
   273  func (o GroupAssociationMapOutput) ToGroupAssociationMapOutput() GroupAssociationMapOutput {
   274  	return o
   275  }
   276  
   277  func (o GroupAssociationMapOutput) ToGroupAssociationMapOutputWithContext(ctx context.Context) GroupAssociationMapOutput {
   278  	return o
   279  }
   280  
   281  func (o GroupAssociationMapOutput) MapIndex(k pulumi.StringInput) GroupAssociationOutput {
   282  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *GroupAssociation {
   283  		return vs[0].(map[string]*GroupAssociation)[vs[1].(string)]
   284  	}).(GroupAssociationOutput)
   285  }
   286  
   287  func init() {
   288  	pulumi.RegisterInputType(reflect.TypeOf((*GroupAssociationInput)(nil)).Elem(), &GroupAssociation{})
   289  	pulumi.RegisterInputType(reflect.TypeOf((*GroupAssociationArrayInput)(nil)).Elem(), GroupAssociationArray{})
   290  	pulumi.RegisterInputType(reflect.TypeOf((*GroupAssociationMapInput)(nil)).Elem(), GroupAssociationMap{})
   291  	pulumi.RegisterOutputType(GroupAssociationOutput{})
   292  	pulumi.RegisterOutputType(GroupAssociationArrayOutput{})
   293  	pulumi.RegisterOutputType(GroupAssociationMapOutput{})
   294  }