github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/securityhub/findingAggregator.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 securityhub
     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 a Security Hub finding aggregator. Security Hub needs to be enabled in a region in order for the aggregator to pull through findings.
    16  //
    17  // ## Example Usage
    18  //
    19  // ### All Regions Usage
    20  //
    21  // The following example will enable the aggregator for every region.
    22  //
    23  // <!--Start PulumiCodeChooser -->
    24  // ```go
    25  // package main
    26  //
    27  // import (
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/securityhub"
    30  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    31  //
    32  // )
    33  //
    34  //	func main() {
    35  //		pulumi.Run(func(ctx *pulumi.Context) error {
    36  //			example, err := securityhub.NewAccount(ctx, "example", nil)
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = securityhub.NewFindingAggregator(ctx, "example", &securityhub.FindingAggregatorArgs{
    41  //				LinkingMode: pulumi.String("ALL_REGIONS"),
    42  //			}, pulumi.DependsOn([]pulumi.Resource{
    43  //				example,
    44  //			}))
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  //
    55  // ### All Regions Except Specified Regions Usage
    56  //
    57  // The following example will enable the aggregator for every region except those specified in `specifiedRegions`.
    58  //
    59  // <!--Start PulumiCodeChooser -->
    60  // ```go
    61  // package main
    62  //
    63  // import (
    64  //
    65  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/securityhub"
    66  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    67  //
    68  // )
    69  //
    70  //	func main() {
    71  //		pulumi.Run(func(ctx *pulumi.Context) error {
    72  //			example, err := securityhub.NewAccount(ctx, "example", nil)
    73  //			if err != nil {
    74  //				return err
    75  //			}
    76  //			_, err = securityhub.NewFindingAggregator(ctx, "example", &securityhub.FindingAggregatorArgs{
    77  //				LinkingMode: pulumi.String("ALL_REGIONS_EXCEPT_SPECIFIED"),
    78  //				SpecifiedRegions: pulumi.StringArray{
    79  //					pulumi.String("eu-west-1"),
    80  //					pulumi.String("eu-west-2"),
    81  //				},
    82  //			}, pulumi.DependsOn([]pulumi.Resource{
    83  //				example,
    84  //			}))
    85  //			if err != nil {
    86  //				return err
    87  //			}
    88  //			return nil
    89  //		})
    90  //	}
    91  //
    92  // ```
    93  // <!--End PulumiCodeChooser -->
    94  //
    95  // ### Specified Regions Usage
    96  //
    97  // The following example will enable the aggregator for every region specified in `specifiedRegions`.
    98  //
    99  // <!--Start PulumiCodeChooser -->
   100  // ```go
   101  // package main
   102  //
   103  // import (
   104  //
   105  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/securityhub"
   106  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   107  //
   108  // )
   109  //
   110  //	func main() {
   111  //		pulumi.Run(func(ctx *pulumi.Context) error {
   112  //			example, err := securityhub.NewAccount(ctx, "example", nil)
   113  //			if err != nil {
   114  //				return err
   115  //			}
   116  //			_, err = securityhub.NewFindingAggregator(ctx, "example", &securityhub.FindingAggregatorArgs{
   117  //				LinkingMode: pulumi.String("SPECIFIED_REGIONS"),
   118  //				SpecifiedRegions: pulumi.StringArray{
   119  //					pulumi.String("eu-west-1"),
   120  //					pulumi.String("eu-west-2"),
   121  //				},
   122  //			}, pulumi.DependsOn([]pulumi.Resource{
   123  //				example,
   124  //			}))
   125  //			if err != nil {
   126  //				return err
   127  //			}
   128  //			return nil
   129  //		})
   130  //	}
   131  //
   132  // ```
   133  // <!--End PulumiCodeChooser -->
   134  //
   135  // ## Import
   136  //
   137  // Using `pulumi import`, import an existing Security Hub finding aggregator using the `arn`. For example:
   138  //
   139  // ```sh
   140  // $ pulumi import aws:securityhub/findingAggregator:FindingAggregator example arn:aws:securityhub:eu-west-1:123456789098:finding-aggregator/abcd1234-abcd-1234-1234-abcdef123456
   141  // ```
   142  type FindingAggregator struct {
   143  	pulumi.CustomResourceState
   144  
   145  	// Indicates whether to aggregate findings from all of the available Regions or from a specified list. The options are `ALL_REGIONS`, `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`. When `ALL_REGIONS` or `ALL_REGIONS_EXCEPT_SPECIFIED` are used, Security Hub will automatically aggregate findings from new Regions as Security Hub supports them and you opt into them.
   146  	LinkingMode pulumi.StringOutput `pulumi:"linkingMode"`
   147  	// List of regions to include or exclude (required if `linkingMode` is set to `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`)
   148  	SpecifiedRegions pulumi.StringArrayOutput `pulumi:"specifiedRegions"`
   149  }
   150  
   151  // NewFindingAggregator registers a new resource with the given unique name, arguments, and options.
   152  func NewFindingAggregator(ctx *pulumi.Context,
   153  	name string, args *FindingAggregatorArgs, opts ...pulumi.ResourceOption) (*FindingAggregator, error) {
   154  	if args == nil {
   155  		return nil, errors.New("missing one or more required arguments")
   156  	}
   157  
   158  	if args.LinkingMode == nil {
   159  		return nil, errors.New("invalid value for required argument 'LinkingMode'")
   160  	}
   161  	opts = internal.PkgResourceDefaultOpts(opts)
   162  	var resource FindingAggregator
   163  	err := ctx.RegisterResource("aws:securityhub/findingAggregator:FindingAggregator", name, args, &resource, opts...)
   164  	if err != nil {
   165  		return nil, err
   166  	}
   167  	return &resource, nil
   168  }
   169  
   170  // GetFindingAggregator gets an existing FindingAggregator resource's state with the given name, ID, and optional
   171  // state properties that are used to uniquely qualify the lookup (nil if not required).
   172  func GetFindingAggregator(ctx *pulumi.Context,
   173  	name string, id pulumi.IDInput, state *FindingAggregatorState, opts ...pulumi.ResourceOption) (*FindingAggregator, error) {
   174  	var resource FindingAggregator
   175  	err := ctx.ReadResource("aws:securityhub/findingAggregator:FindingAggregator", name, id, state, &resource, opts...)
   176  	if err != nil {
   177  		return nil, err
   178  	}
   179  	return &resource, nil
   180  }
   181  
   182  // Input properties used for looking up and filtering FindingAggregator resources.
   183  type findingAggregatorState struct {
   184  	// Indicates whether to aggregate findings from all of the available Regions or from a specified list. The options are `ALL_REGIONS`, `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`. When `ALL_REGIONS` or `ALL_REGIONS_EXCEPT_SPECIFIED` are used, Security Hub will automatically aggregate findings from new Regions as Security Hub supports them and you opt into them.
   185  	LinkingMode *string `pulumi:"linkingMode"`
   186  	// List of regions to include or exclude (required if `linkingMode` is set to `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`)
   187  	SpecifiedRegions []string `pulumi:"specifiedRegions"`
   188  }
   189  
   190  type FindingAggregatorState struct {
   191  	// Indicates whether to aggregate findings from all of the available Regions or from a specified list. The options are `ALL_REGIONS`, `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`. When `ALL_REGIONS` or `ALL_REGIONS_EXCEPT_SPECIFIED` are used, Security Hub will automatically aggregate findings from new Regions as Security Hub supports them and you opt into them.
   192  	LinkingMode pulumi.StringPtrInput
   193  	// List of regions to include or exclude (required if `linkingMode` is set to `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`)
   194  	SpecifiedRegions pulumi.StringArrayInput
   195  }
   196  
   197  func (FindingAggregatorState) ElementType() reflect.Type {
   198  	return reflect.TypeOf((*findingAggregatorState)(nil)).Elem()
   199  }
   200  
   201  type findingAggregatorArgs struct {
   202  	// Indicates whether to aggregate findings from all of the available Regions or from a specified list. The options are `ALL_REGIONS`, `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`. When `ALL_REGIONS` or `ALL_REGIONS_EXCEPT_SPECIFIED` are used, Security Hub will automatically aggregate findings from new Regions as Security Hub supports them and you opt into them.
   203  	LinkingMode string `pulumi:"linkingMode"`
   204  	// List of regions to include or exclude (required if `linkingMode` is set to `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`)
   205  	SpecifiedRegions []string `pulumi:"specifiedRegions"`
   206  }
   207  
   208  // The set of arguments for constructing a FindingAggregator resource.
   209  type FindingAggregatorArgs struct {
   210  	// Indicates whether to aggregate findings from all of the available Regions or from a specified list. The options are `ALL_REGIONS`, `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`. When `ALL_REGIONS` or `ALL_REGIONS_EXCEPT_SPECIFIED` are used, Security Hub will automatically aggregate findings from new Regions as Security Hub supports them and you opt into them.
   211  	LinkingMode pulumi.StringInput
   212  	// List of regions to include or exclude (required if `linkingMode` is set to `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`)
   213  	SpecifiedRegions pulumi.StringArrayInput
   214  }
   215  
   216  func (FindingAggregatorArgs) ElementType() reflect.Type {
   217  	return reflect.TypeOf((*findingAggregatorArgs)(nil)).Elem()
   218  }
   219  
   220  type FindingAggregatorInput interface {
   221  	pulumi.Input
   222  
   223  	ToFindingAggregatorOutput() FindingAggregatorOutput
   224  	ToFindingAggregatorOutputWithContext(ctx context.Context) FindingAggregatorOutput
   225  }
   226  
   227  func (*FindingAggregator) ElementType() reflect.Type {
   228  	return reflect.TypeOf((**FindingAggregator)(nil)).Elem()
   229  }
   230  
   231  func (i *FindingAggregator) ToFindingAggregatorOutput() FindingAggregatorOutput {
   232  	return i.ToFindingAggregatorOutputWithContext(context.Background())
   233  }
   234  
   235  func (i *FindingAggregator) ToFindingAggregatorOutputWithContext(ctx context.Context) FindingAggregatorOutput {
   236  	return pulumi.ToOutputWithContext(ctx, i).(FindingAggregatorOutput)
   237  }
   238  
   239  // FindingAggregatorArrayInput is an input type that accepts FindingAggregatorArray and FindingAggregatorArrayOutput values.
   240  // You can construct a concrete instance of `FindingAggregatorArrayInput` via:
   241  //
   242  //	FindingAggregatorArray{ FindingAggregatorArgs{...} }
   243  type FindingAggregatorArrayInput interface {
   244  	pulumi.Input
   245  
   246  	ToFindingAggregatorArrayOutput() FindingAggregatorArrayOutput
   247  	ToFindingAggregatorArrayOutputWithContext(context.Context) FindingAggregatorArrayOutput
   248  }
   249  
   250  type FindingAggregatorArray []FindingAggregatorInput
   251  
   252  func (FindingAggregatorArray) ElementType() reflect.Type {
   253  	return reflect.TypeOf((*[]*FindingAggregator)(nil)).Elem()
   254  }
   255  
   256  func (i FindingAggregatorArray) ToFindingAggregatorArrayOutput() FindingAggregatorArrayOutput {
   257  	return i.ToFindingAggregatorArrayOutputWithContext(context.Background())
   258  }
   259  
   260  func (i FindingAggregatorArray) ToFindingAggregatorArrayOutputWithContext(ctx context.Context) FindingAggregatorArrayOutput {
   261  	return pulumi.ToOutputWithContext(ctx, i).(FindingAggregatorArrayOutput)
   262  }
   263  
   264  // FindingAggregatorMapInput is an input type that accepts FindingAggregatorMap and FindingAggregatorMapOutput values.
   265  // You can construct a concrete instance of `FindingAggregatorMapInput` via:
   266  //
   267  //	FindingAggregatorMap{ "key": FindingAggregatorArgs{...} }
   268  type FindingAggregatorMapInput interface {
   269  	pulumi.Input
   270  
   271  	ToFindingAggregatorMapOutput() FindingAggregatorMapOutput
   272  	ToFindingAggregatorMapOutputWithContext(context.Context) FindingAggregatorMapOutput
   273  }
   274  
   275  type FindingAggregatorMap map[string]FindingAggregatorInput
   276  
   277  func (FindingAggregatorMap) ElementType() reflect.Type {
   278  	return reflect.TypeOf((*map[string]*FindingAggregator)(nil)).Elem()
   279  }
   280  
   281  func (i FindingAggregatorMap) ToFindingAggregatorMapOutput() FindingAggregatorMapOutput {
   282  	return i.ToFindingAggregatorMapOutputWithContext(context.Background())
   283  }
   284  
   285  func (i FindingAggregatorMap) ToFindingAggregatorMapOutputWithContext(ctx context.Context) FindingAggregatorMapOutput {
   286  	return pulumi.ToOutputWithContext(ctx, i).(FindingAggregatorMapOutput)
   287  }
   288  
   289  type FindingAggregatorOutput struct{ *pulumi.OutputState }
   290  
   291  func (FindingAggregatorOutput) ElementType() reflect.Type {
   292  	return reflect.TypeOf((**FindingAggregator)(nil)).Elem()
   293  }
   294  
   295  func (o FindingAggregatorOutput) ToFindingAggregatorOutput() FindingAggregatorOutput {
   296  	return o
   297  }
   298  
   299  func (o FindingAggregatorOutput) ToFindingAggregatorOutputWithContext(ctx context.Context) FindingAggregatorOutput {
   300  	return o
   301  }
   302  
   303  // Indicates whether to aggregate findings from all of the available Regions or from a specified list. The options are `ALL_REGIONS`, `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`. When `ALL_REGIONS` or `ALL_REGIONS_EXCEPT_SPECIFIED` are used, Security Hub will automatically aggregate findings from new Regions as Security Hub supports them and you opt into them.
   304  func (o FindingAggregatorOutput) LinkingMode() pulumi.StringOutput {
   305  	return o.ApplyT(func(v *FindingAggregator) pulumi.StringOutput { return v.LinkingMode }).(pulumi.StringOutput)
   306  }
   307  
   308  // List of regions to include or exclude (required if `linkingMode` is set to `ALL_REGIONS_EXCEPT_SPECIFIED` or `SPECIFIED_REGIONS`)
   309  func (o FindingAggregatorOutput) SpecifiedRegions() pulumi.StringArrayOutput {
   310  	return o.ApplyT(func(v *FindingAggregator) pulumi.StringArrayOutput { return v.SpecifiedRegions }).(pulumi.StringArrayOutput)
   311  }
   312  
   313  type FindingAggregatorArrayOutput struct{ *pulumi.OutputState }
   314  
   315  func (FindingAggregatorArrayOutput) ElementType() reflect.Type {
   316  	return reflect.TypeOf((*[]*FindingAggregator)(nil)).Elem()
   317  }
   318  
   319  func (o FindingAggregatorArrayOutput) ToFindingAggregatorArrayOutput() FindingAggregatorArrayOutput {
   320  	return o
   321  }
   322  
   323  func (o FindingAggregatorArrayOutput) ToFindingAggregatorArrayOutputWithContext(ctx context.Context) FindingAggregatorArrayOutput {
   324  	return o
   325  }
   326  
   327  func (o FindingAggregatorArrayOutput) Index(i pulumi.IntInput) FindingAggregatorOutput {
   328  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *FindingAggregator {
   329  		return vs[0].([]*FindingAggregator)[vs[1].(int)]
   330  	}).(FindingAggregatorOutput)
   331  }
   332  
   333  type FindingAggregatorMapOutput struct{ *pulumi.OutputState }
   334  
   335  func (FindingAggregatorMapOutput) ElementType() reflect.Type {
   336  	return reflect.TypeOf((*map[string]*FindingAggregator)(nil)).Elem()
   337  }
   338  
   339  func (o FindingAggregatorMapOutput) ToFindingAggregatorMapOutput() FindingAggregatorMapOutput {
   340  	return o
   341  }
   342  
   343  func (o FindingAggregatorMapOutput) ToFindingAggregatorMapOutputWithContext(ctx context.Context) FindingAggregatorMapOutput {
   344  	return o
   345  }
   346  
   347  func (o FindingAggregatorMapOutput) MapIndex(k pulumi.StringInput) FindingAggregatorOutput {
   348  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *FindingAggregator {
   349  		return vs[0].(map[string]*FindingAggregator)[vs[1].(string)]
   350  	}).(FindingAggregatorOutput)
   351  }
   352  
   353  func init() {
   354  	pulumi.RegisterInputType(reflect.TypeOf((*FindingAggregatorInput)(nil)).Elem(), &FindingAggregator{})
   355  	pulumi.RegisterInputType(reflect.TypeOf((*FindingAggregatorArrayInput)(nil)).Elem(), FindingAggregatorArray{})
   356  	pulumi.RegisterInputType(reflect.TypeOf((*FindingAggregatorMapInput)(nil)).Elem(), FindingAggregatorMap{})
   357  	pulumi.RegisterOutputType(FindingAggregatorOutput{})
   358  	pulumi.RegisterOutputType(FindingAggregatorArrayOutput{})
   359  	pulumi.RegisterOutputType(FindingAggregatorMapOutput{})
   360  }