github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/inspector2/enabler.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 inspector2 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 // Resource for enabling Amazon Inspector resource scans. 16 // 17 // This resource must be created in the Organization's Administrator Account. 18 // 19 // ## Example Usage 20 // 21 // ### Basic Usage 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/inspector2" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // _, err := inspector2.NewEnabler(ctx, "example", &inspector2.EnablerArgs{ 37 // AccountIds: pulumi.StringArray{ 38 // pulumi.String("123456789012"), 39 // }, 40 // ResourceTypes: pulumi.StringArray{ 41 // pulumi.String("EC2"), 42 // }, 43 // }) 44 // if err != nil { 45 // return err 46 // } 47 // return nil 48 // }) 49 // } 50 // 51 // ``` 52 // <!--End PulumiCodeChooser --> 53 // 54 // ### For the Calling Account 55 // 56 // <!--Start PulumiCodeChooser --> 57 // ```go 58 // package main 59 // 60 // import ( 61 // 62 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 63 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/inspector2" 64 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 65 // 66 // ) 67 // 68 // func main() { 69 // pulumi.Run(func(ctx *pulumi.Context) error { 70 // current, err := aws.GetCallerIdentity(ctx, nil, nil) 71 // if err != nil { 72 // return err 73 // } 74 // _, err = inspector2.NewEnabler(ctx, "test", &inspector2.EnablerArgs{ 75 // AccountIds: pulumi.StringArray{ 76 // pulumi.String(current.AccountId), 77 // }, 78 // ResourceTypes: pulumi.StringArray{ 79 // pulumi.String("ECR"), 80 // pulumi.String("EC2"), 81 // }, 82 // }) 83 // if err != nil { 84 // return err 85 // } 86 // return nil 87 // }) 88 // } 89 // 90 // ``` 91 // <!--End PulumiCodeChooser --> 92 type Enabler struct { 93 pulumi.CustomResourceState 94 95 // Set of account IDs. 96 // Can contain one of: the Organization's Administrator Account, or one or more Member Accounts. 97 AccountIds pulumi.StringArrayOutput `pulumi:"accountIds"` 98 // Type of resources to scan. 99 // Valid values are `EC2`, `ECR`, `LAMBDA` and `LAMBDA_CODE`. 100 // At least one item is required. 101 ResourceTypes pulumi.StringArrayOutput `pulumi:"resourceTypes"` 102 } 103 104 // NewEnabler registers a new resource with the given unique name, arguments, and options. 105 func NewEnabler(ctx *pulumi.Context, 106 name string, args *EnablerArgs, opts ...pulumi.ResourceOption) (*Enabler, error) { 107 if args == nil { 108 return nil, errors.New("missing one or more required arguments") 109 } 110 111 if args.AccountIds == nil { 112 return nil, errors.New("invalid value for required argument 'AccountIds'") 113 } 114 if args.ResourceTypes == nil { 115 return nil, errors.New("invalid value for required argument 'ResourceTypes'") 116 } 117 opts = internal.PkgResourceDefaultOpts(opts) 118 var resource Enabler 119 err := ctx.RegisterResource("aws:inspector2/enabler:Enabler", name, args, &resource, opts...) 120 if err != nil { 121 return nil, err 122 } 123 return &resource, nil 124 } 125 126 // GetEnabler gets an existing Enabler resource's state with the given name, ID, and optional 127 // state properties that are used to uniquely qualify the lookup (nil if not required). 128 func GetEnabler(ctx *pulumi.Context, 129 name string, id pulumi.IDInput, state *EnablerState, opts ...pulumi.ResourceOption) (*Enabler, error) { 130 var resource Enabler 131 err := ctx.ReadResource("aws:inspector2/enabler:Enabler", name, id, state, &resource, opts...) 132 if err != nil { 133 return nil, err 134 } 135 return &resource, nil 136 } 137 138 // Input properties used for looking up and filtering Enabler resources. 139 type enablerState struct { 140 // Set of account IDs. 141 // Can contain one of: the Organization's Administrator Account, or one or more Member Accounts. 142 AccountIds []string `pulumi:"accountIds"` 143 // Type of resources to scan. 144 // Valid values are `EC2`, `ECR`, `LAMBDA` and `LAMBDA_CODE`. 145 // At least one item is required. 146 ResourceTypes []string `pulumi:"resourceTypes"` 147 } 148 149 type EnablerState struct { 150 // Set of account IDs. 151 // Can contain one of: the Organization's Administrator Account, or one or more Member Accounts. 152 AccountIds pulumi.StringArrayInput 153 // Type of resources to scan. 154 // Valid values are `EC2`, `ECR`, `LAMBDA` and `LAMBDA_CODE`. 155 // At least one item is required. 156 ResourceTypes pulumi.StringArrayInput 157 } 158 159 func (EnablerState) ElementType() reflect.Type { 160 return reflect.TypeOf((*enablerState)(nil)).Elem() 161 } 162 163 type enablerArgs struct { 164 // Set of account IDs. 165 // Can contain one of: the Organization's Administrator Account, or one or more Member Accounts. 166 AccountIds []string `pulumi:"accountIds"` 167 // Type of resources to scan. 168 // Valid values are `EC2`, `ECR`, `LAMBDA` and `LAMBDA_CODE`. 169 // At least one item is required. 170 ResourceTypes []string `pulumi:"resourceTypes"` 171 } 172 173 // The set of arguments for constructing a Enabler resource. 174 type EnablerArgs struct { 175 // Set of account IDs. 176 // Can contain one of: the Organization's Administrator Account, or one or more Member Accounts. 177 AccountIds pulumi.StringArrayInput 178 // Type of resources to scan. 179 // Valid values are `EC2`, `ECR`, `LAMBDA` and `LAMBDA_CODE`. 180 // At least one item is required. 181 ResourceTypes pulumi.StringArrayInput 182 } 183 184 func (EnablerArgs) ElementType() reflect.Type { 185 return reflect.TypeOf((*enablerArgs)(nil)).Elem() 186 } 187 188 type EnablerInput interface { 189 pulumi.Input 190 191 ToEnablerOutput() EnablerOutput 192 ToEnablerOutputWithContext(ctx context.Context) EnablerOutput 193 } 194 195 func (*Enabler) ElementType() reflect.Type { 196 return reflect.TypeOf((**Enabler)(nil)).Elem() 197 } 198 199 func (i *Enabler) ToEnablerOutput() EnablerOutput { 200 return i.ToEnablerOutputWithContext(context.Background()) 201 } 202 203 func (i *Enabler) ToEnablerOutputWithContext(ctx context.Context) EnablerOutput { 204 return pulumi.ToOutputWithContext(ctx, i).(EnablerOutput) 205 } 206 207 // EnablerArrayInput is an input type that accepts EnablerArray and EnablerArrayOutput values. 208 // You can construct a concrete instance of `EnablerArrayInput` via: 209 // 210 // EnablerArray{ EnablerArgs{...} } 211 type EnablerArrayInput interface { 212 pulumi.Input 213 214 ToEnablerArrayOutput() EnablerArrayOutput 215 ToEnablerArrayOutputWithContext(context.Context) EnablerArrayOutput 216 } 217 218 type EnablerArray []EnablerInput 219 220 func (EnablerArray) ElementType() reflect.Type { 221 return reflect.TypeOf((*[]*Enabler)(nil)).Elem() 222 } 223 224 func (i EnablerArray) ToEnablerArrayOutput() EnablerArrayOutput { 225 return i.ToEnablerArrayOutputWithContext(context.Background()) 226 } 227 228 func (i EnablerArray) ToEnablerArrayOutputWithContext(ctx context.Context) EnablerArrayOutput { 229 return pulumi.ToOutputWithContext(ctx, i).(EnablerArrayOutput) 230 } 231 232 // EnablerMapInput is an input type that accepts EnablerMap and EnablerMapOutput values. 233 // You can construct a concrete instance of `EnablerMapInput` via: 234 // 235 // EnablerMap{ "key": EnablerArgs{...} } 236 type EnablerMapInput interface { 237 pulumi.Input 238 239 ToEnablerMapOutput() EnablerMapOutput 240 ToEnablerMapOutputWithContext(context.Context) EnablerMapOutput 241 } 242 243 type EnablerMap map[string]EnablerInput 244 245 func (EnablerMap) ElementType() reflect.Type { 246 return reflect.TypeOf((*map[string]*Enabler)(nil)).Elem() 247 } 248 249 func (i EnablerMap) ToEnablerMapOutput() EnablerMapOutput { 250 return i.ToEnablerMapOutputWithContext(context.Background()) 251 } 252 253 func (i EnablerMap) ToEnablerMapOutputWithContext(ctx context.Context) EnablerMapOutput { 254 return pulumi.ToOutputWithContext(ctx, i).(EnablerMapOutput) 255 } 256 257 type EnablerOutput struct{ *pulumi.OutputState } 258 259 func (EnablerOutput) ElementType() reflect.Type { 260 return reflect.TypeOf((**Enabler)(nil)).Elem() 261 } 262 263 func (o EnablerOutput) ToEnablerOutput() EnablerOutput { 264 return o 265 } 266 267 func (o EnablerOutput) ToEnablerOutputWithContext(ctx context.Context) EnablerOutput { 268 return o 269 } 270 271 // Set of account IDs. 272 // Can contain one of: the Organization's Administrator Account, or one or more Member Accounts. 273 func (o EnablerOutput) AccountIds() pulumi.StringArrayOutput { 274 return o.ApplyT(func(v *Enabler) pulumi.StringArrayOutput { return v.AccountIds }).(pulumi.StringArrayOutput) 275 } 276 277 // Type of resources to scan. 278 // Valid values are `EC2`, `ECR`, `LAMBDA` and `LAMBDA_CODE`. 279 // At least one item is required. 280 func (o EnablerOutput) ResourceTypes() pulumi.StringArrayOutput { 281 return o.ApplyT(func(v *Enabler) pulumi.StringArrayOutput { return v.ResourceTypes }).(pulumi.StringArrayOutput) 282 } 283 284 type EnablerArrayOutput struct{ *pulumi.OutputState } 285 286 func (EnablerArrayOutput) ElementType() reflect.Type { 287 return reflect.TypeOf((*[]*Enabler)(nil)).Elem() 288 } 289 290 func (o EnablerArrayOutput) ToEnablerArrayOutput() EnablerArrayOutput { 291 return o 292 } 293 294 func (o EnablerArrayOutput) ToEnablerArrayOutputWithContext(ctx context.Context) EnablerArrayOutput { 295 return o 296 } 297 298 func (o EnablerArrayOutput) Index(i pulumi.IntInput) EnablerOutput { 299 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Enabler { 300 return vs[0].([]*Enabler)[vs[1].(int)] 301 }).(EnablerOutput) 302 } 303 304 type EnablerMapOutput struct{ *pulumi.OutputState } 305 306 func (EnablerMapOutput) ElementType() reflect.Type { 307 return reflect.TypeOf((*map[string]*Enabler)(nil)).Elem() 308 } 309 310 func (o EnablerMapOutput) ToEnablerMapOutput() EnablerMapOutput { 311 return o 312 } 313 314 func (o EnablerMapOutput) ToEnablerMapOutputWithContext(ctx context.Context) EnablerMapOutput { 315 return o 316 } 317 318 func (o EnablerMapOutput) MapIndex(k pulumi.StringInput) EnablerOutput { 319 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Enabler { 320 return vs[0].(map[string]*Enabler)[vs[1].(string)] 321 }).(EnablerOutput) 322 } 323 324 func init() { 325 pulumi.RegisterInputType(reflect.TypeOf((*EnablerInput)(nil)).Elem(), &Enabler{}) 326 pulumi.RegisterInputType(reflect.TypeOf((*EnablerArrayInput)(nil)).Elem(), EnablerArray{}) 327 pulumi.RegisterInputType(reflect.TypeOf((*EnablerMapInput)(nil)).Elem(), EnablerMap{}) 328 pulumi.RegisterOutputType(EnablerOutput{}) 329 pulumi.RegisterOutputType(EnablerArrayOutput{}) 330 pulumi.RegisterOutputType(EnablerMapOutput{}) 331 }