github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iot/thing.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 // Creates and manages an AWS IoT Thing. 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 // _, err := iot.NewThing(ctx, "example", &iot.ThingArgs{ 32 // Name: pulumi.String("example"), 33 // Attributes: pulumi.StringMap{ 34 // "First": pulumi.String("examplevalue"), 35 // }, 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 Things using the name. For example: 50 // 51 // ```sh 52 // $ pulumi import aws:iot/thing:Thing example example 53 // ``` 54 type Thing struct { 55 pulumi.CustomResourceState 56 57 // The ARN of the thing. 58 Arn pulumi.StringOutput `pulumi:"arn"` 59 // Map of attributes of the thing. 60 Attributes pulumi.StringMapOutput `pulumi:"attributes"` 61 // The default client ID. 62 DefaultClientId pulumi.StringOutput `pulumi:"defaultClientId"` 63 // The name of the thing. 64 Name pulumi.StringOutput `pulumi:"name"` 65 // The thing type name. 66 ThingTypeName pulumi.StringPtrOutput `pulumi:"thingTypeName"` 67 // The current version of the thing record in the registry. 68 Version pulumi.IntOutput `pulumi:"version"` 69 } 70 71 // NewThing registers a new resource with the given unique name, arguments, and options. 72 func NewThing(ctx *pulumi.Context, 73 name string, args *ThingArgs, opts ...pulumi.ResourceOption) (*Thing, error) { 74 if args == nil { 75 args = &ThingArgs{} 76 } 77 78 opts = internal.PkgResourceDefaultOpts(opts) 79 var resource Thing 80 err := ctx.RegisterResource("aws:iot/thing:Thing", name, args, &resource, opts...) 81 if err != nil { 82 return nil, err 83 } 84 return &resource, nil 85 } 86 87 // GetThing gets an existing Thing 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 GetThing(ctx *pulumi.Context, 90 name string, id pulumi.IDInput, state *ThingState, opts ...pulumi.ResourceOption) (*Thing, error) { 91 var resource Thing 92 err := ctx.ReadResource("aws:iot/thing:Thing", 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 Thing resources. 100 type thingState struct { 101 // The ARN of the thing. 102 Arn *string `pulumi:"arn"` 103 // Map of attributes of the thing. 104 Attributes map[string]string `pulumi:"attributes"` 105 // The default client ID. 106 DefaultClientId *string `pulumi:"defaultClientId"` 107 // The name of the thing. 108 Name *string `pulumi:"name"` 109 // The thing type name. 110 ThingTypeName *string `pulumi:"thingTypeName"` 111 // The current version of the thing record in the registry. 112 Version *int `pulumi:"version"` 113 } 114 115 type ThingState struct { 116 // The ARN of the thing. 117 Arn pulumi.StringPtrInput 118 // Map of attributes of the thing. 119 Attributes pulumi.StringMapInput 120 // The default client ID. 121 DefaultClientId pulumi.StringPtrInput 122 // The name of the thing. 123 Name pulumi.StringPtrInput 124 // The thing type name. 125 ThingTypeName pulumi.StringPtrInput 126 // The current version of the thing record in the registry. 127 Version pulumi.IntPtrInput 128 } 129 130 func (ThingState) ElementType() reflect.Type { 131 return reflect.TypeOf((*thingState)(nil)).Elem() 132 } 133 134 type thingArgs struct { 135 // Map of attributes of the thing. 136 Attributes map[string]string `pulumi:"attributes"` 137 // The name of the thing. 138 Name *string `pulumi:"name"` 139 // The thing type name. 140 ThingTypeName *string `pulumi:"thingTypeName"` 141 } 142 143 // The set of arguments for constructing a Thing resource. 144 type ThingArgs struct { 145 // Map of attributes of the thing. 146 Attributes pulumi.StringMapInput 147 // The name of the thing. 148 Name pulumi.StringPtrInput 149 // The thing type name. 150 ThingTypeName pulumi.StringPtrInput 151 } 152 153 func (ThingArgs) ElementType() reflect.Type { 154 return reflect.TypeOf((*thingArgs)(nil)).Elem() 155 } 156 157 type ThingInput interface { 158 pulumi.Input 159 160 ToThingOutput() ThingOutput 161 ToThingOutputWithContext(ctx context.Context) ThingOutput 162 } 163 164 func (*Thing) ElementType() reflect.Type { 165 return reflect.TypeOf((**Thing)(nil)).Elem() 166 } 167 168 func (i *Thing) ToThingOutput() ThingOutput { 169 return i.ToThingOutputWithContext(context.Background()) 170 } 171 172 func (i *Thing) ToThingOutputWithContext(ctx context.Context) ThingOutput { 173 return pulumi.ToOutputWithContext(ctx, i).(ThingOutput) 174 } 175 176 // ThingArrayInput is an input type that accepts ThingArray and ThingArrayOutput values. 177 // You can construct a concrete instance of `ThingArrayInput` via: 178 // 179 // ThingArray{ ThingArgs{...} } 180 type ThingArrayInput interface { 181 pulumi.Input 182 183 ToThingArrayOutput() ThingArrayOutput 184 ToThingArrayOutputWithContext(context.Context) ThingArrayOutput 185 } 186 187 type ThingArray []ThingInput 188 189 func (ThingArray) ElementType() reflect.Type { 190 return reflect.TypeOf((*[]*Thing)(nil)).Elem() 191 } 192 193 func (i ThingArray) ToThingArrayOutput() ThingArrayOutput { 194 return i.ToThingArrayOutputWithContext(context.Background()) 195 } 196 197 func (i ThingArray) ToThingArrayOutputWithContext(ctx context.Context) ThingArrayOutput { 198 return pulumi.ToOutputWithContext(ctx, i).(ThingArrayOutput) 199 } 200 201 // ThingMapInput is an input type that accepts ThingMap and ThingMapOutput values. 202 // You can construct a concrete instance of `ThingMapInput` via: 203 // 204 // ThingMap{ "key": ThingArgs{...} } 205 type ThingMapInput interface { 206 pulumi.Input 207 208 ToThingMapOutput() ThingMapOutput 209 ToThingMapOutputWithContext(context.Context) ThingMapOutput 210 } 211 212 type ThingMap map[string]ThingInput 213 214 func (ThingMap) ElementType() reflect.Type { 215 return reflect.TypeOf((*map[string]*Thing)(nil)).Elem() 216 } 217 218 func (i ThingMap) ToThingMapOutput() ThingMapOutput { 219 return i.ToThingMapOutputWithContext(context.Background()) 220 } 221 222 func (i ThingMap) ToThingMapOutputWithContext(ctx context.Context) ThingMapOutput { 223 return pulumi.ToOutputWithContext(ctx, i).(ThingMapOutput) 224 } 225 226 type ThingOutput struct{ *pulumi.OutputState } 227 228 func (ThingOutput) ElementType() reflect.Type { 229 return reflect.TypeOf((**Thing)(nil)).Elem() 230 } 231 232 func (o ThingOutput) ToThingOutput() ThingOutput { 233 return o 234 } 235 236 func (o ThingOutput) ToThingOutputWithContext(ctx context.Context) ThingOutput { 237 return o 238 } 239 240 // The ARN of the thing. 241 func (o ThingOutput) Arn() pulumi.StringOutput { 242 return o.ApplyT(func(v *Thing) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 243 } 244 245 // Map of attributes of the thing. 246 func (o ThingOutput) Attributes() pulumi.StringMapOutput { 247 return o.ApplyT(func(v *Thing) pulumi.StringMapOutput { return v.Attributes }).(pulumi.StringMapOutput) 248 } 249 250 // The default client ID. 251 func (o ThingOutput) DefaultClientId() pulumi.StringOutput { 252 return o.ApplyT(func(v *Thing) pulumi.StringOutput { return v.DefaultClientId }).(pulumi.StringOutput) 253 } 254 255 // The name of the thing. 256 func (o ThingOutput) Name() pulumi.StringOutput { 257 return o.ApplyT(func(v *Thing) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 258 } 259 260 // The thing type name. 261 func (o ThingOutput) ThingTypeName() pulumi.StringPtrOutput { 262 return o.ApplyT(func(v *Thing) pulumi.StringPtrOutput { return v.ThingTypeName }).(pulumi.StringPtrOutput) 263 } 264 265 // The current version of the thing record in the registry. 266 func (o ThingOutput) Version() pulumi.IntOutput { 267 return o.ApplyT(func(v *Thing) pulumi.IntOutput { return v.Version }).(pulumi.IntOutput) 268 } 269 270 type ThingArrayOutput struct{ *pulumi.OutputState } 271 272 func (ThingArrayOutput) ElementType() reflect.Type { 273 return reflect.TypeOf((*[]*Thing)(nil)).Elem() 274 } 275 276 func (o ThingArrayOutput) ToThingArrayOutput() ThingArrayOutput { 277 return o 278 } 279 280 func (o ThingArrayOutput) ToThingArrayOutputWithContext(ctx context.Context) ThingArrayOutput { 281 return o 282 } 283 284 func (o ThingArrayOutput) Index(i pulumi.IntInput) ThingOutput { 285 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Thing { 286 return vs[0].([]*Thing)[vs[1].(int)] 287 }).(ThingOutput) 288 } 289 290 type ThingMapOutput struct{ *pulumi.OutputState } 291 292 func (ThingMapOutput) ElementType() reflect.Type { 293 return reflect.TypeOf((*map[string]*Thing)(nil)).Elem() 294 } 295 296 func (o ThingMapOutput) ToThingMapOutput() ThingMapOutput { 297 return o 298 } 299 300 func (o ThingMapOutput) ToThingMapOutputWithContext(ctx context.Context) ThingMapOutput { 301 return o 302 } 303 304 func (o ThingMapOutput) MapIndex(k pulumi.StringInput) ThingOutput { 305 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Thing { 306 return vs[0].(map[string]*Thing)[vs[1].(string)] 307 }).(ThingOutput) 308 } 309 310 func init() { 311 pulumi.RegisterInputType(reflect.TypeOf((*ThingInput)(nil)).Elem(), &Thing{}) 312 pulumi.RegisterInputType(reflect.TypeOf((*ThingArrayInput)(nil)).Elem(), ThingArray{}) 313 pulumi.RegisterInputType(reflect.TypeOf((*ThingMapInput)(nil)).Elem(), ThingMap{}) 314 pulumi.RegisterOutputType(ThingOutput{}) 315 pulumi.RegisterOutputType(ThingArrayOutput{}) 316 pulumi.RegisterOutputType(ThingMapOutput{}) 317 }