github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/guardduty/detector.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Provides a resource to manage an Amazon GuardDuty detector.
    15  //
    16  // > **NOTE:** Deleting this resource is equivalent to "disabling" GuardDuty for an AWS region, which removes all existing findings. You can set the `enable` attribute to `false` to instead "suspend" monitoring and feedback reporting while keeping existing data. See the [Suspending or Disabling Amazon GuardDuty documentation](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_suspend-disable.html) for more information.
    17  //
    18  // ## Example Usage
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/guardduty"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := guardduty.NewDetector(ctx, "MyDetector", &guardduty.DetectorArgs{
    34  //				Enable: pulumi.Bool(true),
    35  //				Datasources: &guardduty.DetectorDatasourcesArgs{
    36  //					S3Logs: &guardduty.DetectorDatasourcesS3LogsArgs{
    37  //						Enable: pulumi.Bool(true),
    38  //					},
    39  //					Kubernetes: &guardduty.DetectorDatasourcesKubernetesArgs{
    40  //						AuditLogs: &guardduty.DetectorDatasourcesKubernetesAuditLogsArgs{
    41  //							Enable: pulumi.Bool(false),
    42  //						},
    43  //					},
    44  //					MalwareProtection: &guardduty.DetectorDatasourcesMalwareProtectionArgs{
    45  //						ScanEc2InstanceWithFindings: &guardduty.DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsArgs{
    46  //							EbsVolumes: &guardduty.DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsEbsVolumesArgs{
    47  //								Enable: pulumi.Bool(true),
    48  //							},
    49  //						},
    50  //					},
    51  //				},
    52  //			})
    53  //			if err != nil {
    54  //				return err
    55  //			}
    56  //			return nil
    57  //		})
    58  //	}
    59  //
    60  // ```
    61  // <!--End PulumiCodeChooser -->
    62  //
    63  // ## Import
    64  //
    65  // Using `pulumi import`, import GuardDuty detectors using the detector ID. For example:
    66  //
    67  // ```sh
    68  // $ pulumi import aws:guardduty/detector:Detector MyDetector 00b00fd5aecc0ab60a708659477e9617
    69  // ```
    70  // The ID of the detector can be retrieved via the [AWS CLI](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/guardduty/list-detectors.html) using `aws guardduty list-detectors`.
    71  type Detector struct {
    72  	pulumi.CustomResourceState
    73  
    74  	// The AWS account ID of the GuardDuty detector
    75  	AccountId pulumi.StringOutput `pulumi:"accountId"`
    76  	// Amazon Resource Name (ARN) of the GuardDuty detector
    77  	Arn pulumi.StringOutput `pulumi:"arn"`
    78  	// Describes which data sources will be enabled for the detector. See Data Sources below for more details. [Deprecated](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty-feature-object-api-changes-march2023.html) in favor of `guardduty.DetectorFeature` resources.
    79  	Datasources DetectorDatasourcesOutput `pulumi:"datasources"`
    80  	// Enable monitoring and feedback reporting. Setting to `false` is equivalent to "suspending" GuardDuty. Defaults to `true`.
    81  	Enable pulumi.BoolPtrOutput `pulumi:"enable"`
    82  	// Specifies the frequency of notifications sent for subsequent finding occurrences. If the detector is a GuardDuty member account, the value is determined by the GuardDuty primary account and cannot be modified, otherwise defaults to `SIX_HOURS`. For standalone and GuardDuty primary accounts, it must be configured in this provider to enable drift detection. Valid values for standalone and primary accounts: `FIFTEEN_MINUTES`, `ONE_HOUR`, `SIX_HOURS`. See [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_findings_cloudwatch.html#guardduty_findings_cloudwatch_notification_frequency) for more information.
    83  	FindingPublishingFrequency pulumi.StringOutput `pulumi:"findingPublishingFrequency"`
    84  	// 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.
    85  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    86  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    87  	//
    88  	// Deprecated: Please use `tags` instead.
    89  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    90  }
    91  
    92  // NewDetector registers a new resource with the given unique name, arguments, and options.
    93  func NewDetector(ctx *pulumi.Context,
    94  	name string, args *DetectorArgs, opts ...pulumi.ResourceOption) (*Detector, error) {
    95  	if args == nil {
    96  		args = &DetectorArgs{}
    97  	}
    98  
    99  	opts = internal.PkgResourceDefaultOpts(opts)
   100  	var resource Detector
   101  	err := ctx.RegisterResource("aws:guardduty/detector:Detector", name, args, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // GetDetector gets an existing Detector resource's state with the given name, ID, and optional
   109  // state properties that are used to uniquely qualify the lookup (nil if not required).
   110  func GetDetector(ctx *pulumi.Context,
   111  	name string, id pulumi.IDInput, state *DetectorState, opts ...pulumi.ResourceOption) (*Detector, error) {
   112  	var resource Detector
   113  	err := ctx.ReadResource("aws:guardduty/detector:Detector", name, id, state, &resource, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	return &resource, nil
   118  }
   119  
   120  // Input properties used for looking up and filtering Detector resources.
   121  type detectorState struct {
   122  	// The AWS account ID of the GuardDuty detector
   123  	AccountId *string `pulumi:"accountId"`
   124  	// Amazon Resource Name (ARN) of the GuardDuty detector
   125  	Arn *string `pulumi:"arn"`
   126  	// Describes which data sources will be enabled for the detector. See Data Sources below for more details. [Deprecated](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty-feature-object-api-changes-march2023.html) in favor of `guardduty.DetectorFeature` resources.
   127  	Datasources *DetectorDatasources `pulumi:"datasources"`
   128  	// Enable monitoring and feedback reporting. Setting to `false` is equivalent to "suspending" GuardDuty. Defaults to `true`.
   129  	Enable *bool `pulumi:"enable"`
   130  	// Specifies the frequency of notifications sent for subsequent finding occurrences. If the detector is a GuardDuty member account, the value is determined by the GuardDuty primary account and cannot be modified, otherwise defaults to `SIX_HOURS`. For standalone and GuardDuty primary accounts, it must be configured in this provider to enable drift detection. Valid values for standalone and primary accounts: `FIFTEEN_MINUTES`, `ONE_HOUR`, `SIX_HOURS`. See [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_findings_cloudwatch.html#guardduty_findings_cloudwatch_notification_frequency) for more information.
   131  	FindingPublishingFrequency *string `pulumi:"findingPublishingFrequency"`
   132  	// 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.
   133  	Tags map[string]string `pulumi:"tags"`
   134  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   135  	//
   136  	// Deprecated: Please use `tags` instead.
   137  	TagsAll map[string]string `pulumi:"tagsAll"`
   138  }
   139  
   140  type DetectorState struct {
   141  	// The AWS account ID of the GuardDuty detector
   142  	AccountId pulumi.StringPtrInput
   143  	// Amazon Resource Name (ARN) of the GuardDuty detector
   144  	Arn pulumi.StringPtrInput
   145  	// Describes which data sources will be enabled for the detector. See Data Sources below for more details. [Deprecated](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty-feature-object-api-changes-march2023.html) in favor of `guardduty.DetectorFeature` resources.
   146  	Datasources DetectorDatasourcesPtrInput
   147  	// Enable monitoring and feedback reporting. Setting to `false` is equivalent to "suspending" GuardDuty. Defaults to `true`.
   148  	Enable pulumi.BoolPtrInput
   149  	// Specifies the frequency of notifications sent for subsequent finding occurrences. If the detector is a GuardDuty member account, the value is determined by the GuardDuty primary account and cannot be modified, otherwise defaults to `SIX_HOURS`. For standalone and GuardDuty primary accounts, it must be configured in this provider to enable drift detection. Valid values for standalone and primary accounts: `FIFTEEN_MINUTES`, `ONE_HOUR`, `SIX_HOURS`. See [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_findings_cloudwatch.html#guardduty_findings_cloudwatch_notification_frequency) for more information.
   150  	FindingPublishingFrequency pulumi.StringPtrInput
   151  	// 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.
   152  	Tags pulumi.StringMapInput
   153  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   154  	//
   155  	// Deprecated: Please use `tags` instead.
   156  	TagsAll pulumi.StringMapInput
   157  }
   158  
   159  func (DetectorState) ElementType() reflect.Type {
   160  	return reflect.TypeOf((*detectorState)(nil)).Elem()
   161  }
   162  
   163  type detectorArgs struct {
   164  	// Describes which data sources will be enabled for the detector. See Data Sources below for more details. [Deprecated](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty-feature-object-api-changes-march2023.html) in favor of `guardduty.DetectorFeature` resources.
   165  	Datasources *DetectorDatasources `pulumi:"datasources"`
   166  	// Enable monitoring and feedback reporting. Setting to `false` is equivalent to "suspending" GuardDuty. Defaults to `true`.
   167  	Enable *bool `pulumi:"enable"`
   168  	// Specifies the frequency of notifications sent for subsequent finding occurrences. If the detector is a GuardDuty member account, the value is determined by the GuardDuty primary account and cannot be modified, otherwise defaults to `SIX_HOURS`. For standalone and GuardDuty primary accounts, it must be configured in this provider to enable drift detection. Valid values for standalone and primary accounts: `FIFTEEN_MINUTES`, `ONE_HOUR`, `SIX_HOURS`. See [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_findings_cloudwatch.html#guardduty_findings_cloudwatch_notification_frequency) for more information.
   169  	FindingPublishingFrequency *string `pulumi:"findingPublishingFrequency"`
   170  	// 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.
   171  	Tags map[string]string `pulumi:"tags"`
   172  }
   173  
   174  // The set of arguments for constructing a Detector resource.
   175  type DetectorArgs struct {
   176  	// Describes which data sources will be enabled for the detector. See Data Sources below for more details. [Deprecated](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty-feature-object-api-changes-march2023.html) in favor of `guardduty.DetectorFeature` resources.
   177  	Datasources DetectorDatasourcesPtrInput
   178  	// Enable monitoring and feedback reporting. Setting to `false` is equivalent to "suspending" GuardDuty. Defaults to `true`.
   179  	Enable pulumi.BoolPtrInput
   180  	// Specifies the frequency of notifications sent for subsequent finding occurrences. If the detector is a GuardDuty member account, the value is determined by the GuardDuty primary account and cannot be modified, otherwise defaults to `SIX_HOURS`. For standalone and GuardDuty primary accounts, it must be configured in this provider to enable drift detection. Valid values for standalone and primary accounts: `FIFTEEN_MINUTES`, `ONE_HOUR`, `SIX_HOURS`. See [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_findings_cloudwatch.html#guardduty_findings_cloudwatch_notification_frequency) for more information.
   181  	FindingPublishingFrequency pulumi.StringPtrInput
   182  	// 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.
   183  	Tags pulumi.StringMapInput
   184  }
   185  
   186  func (DetectorArgs) ElementType() reflect.Type {
   187  	return reflect.TypeOf((*detectorArgs)(nil)).Elem()
   188  }
   189  
   190  type DetectorInput interface {
   191  	pulumi.Input
   192  
   193  	ToDetectorOutput() DetectorOutput
   194  	ToDetectorOutputWithContext(ctx context.Context) DetectorOutput
   195  }
   196  
   197  func (*Detector) ElementType() reflect.Type {
   198  	return reflect.TypeOf((**Detector)(nil)).Elem()
   199  }
   200  
   201  func (i *Detector) ToDetectorOutput() DetectorOutput {
   202  	return i.ToDetectorOutputWithContext(context.Background())
   203  }
   204  
   205  func (i *Detector) ToDetectorOutputWithContext(ctx context.Context) DetectorOutput {
   206  	return pulumi.ToOutputWithContext(ctx, i).(DetectorOutput)
   207  }
   208  
   209  // DetectorArrayInput is an input type that accepts DetectorArray and DetectorArrayOutput values.
   210  // You can construct a concrete instance of `DetectorArrayInput` via:
   211  //
   212  //	DetectorArray{ DetectorArgs{...} }
   213  type DetectorArrayInput interface {
   214  	pulumi.Input
   215  
   216  	ToDetectorArrayOutput() DetectorArrayOutput
   217  	ToDetectorArrayOutputWithContext(context.Context) DetectorArrayOutput
   218  }
   219  
   220  type DetectorArray []DetectorInput
   221  
   222  func (DetectorArray) ElementType() reflect.Type {
   223  	return reflect.TypeOf((*[]*Detector)(nil)).Elem()
   224  }
   225  
   226  func (i DetectorArray) ToDetectorArrayOutput() DetectorArrayOutput {
   227  	return i.ToDetectorArrayOutputWithContext(context.Background())
   228  }
   229  
   230  func (i DetectorArray) ToDetectorArrayOutputWithContext(ctx context.Context) DetectorArrayOutput {
   231  	return pulumi.ToOutputWithContext(ctx, i).(DetectorArrayOutput)
   232  }
   233  
   234  // DetectorMapInput is an input type that accepts DetectorMap and DetectorMapOutput values.
   235  // You can construct a concrete instance of `DetectorMapInput` via:
   236  //
   237  //	DetectorMap{ "key": DetectorArgs{...} }
   238  type DetectorMapInput interface {
   239  	pulumi.Input
   240  
   241  	ToDetectorMapOutput() DetectorMapOutput
   242  	ToDetectorMapOutputWithContext(context.Context) DetectorMapOutput
   243  }
   244  
   245  type DetectorMap map[string]DetectorInput
   246  
   247  func (DetectorMap) ElementType() reflect.Type {
   248  	return reflect.TypeOf((*map[string]*Detector)(nil)).Elem()
   249  }
   250  
   251  func (i DetectorMap) ToDetectorMapOutput() DetectorMapOutput {
   252  	return i.ToDetectorMapOutputWithContext(context.Background())
   253  }
   254  
   255  func (i DetectorMap) ToDetectorMapOutputWithContext(ctx context.Context) DetectorMapOutput {
   256  	return pulumi.ToOutputWithContext(ctx, i).(DetectorMapOutput)
   257  }
   258  
   259  type DetectorOutput struct{ *pulumi.OutputState }
   260  
   261  func (DetectorOutput) ElementType() reflect.Type {
   262  	return reflect.TypeOf((**Detector)(nil)).Elem()
   263  }
   264  
   265  func (o DetectorOutput) ToDetectorOutput() DetectorOutput {
   266  	return o
   267  }
   268  
   269  func (o DetectorOutput) ToDetectorOutputWithContext(ctx context.Context) DetectorOutput {
   270  	return o
   271  }
   272  
   273  // The AWS account ID of the GuardDuty detector
   274  func (o DetectorOutput) AccountId() pulumi.StringOutput {
   275  	return o.ApplyT(func(v *Detector) pulumi.StringOutput { return v.AccountId }).(pulumi.StringOutput)
   276  }
   277  
   278  // Amazon Resource Name (ARN) of the GuardDuty detector
   279  func (o DetectorOutput) Arn() pulumi.StringOutput {
   280  	return o.ApplyT(func(v *Detector) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   281  }
   282  
   283  // Describes which data sources will be enabled for the detector. See Data Sources below for more details. [Deprecated](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty-feature-object-api-changes-march2023.html) in favor of `guardduty.DetectorFeature` resources.
   284  func (o DetectorOutput) Datasources() DetectorDatasourcesOutput {
   285  	return o.ApplyT(func(v *Detector) DetectorDatasourcesOutput { return v.Datasources }).(DetectorDatasourcesOutput)
   286  }
   287  
   288  // Enable monitoring and feedback reporting. Setting to `false` is equivalent to "suspending" GuardDuty. Defaults to `true`.
   289  func (o DetectorOutput) Enable() pulumi.BoolPtrOutput {
   290  	return o.ApplyT(func(v *Detector) pulumi.BoolPtrOutput { return v.Enable }).(pulumi.BoolPtrOutput)
   291  }
   292  
   293  // Specifies the frequency of notifications sent for subsequent finding occurrences. If the detector is a GuardDuty member account, the value is determined by the GuardDuty primary account and cannot be modified, otherwise defaults to `SIX_HOURS`. For standalone and GuardDuty primary accounts, it must be configured in this provider to enable drift detection. Valid values for standalone and primary accounts: `FIFTEEN_MINUTES`, `ONE_HOUR`, `SIX_HOURS`. See [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_findings_cloudwatch.html#guardduty_findings_cloudwatch_notification_frequency) for more information.
   294  func (o DetectorOutput) FindingPublishingFrequency() pulumi.StringOutput {
   295  	return o.ApplyT(func(v *Detector) pulumi.StringOutput { return v.FindingPublishingFrequency }).(pulumi.StringOutput)
   296  }
   297  
   298  // 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.
   299  func (o DetectorOutput) Tags() pulumi.StringMapOutput {
   300  	return o.ApplyT(func(v *Detector) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   301  }
   302  
   303  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   304  //
   305  // Deprecated: Please use `tags` instead.
   306  func (o DetectorOutput) TagsAll() pulumi.StringMapOutput {
   307  	return o.ApplyT(func(v *Detector) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   308  }
   309  
   310  type DetectorArrayOutput struct{ *pulumi.OutputState }
   311  
   312  func (DetectorArrayOutput) ElementType() reflect.Type {
   313  	return reflect.TypeOf((*[]*Detector)(nil)).Elem()
   314  }
   315  
   316  func (o DetectorArrayOutput) ToDetectorArrayOutput() DetectorArrayOutput {
   317  	return o
   318  }
   319  
   320  func (o DetectorArrayOutput) ToDetectorArrayOutputWithContext(ctx context.Context) DetectorArrayOutput {
   321  	return o
   322  }
   323  
   324  func (o DetectorArrayOutput) Index(i pulumi.IntInput) DetectorOutput {
   325  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Detector {
   326  		return vs[0].([]*Detector)[vs[1].(int)]
   327  	}).(DetectorOutput)
   328  }
   329  
   330  type DetectorMapOutput struct{ *pulumi.OutputState }
   331  
   332  func (DetectorMapOutput) ElementType() reflect.Type {
   333  	return reflect.TypeOf((*map[string]*Detector)(nil)).Elem()
   334  }
   335  
   336  func (o DetectorMapOutput) ToDetectorMapOutput() DetectorMapOutput {
   337  	return o
   338  }
   339  
   340  func (o DetectorMapOutput) ToDetectorMapOutputWithContext(ctx context.Context) DetectorMapOutput {
   341  	return o
   342  }
   343  
   344  func (o DetectorMapOutput) MapIndex(k pulumi.StringInput) DetectorOutput {
   345  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Detector {
   346  		return vs[0].(map[string]*Detector)[vs[1].(string)]
   347  	}).(DetectorOutput)
   348  }
   349  
   350  func init() {
   351  	pulumi.RegisterInputType(reflect.TypeOf((*DetectorInput)(nil)).Elem(), &Detector{})
   352  	pulumi.RegisterInputType(reflect.TypeOf((*DetectorArrayInput)(nil)).Elem(), DetectorArray{})
   353  	pulumi.RegisterInputType(reflect.TypeOf((*DetectorMapInput)(nil)).Elem(), DetectorMap{})
   354  	pulumi.RegisterOutputType(DetectorOutput{})
   355  	pulumi.RegisterOutputType(DetectorArrayOutput{})
   356  	pulumi.RegisterOutputType(DetectorMapOutput{})
   357  }