github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/guardduty/threatIntelSet.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 guardduty
     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  // Provides a resource to manage a GuardDuty ThreatIntelSet.
    16  //
    17  // > **Note:** Currently in GuardDuty, users from member accounts cannot upload and further manage ThreatIntelSets. ThreatIntelSets that are uploaded by the primary account are imposed on GuardDuty functionality in its member accounts. See the [GuardDuty API Documentation](https://docs.aws.amazon.com/guardduty/latest/ug/create-threat-intel-set.html)
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"fmt"
    28  //
    29  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/guardduty"
    30  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    31  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    32  //
    33  // )
    34  //
    35  //	func main() {
    36  //		pulumi.Run(func(ctx *pulumi.Context) error {
    37  //			primary, err := guardduty.NewDetector(ctx, "primary", &guardduty.DetectorArgs{
    38  //				Enable: pulumi.Bool(true),
    39  //			})
    40  //			if err != nil {
    41  //				return err
    42  //			}
    43  //			bucket, err := s3.NewBucketV2(ctx, "bucket", nil)
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			_, err = s3.NewBucketAclV2(ctx, "bucket_acl", &s3.BucketAclV2Args{
    48  //				Bucket: bucket.ID(),
    49  //				Acl:    pulumi.String("private"),
    50  //			})
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			myThreatIntelSet, err := s3.NewBucketObjectv2(ctx, "MyThreatIntelSet", &s3.BucketObjectv2Args{
    55  //				Acl:     pulumi.String("public-read"),
    56  //				Content: pulumi.String("10.0.0.0/8\n"),
    57  //				Bucket:  bucket.ID(),
    58  //				Key:     pulumi.String("MyThreatIntelSet"),
    59  //			})
    60  //			if err != nil {
    61  //				return err
    62  //			}
    63  //			_, err = guardduty.NewThreatIntelSet(ctx, "MyThreatIntelSet", &guardduty.ThreatIntelSetArgs{
    64  //				Activate:   pulumi.Bool(true),
    65  //				DetectorId: primary.ID(),
    66  //				Format:     pulumi.String("TXT"),
    67  //				Location: pulumi.All(myThreatIntelSet.Bucket, myThreatIntelSet.Key).ApplyT(func(_args []interface{}) (string, error) {
    68  //					bucket := _args[0].(string)
    69  //					key := _args[1].(string)
    70  //					return fmt.Sprintf("https://s3.amazonaws.com/%v/%v", bucket, key), nil
    71  //				}).(pulumi.StringOutput),
    72  //				Name: pulumi.String("MyThreatIntelSet"),
    73  //			})
    74  //			if err != nil {
    75  //				return err
    76  //			}
    77  //			return nil
    78  //		})
    79  //	}
    80  //
    81  // ```
    82  // <!--End PulumiCodeChooser -->
    83  //
    84  // ## Import
    85  //
    86  // Using `pulumi import`, import GuardDuty ThreatIntelSet using the primary GuardDuty detector ID and ThreatIntelSetID. For example:
    87  //
    88  // ```sh
    89  // $ pulumi import aws:guardduty/threatIntelSet:ThreatIntelSet MyThreatIntelSet 00b00fd5aecc0ab60a708659477e9617:123456789012
    90  // ```
    91  type ThreatIntelSet struct {
    92  	pulumi.CustomResourceState
    93  
    94  	// Specifies whether GuardDuty is to start using the uploaded ThreatIntelSet.
    95  	Activate pulumi.BoolOutput `pulumi:"activate"`
    96  	// Amazon Resource Name (ARN) of the GuardDuty ThreatIntelSet.
    97  	Arn pulumi.StringOutput `pulumi:"arn"`
    98  	// The detector ID of the GuardDuty.
    99  	DetectorId pulumi.StringOutput `pulumi:"detectorId"`
   100  	// The format of the file that contains the ThreatIntelSet. Valid values: `TXT` | `STIX` | `OTX_CSV` | `ALIEN_VAULT` | `PROOF_POINT` | `FIRE_EYE`
   101  	Format pulumi.StringOutput `pulumi:"format"`
   102  	// The URI of the file that contains the ThreatIntelSet.
   103  	Location pulumi.StringOutput `pulumi:"location"`
   104  	// The friendly name to identify the ThreatIntelSet.
   105  	Name pulumi.StringOutput `pulumi:"name"`
   106  	// 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.
   107  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   108  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   109  	//
   110  	// Deprecated: Please use `tags` instead.
   111  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   112  }
   113  
   114  // NewThreatIntelSet registers a new resource with the given unique name, arguments, and options.
   115  func NewThreatIntelSet(ctx *pulumi.Context,
   116  	name string, args *ThreatIntelSetArgs, opts ...pulumi.ResourceOption) (*ThreatIntelSet, error) {
   117  	if args == nil {
   118  		return nil, errors.New("missing one or more required arguments")
   119  	}
   120  
   121  	if args.Activate == nil {
   122  		return nil, errors.New("invalid value for required argument 'Activate'")
   123  	}
   124  	if args.DetectorId == nil {
   125  		return nil, errors.New("invalid value for required argument 'DetectorId'")
   126  	}
   127  	if args.Format == nil {
   128  		return nil, errors.New("invalid value for required argument 'Format'")
   129  	}
   130  	if args.Location == nil {
   131  		return nil, errors.New("invalid value for required argument 'Location'")
   132  	}
   133  	opts = internal.PkgResourceDefaultOpts(opts)
   134  	var resource ThreatIntelSet
   135  	err := ctx.RegisterResource("aws:guardduty/threatIntelSet:ThreatIntelSet", name, args, &resource, opts...)
   136  	if err != nil {
   137  		return nil, err
   138  	}
   139  	return &resource, nil
   140  }
   141  
   142  // GetThreatIntelSet gets an existing ThreatIntelSet resource's state with the given name, ID, and optional
   143  // state properties that are used to uniquely qualify the lookup (nil if not required).
   144  func GetThreatIntelSet(ctx *pulumi.Context,
   145  	name string, id pulumi.IDInput, state *ThreatIntelSetState, opts ...pulumi.ResourceOption) (*ThreatIntelSet, error) {
   146  	var resource ThreatIntelSet
   147  	err := ctx.ReadResource("aws:guardduty/threatIntelSet:ThreatIntelSet", name, id, state, &resource, opts...)
   148  	if err != nil {
   149  		return nil, err
   150  	}
   151  	return &resource, nil
   152  }
   153  
   154  // Input properties used for looking up and filtering ThreatIntelSet resources.
   155  type threatIntelSetState struct {
   156  	// Specifies whether GuardDuty is to start using the uploaded ThreatIntelSet.
   157  	Activate *bool `pulumi:"activate"`
   158  	// Amazon Resource Name (ARN) of the GuardDuty ThreatIntelSet.
   159  	Arn *string `pulumi:"arn"`
   160  	// The detector ID of the GuardDuty.
   161  	DetectorId *string `pulumi:"detectorId"`
   162  	// The format of the file that contains the ThreatIntelSet. Valid values: `TXT` | `STIX` | `OTX_CSV` | `ALIEN_VAULT` | `PROOF_POINT` | `FIRE_EYE`
   163  	Format *string `pulumi:"format"`
   164  	// The URI of the file that contains the ThreatIntelSet.
   165  	Location *string `pulumi:"location"`
   166  	// The friendly name to identify the ThreatIntelSet.
   167  	Name *string `pulumi:"name"`
   168  	// 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.
   169  	Tags map[string]string `pulumi:"tags"`
   170  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   171  	//
   172  	// Deprecated: Please use `tags` instead.
   173  	TagsAll map[string]string `pulumi:"tagsAll"`
   174  }
   175  
   176  type ThreatIntelSetState struct {
   177  	// Specifies whether GuardDuty is to start using the uploaded ThreatIntelSet.
   178  	Activate pulumi.BoolPtrInput
   179  	// Amazon Resource Name (ARN) of the GuardDuty ThreatIntelSet.
   180  	Arn pulumi.StringPtrInput
   181  	// The detector ID of the GuardDuty.
   182  	DetectorId pulumi.StringPtrInput
   183  	// The format of the file that contains the ThreatIntelSet. Valid values: `TXT` | `STIX` | `OTX_CSV` | `ALIEN_VAULT` | `PROOF_POINT` | `FIRE_EYE`
   184  	Format pulumi.StringPtrInput
   185  	// The URI of the file that contains the ThreatIntelSet.
   186  	Location pulumi.StringPtrInput
   187  	// The friendly name to identify the ThreatIntelSet.
   188  	Name pulumi.StringPtrInput
   189  	// 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.
   190  	Tags pulumi.StringMapInput
   191  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   192  	//
   193  	// Deprecated: Please use `tags` instead.
   194  	TagsAll pulumi.StringMapInput
   195  }
   196  
   197  func (ThreatIntelSetState) ElementType() reflect.Type {
   198  	return reflect.TypeOf((*threatIntelSetState)(nil)).Elem()
   199  }
   200  
   201  type threatIntelSetArgs struct {
   202  	// Specifies whether GuardDuty is to start using the uploaded ThreatIntelSet.
   203  	Activate bool `pulumi:"activate"`
   204  	// The detector ID of the GuardDuty.
   205  	DetectorId string `pulumi:"detectorId"`
   206  	// The format of the file that contains the ThreatIntelSet. Valid values: `TXT` | `STIX` | `OTX_CSV` | `ALIEN_VAULT` | `PROOF_POINT` | `FIRE_EYE`
   207  	Format string `pulumi:"format"`
   208  	// The URI of the file that contains the ThreatIntelSet.
   209  	Location string `pulumi:"location"`
   210  	// The friendly name to identify the ThreatIntelSet.
   211  	Name *string `pulumi:"name"`
   212  	// 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.
   213  	Tags map[string]string `pulumi:"tags"`
   214  }
   215  
   216  // The set of arguments for constructing a ThreatIntelSet resource.
   217  type ThreatIntelSetArgs struct {
   218  	// Specifies whether GuardDuty is to start using the uploaded ThreatIntelSet.
   219  	Activate pulumi.BoolInput
   220  	// The detector ID of the GuardDuty.
   221  	DetectorId pulumi.StringInput
   222  	// The format of the file that contains the ThreatIntelSet. Valid values: `TXT` | `STIX` | `OTX_CSV` | `ALIEN_VAULT` | `PROOF_POINT` | `FIRE_EYE`
   223  	Format pulumi.StringInput
   224  	// The URI of the file that contains the ThreatIntelSet.
   225  	Location pulumi.StringInput
   226  	// The friendly name to identify the ThreatIntelSet.
   227  	Name pulumi.StringPtrInput
   228  	// 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.
   229  	Tags pulumi.StringMapInput
   230  }
   231  
   232  func (ThreatIntelSetArgs) ElementType() reflect.Type {
   233  	return reflect.TypeOf((*threatIntelSetArgs)(nil)).Elem()
   234  }
   235  
   236  type ThreatIntelSetInput interface {
   237  	pulumi.Input
   238  
   239  	ToThreatIntelSetOutput() ThreatIntelSetOutput
   240  	ToThreatIntelSetOutputWithContext(ctx context.Context) ThreatIntelSetOutput
   241  }
   242  
   243  func (*ThreatIntelSet) ElementType() reflect.Type {
   244  	return reflect.TypeOf((**ThreatIntelSet)(nil)).Elem()
   245  }
   246  
   247  func (i *ThreatIntelSet) ToThreatIntelSetOutput() ThreatIntelSetOutput {
   248  	return i.ToThreatIntelSetOutputWithContext(context.Background())
   249  }
   250  
   251  func (i *ThreatIntelSet) ToThreatIntelSetOutputWithContext(ctx context.Context) ThreatIntelSetOutput {
   252  	return pulumi.ToOutputWithContext(ctx, i).(ThreatIntelSetOutput)
   253  }
   254  
   255  // ThreatIntelSetArrayInput is an input type that accepts ThreatIntelSetArray and ThreatIntelSetArrayOutput values.
   256  // You can construct a concrete instance of `ThreatIntelSetArrayInput` via:
   257  //
   258  //	ThreatIntelSetArray{ ThreatIntelSetArgs{...} }
   259  type ThreatIntelSetArrayInput interface {
   260  	pulumi.Input
   261  
   262  	ToThreatIntelSetArrayOutput() ThreatIntelSetArrayOutput
   263  	ToThreatIntelSetArrayOutputWithContext(context.Context) ThreatIntelSetArrayOutput
   264  }
   265  
   266  type ThreatIntelSetArray []ThreatIntelSetInput
   267  
   268  func (ThreatIntelSetArray) ElementType() reflect.Type {
   269  	return reflect.TypeOf((*[]*ThreatIntelSet)(nil)).Elem()
   270  }
   271  
   272  func (i ThreatIntelSetArray) ToThreatIntelSetArrayOutput() ThreatIntelSetArrayOutput {
   273  	return i.ToThreatIntelSetArrayOutputWithContext(context.Background())
   274  }
   275  
   276  func (i ThreatIntelSetArray) ToThreatIntelSetArrayOutputWithContext(ctx context.Context) ThreatIntelSetArrayOutput {
   277  	return pulumi.ToOutputWithContext(ctx, i).(ThreatIntelSetArrayOutput)
   278  }
   279  
   280  // ThreatIntelSetMapInput is an input type that accepts ThreatIntelSetMap and ThreatIntelSetMapOutput values.
   281  // You can construct a concrete instance of `ThreatIntelSetMapInput` via:
   282  //
   283  //	ThreatIntelSetMap{ "key": ThreatIntelSetArgs{...} }
   284  type ThreatIntelSetMapInput interface {
   285  	pulumi.Input
   286  
   287  	ToThreatIntelSetMapOutput() ThreatIntelSetMapOutput
   288  	ToThreatIntelSetMapOutputWithContext(context.Context) ThreatIntelSetMapOutput
   289  }
   290  
   291  type ThreatIntelSetMap map[string]ThreatIntelSetInput
   292  
   293  func (ThreatIntelSetMap) ElementType() reflect.Type {
   294  	return reflect.TypeOf((*map[string]*ThreatIntelSet)(nil)).Elem()
   295  }
   296  
   297  func (i ThreatIntelSetMap) ToThreatIntelSetMapOutput() ThreatIntelSetMapOutput {
   298  	return i.ToThreatIntelSetMapOutputWithContext(context.Background())
   299  }
   300  
   301  func (i ThreatIntelSetMap) ToThreatIntelSetMapOutputWithContext(ctx context.Context) ThreatIntelSetMapOutput {
   302  	return pulumi.ToOutputWithContext(ctx, i).(ThreatIntelSetMapOutput)
   303  }
   304  
   305  type ThreatIntelSetOutput struct{ *pulumi.OutputState }
   306  
   307  func (ThreatIntelSetOutput) ElementType() reflect.Type {
   308  	return reflect.TypeOf((**ThreatIntelSet)(nil)).Elem()
   309  }
   310  
   311  func (o ThreatIntelSetOutput) ToThreatIntelSetOutput() ThreatIntelSetOutput {
   312  	return o
   313  }
   314  
   315  func (o ThreatIntelSetOutput) ToThreatIntelSetOutputWithContext(ctx context.Context) ThreatIntelSetOutput {
   316  	return o
   317  }
   318  
   319  // Specifies whether GuardDuty is to start using the uploaded ThreatIntelSet.
   320  func (o ThreatIntelSetOutput) Activate() pulumi.BoolOutput {
   321  	return o.ApplyT(func(v *ThreatIntelSet) pulumi.BoolOutput { return v.Activate }).(pulumi.BoolOutput)
   322  }
   323  
   324  // Amazon Resource Name (ARN) of the GuardDuty ThreatIntelSet.
   325  func (o ThreatIntelSetOutput) Arn() pulumi.StringOutput {
   326  	return o.ApplyT(func(v *ThreatIntelSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   327  }
   328  
   329  // The detector ID of the GuardDuty.
   330  func (o ThreatIntelSetOutput) DetectorId() pulumi.StringOutput {
   331  	return o.ApplyT(func(v *ThreatIntelSet) pulumi.StringOutput { return v.DetectorId }).(pulumi.StringOutput)
   332  }
   333  
   334  // The format of the file that contains the ThreatIntelSet. Valid values: `TXT` | `STIX` | `OTX_CSV` | `ALIEN_VAULT` | `PROOF_POINT` | `FIRE_EYE`
   335  func (o ThreatIntelSetOutput) Format() pulumi.StringOutput {
   336  	return o.ApplyT(func(v *ThreatIntelSet) pulumi.StringOutput { return v.Format }).(pulumi.StringOutput)
   337  }
   338  
   339  // The URI of the file that contains the ThreatIntelSet.
   340  func (o ThreatIntelSetOutput) Location() pulumi.StringOutput {
   341  	return o.ApplyT(func(v *ThreatIntelSet) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
   342  }
   343  
   344  // The friendly name to identify the ThreatIntelSet.
   345  func (o ThreatIntelSetOutput) Name() pulumi.StringOutput {
   346  	return o.ApplyT(func(v *ThreatIntelSet) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   347  }
   348  
   349  // 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.
   350  func (o ThreatIntelSetOutput) Tags() pulumi.StringMapOutput {
   351  	return o.ApplyT(func(v *ThreatIntelSet) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   352  }
   353  
   354  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   355  //
   356  // Deprecated: Please use `tags` instead.
   357  func (o ThreatIntelSetOutput) TagsAll() pulumi.StringMapOutput {
   358  	return o.ApplyT(func(v *ThreatIntelSet) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   359  }
   360  
   361  type ThreatIntelSetArrayOutput struct{ *pulumi.OutputState }
   362  
   363  func (ThreatIntelSetArrayOutput) ElementType() reflect.Type {
   364  	return reflect.TypeOf((*[]*ThreatIntelSet)(nil)).Elem()
   365  }
   366  
   367  func (o ThreatIntelSetArrayOutput) ToThreatIntelSetArrayOutput() ThreatIntelSetArrayOutput {
   368  	return o
   369  }
   370  
   371  func (o ThreatIntelSetArrayOutput) ToThreatIntelSetArrayOutputWithContext(ctx context.Context) ThreatIntelSetArrayOutput {
   372  	return o
   373  }
   374  
   375  func (o ThreatIntelSetArrayOutput) Index(i pulumi.IntInput) ThreatIntelSetOutput {
   376  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ThreatIntelSet {
   377  		return vs[0].([]*ThreatIntelSet)[vs[1].(int)]
   378  	}).(ThreatIntelSetOutput)
   379  }
   380  
   381  type ThreatIntelSetMapOutput struct{ *pulumi.OutputState }
   382  
   383  func (ThreatIntelSetMapOutput) ElementType() reflect.Type {
   384  	return reflect.TypeOf((*map[string]*ThreatIntelSet)(nil)).Elem()
   385  }
   386  
   387  func (o ThreatIntelSetMapOutput) ToThreatIntelSetMapOutput() ThreatIntelSetMapOutput {
   388  	return o
   389  }
   390  
   391  func (o ThreatIntelSetMapOutput) ToThreatIntelSetMapOutputWithContext(ctx context.Context) ThreatIntelSetMapOutput {
   392  	return o
   393  }
   394  
   395  func (o ThreatIntelSetMapOutput) MapIndex(k pulumi.StringInput) ThreatIntelSetOutput {
   396  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ThreatIntelSet {
   397  		return vs[0].(map[string]*ThreatIntelSet)[vs[1].(string)]
   398  	}).(ThreatIntelSetOutput)
   399  }
   400  
   401  func init() {
   402  	pulumi.RegisterInputType(reflect.TypeOf((*ThreatIntelSetInput)(nil)).Elem(), &ThreatIntelSet{})
   403  	pulumi.RegisterInputType(reflect.TypeOf((*ThreatIntelSetArrayInput)(nil)).Elem(), ThreatIntelSetArray{})
   404  	pulumi.RegisterInputType(reflect.TypeOf((*ThreatIntelSetMapInput)(nil)).Elem(), ThreatIntelSetMap{})
   405  	pulumi.RegisterOutputType(ThreatIntelSetOutput{})
   406  	pulumi.RegisterOutputType(ThreatIntelSetArrayOutput{})
   407  	pulumi.RegisterOutputType(ThreatIntelSetMapOutput{})
   408  }