github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iot/thingGroup.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 iot
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Manages an AWS IoT Thing Group.
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iot"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			parent, err := iot.NewThingGroup(ctx, "parent", &iot.ThingGroupArgs{
    32  //				Name: pulumi.String("parent"),
    33  //			})
    34  //			if err != nil {
    35  //				return err
    36  //			}
    37  //			_, err = iot.NewThingGroup(ctx, "example", &iot.ThingGroupArgs{
    38  //				Name:            pulumi.String("example"),
    39  //				ParentGroupName: parent.Name,
    40  //				Properties: &iot.ThingGroupPropertiesArgs{
    41  //					AttributePayload: &iot.ThingGroupPropertiesAttributePayloadArgs{
    42  //						Attributes: pulumi.StringMap{
    43  //							"One": pulumi.String("11111"),
    44  //							"Two": pulumi.String("TwoTwo"),
    45  //						},
    46  //					},
    47  //					Description: pulumi.String("This is my thing group"),
    48  //				},
    49  //				Tags: pulumi.StringMap{
    50  //					"managed": pulumi.String("true"),
    51  //				},
    52  //			})
    53  //			if err != nil {
    54  //				return err
    55  //			}
    56  //			return nil
    57  //		})
    58  //	}
    59  //
    60  // ```
    61  // <!--End PulumiCodeChooser -->
    62  //
    63  // ## Import
    64  //
    65  // Using `pulumi import`, import IoT Things Groups using the name. For example:
    66  //
    67  // ```sh
    68  // $ pulumi import aws:iot/thingGroup:ThingGroup example example
    69  // ```
    70  type ThingGroup struct {
    71  	pulumi.CustomResourceState
    72  
    73  	// The ARN of the Thing Group.
    74  	Arn       pulumi.StringOutput           `pulumi:"arn"`
    75  	Metadatas ThingGroupMetadataArrayOutput `pulumi:"metadatas"`
    76  	// The name of the Thing Group.
    77  	Name pulumi.StringOutput `pulumi:"name"`
    78  	// The name of the parent Thing Group.
    79  	ParentGroupName pulumi.StringPtrOutput `pulumi:"parentGroupName"`
    80  	// The Thing Group properties. Defined below.
    81  	Properties ThingGroupPropertiesPtrOutput `pulumi:"properties"`
    82  	// Key-value mapping of resource tags
    83  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    84  	// Deprecated: Please use `tags` instead.
    85  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    86  	// The current version of the Thing Group record in the registry.
    87  	Version pulumi.IntOutput `pulumi:"version"`
    88  }
    89  
    90  // NewThingGroup registers a new resource with the given unique name, arguments, and options.
    91  func NewThingGroup(ctx *pulumi.Context,
    92  	name string, args *ThingGroupArgs, opts ...pulumi.ResourceOption) (*ThingGroup, error) {
    93  	if args == nil {
    94  		args = &ThingGroupArgs{}
    95  	}
    96  
    97  	opts = internal.PkgResourceDefaultOpts(opts)
    98  	var resource ThingGroup
    99  	err := ctx.RegisterResource("aws:iot/thingGroup:ThingGroup", name, args, &resource, opts...)
   100  	if err != nil {
   101  		return nil, err
   102  	}
   103  	return &resource, nil
   104  }
   105  
   106  // GetThingGroup gets an existing ThingGroup resource's state with the given name, ID, and optional
   107  // state properties that are used to uniquely qualify the lookup (nil if not required).
   108  func GetThingGroup(ctx *pulumi.Context,
   109  	name string, id pulumi.IDInput, state *ThingGroupState, opts ...pulumi.ResourceOption) (*ThingGroup, error) {
   110  	var resource ThingGroup
   111  	err := ctx.ReadResource("aws:iot/thingGroup:ThingGroup", name, id, state, &resource, opts...)
   112  	if err != nil {
   113  		return nil, err
   114  	}
   115  	return &resource, nil
   116  }
   117  
   118  // Input properties used for looking up and filtering ThingGroup resources.
   119  type thingGroupState struct {
   120  	// The ARN of the Thing Group.
   121  	Arn       *string              `pulumi:"arn"`
   122  	Metadatas []ThingGroupMetadata `pulumi:"metadatas"`
   123  	// The name of the Thing Group.
   124  	Name *string `pulumi:"name"`
   125  	// The name of the parent Thing Group.
   126  	ParentGroupName *string `pulumi:"parentGroupName"`
   127  	// The Thing Group properties. Defined below.
   128  	Properties *ThingGroupProperties `pulumi:"properties"`
   129  	// Key-value mapping of resource tags
   130  	Tags map[string]string `pulumi:"tags"`
   131  	// Deprecated: Please use `tags` instead.
   132  	TagsAll map[string]string `pulumi:"tagsAll"`
   133  	// The current version of the Thing Group record in the registry.
   134  	Version *int `pulumi:"version"`
   135  }
   136  
   137  type ThingGroupState struct {
   138  	// The ARN of the Thing Group.
   139  	Arn       pulumi.StringPtrInput
   140  	Metadatas ThingGroupMetadataArrayInput
   141  	// The name of the Thing Group.
   142  	Name pulumi.StringPtrInput
   143  	// The name of the parent Thing Group.
   144  	ParentGroupName pulumi.StringPtrInput
   145  	// The Thing Group properties. Defined below.
   146  	Properties ThingGroupPropertiesPtrInput
   147  	// Key-value mapping of resource tags
   148  	Tags pulumi.StringMapInput
   149  	// Deprecated: Please use `tags` instead.
   150  	TagsAll pulumi.StringMapInput
   151  	// The current version of the Thing Group record in the registry.
   152  	Version pulumi.IntPtrInput
   153  }
   154  
   155  func (ThingGroupState) ElementType() reflect.Type {
   156  	return reflect.TypeOf((*thingGroupState)(nil)).Elem()
   157  }
   158  
   159  type thingGroupArgs struct {
   160  	// The name of the Thing Group.
   161  	Name *string `pulumi:"name"`
   162  	// The name of the parent Thing Group.
   163  	ParentGroupName *string `pulumi:"parentGroupName"`
   164  	// The Thing Group properties. Defined below.
   165  	Properties *ThingGroupProperties `pulumi:"properties"`
   166  	// Key-value mapping of resource tags
   167  	Tags map[string]string `pulumi:"tags"`
   168  }
   169  
   170  // The set of arguments for constructing a ThingGroup resource.
   171  type ThingGroupArgs struct {
   172  	// The name of the Thing Group.
   173  	Name pulumi.StringPtrInput
   174  	// The name of the parent Thing Group.
   175  	ParentGroupName pulumi.StringPtrInput
   176  	// The Thing Group properties. Defined below.
   177  	Properties ThingGroupPropertiesPtrInput
   178  	// Key-value mapping of resource tags
   179  	Tags pulumi.StringMapInput
   180  }
   181  
   182  func (ThingGroupArgs) ElementType() reflect.Type {
   183  	return reflect.TypeOf((*thingGroupArgs)(nil)).Elem()
   184  }
   185  
   186  type ThingGroupInput interface {
   187  	pulumi.Input
   188  
   189  	ToThingGroupOutput() ThingGroupOutput
   190  	ToThingGroupOutputWithContext(ctx context.Context) ThingGroupOutput
   191  }
   192  
   193  func (*ThingGroup) ElementType() reflect.Type {
   194  	return reflect.TypeOf((**ThingGroup)(nil)).Elem()
   195  }
   196  
   197  func (i *ThingGroup) ToThingGroupOutput() ThingGroupOutput {
   198  	return i.ToThingGroupOutputWithContext(context.Background())
   199  }
   200  
   201  func (i *ThingGroup) ToThingGroupOutputWithContext(ctx context.Context) ThingGroupOutput {
   202  	return pulumi.ToOutputWithContext(ctx, i).(ThingGroupOutput)
   203  }
   204  
   205  // ThingGroupArrayInput is an input type that accepts ThingGroupArray and ThingGroupArrayOutput values.
   206  // You can construct a concrete instance of `ThingGroupArrayInput` via:
   207  //
   208  //	ThingGroupArray{ ThingGroupArgs{...} }
   209  type ThingGroupArrayInput interface {
   210  	pulumi.Input
   211  
   212  	ToThingGroupArrayOutput() ThingGroupArrayOutput
   213  	ToThingGroupArrayOutputWithContext(context.Context) ThingGroupArrayOutput
   214  }
   215  
   216  type ThingGroupArray []ThingGroupInput
   217  
   218  func (ThingGroupArray) ElementType() reflect.Type {
   219  	return reflect.TypeOf((*[]*ThingGroup)(nil)).Elem()
   220  }
   221  
   222  func (i ThingGroupArray) ToThingGroupArrayOutput() ThingGroupArrayOutput {
   223  	return i.ToThingGroupArrayOutputWithContext(context.Background())
   224  }
   225  
   226  func (i ThingGroupArray) ToThingGroupArrayOutputWithContext(ctx context.Context) ThingGroupArrayOutput {
   227  	return pulumi.ToOutputWithContext(ctx, i).(ThingGroupArrayOutput)
   228  }
   229  
   230  // ThingGroupMapInput is an input type that accepts ThingGroupMap and ThingGroupMapOutput values.
   231  // You can construct a concrete instance of `ThingGroupMapInput` via:
   232  //
   233  //	ThingGroupMap{ "key": ThingGroupArgs{...} }
   234  type ThingGroupMapInput interface {
   235  	pulumi.Input
   236  
   237  	ToThingGroupMapOutput() ThingGroupMapOutput
   238  	ToThingGroupMapOutputWithContext(context.Context) ThingGroupMapOutput
   239  }
   240  
   241  type ThingGroupMap map[string]ThingGroupInput
   242  
   243  func (ThingGroupMap) ElementType() reflect.Type {
   244  	return reflect.TypeOf((*map[string]*ThingGroup)(nil)).Elem()
   245  }
   246  
   247  func (i ThingGroupMap) ToThingGroupMapOutput() ThingGroupMapOutput {
   248  	return i.ToThingGroupMapOutputWithContext(context.Background())
   249  }
   250  
   251  func (i ThingGroupMap) ToThingGroupMapOutputWithContext(ctx context.Context) ThingGroupMapOutput {
   252  	return pulumi.ToOutputWithContext(ctx, i).(ThingGroupMapOutput)
   253  }
   254  
   255  type ThingGroupOutput struct{ *pulumi.OutputState }
   256  
   257  func (ThingGroupOutput) ElementType() reflect.Type {
   258  	return reflect.TypeOf((**ThingGroup)(nil)).Elem()
   259  }
   260  
   261  func (o ThingGroupOutput) ToThingGroupOutput() ThingGroupOutput {
   262  	return o
   263  }
   264  
   265  func (o ThingGroupOutput) ToThingGroupOutputWithContext(ctx context.Context) ThingGroupOutput {
   266  	return o
   267  }
   268  
   269  // The ARN of the Thing Group.
   270  func (o ThingGroupOutput) Arn() pulumi.StringOutput {
   271  	return o.ApplyT(func(v *ThingGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   272  }
   273  
   274  func (o ThingGroupOutput) Metadatas() ThingGroupMetadataArrayOutput {
   275  	return o.ApplyT(func(v *ThingGroup) ThingGroupMetadataArrayOutput { return v.Metadatas }).(ThingGroupMetadataArrayOutput)
   276  }
   277  
   278  // The name of the Thing Group.
   279  func (o ThingGroupOutput) Name() pulumi.StringOutput {
   280  	return o.ApplyT(func(v *ThingGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   281  }
   282  
   283  // The name of the parent Thing Group.
   284  func (o ThingGroupOutput) ParentGroupName() pulumi.StringPtrOutput {
   285  	return o.ApplyT(func(v *ThingGroup) pulumi.StringPtrOutput { return v.ParentGroupName }).(pulumi.StringPtrOutput)
   286  }
   287  
   288  // The Thing Group properties. Defined below.
   289  func (o ThingGroupOutput) Properties() ThingGroupPropertiesPtrOutput {
   290  	return o.ApplyT(func(v *ThingGroup) ThingGroupPropertiesPtrOutput { return v.Properties }).(ThingGroupPropertiesPtrOutput)
   291  }
   292  
   293  // Key-value mapping of resource tags
   294  func (o ThingGroupOutput) Tags() pulumi.StringMapOutput {
   295  	return o.ApplyT(func(v *ThingGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   296  }
   297  
   298  // Deprecated: Please use `tags` instead.
   299  func (o ThingGroupOutput) TagsAll() pulumi.StringMapOutput {
   300  	return o.ApplyT(func(v *ThingGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   301  }
   302  
   303  // The current version of the Thing Group record in the registry.
   304  func (o ThingGroupOutput) Version() pulumi.IntOutput {
   305  	return o.ApplyT(func(v *ThingGroup) pulumi.IntOutput { return v.Version }).(pulumi.IntOutput)
   306  }
   307  
   308  type ThingGroupArrayOutput struct{ *pulumi.OutputState }
   309  
   310  func (ThingGroupArrayOutput) ElementType() reflect.Type {
   311  	return reflect.TypeOf((*[]*ThingGroup)(nil)).Elem()
   312  }
   313  
   314  func (o ThingGroupArrayOutput) ToThingGroupArrayOutput() ThingGroupArrayOutput {
   315  	return o
   316  }
   317  
   318  func (o ThingGroupArrayOutput) ToThingGroupArrayOutputWithContext(ctx context.Context) ThingGroupArrayOutput {
   319  	return o
   320  }
   321  
   322  func (o ThingGroupArrayOutput) Index(i pulumi.IntInput) ThingGroupOutput {
   323  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ThingGroup {
   324  		return vs[0].([]*ThingGroup)[vs[1].(int)]
   325  	}).(ThingGroupOutput)
   326  }
   327  
   328  type ThingGroupMapOutput struct{ *pulumi.OutputState }
   329  
   330  func (ThingGroupMapOutput) ElementType() reflect.Type {
   331  	return reflect.TypeOf((*map[string]*ThingGroup)(nil)).Elem()
   332  }
   333  
   334  func (o ThingGroupMapOutput) ToThingGroupMapOutput() ThingGroupMapOutput {
   335  	return o
   336  }
   337  
   338  func (o ThingGroupMapOutput) ToThingGroupMapOutputWithContext(ctx context.Context) ThingGroupMapOutput {
   339  	return o
   340  }
   341  
   342  func (o ThingGroupMapOutput) MapIndex(k pulumi.StringInput) ThingGroupOutput {
   343  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ThingGroup {
   344  		return vs[0].(map[string]*ThingGroup)[vs[1].(string)]
   345  	}).(ThingGroupOutput)
   346  }
   347  
   348  func init() {
   349  	pulumi.RegisterInputType(reflect.TypeOf((*ThingGroupInput)(nil)).Elem(), &ThingGroup{})
   350  	pulumi.RegisterInputType(reflect.TypeOf((*ThingGroupArrayInput)(nil)).Elem(), ThingGroupArray{})
   351  	pulumi.RegisterInputType(reflect.TypeOf((*ThingGroupMapInput)(nil)).Elem(), ThingGroupMap{})
   352  	pulumi.RegisterOutputType(ThingGroupOutput{})
   353  	pulumi.RegisterOutputType(ThingGroupArrayOutput{})
   354  	pulumi.RegisterOutputType(ThingGroupMapOutput{})
   355  }