github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/wafv2/regexPatternSet.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 wafv2
     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 an AWS WAFv2 Regex Pattern Set Resource
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/wafv2"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := wafv2.NewRegexPatternSet(ctx, "example", &wafv2.RegexPatternSetArgs{
    33  //				Name:        pulumi.String("example"),
    34  //				Description: pulumi.String("Example regex pattern set"),
    35  //				Scope:       pulumi.String("REGIONAL"),
    36  //				RegularExpressions: wafv2.RegexPatternSetRegularExpressionArray{
    37  //					&wafv2.RegexPatternSetRegularExpressionArgs{
    38  //						RegexString: pulumi.String("one"),
    39  //					},
    40  //					&wafv2.RegexPatternSetRegularExpressionArgs{
    41  //						RegexString: pulumi.String("two"),
    42  //					},
    43  //				},
    44  //				Tags: pulumi.StringMap{
    45  //					"Tag1": pulumi.String("Value1"),
    46  //					"Tag2": pulumi.String("Value2"),
    47  //				},
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			return nil
    53  //		})
    54  //	}
    55  //
    56  // ```
    57  // <!--End PulumiCodeChooser -->
    58  //
    59  // ## Import
    60  //
    61  // Using `pulumi import`, import WAFv2 Regex Pattern Sets using `ID/name/scope`. For example:
    62  //
    63  // ```sh
    64  // $ pulumi import aws:wafv2/regexPatternSet:RegexPatternSet example a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc/example/REGIONAL
    65  // ```
    66  type RegexPatternSet struct {
    67  	pulumi.CustomResourceState
    68  
    69  	// The Amazon Resource Name (ARN) that identifies the cluster.
    70  	Arn pulumi.StringOutput `pulumi:"arn"`
    71  	// A friendly description of the regular expression pattern set.
    72  	Description pulumi.StringPtrOutput `pulumi:"description"`
    73  	LockToken   pulumi.StringOutput    `pulumi:"lockToken"`
    74  	// A friendly name of the regular expression pattern set.
    75  	Name pulumi.StringOutput `pulumi:"name"`
    76  	// One or more blocks of regular expression patterns that you want AWS WAF to search for, such as `B[a@]dB[o0]t`. See Regular Expression below for details. A maximum of 10 `regularExpression` blocks may be specified.
    77  	RegularExpressions RegexPatternSetRegularExpressionArrayOutput `pulumi:"regularExpressions"`
    78  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
    79  	Scope pulumi.StringOutput `pulumi:"scope"`
    80  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    81  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    82  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    83  	//
    84  	// Deprecated: Please use `tags` instead.
    85  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    86  }
    87  
    88  // NewRegexPatternSet registers a new resource with the given unique name, arguments, and options.
    89  func NewRegexPatternSet(ctx *pulumi.Context,
    90  	name string, args *RegexPatternSetArgs, opts ...pulumi.ResourceOption) (*RegexPatternSet, error) {
    91  	if args == nil {
    92  		return nil, errors.New("missing one or more required arguments")
    93  	}
    94  
    95  	if args.Scope == nil {
    96  		return nil, errors.New("invalid value for required argument 'Scope'")
    97  	}
    98  	opts = internal.PkgResourceDefaultOpts(opts)
    99  	var resource RegexPatternSet
   100  	err := ctx.RegisterResource("aws:wafv2/regexPatternSet:RegexPatternSet", name, args, &resource, opts...)
   101  	if err != nil {
   102  		return nil, err
   103  	}
   104  	return &resource, nil
   105  }
   106  
   107  // GetRegexPatternSet gets an existing RegexPatternSet resource's state with the given name, ID, and optional
   108  // state properties that are used to uniquely qualify the lookup (nil if not required).
   109  func GetRegexPatternSet(ctx *pulumi.Context,
   110  	name string, id pulumi.IDInput, state *RegexPatternSetState, opts ...pulumi.ResourceOption) (*RegexPatternSet, error) {
   111  	var resource RegexPatternSet
   112  	err := ctx.ReadResource("aws:wafv2/regexPatternSet:RegexPatternSet", name, id, state, &resource, opts...)
   113  	if err != nil {
   114  		return nil, err
   115  	}
   116  	return &resource, nil
   117  }
   118  
   119  // Input properties used for looking up and filtering RegexPatternSet resources.
   120  type regexPatternSetState struct {
   121  	// The Amazon Resource Name (ARN) that identifies the cluster.
   122  	Arn *string `pulumi:"arn"`
   123  	// A friendly description of the regular expression pattern set.
   124  	Description *string `pulumi:"description"`
   125  	LockToken   *string `pulumi:"lockToken"`
   126  	// A friendly name of the regular expression pattern set.
   127  	Name *string `pulumi:"name"`
   128  	// One or more blocks of regular expression patterns that you want AWS WAF to search for, such as `B[a@]dB[o0]t`. See Regular Expression below for details. A maximum of 10 `regularExpression` blocks may be specified.
   129  	RegularExpressions []RegexPatternSetRegularExpression `pulumi:"regularExpressions"`
   130  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   131  	Scope *string `pulumi:"scope"`
   132  	// An array of key:value pairs to associate with the resource. 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 RegexPatternSetState struct {
   141  	// The Amazon Resource Name (ARN) that identifies the cluster.
   142  	Arn pulumi.StringPtrInput
   143  	// A friendly description of the regular expression pattern set.
   144  	Description pulumi.StringPtrInput
   145  	LockToken   pulumi.StringPtrInput
   146  	// A friendly name of the regular expression pattern set.
   147  	Name pulumi.StringPtrInput
   148  	// One or more blocks of regular expression patterns that you want AWS WAF to search for, such as `B[a@]dB[o0]t`. See Regular Expression below for details. A maximum of 10 `regularExpression` blocks may be specified.
   149  	RegularExpressions RegexPatternSetRegularExpressionArrayInput
   150  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   151  	Scope pulumi.StringPtrInput
   152  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   153  	Tags pulumi.StringMapInput
   154  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   155  	//
   156  	// Deprecated: Please use `tags` instead.
   157  	TagsAll pulumi.StringMapInput
   158  }
   159  
   160  func (RegexPatternSetState) ElementType() reflect.Type {
   161  	return reflect.TypeOf((*regexPatternSetState)(nil)).Elem()
   162  }
   163  
   164  type regexPatternSetArgs struct {
   165  	// A friendly description of the regular expression pattern set.
   166  	Description *string `pulumi:"description"`
   167  	// A friendly name of the regular expression pattern set.
   168  	Name *string `pulumi:"name"`
   169  	// One or more blocks of regular expression patterns that you want AWS WAF to search for, such as `B[a@]dB[o0]t`. See Regular Expression below for details. A maximum of 10 `regularExpression` blocks may be specified.
   170  	RegularExpressions []RegexPatternSetRegularExpression `pulumi:"regularExpressions"`
   171  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   172  	Scope string `pulumi:"scope"`
   173  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   174  	Tags map[string]string `pulumi:"tags"`
   175  }
   176  
   177  // The set of arguments for constructing a RegexPatternSet resource.
   178  type RegexPatternSetArgs struct {
   179  	// A friendly description of the regular expression pattern set.
   180  	Description pulumi.StringPtrInput
   181  	// A friendly name of the regular expression pattern set.
   182  	Name pulumi.StringPtrInput
   183  	// One or more blocks of regular expression patterns that you want AWS WAF to search for, such as `B[a@]dB[o0]t`. See Regular Expression below for details. A maximum of 10 `regularExpression` blocks may be specified.
   184  	RegularExpressions RegexPatternSetRegularExpressionArrayInput
   185  	// Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   186  	Scope pulumi.StringInput
   187  	// An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   188  	Tags pulumi.StringMapInput
   189  }
   190  
   191  func (RegexPatternSetArgs) ElementType() reflect.Type {
   192  	return reflect.TypeOf((*regexPatternSetArgs)(nil)).Elem()
   193  }
   194  
   195  type RegexPatternSetInput interface {
   196  	pulumi.Input
   197  
   198  	ToRegexPatternSetOutput() RegexPatternSetOutput
   199  	ToRegexPatternSetOutputWithContext(ctx context.Context) RegexPatternSetOutput
   200  }
   201  
   202  func (*RegexPatternSet) ElementType() reflect.Type {
   203  	return reflect.TypeOf((**RegexPatternSet)(nil)).Elem()
   204  }
   205  
   206  func (i *RegexPatternSet) ToRegexPatternSetOutput() RegexPatternSetOutput {
   207  	return i.ToRegexPatternSetOutputWithContext(context.Background())
   208  }
   209  
   210  func (i *RegexPatternSet) ToRegexPatternSetOutputWithContext(ctx context.Context) RegexPatternSetOutput {
   211  	return pulumi.ToOutputWithContext(ctx, i).(RegexPatternSetOutput)
   212  }
   213  
   214  // RegexPatternSetArrayInput is an input type that accepts RegexPatternSetArray and RegexPatternSetArrayOutput values.
   215  // You can construct a concrete instance of `RegexPatternSetArrayInput` via:
   216  //
   217  //	RegexPatternSetArray{ RegexPatternSetArgs{...} }
   218  type RegexPatternSetArrayInput interface {
   219  	pulumi.Input
   220  
   221  	ToRegexPatternSetArrayOutput() RegexPatternSetArrayOutput
   222  	ToRegexPatternSetArrayOutputWithContext(context.Context) RegexPatternSetArrayOutput
   223  }
   224  
   225  type RegexPatternSetArray []RegexPatternSetInput
   226  
   227  func (RegexPatternSetArray) ElementType() reflect.Type {
   228  	return reflect.TypeOf((*[]*RegexPatternSet)(nil)).Elem()
   229  }
   230  
   231  func (i RegexPatternSetArray) ToRegexPatternSetArrayOutput() RegexPatternSetArrayOutput {
   232  	return i.ToRegexPatternSetArrayOutputWithContext(context.Background())
   233  }
   234  
   235  func (i RegexPatternSetArray) ToRegexPatternSetArrayOutputWithContext(ctx context.Context) RegexPatternSetArrayOutput {
   236  	return pulumi.ToOutputWithContext(ctx, i).(RegexPatternSetArrayOutput)
   237  }
   238  
   239  // RegexPatternSetMapInput is an input type that accepts RegexPatternSetMap and RegexPatternSetMapOutput values.
   240  // You can construct a concrete instance of `RegexPatternSetMapInput` via:
   241  //
   242  //	RegexPatternSetMap{ "key": RegexPatternSetArgs{...} }
   243  type RegexPatternSetMapInput interface {
   244  	pulumi.Input
   245  
   246  	ToRegexPatternSetMapOutput() RegexPatternSetMapOutput
   247  	ToRegexPatternSetMapOutputWithContext(context.Context) RegexPatternSetMapOutput
   248  }
   249  
   250  type RegexPatternSetMap map[string]RegexPatternSetInput
   251  
   252  func (RegexPatternSetMap) ElementType() reflect.Type {
   253  	return reflect.TypeOf((*map[string]*RegexPatternSet)(nil)).Elem()
   254  }
   255  
   256  func (i RegexPatternSetMap) ToRegexPatternSetMapOutput() RegexPatternSetMapOutput {
   257  	return i.ToRegexPatternSetMapOutputWithContext(context.Background())
   258  }
   259  
   260  func (i RegexPatternSetMap) ToRegexPatternSetMapOutputWithContext(ctx context.Context) RegexPatternSetMapOutput {
   261  	return pulumi.ToOutputWithContext(ctx, i).(RegexPatternSetMapOutput)
   262  }
   263  
   264  type RegexPatternSetOutput struct{ *pulumi.OutputState }
   265  
   266  func (RegexPatternSetOutput) ElementType() reflect.Type {
   267  	return reflect.TypeOf((**RegexPatternSet)(nil)).Elem()
   268  }
   269  
   270  func (o RegexPatternSetOutput) ToRegexPatternSetOutput() RegexPatternSetOutput {
   271  	return o
   272  }
   273  
   274  func (o RegexPatternSetOutput) ToRegexPatternSetOutputWithContext(ctx context.Context) RegexPatternSetOutput {
   275  	return o
   276  }
   277  
   278  // The Amazon Resource Name (ARN) that identifies the cluster.
   279  func (o RegexPatternSetOutput) Arn() pulumi.StringOutput {
   280  	return o.ApplyT(func(v *RegexPatternSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   281  }
   282  
   283  // A friendly description of the regular expression pattern set.
   284  func (o RegexPatternSetOutput) Description() pulumi.StringPtrOutput {
   285  	return o.ApplyT(func(v *RegexPatternSet) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   286  }
   287  
   288  func (o RegexPatternSetOutput) LockToken() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *RegexPatternSet) pulumi.StringOutput { return v.LockToken }).(pulumi.StringOutput)
   290  }
   291  
   292  // A friendly name of the regular expression pattern set.
   293  func (o RegexPatternSetOutput) Name() pulumi.StringOutput {
   294  	return o.ApplyT(func(v *RegexPatternSet) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   295  }
   296  
   297  // One or more blocks of regular expression patterns that you want AWS WAF to search for, such as `B[a@]dB[o0]t`. See Regular Expression below for details. A maximum of 10 `regularExpression` blocks may be specified.
   298  func (o RegexPatternSetOutput) RegularExpressions() RegexPatternSetRegularExpressionArrayOutput {
   299  	return o.ApplyT(func(v *RegexPatternSet) RegexPatternSetRegularExpressionArrayOutput { return v.RegularExpressions }).(RegexPatternSetRegularExpressionArrayOutput)
   300  }
   301  
   302  // Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are `CLOUDFRONT` or `REGIONAL`. To work with CloudFront, you must also specify the region `us-east-1` (N. Virginia) on the AWS provider.
   303  func (o RegexPatternSetOutput) Scope() pulumi.StringOutput {
   304  	return o.ApplyT(func(v *RegexPatternSet) pulumi.StringOutput { return v.Scope }).(pulumi.StringOutput)
   305  }
   306  
   307  // An array of key:value pairs to associate with the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   308  func (o RegexPatternSetOutput) Tags() pulumi.StringMapOutput {
   309  	return o.ApplyT(func(v *RegexPatternSet) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   310  }
   311  
   312  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   313  //
   314  // Deprecated: Please use `tags` instead.
   315  func (o RegexPatternSetOutput) TagsAll() pulumi.StringMapOutput {
   316  	return o.ApplyT(func(v *RegexPatternSet) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   317  }
   318  
   319  type RegexPatternSetArrayOutput struct{ *pulumi.OutputState }
   320  
   321  func (RegexPatternSetArrayOutput) ElementType() reflect.Type {
   322  	return reflect.TypeOf((*[]*RegexPatternSet)(nil)).Elem()
   323  }
   324  
   325  func (o RegexPatternSetArrayOutput) ToRegexPatternSetArrayOutput() RegexPatternSetArrayOutput {
   326  	return o
   327  }
   328  
   329  func (o RegexPatternSetArrayOutput) ToRegexPatternSetArrayOutputWithContext(ctx context.Context) RegexPatternSetArrayOutput {
   330  	return o
   331  }
   332  
   333  func (o RegexPatternSetArrayOutput) Index(i pulumi.IntInput) RegexPatternSetOutput {
   334  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RegexPatternSet {
   335  		return vs[0].([]*RegexPatternSet)[vs[1].(int)]
   336  	}).(RegexPatternSetOutput)
   337  }
   338  
   339  type RegexPatternSetMapOutput struct{ *pulumi.OutputState }
   340  
   341  func (RegexPatternSetMapOutput) ElementType() reflect.Type {
   342  	return reflect.TypeOf((*map[string]*RegexPatternSet)(nil)).Elem()
   343  }
   344  
   345  func (o RegexPatternSetMapOutput) ToRegexPatternSetMapOutput() RegexPatternSetMapOutput {
   346  	return o
   347  }
   348  
   349  func (o RegexPatternSetMapOutput) ToRegexPatternSetMapOutputWithContext(ctx context.Context) RegexPatternSetMapOutput {
   350  	return o
   351  }
   352  
   353  func (o RegexPatternSetMapOutput) MapIndex(k pulumi.StringInput) RegexPatternSetOutput {
   354  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RegexPatternSet {
   355  		return vs[0].(map[string]*RegexPatternSet)[vs[1].(string)]
   356  	}).(RegexPatternSetOutput)
   357  }
   358  
   359  func init() {
   360  	pulumi.RegisterInputType(reflect.TypeOf((*RegexPatternSetInput)(nil)).Elem(), &RegexPatternSet{})
   361  	pulumi.RegisterInputType(reflect.TypeOf((*RegexPatternSetArrayInput)(nil)).Elem(), RegexPatternSetArray{})
   362  	pulumi.RegisterInputType(reflect.TypeOf((*RegexPatternSetMapInput)(nil)).Elem(), RegexPatternSetMap{})
   363  	pulumi.RegisterOutputType(RegexPatternSetOutput{})
   364  	pulumi.RegisterOutputType(RegexPatternSetArrayOutput{})
   365  	pulumi.RegisterOutputType(RegexPatternSetMapOutput{})
   366  }