github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iot/thingGroupMembership.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Adds an IoT Thing to an IoT Thing Group. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iot" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // _, err := iot.NewThingGroupMembership(ctx, "example", &iot.ThingGroupMembershipArgs{ 33 // ThingName: pulumi.String("example-thing"), 34 // ThingGroupName: pulumi.String("example-group"), 35 // OverrideDynamicGroup: pulumi.Bool(true), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // return nil 41 // }) 42 // } 43 // 44 // ``` 45 // <!--End PulumiCodeChooser --> 46 // 47 // ## Import 48 // 49 // Using `pulumi import`, import IoT Thing Group Membership using the thing group name and thing name. For example: 50 // 51 // ```sh 52 // $ pulumi import aws:iot/thingGroupMembership:ThingGroupMembership example thing_group_name/thing_name 53 // ``` 54 type ThingGroupMembership struct { 55 pulumi.CustomResourceState 56 57 // Override dynamic thing groups with static thing groups when 10-group limit is reached. If a thing belongs to 10 thing groups, and one or more of those groups are dynamic thing groups, adding a thing to a static group removes the thing from the last dynamic group. 58 OverrideDynamicGroup pulumi.BoolPtrOutput `pulumi:"overrideDynamicGroup"` 59 // The name of the group to which you are adding a thing. 60 ThingGroupName pulumi.StringOutput `pulumi:"thingGroupName"` 61 // The name of the thing to add to a group. 62 ThingName pulumi.StringOutput `pulumi:"thingName"` 63 } 64 65 // NewThingGroupMembership registers a new resource with the given unique name, arguments, and options. 66 func NewThingGroupMembership(ctx *pulumi.Context, 67 name string, args *ThingGroupMembershipArgs, opts ...pulumi.ResourceOption) (*ThingGroupMembership, error) { 68 if args == nil { 69 return nil, errors.New("missing one or more required arguments") 70 } 71 72 if args.ThingGroupName == nil { 73 return nil, errors.New("invalid value for required argument 'ThingGroupName'") 74 } 75 if args.ThingName == nil { 76 return nil, errors.New("invalid value for required argument 'ThingName'") 77 } 78 opts = internal.PkgResourceDefaultOpts(opts) 79 var resource ThingGroupMembership 80 err := ctx.RegisterResource("aws:iot/thingGroupMembership:ThingGroupMembership", name, args, &resource, opts...) 81 if err != nil { 82 return nil, err 83 } 84 return &resource, nil 85 } 86 87 // GetThingGroupMembership gets an existing ThingGroupMembership resource's state with the given name, ID, and optional 88 // state properties that are used to uniquely qualify the lookup (nil if not required). 89 func GetThingGroupMembership(ctx *pulumi.Context, 90 name string, id pulumi.IDInput, state *ThingGroupMembershipState, opts ...pulumi.ResourceOption) (*ThingGroupMembership, error) { 91 var resource ThingGroupMembership 92 err := ctx.ReadResource("aws:iot/thingGroupMembership:ThingGroupMembership", name, id, state, &resource, opts...) 93 if err != nil { 94 return nil, err 95 } 96 return &resource, nil 97 } 98 99 // Input properties used for looking up and filtering ThingGroupMembership resources. 100 type thingGroupMembershipState struct { 101 // Override dynamic thing groups with static thing groups when 10-group limit is reached. If a thing belongs to 10 thing groups, and one or more of those groups are dynamic thing groups, adding a thing to a static group removes the thing from the last dynamic group. 102 OverrideDynamicGroup *bool `pulumi:"overrideDynamicGroup"` 103 // The name of the group to which you are adding a thing. 104 ThingGroupName *string `pulumi:"thingGroupName"` 105 // The name of the thing to add to a group. 106 ThingName *string `pulumi:"thingName"` 107 } 108 109 type ThingGroupMembershipState struct { 110 // Override dynamic thing groups with static thing groups when 10-group limit is reached. If a thing belongs to 10 thing groups, and one or more of those groups are dynamic thing groups, adding a thing to a static group removes the thing from the last dynamic group. 111 OverrideDynamicGroup pulumi.BoolPtrInput 112 // The name of the group to which you are adding a thing. 113 ThingGroupName pulumi.StringPtrInput 114 // The name of the thing to add to a group. 115 ThingName pulumi.StringPtrInput 116 } 117 118 func (ThingGroupMembershipState) ElementType() reflect.Type { 119 return reflect.TypeOf((*thingGroupMembershipState)(nil)).Elem() 120 } 121 122 type thingGroupMembershipArgs struct { 123 // Override dynamic thing groups with static thing groups when 10-group limit is reached. If a thing belongs to 10 thing groups, and one or more of those groups are dynamic thing groups, adding a thing to a static group removes the thing from the last dynamic group. 124 OverrideDynamicGroup *bool `pulumi:"overrideDynamicGroup"` 125 // The name of the group to which you are adding a thing. 126 ThingGroupName string `pulumi:"thingGroupName"` 127 // The name of the thing to add to a group. 128 ThingName string `pulumi:"thingName"` 129 } 130 131 // The set of arguments for constructing a ThingGroupMembership resource. 132 type ThingGroupMembershipArgs struct { 133 // Override dynamic thing groups with static thing groups when 10-group limit is reached. If a thing belongs to 10 thing groups, and one or more of those groups are dynamic thing groups, adding a thing to a static group removes the thing from the last dynamic group. 134 OverrideDynamicGroup pulumi.BoolPtrInput 135 // The name of the group to which you are adding a thing. 136 ThingGroupName pulumi.StringInput 137 // The name of the thing to add to a group. 138 ThingName pulumi.StringInput 139 } 140 141 func (ThingGroupMembershipArgs) ElementType() reflect.Type { 142 return reflect.TypeOf((*thingGroupMembershipArgs)(nil)).Elem() 143 } 144 145 type ThingGroupMembershipInput interface { 146 pulumi.Input 147 148 ToThingGroupMembershipOutput() ThingGroupMembershipOutput 149 ToThingGroupMembershipOutputWithContext(ctx context.Context) ThingGroupMembershipOutput 150 } 151 152 func (*ThingGroupMembership) ElementType() reflect.Type { 153 return reflect.TypeOf((**ThingGroupMembership)(nil)).Elem() 154 } 155 156 func (i *ThingGroupMembership) ToThingGroupMembershipOutput() ThingGroupMembershipOutput { 157 return i.ToThingGroupMembershipOutputWithContext(context.Background()) 158 } 159 160 func (i *ThingGroupMembership) ToThingGroupMembershipOutputWithContext(ctx context.Context) ThingGroupMembershipOutput { 161 return pulumi.ToOutputWithContext(ctx, i).(ThingGroupMembershipOutput) 162 } 163 164 // ThingGroupMembershipArrayInput is an input type that accepts ThingGroupMembershipArray and ThingGroupMembershipArrayOutput values. 165 // You can construct a concrete instance of `ThingGroupMembershipArrayInput` via: 166 // 167 // ThingGroupMembershipArray{ ThingGroupMembershipArgs{...} } 168 type ThingGroupMembershipArrayInput interface { 169 pulumi.Input 170 171 ToThingGroupMembershipArrayOutput() ThingGroupMembershipArrayOutput 172 ToThingGroupMembershipArrayOutputWithContext(context.Context) ThingGroupMembershipArrayOutput 173 } 174 175 type ThingGroupMembershipArray []ThingGroupMembershipInput 176 177 func (ThingGroupMembershipArray) ElementType() reflect.Type { 178 return reflect.TypeOf((*[]*ThingGroupMembership)(nil)).Elem() 179 } 180 181 func (i ThingGroupMembershipArray) ToThingGroupMembershipArrayOutput() ThingGroupMembershipArrayOutput { 182 return i.ToThingGroupMembershipArrayOutputWithContext(context.Background()) 183 } 184 185 func (i ThingGroupMembershipArray) ToThingGroupMembershipArrayOutputWithContext(ctx context.Context) ThingGroupMembershipArrayOutput { 186 return pulumi.ToOutputWithContext(ctx, i).(ThingGroupMembershipArrayOutput) 187 } 188 189 // ThingGroupMembershipMapInput is an input type that accepts ThingGroupMembershipMap and ThingGroupMembershipMapOutput values. 190 // You can construct a concrete instance of `ThingGroupMembershipMapInput` via: 191 // 192 // ThingGroupMembershipMap{ "key": ThingGroupMembershipArgs{...} } 193 type ThingGroupMembershipMapInput interface { 194 pulumi.Input 195 196 ToThingGroupMembershipMapOutput() ThingGroupMembershipMapOutput 197 ToThingGroupMembershipMapOutputWithContext(context.Context) ThingGroupMembershipMapOutput 198 } 199 200 type ThingGroupMembershipMap map[string]ThingGroupMembershipInput 201 202 func (ThingGroupMembershipMap) ElementType() reflect.Type { 203 return reflect.TypeOf((*map[string]*ThingGroupMembership)(nil)).Elem() 204 } 205 206 func (i ThingGroupMembershipMap) ToThingGroupMembershipMapOutput() ThingGroupMembershipMapOutput { 207 return i.ToThingGroupMembershipMapOutputWithContext(context.Background()) 208 } 209 210 func (i ThingGroupMembershipMap) ToThingGroupMembershipMapOutputWithContext(ctx context.Context) ThingGroupMembershipMapOutput { 211 return pulumi.ToOutputWithContext(ctx, i).(ThingGroupMembershipMapOutput) 212 } 213 214 type ThingGroupMembershipOutput struct{ *pulumi.OutputState } 215 216 func (ThingGroupMembershipOutput) ElementType() reflect.Type { 217 return reflect.TypeOf((**ThingGroupMembership)(nil)).Elem() 218 } 219 220 func (o ThingGroupMembershipOutput) ToThingGroupMembershipOutput() ThingGroupMembershipOutput { 221 return o 222 } 223 224 func (o ThingGroupMembershipOutput) ToThingGroupMembershipOutputWithContext(ctx context.Context) ThingGroupMembershipOutput { 225 return o 226 } 227 228 // Override dynamic thing groups with static thing groups when 10-group limit is reached. If a thing belongs to 10 thing groups, and one or more of those groups are dynamic thing groups, adding a thing to a static group removes the thing from the last dynamic group. 229 func (o ThingGroupMembershipOutput) OverrideDynamicGroup() pulumi.BoolPtrOutput { 230 return o.ApplyT(func(v *ThingGroupMembership) pulumi.BoolPtrOutput { return v.OverrideDynamicGroup }).(pulumi.BoolPtrOutput) 231 } 232 233 // The name of the group to which you are adding a thing. 234 func (o ThingGroupMembershipOutput) ThingGroupName() pulumi.StringOutput { 235 return o.ApplyT(func(v *ThingGroupMembership) pulumi.StringOutput { return v.ThingGroupName }).(pulumi.StringOutput) 236 } 237 238 // The name of the thing to add to a group. 239 func (o ThingGroupMembershipOutput) ThingName() pulumi.StringOutput { 240 return o.ApplyT(func(v *ThingGroupMembership) pulumi.StringOutput { return v.ThingName }).(pulumi.StringOutput) 241 } 242 243 type ThingGroupMembershipArrayOutput struct{ *pulumi.OutputState } 244 245 func (ThingGroupMembershipArrayOutput) ElementType() reflect.Type { 246 return reflect.TypeOf((*[]*ThingGroupMembership)(nil)).Elem() 247 } 248 249 func (o ThingGroupMembershipArrayOutput) ToThingGroupMembershipArrayOutput() ThingGroupMembershipArrayOutput { 250 return o 251 } 252 253 func (o ThingGroupMembershipArrayOutput) ToThingGroupMembershipArrayOutputWithContext(ctx context.Context) ThingGroupMembershipArrayOutput { 254 return o 255 } 256 257 func (o ThingGroupMembershipArrayOutput) Index(i pulumi.IntInput) ThingGroupMembershipOutput { 258 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ThingGroupMembership { 259 return vs[0].([]*ThingGroupMembership)[vs[1].(int)] 260 }).(ThingGroupMembershipOutput) 261 } 262 263 type ThingGroupMembershipMapOutput struct{ *pulumi.OutputState } 264 265 func (ThingGroupMembershipMapOutput) ElementType() reflect.Type { 266 return reflect.TypeOf((*map[string]*ThingGroupMembership)(nil)).Elem() 267 } 268 269 func (o ThingGroupMembershipMapOutput) ToThingGroupMembershipMapOutput() ThingGroupMembershipMapOutput { 270 return o 271 } 272 273 func (o ThingGroupMembershipMapOutput) ToThingGroupMembershipMapOutputWithContext(ctx context.Context) ThingGroupMembershipMapOutput { 274 return o 275 } 276 277 func (o ThingGroupMembershipMapOutput) MapIndex(k pulumi.StringInput) ThingGroupMembershipOutput { 278 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ThingGroupMembership { 279 return vs[0].(map[string]*ThingGroupMembership)[vs[1].(string)] 280 }).(ThingGroupMembershipOutput) 281 } 282 283 func init() { 284 pulumi.RegisterInputType(reflect.TypeOf((*ThingGroupMembershipInput)(nil)).Elem(), &ThingGroupMembership{}) 285 pulumi.RegisterInputType(reflect.TypeOf((*ThingGroupMembershipArrayInput)(nil)).Elem(), ThingGroupMembershipArray{}) 286 pulumi.RegisterInputType(reflect.TypeOf((*ThingGroupMembershipMapInput)(nil)).Elem(), ThingGroupMembershipMap{}) 287 pulumi.RegisterOutputType(ThingGroupMembershipOutput{}) 288 pulumi.RegisterOutputType(ThingGroupMembershipArrayOutput{}) 289 pulumi.RegisterOutputType(ThingGroupMembershipMapOutput{}) 290 }