github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/accessanalyzer/analyzer.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 accessanalyzer 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 // Manages an Access Analyzer Analyzer. More information can be found in the [Access Analyzer User Guide](https://docs.aws.amazon.com/IAM/latest/UserGuide/what-is-access-analyzer.html). 16 // 17 // ## Example Usage 18 // 19 // ### Account Analyzer 20 // 21 // <!--Start PulumiCodeChooser --> 22 // ```go 23 // package main 24 // 25 // import ( 26 // 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/accessanalyzer" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // _, err := accessanalyzer.NewAnalyzer(ctx, "example", &accessanalyzer.AnalyzerArgs{ 35 // AnalyzerName: pulumi.String("example"), 36 // }) 37 // if err != nil { 38 // return err 39 // } 40 // return nil 41 // }) 42 // } 43 // 44 // ``` 45 // <!--End PulumiCodeChooser --> 46 // 47 // ### Organization Analyzer 48 // 49 // <!--Start PulumiCodeChooser --> 50 // ```go 51 // package main 52 // 53 // import ( 54 // 55 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/accessanalyzer" 56 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations" 57 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 58 // 59 // ) 60 // 61 // func main() { 62 // pulumi.Run(func(ctx *pulumi.Context) error { 63 // example, err := organizations.NewOrganization(ctx, "example", &organizations.OrganizationArgs{ 64 // AwsServiceAccessPrincipals: pulumi.StringArray{ 65 // pulumi.String("access-analyzer.amazonaws.com"), 66 // }, 67 // }) 68 // if err != nil { 69 // return err 70 // } 71 // _, err = accessanalyzer.NewAnalyzer(ctx, "example", &accessanalyzer.AnalyzerArgs{ 72 // AnalyzerName: pulumi.String("example"), 73 // Type: pulumi.String("ORGANIZATION"), 74 // }, pulumi.DependsOn([]pulumi.Resource{ 75 // example, 76 // })) 77 // if err != nil { 78 // return err 79 // } 80 // return nil 81 // }) 82 // } 83 // 84 // ``` 85 // <!--End PulumiCodeChooser --> 86 // 87 // ## Import 88 // 89 // Using `pulumi import`, import Access Analyzer Analyzers using the `analyzer_name`. For example: 90 // 91 // ```sh 92 // $ pulumi import aws:accessanalyzer/analyzer:Analyzer example example 93 // ``` 94 type Analyzer struct { 95 pulumi.CustomResourceState 96 97 // Name of the Analyzer. 98 // 99 // The following arguments are optional: 100 AnalyzerName pulumi.StringOutput `pulumi:"analyzerName"` 101 // ARN of the Analyzer. 102 Arn pulumi.StringOutput `pulumi:"arn"` 103 // A block that specifies the configuration of the analyzer. Documented below 104 Configuration AnalyzerConfigurationPtrOutput `pulumi:"configuration"` 105 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 106 Tags pulumi.StringMapOutput `pulumi:"tags"` 107 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 108 // 109 // Deprecated: Please use `tags` instead. 110 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 111 // Type of Analyzer. Valid values are `ACCOUNT`, `ORGANIZATION`, ` ACCOUNT_UNUSED_ACCESS `, `ORGANIZATION_UNUSED_ACCESS`. Defaults to `ACCOUNT`. 112 Type pulumi.StringPtrOutput `pulumi:"type"` 113 } 114 115 // NewAnalyzer registers a new resource with the given unique name, arguments, and options. 116 func NewAnalyzer(ctx *pulumi.Context, 117 name string, args *AnalyzerArgs, opts ...pulumi.ResourceOption) (*Analyzer, error) { 118 if args == nil { 119 return nil, errors.New("missing one or more required arguments") 120 } 121 122 if args.AnalyzerName == nil { 123 return nil, errors.New("invalid value for required argument 'AnalyzerName'") 124 } 125 opts = internal.PkgResourceDefaultOpts(opts) 126 var resource Analyzer 127 err := ctx.RegisterResource("aws:accessanalyzer/analyzer:Analyzer", name, args, &resource, opts...) 128 if err != nil { 129 return nil, err 130 } 131 return &resource, nil 132 } 133 134 // GetAnalyzer gets an existing Analyzer resource's state with the given name, ID, and optional 135 // state properties that are used to uniquely qualify the lookup (nil if not required). 136 func GetAnalyzer(ctx *pulumi.Context, 137 name string, id pulumi.IDInput, state *AnalyzerState, opts ...pulumi.ResourceOption) (*Analyzer, error) { 138 var resource Analyzer 139 err := ctx.ReadResource("aws:accessanalyzer/analyzer:Analyzer", name, id, state, &resource, opts...) 140 if err != nil { 141 return nil, err 142 } 143 return &resource, nil 144 } 145 146 // Input properties used for looking up and filtering Analyzer resources. 147 type analyzerState struct { 148 // Name of the Analyzer. 149 // 150 // The following arguments are optional: 151 AnalyzerName *string `pulumi:"analyzerName"` 152 // ARN of the Analyzer. 153 Arn *string `pulumi:"arn"` 154 // A block that specifies the configuration of the analyzer. Documented below 155 Configuration *AnalyzerConfiguration `pulumi:"configuration"` 156 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 157 Tags map[string]string `pulumi:"tags"` 158 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 159 // 160 // Deprecated: Please use `tags` instead. 161 TagsAll map[string]string `pulumi:"tagsAll"` 162 // Type of Analyzer. Valid values are `ACCOUNT`, `ORGANIZATION`, ` ACCOUNT_UNUSED_ACCESS `, `ORGANIZATION_UNUSED_ACCESS`. Defaults to `ACCOUNT`. 163 Type *string `pulumi:"type"` 164 } 165 166 type AnalyzerState struct { 167 // Name of the Analyzer. 168 // 169 // The following arguments are optional: 170 AnalyzerName pulumi.StringPtrInput 171 // ARN of the Analyzer. 172 Arn pulumi.StringPtrInput 173 // A block that specifies the configuration of the analyzer. Documented below 174 Configuration AnalyzerConfigurationPtrInput 175 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 176 Tags pulumi.StringMapInput 177 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 178 // 179 // Deprecated: Please use `tags` instead. 180 TagsAll pulumi.StringMapInput 181 // Type of Analyzer. Valid values are `ACCOUNT`, `ORGANIZATION`, ` ACCOUNT_UNUSED_ACCESS `, `ORGANIZATION_UNUSED_ACCESS`. Defaults to `ACCOUNT`. 182 Type pulumi.StringPtrInput 183 } 184 185 func (AnalyzerState) ElementType() reflect.Type { 186 return reflect.TypeOf((*analyzerState)(nil)).Elem() 187 } 188 189 type analyzerArgs struct { 190 // Name of the Analyzer. 191 // 192 // The following arguments are optional: 193 AnalyzerName string `pulumi:"analyzerName"` 194 // A block that specifies the configuration of the analyzer. Documented below 195 Configuration *AnalyzerConfiguration `pulumi:"configuration"` 196 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 197 Tags map[string]string `pulumi:"tags"` 198 // Type of Analyzer. Valid values are `ACCOUNT`, `ORGANIZATION`, ` ACCOUNT_UNUSED_ACCESS `, `ORGANIZATION_UNUSED_ACCESS`. Defaults to `ACCOUNT`. 199 Type *string `pulumi:"type"` 200 } 201 202 // The set of arguments for constructing a Analyzer resource. 203 type AnalyzerArgs struct { 204 // Name of the Analyzer. 205 // 206 // The following arguments are optional: 207 AnalyzerName pulumi.StringInput 208 // A block that specifies the configuration of the analyzer. Documented below 209 Configuration AnalyzerConfigurationPtrInput 210 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 211 Tags pulumi.StringMapInput 212 // Type of Analyzer. Valid values are `ACCOUNT`, `ORGANIZATION`, ` ACCOUNT_UNUSED_ACCESS `, `ORGANIZATION_UNUSED_ACCESS`. Defaults to `ACCOUNT`. 213 Type pulumi.StringPtrInput 214 } 215 216 func (AnalyzerArgs) ElementType() reflect.Type { 217 return reflect.TypeOf((*analyzerArgs)(nil)).Elem() 218 } 219 220 type AnalyzerInput interface { 221 pulumi.Input 222 223 ToAnalyzerOutput() AnalyzerOutput 224 ToAnalyzerOutputWithContext(ctx context.Context) AnalyzerOutput 225 } 226 227 func (*Analyzer) ElementType() reflect.Type { 228 return reflect.TypeOf((**Analyzer)(nil)).Elem() 229 } 230 231 func (i *Analyzer) ToAnalyzerOutput() AnalyzerOutput { 232 return i.ToAnalyzerOutputWithContext(context.Background()) 233 } 234 235 func (i *Analyzer) ToAnalyzerOutputWithContext(ctx context.Context) AnalyzerOutput { 236 return pulumi.ToOutputWithContext(ctx, i).(AnalyzerOutput) 237 } 238 239 // AnalyzerArrayInput is an input type that accepts AnalyzerArray and AnalyzerArrayOutput values. 240 // You can construct a concrete instance of `AnalyzerArrayInput` via: 241 // 242 // AnalyzerArray{ AnalyzerArgs{...} } 243 type AnalyzerArrayInput interface { 244 pulumi.Input 245 246 ToAnalyzerArrayOutput() AnalyzerArrayOutput 247 ToAnalyzerArrayOutputWithContext(context.Context) AnalyzerArrayOutput 248 } 249 250 type AnalyzerArray []AnalyzerInput 251 252 func (AnalyzerArray) ElementType() reflect.Type { 253 return reflect.TypeOf((*[]*Analyzer)(nil)).Elem() 254 } 255 256 func (i AnalyzerArray) ToAnalyzerArrayOutput() AnalyzerArrayOutput { 257 return i.ToAnalyzerArrayOutputWithContext(context.Background()) 258 } 259 260 func (i AnalyzerArray) ToAnalyzerArrayOutputWithContext(ctx context.Context) AnalyzerArrayOutput { 261 return pulumi.ToOutputWithContext(ctx, i).(AnalyzerArrayOutput) 262 } 263 264 // AnalyzerMapInput is an input type that accepts AnalyzerMap and AnalyzerMapOutput values. 265 // You can construct a concrete instance of `AnalyzerMapInput` via: 266 // 267 // AnalyzerMap{ "key": AnalyzerArgs{...} } 268 type AnalyzerMapInput interface { 269 pulumi.Input 270 271 ToAnalyzerMapOutput() AnalyzerMapOutput 272 ToAnalyzerMapOutputWithContext(context.Context) AnalyzerMapOutput 273 } 274 275 type AnalyzerMap map[string]AnalyzerInput 276 277 func (AnalyzerMap) ElementType() reflect.Type { 278 return reflect.TypeOf((*map[string]*Analyzer)(nil)).Elem() 279 } 280 281 func (i AnalyzerMap) ToAnalyzerMapOutput() AnalyzerMapOutput { 282 return i.ToAnalyzerMapOutputWithContext(context.Background()) 283 } 284 285 func (i AnalyzerMap) ToAnalyzerMapOutputWithContext(ctx context.Context) AnalyzerMapOutput { 286 return pulumi.ToOutputWithContext(ctx, i).(AnalyzerMapOutput) 287 } 288 289 type AnalyzerOutput struct{ *pulumi.OutputState } 290 291 func (AnalyzerOutput) ElementType() reflect.Type { 292 return reflect.TypeOf((**Analyzer)(nil)).Elem() 293 } 294 295 func (o AnalyzerOutput) ToAnalyzerOutput() AnalyzerOutput { 296 return o 297 } 298 299 func (o AnalyzerOutput) ToAnalyzerOutputWithContext(ctx context.Context) AnalyzerOutput { 300 return o 301 } 302 303 // Name of the Analyzer. 304 // 305 // The following arguments are optional: 306 func (o AnalyzerOutput) AnalyzerName() pulumi.StringOutput { 307 return o.ApplyT(func(v *Analyzer) pulumi.StringOutput { return v.AnalyzerName }).(pulumi.StringOutput) 308 } 309 310 // ARN of the Analyzer. 311 func (o AnalyzerOutput) Arn() pulumi.StringOutput { 312 return o.ApplyT(func(v *Analyzer) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 313 } 314 315 // A block that specifies the configuration of the analyzer. Documented below 316 func (o AnalyzerOutput) Configuration() AnalyzerConfigurationPtrOutput { 317 return o.ApplyT(func(v *Analyzer) AnalyzerConfigurationPtrOutput { return v.Configuration }).(AnalyzerConfigurationPtrOutput) 318 } 319 320 // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 321 func (o AnalyzerOutput) Tags() pulumi.StringMapOutput { 322 return o.ApplyT(func(v *Analyzer) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 323 } 324 325 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 326 // 327 // Deprecated: Please use `tags` instead. 328 func (o AnalyzerOutput) TagsAll() pulumi.StringMapOutput { 329 return o.ApplyT(func(v *Analyzer) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 330 } 331 332 // Type of Analyzer. Valid values are `ACCOUNT`, `ORGANIZATION`, ` ACCOUNT_UNUSED_ACCESS `, `ORGANIZATION_UNUSED_ACCESS`. Defaults to `ACCOUNT`. 333 func (o AnalyzerOutput) Type() pulumi.StringPtrOutput { 334 return o.ApplyT(func(v *Analyzer) pulumi.StringPtrOutput { return v.Type }).(pulumi.StringPtrOutput) 335 } 336 337 type AnalyzerArrayOutput struct{ *pulumi.OutputState } 338 339 func (AnalyzerArrayOutput) ElementType() reflect.Type { 340 return reflect.TypeOf((*[]*Analyzer)(nil)).Elem() 341 } 342 343 func (o AnalyzerArrayOutput) ToAnalyzerArrayOutput() AnalyzerArrayOutput { 344 return o 345 } 346 347 func (o AnalyzerArrayOutput) ToAnalyzerArrayOutputWithContext(ctx context.Context) AnalyzerArrayOutput { 348 return o 349 } 350 351 func (o AnalyzerArrayOutput) Index(i pulumi.IntInput) AnalyzerOutput { 352 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Analyzer { 353 return vs[0].([]*Analyzer)[vs[1].(int)] 354 }).(AnalyzerOutput) 355 } 356 357 type AnalyzerMapOutput struct{ *pulumi.OutputState } 358 359 func (AnalyzerMapOutput) ElementType() reflect.Type { 360 return reflect.TypeOf((*map[string]*Analyzer)(nil)).Elem() 361 } 362 363 func (o AnalyzerMapOutput) ToAnalyzerMapOutput() AnalyzerMapOutput { 364 return o 365 } 366 367 func (o AnalyzerMapOutput) ToAnalyzerMapOutputWithContext(ctx context.Context) AnalyzerMapOutput { 368 return o 369 } 370 371 func (o AnalyzerMapOutput) MapIndex(k pulumi.StringInput) AnalyzerOutput { 372 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Analyzer { 373 return vs[0].(map[string]*Analyzer)[vs[1].(string)] 374 }).(AnalyzerOutput) 375 } 376 377 func init() { 378 pulumi.RegisterInputType(reflect.TypeOf((*AnalyzerInput)(nil)).Elem(), &Analyzer{}) 379 pulumi.RegisterInputType(reflect.TypeOf((*AnalyzerArrayInput)(nil)).Elem(), AnalyzerArray{}) 380 pulumi.RegisterInputType(reflect.TypeOf((*AnalyzerMapInput)(nil)).Elem(), AnalyzerMap{}) 381 pulumi.RegisterOutputType(AnalyzerOutput{}) 382 pulumi.RegisterOutputType(AnalyzerArrayOutput{}) 383 pulumi.RegisterOutputType(AnalyzerMapOutput{}) 384 }