github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/waf/byteMatchSet.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 waf
     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 WAF Byte Match Set Resource
    15  //
    16  // ## Example Usage
    17  //
    18  // <!--Start PulumiCodeChooser -->
    19  // ```go
    20  // package main
    21  //
    22  // import (
    23  //
    24  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/waf"
    25  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    26  //
    27  // )
    28  //
    29  //	func main() {
    30  //		pulumi.Run(func(ctx *pulumi.Context) error {
    31  //			_, err := waf.NewByteMatchSet(ctx, "byte_set", &waf.ByteMatchSetArgs{
    32  //				Name: pulumi.String("my_waf_byte_match_set"),
    33  //				ByteMatchTuples: waf.ByteMatchSetByteMatchTupleArray{
    34  //					&waf.ByteMatchSetByteMatchTupleArgs{
    35  //						TextTransformation:   pulumi.String("NONE"),
    36  //						TargetString:         pulumi.String("badrefer1"),
    37  //						PositionalConstraint: pulumi.String("CONTAINS"),
    38  //						FieldToMatch: &waf.ByteMatchSetByteMatchTupleFieldToMatchArgs{
    39  //							Type: pulumi.String("HEADER"),
    40  //							Data: pulumi.String("referer"),
    41  //						},
    42  //					},
    43  //				},
    44  //			})
    45  //			if err != nil {
    46  //				return err
    47  //			}
    48  //			return nil
    49  //		})
    50  //	}
    51  //
    52  // ```
    53  // <!--End PulumiCodeChooser -->
    54  //
    55  // ## Import
    56  //
    57  // Using `pulumi import`, import WAF Byte Match Set using the id. For example:
    58  //
    59  // ```sh
    60  // $ pulumi import aws:waf/byteMatchSet:ByteMatchSet byte_set a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
    61  // ```
    62  type ByteMatchSet struct {
    63  	pulumi.CustomResourceState
    64  
    65  	// Specifies the bytes (typically a string that corresponds
    66  	// with ASCII characters) that you want to search for in web requests,
    67  	// the location in requests that you want to search, and other settings.
    68  	ByteMatchTuples ByteMatchSetByteMatchTupleArrayOutput `pulumi:"byteMatchTuples"`
    69  	// The name or description of the Byte Match Set.
    70  	Name pulumi.StringOutput `pulumi:"name"`
    71  }
    72  
    73  // NewByteMatchSet registers a new resource with the given unique name, arguments, and options.
    74  func NewByteMatchSet(ctx *pulumi.Context,
    75  	name string, args *ByteMatchSetArgs, opts ...pulumi.ResourceOption) (*ByteMatchSet, error) {
    76  	if args == nil {
    77  		args = &ByteMatchSetArgs{}
    78  	}
    79  
    80  	opts = internal.PkgResourceDefaultOpts(opts)
    81  	var resource ByteMatchSet
    82  	err := ctx.RegisterResource("aws:waf/byteMatchSet:ByteMatchSet", name, args, &resource, opts...)
    83  	if err != nil {
    84  		return nil, err
    85  	}
    86  	return &resource, nil
    87  }
    88  
    89  // GetByteMatchSet gets an existing ByteMatchSet resource's state with the given name, ID, and optional
    90  // state properties that are used to uniquely qualify the lookup (nil if not required).
    91  func GetByteMatchSet(ctx *pulumi.Context,
    92  	name string, id pulumi.IDInput, state *ByteMatchSetState, opts ...pulumi.ResourceOption) (*ByteMatchSet, error) {
    93  	var resource ByteMatchSet
    94  	err := ctx.ReadResource("aws:waf/byteMatchSet:ByteMatchSet", name, id, state, &resource, opts...)
    95  	if err != nil {
    96  		return nil, err
    97  	}
    98  	return &resource, nil
    99  }
   100  
   101  // Input properties used for looking up and filtering ByteMatchSet resources.
   102  type byteMatchSetState struct {
   103  	// Specifies the bytes (typically a string that corresponds
   104  	// with ASCII characters) that you want to search for in web requests,
   105  	// the location in requests that you want to search, and other settings.
   106  	ByteMatchTuples []ByteMatchSetByteMatchTuple `pulumi:"byteMatchTuples"`
   107  	// The name or description of the Byte Match Set.
   108  	Name *string `pulumi:"name"`
   109  }
   110  
   111  type ByteMatchSetState struct {
   112  	// Specifies the bytes (typically a string that corresponds
   113  	// with ASCII characters) that you want to search for in web requests,
   114  	// the location in requests that you want to search, and other settings.
   115  	ByteMatchTuples ByteMatchSetByteMatchTupleArrayInput
   116  	// The name or description of the Byte Match Set.
   117  	Name pulumi.StringPtrInput
   118  }
   119  
   120  func (ByteMatchSetState) ElementType() reflect.Type {
   121  	return reflect.TypeOf((*byteMatchSetState)(nil)).Elem()
   122  }
   123  
   124  type byteMatchSetArgs struct {
   125  	// Specifies the bytes (typically a string that corresponds
   126  	// with ASCII characters) that you want to search for in web requests,
   127  	// the location in requests that you want to search, and other settings.
   128  	ByteMatchTuples []ByteMatchSetByteMatchTuple `pulumi:"byteMatchTuples"`
   129  	// The name or description of the Byte Match Set.
   130  	Name *string `pulumi:"name"`
   131  }
   132  
   133  // The set of arguments for constructing a ByteMatchSet resource.
   134  type ByteMatchSetArgs struct {
   135  	// Specifies the bytes (typically a string that corresponds
   136  	// with ASCII characters) that you want to search for in web requests,
   137  	// the location in requests that you want to search, and other settings.
   138  	ByteMatchTuples ByteMatchSetByteMatchTupleArrayInput
   139  	// The name or description of the Byte Match Set.
   140  	Name pulumi.StringPtrInput
   141  }
   142  
   143  func (ByteMatchSetArgs) ElementType() reflect.Type {
   144  	return reflect.TypeOf((*byteMatchSetArgs)(nil)).Elem()
   145  }
   146  
   147  type ByteMatchSetInput interface {
   148  	pulumi.Input
   149  
   150  	ToByteMatchSetOutput() ByteMatchSetOutput
   151  	ToByteMatchSetOutputWithContext(ctx context.Context) ByteMatchSetOutput
   152  }
   153  
   154  func (*ByteMatchSet) ElementType() reflect.Type {
   155  	return reflect.TypeOf((**ByteMatchSet)(nil)).Elem()
   156  }
   157  
   158  func (i *ByteMatchSet) ToByteMatchSetOutput() ByteMatchSetOutput {
   159  	return i.ToByteMatchSetOutputWithContext(context.Background())
   160  }
   161  
   162  func (i *ByteMatchSet) ToByteMatchSetOutputWithContext(ctx context.Context) ByteMatchSetOutput {
   163  	return pulumi.ToOutputWithContext(ctx, i).(ByteMatchSetOutput)
   164  }
   165  
   166  // ByteMatchSetArrayInput is an input type that accepts ByteMatchSetArray and ByteMatchSetArrayOutput values.
   167  // You can construct a concrete instance of `ByteMatchSetArrayInput` via:
   168  //
   169  //	ByteMatchSetArray{ ByteMatchSetArgs{...} }
   170  type ByteMatchSetArrayInput interface {
   171  	pulumi.Input
   172  
   173  	ToByteMatchSetArrayOutput() ByteMatchSetArrayOutput
   174  	ToByteMatchSetArrayOutputWithContext(context.Context) ByteMatchSetArrayOutput
   175  }
   176  
   177  type ByteMatchSetArray []ByteMatchSetInput
   178  
   179  func (ByteMatchSetArray) ElementType() reflect.Type {
   180  	return reflect.TypeOf((*[]*ByteMatchSet)(nil)).Elem()
   181  }
   182  
   183  func (i ByteMatchSetArray) ToByteMatchSetArrayOutput() ByteMatchSetArrayOutput {
   184  	return i.ToByteMatchSetArrayOutputWithContext(context.Background())
   185  }
   186  
   187  func (i ByteMatchSetArray) ToByteMatchSetArrayOutputWithContext(ctx context.Context) ByteMatchSetArrayOutput {
   188  	return pulumi.ToOutputWithContext(ctx, i).(ByteMatchSetArrayOutput)
   189  }
   190  
   191  // ByteMatchSetMapInput is an input type that accepts ByteMatchSetMap and ByteMatchSetMapOutput values.
   192  // You can construct a concrete instance of `ByteMatchSetMapInput` via:
   193  //
   194  //	ByteMatchSetMap{ "key": ByteMatchSetArgs{...} }
   195  type ByteMatchSetMapInput interface {
   196  	pulumi.Input
   197  
   198  	ToByteMatchSetMapOutput() ByteMatchSetMapOutput
   199  	ToByteMatchSetMapOutputWithContext(context.Context) ByteMatchSetMapOutput
   200  }
   201  
   202  type ByteMatchSetMap map[string]ByteMatchSetInput
   203  
   204  func (ByteMatchSetMap) ElementType() reflect.Type {
   205  	return reflect.TypeOf((*map[string]*ByteMatchSet)(nil)).Elem()
   206  }
   207  
   208  func (i ByteMatchSetMap) ToByteMatchSetMapOutput() ByteMatchSetMapOutput {
   209  	return i.ToByteMatchSetMapOutputWithContext(context.Background())
   210  }
   211  
   212  func (i ByteMatchSetMap) ToByteMatchSetMapOutputWithContext(ctx context.Context) ByteMatchSetMapOutput {
   213  	return pulumi.ToOutputWithContext(ctx, i).(ByteMatchSetMapOutput)
   214  }
   215  
   216  type ByteMatchSetOutput struct{ *pulumi.OutputState }
   217  
   218  func (ByteMatchSetOutput) ElementType() reflect.Type {
   219  	return reflect.TypeOf((**ByteMatchSet)(nil)).Elem()
   220  }
   221  
   222  func (o ByteMatchSetOutput) ToByteMatchSetOutput() ByteMatchSetOutput {
   223  	return o
   224  }
   225  
   226  func (o ByteMatchSetOutput) ToByteMatchSetOutputWithContext(ctx context.Context) ByteMatchSetOutput {
   227  	return o
   228  }
   229  
   230  // Specifies the bytes (typically a string that corresponds
   231  // with ASCII characters) that you want to search for in web requests,
   232  // the location in requests that you want to search, and other settings.
   233  func (o ByteMatchSetOutput) ByteMatchTuples() ByteMatchSetByteMatchTupleArrayOutput {
   234  	return o.ApplyT(func(v *ByteMatchSet) ByteMatchSetByteMatchTupleArrayOutput { return v.ByteMatchTuples }).(ByteMatchSetByteMatchTupleArrayOutput)
   235  }
   236  
   237  // The name or description of the Byte Match Set.
   238  func (o ByteMatchSetOutput) Name() pulumi.StringOutput {
   239  	return o.ApplyT(func(v *ByteMatchSet) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   240  }
   241  
   242  type ByteMatchSetArrayOutput struct{ *pulumi.OutputState }
   243  
   244  func (ByteMatchSetArrayOutput) ElementType() reflect.Type {
   245  	return reflect.TypeOf((*[]*ByteMatchSet)(nil)).Elem()
   246  }
   247  
   248  func (o ByteMatchSetArrayOutput) ToByteMatchSetArrayOutput() ByteMatchSetArrayOutput {
   249  	return o
   250  }
   251  
   252  func (o ByteMatchSetArrayOutput) ToByteMatchSetArrayOutputWithContext(ctx context.Context) ByteMatchSetArrayOutput {
   253  	return o
   254  }
   255  
   256  func (o ByteMatchSetArrayOutput) Index(i pulumi.IntInput) ByteMatchSetOutput {
   257  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ByteMatchSet {
   258  		return vs[0].([]*ByteMatchSet)[vs[1].(int)]
   259  	}).(ByteMatchSetOutput)
   260  }
   261  
   262  type ByteMatchSetMapOutput struct{ *pulumi.OutputState }
   263  
   264  func (ByteMatchSetMapOutput) ElementType() reflect.Type {
   265  	return reflect.TypeOf((*map[string]*ByteMatchSet)(nil)).Elem()
   266  }
   267  
   268  func (o ByteMatchSetMapOutput) ToByteMatchSetMapOutput() ByteMatchSetMapOutput {
   269  	return o
   270  }
   271  
   272  func (o ByteMatchSetMapOutput) ToByteMatchSetMapOutputWithContext(ctx context.Context) ByteMatchSetMapOutput {
   273  	return o
   274  }
   275  
   276  func (o ByteMatchSetMapOutput) MapIndex(k pulumi.StringInput) ByteMatchSetOutput {
   277  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ByteMatchSet {
   278  		return vs[0].(map[string]*ByteMatchSet)[vs[1].(string)]
   279  	}).(ByteMatchSetOutput)
   280  }
   281  
   282  func init() {
   283  	pulumi.RegisterInputType(reflect.TypeOf((*ByteMatchSetInput)(nil)).Elem(), &ByteMatchSet{})
   284  	pulumi.RegisterInputType(reflect.TypeOf((*ByteMatchSetArrayInput)(nil)).Elem(), ByteMatchSetArray{})
   285  	pulumi.RegisterInputType(reflect.TypeOf((*ByteMatchSetMapInput)(nil)).Elem(), ByteMatchSetMap{})
   286  	pulumi.RegisterOutputType(ByteMatchSetOutput{})
   287  	pulumi.RegisterOutputType(ByteMatchSetArrayOutput{})
   288  	pulumi.RegisterOutputType(ByteMatchSetMapOutput{})
   289  }