github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/guardduty/detectorFeature.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 single Amazon GuardDuty [detector feature](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty-features-activation-model.html#guardduty-features).
    16  //
    17  // > **NOTE:** Deleting this resource does not disable the detector feature, the resource in simply removed from state instead.
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/guardduty"
    28  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    29  //
    30  // )
    31  //
    32  //	func main() {
    33  //		pulumi.Run(func(ctx *pulumi.Context) error {
    34  //			example, err := guardduty.NewDetector(ctx, "example", &guardduty.DetectorArgs{
    35  //				Enable: pulumi.Bool(true),
    36  //			})
    37  //			if err != nil {
    38  //				return err
    39  //			}
    40  //			_, err = guardduty.NewDetectorFeature(ctx, "eks_runtime_monitoring", &guardduty.DetectorFeatureArgs{
    41  //				DetectorId: example.ID(),
    42  //				Name:       pulumi.String("EKS_RUNTIME_MONITORING"),
    43  //				Status:     pulumi.String("ENABLED"),
    44  //				AdditionalConfigurations: guardduty.DetectorFeatureAdditionalConfigurationArray{
    45  //					&guardduty.DetectorFeatureAdditionalConfigurationArgs{
    46  //						Name:   pulumi.String("EKS_ADDON_MANAGEMENT"),
    47  //						Status: pulumi.String("ENABLED"),
    48  //					},
    49  //				},
    50  //			})
    51  //			if err != nil {
    52  //				return err
    53  //			}
    54  //			return nil
    55  //		})
    56  //	}
    57  //
    58  // ```
    59  // <!--End PulumiCodeChooser -->
    60  type DetectorFeature struct {
    61  	pulumi.CustomResourceState
    62  
    63  	// Additional feature configuration block. See below.
    64  	AdditionalConfigurations DetectorFeatureAdditionalConfigurationArrayOutput `pulumi:"additionalConfigurations"`
    65  	// Amazon GuardDuty detector ID.
    66  	DetectorId pulumi.StringOutput `pulumi:"detectorId"`
    67  	// The name of the detector feature. Refer to the [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_DetectorFeatureConfiguration.html) for the current list of supported values.
    68  	Name pulumi.StringOutput `pulumi:"name"`
    69  	// The status of the detector feature. Valid values: `ENABLED`, `DISABLED`.
    70  	Status pulumi.StringOutput `pulumi:"status"`
    71  }
    72  
    73  // NewDetectorFeature registers a new resource with the given unique name, arguments, and options.
    74  func NewDetectorFeature(ctx *pulumi.Context,
    75  	name string, args *DetectorFeatureArgs, opts ...pulumi.ResourceOption) (*DetectorFeature, error) {
    76  	if args == nil {
    77  		return nil, errors.New("missing one or more required arguments")
    78  	}
    79  
    80  	if args.DetectorId == nil {
    81  		return nil, errors.New("invalid value for required argument 'DetectorId'")
    82  	}
    83  	if args.Status == nil {
    84  		return nil, errors.New("invalid value for required argument 'Status'")
    85  	}
    86  	opts = internal.PkgResourceDefaultOpts(opts)
    87  	var resource DetectorFeature
    88  	err := ctx.RegisterResource("aws:guardduty/detectorFeature:DetectorFeature", name, args, &resource, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return &resource, nil
    93  }
    94  
    95  // GetDetectorFeature gets an existing DetectorFeature resource's state with the given name, ID, and optional
    96  // state properties that are used to uniquely qualify the lookup (nil if not required).
    97  func GetDetectorFeature(ctx *pulumi.Context,
    98  	name string, id pulumi.IDInput, state *DetectorFeatureState, opts ...pulumi.ResourceOption) (*DetectorFeature, error) {
    99  	var resource DetectorFeature
   100  	err := ctx.ReadResource("aws:guardduty/detectorFeature:DetectorFeature", name, id, state, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // Input properties used for looking up and filtering DetectorFeature resources.
   108  type detectorFeatureState struct {
   109  	// Additional feature configuration block. See below.
   110  	AdditionalConfigurations []DetectorFeatureAdditionalConfiguration `pulumi:"additionalConfigurations"`
   111  	// Amazon GuardDuty detector ID.
   112  	DetectorId *string `pulumi:"detectorId"`
   113  	// The name of the detector feature. Refer to the [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_DetectorFeatureConfiguration.html) for the current list of supported values.
   114  	Name *string `pulumi:"name"`
   115  	// The status of the detector feature. Valid values: `ENABLED`, `DISABLED`.
   116  	Status *string `pulumi:"status"`
   117  }
   118  
   119  type DetectorFeatureState struct {
   120  	// Additional feature configuration block. See below.
   121  	AdditionalConfigurations DetectorFeatureAdditionalConfigurationArrayInput
   122  	// Amazon GuardDuty detector ID.
   123  	DetectorId pulumi.StringPtrInput
   124  	// The name of the detector feature. Refer to the [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_DetectorFeatureConfiguration.html) for the current list of supported values.
   125  	Name pulumi.StringPtrInput
   126  	// The status of the detector feature. Valid values: `ENABLED`, `DISABLED`.
   127  	Status pulumi.StringPtrInput
   128  }
   129  
   130  func (DetectorFeatureState) ElementType() reflect.Type {
   131  	return reflect.TypeOf((*detectorFeatureState)(nil)).Elem()
   132  }
   133  
   134  type detectorFeatureArgs struct {
   135  	// Additional feature configuration block. See below.
   136  	AdditionalConfigurations []DetectorFeatureAdditionalConfiguration `pulumi:"additionalConfigurations"`
   137  	// Amazon GuardDuty detector ID.
   138  	DetectorId string `pulumi:"detectorId"`
   139  	// The name of the detector feature. Refer to the [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_DetectorFeatureConfiguration.html) for the current list of supported values.
   140  	Name *string `pulumi:"name"`
   141  	// The status of the detector feature. Valid values: `ENABLED`, `DISABLED`.
   142  	Status string `pulumi:"status"`
   143  }
   144  
   145  // The set of arguments for constructing a DetectorFeature resource.
   146  type DetectorFeatureArgs struct {
   147  	// Additional feature configuration block. See below.
   148  	AdditionalConfigurations DetectorFeatureAdditionalConfigurationArrayInput
   149  	// Amazon GuardDuty detector ID.
   150  	DetectorId pulumi.StringInput
   151  	// The name of the detector feature. Refer to the [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_DetectorFeatureConfiguration.html) for the current list of supported values.
   152  	Name pulumi.StringPtrInput
   153  	// The status of the detector feature. Valid values: `ENABLED`, `DISABLED`.
   154  	Status pulumi.StringInput
   155  }
   156  
   157  func (DetectorFeatureArgs) ElementType() reflect.Type {
   158  	return reflect.TypeOf((*detectorFeatureArgs)(nil)).Elem()
   159  }
   160  
   161  type DetectorFeatureInput interface {
   162  	pulumi.Input
   163  
   164  	ToDetectorFeatureOutput() DetectorFeatureOutput
   165  	ToDetectorFeatureOutputWithContext(ctx context.Context) DetectorFeatureOutput
   166  }
   167  
   168  func (*DetectorFeature) ElementType() reflect.Type {
   169  	return reflect.TypeOf((**DetectorFeature)(nil)).Elem()
   170  }
   171  
   172  func (i *DetectorFeature) ToDetectorFeatureOutput() DetectorFeatureOutput {
   173  	return i.ToDetectorFeatureOutputWithContext(context.Background())
   174  }
   175  
   176  func (i *DetectorFeature) ToDetectorFeatureOutputWithContext(ctx context.Context) DetectorFeatureOutput {
   177  	return pulumi.ToOutputWithContext(ctx, i).(DetectorFeatureOutput)
   178  }
   179  
   180  // DetectorFeatureArrayInput is an input type that accepts DetectorFeatureArray and DetectorFeatureArrayOutput values.
   181  // You can construct a concrete instance of `DetectorFeatureArrayInput` via:
   182  //
   183  //	DetectorFeatureArray{ DetectorFeatureArgs{...} }
   184  type DetectorFeatureArrayInput interface {
   185  	pulumi.Input
   186  
   187  	ToDetectorFeatureArrayOutput() DetectorFeatureArrayOutput
   188  	ToDetectorFeatureArrayOutputWithContext(context.Context) DetectorFeatureArrayOutput
   189  }
   190  
   191  type DetectorFeatureArray []DetectorFeatureInput
   192  
   193  func (DetectorFeatureArray) ElementType() reflect.Type {
   194  	return reflect.TypeOf((*[]*DetectorFeature)(nil)).Elem()
   195  }
   196  
   197  func (i DetectorFeatureArray) ToDetectorFeatureArrayOutput() DetectorFeatureArrayOutput {
   198  	return i.ToDetectorFeatureArrayOutputWithContext(context.Background())
   199  }
   200  
   201  func (i DetectorFeatureArray) ToDetectorFeatureArrayOutputWithContext(ctx context.Context) DetectorFeatureArrayOutput {
   202  	return pulumi.ToOutputWithContext(ctx, i).(DetectorFeatureArrayOutput)
   203  }
   204  
   205  // DetectorFeatureMapInput is an input type that accepts DetectorFeatureMap and DetectorFeatureMapOutput values.
   206  // You can construct a concrete instance of `DetectorFeatureMapInput` via:
   207  //
   208  //	DetectorFeatureMap{ "key": DetectorFeatureArgs{...} }
   209  type DetectorFeatureMapInput interface {
   210  	pulumi.Input
   211  
   212  	ToDetectorFeatureMapOutput() DetectorFeatureMapOutput
   213  	ToDetectorFeatureMapOutputWithContext(context.Context) DetectorFeatureMapOutput
   214  }
   215  
   216  type DetectorFeatureMap map[string]DetectorFeatureInput
   217  
   218  func (DetectorFeatureMap) ElementType() reflect.Type {
   219  	return reflect.TypeOf((*map[string]*DetectorFeature)(nil)).Elem()
   220  }
   221  
   222  func (i DetectorFeatureMap) ToDetectorFeatureMapOutput() DetectorFeatureMapOutput {
   223  	return i.ToDetectorFeatureMapOutputWithContext(context.Background())
   224  }
   225  
   226  func (i DetectorFeatureMap) ToDetectorFeatureMapOutputWithContext(ctx context.Context) DetectorFeatureMapOutput {
   227  	return pulumi.ToOutputWithContext(ctx, i).(DetectorFeatureMapOutput)
   228  }
   229  
   230  type DetectorFeatureOutput struct{ *pulumi.OutputState }
   231  
   232  func (DetectorFeatureOutput) ElementType() reflect.Type {
   233  	return reflect.TypeOf((**DetectorFeature)(nil)).Elem()
   234  }
   235  
   236  func (o DetectorFeatureOutput) ToDetectorFeatureOutput() DetectorFeatureOutput {
   237  	return o
   238  }
   239  
   240  func (o DetectorFeatureOutput) ToDetectorFeatureOutputWithContext(ctx context.Context) DetectorFeatureOutput {
   241  	return o
   242  }
   243  
   244  // Additional feature configuration block. See below.
   245  func (o DetectorFeatureOutput) AdditionalConfigurations() DetectorFeatureAdditionalConfigurationArrayOutput {
   246  	return o.ApplyT(func(v *DetectorFeature) DetectorFeatureAdditionalConfigurationArrayOutput {
   247  		return v.AdditionalConfigurations
   248  	}).(DetectorFeatureAdditionalConfigurationArrayOutput)
   249  }
   250  
   251  // Amazon GuardDuty detector ID.
   252  func (o DetectorFeatureOutput) DetectorId() pulumi.StringOutput {
   253  	return o.ApplyT(func(v *DetectorFeature) pulumi.StringOutput { return v.DetectorId }).(pulumi.StringOutput)
   254  }
   255  
   256  // The name of the detector feature. Refer to the [AWS Documentation](https://docs.aws.amazon.com/guardduty/latest/APIReference/API_DetectorFeatureConfiguration.html) for the current list of supported values.
   257  func (o DetectorFeatureOutput) Name() pulumi.StringOutput {
   258  	return o.ApplyT(func(v *DetectorFeature) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   259  }
   260  
   261  // The status of the detector feature. Valid values: `ENABLED`, `DISABLED`.
   262  func (o DetectorFeatureOutput) Status() pulumi.StringOutput {
   263  	return o.ApplyT(func(v *DetectorFeature) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   264  }
   265  
   266  type DetectorFeatureArrayOutput struct{ *pulumi.OutputState }
   267  
   268  func (DetectorFeatureArrayOutput) ElementType() reflect.Type {
   269  	return reflect.TypeOf((*[]*DetectorFeature)(nil)).Elem()
   270  }
   271  
   272  func (o DetectorFeatureArrayOutput) ToDetectorFeatureArrayOutput() DetectorFeatureArrayOutput {
   273  	return o
   274  }
   275  
   276  func (o DetectorFeatureArrayOutput) ToDetectorFeatureArrayOutputWithContext(ctx context.Context) DetectorFeatureArrayOutput {
   277  	return o
   278  }
   279  
   280  func (o DetectorFeatureArrayOutput) Index(i pulumi.IntInput) DetectorFeatureOutput {
   281  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *DetectorFeature {
   282  		return vs[0].([]*DetectorFeature)[vs[1].(int)]
   283  	}).(DetectorFeatureOutput)
   284  }
   285  
   286  type DetectorFeatureMapOutput struct{ *pulumi.OutputState }
   287  
   288  func (DetectorFeatureMapOutput) ElementType() reflect.Type {
   289  	return reflect.TypeOf((*map[string]*DetectorFeature)(nil)).Elem()
   290  }
   291  
   292  func (o DetectorFeatureMapOutput) ToDetectorFeatureMapOutput() DetectorFeatureMapOutput {
   293  	return o
   294  }
   295  
   296  func (o DetectorFeatureMapOutput) ToDetectorFeatureMapOutputWithContext(ctx context.Context) DetectorFeatureMapOutput {
   297  	return o
   298  }
   299  
   300  func (o DetectorFeatureMapOutput) MapIndex(k pulumi.StringInput) DetectorFeatureOutput {
   301  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *DetectorFeature {
   302  		return vs[0].(map[string]*DetectorFeature)[vs[1].(string)]
   303  	}).(DetectorFeatureOutput)
   304  }
   305  
   306  func init() {
   307  	pulumi.RegisterInputType(reflect.TypeOf((*DetectorFeatureInput)(nil)).Elem(), &DetectorFeature{})
   308  	pulumi.RegisterInputType(reflect.TypeOf((*DetectorFeatureArrayInput)(nil)).Elem(), DetectorFeatureArray{})
   309  	pulumi.RegisterInputType(reflect.TypeOf((*DetectorFeatureMapInput)(nil)).Elem(), DetectorFeatureMap{})
   310  	pulumi.RegisterOutputType(DetectorFeatureOutput{})
   311  	pulumi.RegisterOutputType(DetectorFeatureArrayOutput{})
   312  	pulumi.RegisterOutputType(DetectorFeatureMapOutput{})
   313  }