github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/iot/thingPrincipalAttachment.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 // Attaches Principal to AWS IoT Thing. 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-std/sdk/go/std" 27 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // example, err := iot.NewThing(ctx, "example", &iot.ThingArgs{ 34 // Name: pulumi.String("example"), 35 // }) 36 // if err != nil { 37 // return err 38 // } 39 // invokeFile, err := std.File(ctx, &std.FileArgs{ 40 // Input: "csr.pem", 41 // }, nil) 42 // if err != nil { 43 // return err 44 // } 45 // cert, err := iot.NewCertificate(ctx, "cert", &iot.CertificateArgs{ 46 // Csr: invokeFile.Result, 47 // Active: pulumi.Bool(true), 48 // }) 49 // if err != nil { 50 // return err 51 // } 52 // _, err = iot.NewThingPrincipalAttachment(ctx, "att", &iot.ThingPrincipalAttachmentArgs{ 53 // Principal: cert.Arn, 54 // Thing: example.Name, 55 // }) 56 // if err != nil { 57 // return err 58 // } 59 // return nil 60 // }) 61 // } 62 // 63 // ``` 64 // <!--End PulumiCodeChooser --> 65 type ThingPrincipalAttachment struct { 66 pulumi.CustomResourceState 67 68 // The AWS IoT Certificate ARN or Amazon Cognito Identity ID. 69 Principal pulumi.StringOutput `pulumi:"principal"` 70 // The name of the thing. 71 Thing pulumi.StringOutput `pulumi:"thing"` 72 } 73 74 // NewThingPrincipalAttachment registers a new resource with the given unique name, arguments, and options. 75 func NewThingPrincipalAttachment(ctx *pulumi.Context, 76 name string, args *ThingPrincipalAttachmentArgs, opts ...pulumi.ResourceOption) (*ThingPrincipalAttachment, error) { 77 if args == nil { 78 return nil, errors.New("missing one or more required arguments") 79 } 80 81 if args.Principal == nil { 82 return nil, errors.New("invalid value for required argument 'Principal'") 83 } 84 if args.Thing == nil { 85 return nil, errors.New("invalid value for required argument 'Thing'") 86 } 87 opts = internal.PkgResourceDefaultOpts(opts) 88 var resource ThingPrincipalAttachment 89 err := ctx.RegisterResource("aws:iot/thingPrincipalAttachment:ThingPrincipalAttachment", name, args, &resource, opts...) 90 if err != nil { 91 return nil, err 92 } 93 return &resource, nil 94 } 95 96 // GetThingPrincipalAttachment gets an existing ThingPrincipalAttachment resource's state with the given name, ID, and optional 97 // state properties that are used to uniquely qualify the lookup (nil if not required). 98 func GetThingPrincipalAttachment(ctx *pulumi.Context, 99 name string, id pulumi.IDInput, state *ThingPrincipalAttachmentState, opts ...pulumi.ResourceOption) (*ThingPrincipalAttachment, error) { 100 var resource ThingPrincipalAttachment 101 err := ctx.ReadResource("aws:iot/thingPrincipalAttachment:ThingPrincipalAttachment", name, id, state, &resource, opts...) 102 if err != nil { 103 return nil, err 104 } 105 return &resource, nil 106 } 107 108 // Input properties used for looking up and filtering ThingPrincipalAttachment resources. 109 type thingPrincipalAttachmentState struct { 110 // The AWS IoT Certificate ARN or Amazon Cognito Identity ID. 111 Principal *string `pulumi:"principal"` 112 // The name of the thing. 113 Thing *string `pulumi:"thing"` 114 } 115 116 type ThingPrincipalAttachmentState struct { 117 // The AWS IoT Certificate ARN or Amazon Cognito Identity ID. 118 Principal pulumi.StringPtrInput 119 // The name of the thing. 120 Thing pulumi.StringPtrInput 121 } 122 123 func (ThingPrincipalAttachmentState) ElementType() reflect.Type { 124 return reflect.TypeOf((*thingPrincipalAttachmentState)(nil)).Elem() 125 } 126 127 type thingPrincipalAttachmentArgs struct { 128 // The AWS IoT Certificate ARN or Amazon Cognito Identity ID. 129 Principal string `pulumi:"principal"` 130 // The name of the thing. 131 Thing string `pulumi:"thing"` 132 } 133 134 // The set of arguments for constructing a ThingPrincipalAttachment resource. 135 type ThingPrincipalAttachmentArgs struct { 136 // The AWS IoT Certificate ARN or Amazon Cognito Identity ID. 137 Principal pulumi.StringInput 138 // The name of the thing. 139 Thing pulumi.StringInput 140 } 141 142 func (ThingPrincipalAttachmentArgs) ElementType() reflect.Type { 143 return reflect.TypeOf((*thingPrincipalAttachmentArgs)(nil)).Elem() 144 } 145 146 type ThingPrincipalAttachmentInput interface { 147 pulumi.Input 148 149 ToThingPrincipalAttachmentOutput() ThingPrincipalAttachmentOutput 150 ToThingPrincipalAttachmentOutputWithContext(ctx context.Context) ThingPrincipalAttachmentOutput 151 } 152 153 func (*ThingPrincipalAttachment) ElementType() reflect.Type { 154 return reflect.TypeOf((**ThingPrincipalAttachment)(nil)).Elem() 155 } 156 157 func (i *ThingPrincipalAttachment) ToThingPrincipalAttachmentOutput() ThingPrincipalAttachmentOutput { 158 return i.ToThingPrincipalAttachmentOutputWithContext(context.Background()) 159 } 160 161 func (i *ThingPrincipalAttachment) ToThingPrincipalAttachmentOutputWithContext(ctx context.Context) ThingPrincipalAttachmentOutput { 162 return pulumi.ToOutputWithContext(ctx, i).(ThingPrincipalAttachmentOutput) 163 } 164 165 // ThingPrincipalAttachmentArrayInput is an input type that accepts ThingPrincipalAttachmentArray and ThingPrincipalAttachmentArrayOutput values. 166 // You can construct a concrete instance of `ThingPrincipalAttachmentArrayInput` via: 167 // 168 // ThingPrincipalAttachmentArray{ ThingPrincipalAttachmentArgs{...} } 169 type ThingPrincipalAttachmentArrayInput interface { 170 pulumi.Input 171 172 ToThingPrincipalAttachmentArrayOutput() ThingPrincipalAttachmentArrayOutput 173 ToThingPrincipalAttachmentArrayOutputWithContext(context.Context) ThingPrincipalAttachmentArrayOutput 174 } 175 176 type ThingPrincipalAttachmentArray []ThingPrincipalAttachmentInput 177 178 func (ThingPrincipalAttachmentArray) ElementType() reflect.Type { 179 return reflect.TypeOf((*[]*ThingPrincipalAttachment)(nil)).Elem() 180 } 181 182 func (i ThingPrincipalAttachmentArray) ToThingPrincipalAttachmentArrayOutput() ThingPrincipalAttachmentArrayOutput { 183 return i.ToThingPrincipalAttachmentArrayOutputWithContext(context.Background()) 184 } 185 186 func (i ThingPrincipalAttachmentArray) ToThingPrincipalAttachmentArrayOutputWithContext(ctx context.Context) ThingPrincipalAttachmentArrayOutput { 187 return pulumi.ToOutputWithContext(ctx, i).(ThingPrincipalAttachmentArrayOutput) 188 } 189 190 // ThingPrincipalAttachmentMapInput is an input type that accepts ThingPrincipalAttachmentMap and ThingPrincipalAttachmentMapOutput values. 191 // You can construct a concrete instance of `ThingPrincipalAttachmentMapInput` via: 192 // 193 // ThingPrincipalAttachmentMap{ "key": ThingPrincipalAttachmentArgs{...} } 194 type ThingPrincipalAttachmentMapInput interface { 195 pulumi.Input 196 197 ToThingPrincipalAttachmentMapOutput() ThingPrincipalAttachmentMapOutput 198 ToThingPrincipalAttachmentMapOutputWithContext(context.Context) ThingPrincipalAttachmentMapOutput 199 } 200 201 type ThingPrincipalAttachmentMap map[string]ThingPrincipalAttachmentInput 202 203 func (ThingPrincipalAttachmentMap) ElementType() reflect.Type { 204 return reflect.TypeOf((*map[string]*ThingPrincipalAttachment)(nil)).Elem() 205 } 206 207 func (i ThingPrincipalAttachmentMap) ToThingPrincipalAttachmentMapOutput() ThingPrincipalAttachmentMapOutput { 208 return i.ToThingPrincipalAttachmentMapOutputWithContext(context.Background()) 209 } 210 211 func (i ThingPrincipalAttachmentMap) ToThingPrincipalAttachmentMapOutputWithContext(ctx context.Context) ThingPrincipalAttachmentMapOutput { 212 return pulumi.ToOutputWithContext(ctx, i).(ThingPrincipalAttachmentMapOutput) 213 } 214 215 type ThingPrincipalAttachmentOutput struct{ *pulumi.OutputState } 216 217 func (ThingPrincipalAttachmentOutput) ElementType() reflect.Type { 218 return reflect.TypeOf((**ThingPrincipalAttachment)(nil)).Elem() 219 } 220 221 func (o ThingPrincipalAttachmentOutput) ToThingPrincipalAttachmentOutput() ThingPrincipalAttachmentOutput { 222 return o 223 } 224 225 func (o ThingPrincipalAttachmentOutput) ToThingPrincipalAttachmentOutputWithContext(ctx context.Context) ThingPrincipalAttachmentOutput { 226 return o 227 } 228 229 // The AWS IoT Certificate ARN or Amazon Cognito Identity ID. 230 func (o ThingPrincipalAttachmentOutput) Principal() pulumi.StringOutput { 231 return o.ApplyT(func(v *ThingPrincipalAttachment) pulumi.StringOutput { return v.Principal }).(pulumi.StringOutput) 232 } 233 234 // The name of the thing. 235 func (o ThingPrincipalAttachmentOutput) Thing() pulumi.StringOutput { 236 return o.ApplyT(func(v *ThingPrincipalAttachment) pulumi.StringOutput { return v.Thing }).(pulumi.StringOutput) 237 } 238 239 type ThingPrincipalAttachmentArrayOutput struct{ *pulumi.OutputState } 240 241 func (ThingPrincipalAttachmentArrayOutput) ElementType() reflect.Type { 242 return reflect.TypeOf((*[]*ThingPrincipalAttachment)(nil)).Elem() 243 } 244 245 func (o ThingPrincipalAttachmentArrayOutput) ToThingPrincipalAttachmentArrayOutput() ThingPrincipalAttachmentArrayOutput { 246 return o 247 } 248 249 func (o ThingPrincipalAttachmentArrayOutput) ToThingPrincipalAttachmentArrayOutputWithContext(ctx context.Context) ThingPrincipalAttachmentArrayOutput { 250 return o 251 } 252 253 func (o ThingPrincipalAttachmentArrayOutput) Index(i pulumi.IntInput) ThingPrincipalAttachmentOutput { 254 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ThingPrincipalAttachment { 255 return vs[0].([]*ThingPrincipalAttachment)[vs[1].(int)] 256 }).(ThingPrincipalAttachmentOutput) 257 } 258 259 type ThingPrincipalAttachmentMapOutput struct{ *pulumi.OutputState } 260 261 func (ThingPrincipalAttachmentMapOutput) ElementType() reflect.Type { 262 return reflect.TypeOf((*map[string]*ThingPrincipalAttachment)(nil)).Elem() 263 } 264 265 func (o ThingPrincipalAttachmentMapOutput) ToThingPrincipalAttachmentMapOutput() ThingPrincipalAttachmentMapOutput { 266 return o 267 } 268 269 func (o ThingPrincipalAttachmentMapOutput) ToThingPrincipalAttachmentMapOutputWithContext(ctx context.Context) ThingPrincipalAttachmentMapOutput { 270 return o 271 } 272 273 func (o ThingPrincipalAttachmentMapOutput) MapIndex(k pulumi.StringInput) ThingPrincipalAttachmentOutput { 274 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ThingPrincipalAttachment { 275 return vs[0].(map[string]*ThingPrincipalAttachment)[vs[1].(string)] 276 }).(ThingPrincipalAttachmentOutput) 277 } 278 279 func init() { 280 pulumi.RegisterInputType(reflect.TypeOf((*ThingPrincipalAttachmentInput)(nil)).Elem(), &ThingPrincipalAttachment{}) 281 pulumi.RegisterInputType(reflect.TypeOf((*ThingPrincipalAttachmentArrayInput)(nil)).Elem(), ThingPrincipalAttachmentArray{}) 282 pulumi.RegisterInputType(reflect.TypeOf((*ThingPrincipalAttachmentMapInput)(nil)).Elem(), ThingPrincipalAttachmentMap{}) 283 pulumi.RegisterOutputType(ThingPrincipalAttachmentOutput{}) 284 pulumi.RegisterOutputType(ThingPrincipalAttachmentArrayOutput{}) 285 pulumi.RegisterOutputType(ThingPrincipalAttachmentMapOutput{}) 286 }