github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/waf/geoMatchSet.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 Geo 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.NewGeoMatchSet(ctx, "geo_match_set", &waf.GeoMatchSetArgs{
    32  //				Name: pulumi.String("geo_match_set"),
    33  //				GeoMatchConstraints: waf.GeoMatchSetGeoMatchConstraintArray{
    34  //					&waf.GeoMatchSetGeoMatchConstraintArgs{
    35  //						Type:  pulumi.String("Country"),
    36  //						Value: pulumi.String("US"),
    37  //					},
    38  //					&waf.GeoMatchSetGeoMatchConstraintArgs{
    39  //						Type:  pulumi.String("Country"),
    40  //						Value: pulumi.String("CA"),
    41  //					},
    42  //				},
    43  //			})
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			return nil
    48  //		})
    49  //	}
    50  //
    51  // ```
    52  // <!--End PulumiCodeChooser -->
    53  //
    54  // ## Import
    55  //
    56  // Using `pulumi import`, import WAF Geo Match Set using their ID. For example:
    57  //
    58  // ```sh
    59  // $ pulumi import aws:waf/geoMatchSet:GeoMatchSet example a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
    60  // ```
    61  type GeoMatchSet struct {
    62  	pulumi.CustomResourceState
    63  
    64  	// Amazon Resource Name (ARN)
    65  	Arn pulumi.StringOutput `pulumi:"arn"`
    66  	// The GeoMatchConstraint objects which contain the country that you want AWS WAF to search for.
    67  	GeoMatchConstraints GeoMatchSetGeoMatchConstraintArrayOutput `pulumi:"geoMatchConstraints"`
    68  	// The name or description of the GeoMatchSet.
    69  	Name pulumi.StringOutput `pulumi:"name"`
    70  }
    71  
    72  // NewGeoMatchSet registers a new resource with the given unique name, arguments, and options.
    73  func NewGeoMatchSet(ctx *pulumi.Context,
    74  	name string, args *GeoMatchSetArgs, opts ...pulumi.ResourceOption) (*GeoMatchSet, error) {
    75  	if args == nil {
    76  		args = &GeoMatchSetArgs{}
    77  	}
    78  
    79  	opts = internal.PkgResourceDefaultOpts(opts)
    80  	var resource GeoMatchSet
    81  	err := ctx.RegisterResource("aws:waf/geoMatchSet:GeoMatchSet", name, args, &resource, opts...)
    82  	if err != nil {
    83  		return nil, err
    84  	}
    85  	return &resource, nil
    86  }
    87  
    88  // GetGeoMatchSet gets an existing GeoMatchSet resource's state with the given name, ID, and optional
    89  // state properties that are used to uniquely qualify the lookup (nil if not required).
    90  func GetGeoMatchSet(ctx *pulumi.Context,
    91  	name string, id pulumi.IDInput, state *GeoMatchSetState, opts ...pulumi.ResourceOption) (*GeoMatchSet, error) {
    92  	var resource GeoMatchSet
    93  	err := ctx.ReadResource("aws:waf/geoMatchSet:GeoMatchSet", name, id, state, &resource, opts...)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	return &resource, nil
    98  }
    99  
   100  // Input properties used for looking up and filtering GeoMatchSet resources.
   101  type geoMatchSetState struct {
   102  	// Amazon Resource Name (ARN)
   103  	Arn *string `pulumi:"arn"`
   104  	// The GeoMatchConstraint objects which contain the country that you want AWS WAF to search for.
   105  	GeoMatchConstraints []GeoMatchSetGeoMatchConstraint `pulumi:"geoMatchConstraints"`
   106  	// The name or description of the GeoMatchSet.
   107  	Name *string `pulumi:"name"`
   108  }
   109  
   110  type GeoMatchSetState struct {
   111  	// Amazon Resource Name (ARN)
   112  	Arn pulumi.StringPtrInput
   113  	// The GeoMatchConstraint objects which contain the country that you want AWS WAF to search for.
   114  	GeoMatchConstraints GeoMatchSetGeoMatchConstraintArrayInput
   115  	// The name or description of the GeoMatchSet.
   116  	Name pulumi.StringPtrInput
   117  }
   118  
   119  func (GeoMatchSetState) ElementType() reflect.Type {
   120  	return reflect.TypeOf((*geoMatchSetState)(nil)).Elem()
   121  }
   122  
   123  type geoMatchSetArgs struct {
   124  	// The GeoMatchConstraint objects which contain the country that you want AWS WAF to search for.
   125  	GeoMatchConstraints []GeoMatchSetGeoMatchConstraint `pulumi:"geoMatchConstraints"`
   126  	// The name or description of the GeoMatchSet.
   127  	Name *string `pulumi:"name"`
   128  }
   129  
   130  // The set of arguments for constructing a GeoMatchSet resource.
   131  type GeoMatchSetArgs struct {
   132  	// The GeoMatchConstraint objects which contain the country that you want AWS WAF to search for.
   133  	GeoMatchConstraints GeoMatchSetGeoMatchConstraintArrayInput
   134  	// The name or description of the GeoMatchSet.
   135  	Name pulumi.StringPtrInput
   136  }
   137  
   138  func (GeoMatchSetArgs) ElementType() reflect.Type {
   139  	return reflect.TypeOf((*geoMatchSetArgs)(nil)).Elem()
   140  }
   141  
   142  type GeoMatchSetInput interface {
   143  	pulumi.Input
   144  
   145  	ToGeoMatchSetOutput() GeoMatchSetOutput
   146  	ToGeoMatchSetOutputWithContext(ctx context.Context) GeoMatchSetOutput
   147  }
   148  
   149  func (*GeoMatchSet) ElementType() reflect.Type {
   150  	return reflect.TypeOf((**GeoMatchSet)(nil)).Elem()
   151  }
   152  
   153  func (i *GeoMatchSet) ToGeoMatchSetOutput() GeoMatchSetOutput {
   154  	return i.ToGeoMatchSetOutputWithContext(context.Background())
   155  }
   156  
   157  func (i *GeoMatchSet) ToGeoMatchSetOutputWithContext(ctx context.Context) GeoMatchSetOutput {
   158  	return pulumi.ToOutputWithContext(ctx, i).(GeoMatchSetOutput)
   159  }
   160  
   161  // GeoMatchSetArrayInput is an input type that accepts GeoMatchSetArray and GeoMatchSetArrayOutput values.
   162  // You can construct a concrete instance of `GeoMatchSetArrayInput` via:
   163  //
   164  //	GeoMatchSetArray{ GeoMatchSetArgs{...} }
   165  type GeoMatchSetArrayInput interface {
   166  	pulumi.Input
   167  
   168  	ToGeoMatchSetArrayOutput() GeoMatchSetArrayOutput
   169  	ToGeoMatchSetArrayOutputWithContext(context.Context) GeoMatchSetArrayOutput
   170  }
   171  
   172  type GeoMatchSetArray []GeoMatchSetInput
   173  
   174  func (GeoMatchSetArray) ElementType() reflect.Type {
   175  	return reflect.TypeOf((*[]*GeoMatchSet)(nil)).Elem()
   176  }
   177  
   178  func (i GeoMatchSetArray) ToGeoMatchSetArrayOutput() GeoMatchSetArrayOutput {
   179  	return i.ToGeoMatchSetArrayOutputWithContext(context.Background())
   180  }
   181  
   182  func (i GeoMatchSetArray) ToGeoMatchSetArrayOutputWithContext(ctx context.Context) GeoMatchSetArrayOutput {
   183  	return pulumi.ToOutputWithContext(ctx, i).(GeoMatchSetArrayOutput)
   184  }
   185  
   186  // GeoMatchSetMapInput is an input type that accepts GeoMatchSetMap and GeoMatchSetMapOutput values.
   187  // You can construct a concrete instance of `GeoMatchSetMapInput` via:
   188  //
   189  //	GeoMatchSetMap{ "key": GeoMatchSetArgs{...} }
   190  type GeoMatchSetMapInput interface {
   191  	pulumi.Input
   192  
   193  	ToGeoMatchSetMapOutput() GeoMatchSetMapOutput
   194  	ToGeoMatchSetMapOutputWithContext(context.Context) GeoMatchSetMapOutput
   195  }
   196  
   197  type GeoMatchSetMap map[string]GeoMatchSetInput
   198  
   199  func (GeoMatchSetMap) ElementType() reflect.Type {
   200  	return reflect.TypeOf((*map[string]*GeoMatchSet)(nil)).Elem()
   201  }
   202  
   203  func (i GeoMatchSetMap) ToGeoMatchSetMapOutput() GeoMatchSetMapOutput {
   204  	return i.ToGeoMatchSetMapOutputWithContext(context.Background())
   205  }
   206  
   207  func (i GeoMatchSetMap) ToGeoMatchSetMapOutputWithContext(ctx context.Context) GeoMatchSetMapOutput {
   208  	return pulumi.ToOutputWithContext(ctx, i).(GeoMatchSetMapOutput)
   209  }
   210  
   211  type GeoMatchSetOutput struct{ *pulumi.OutputState }
   212  
   213  func (GeoMatchSetOutput) ElementType() reflect.Type {
   214  	return reflect.TypeOf((**GeoMatchSet)(nil)).Elem()
   215  }
   216  
   217  func (o GeoMatchSetOutput) ToGeoMatchSetOutput() GeoMatchSetOutput {
   218  	return o
   219  }
   220  
   221  func (o GeoMatchSetOutput) ToGeoMatchSetOutputWithContext(ctx context.Context) GeoMatchSetOutput {
   222  	return o
   223  }
   224  
   225  // Amazon Resource Name (ARN)
   226  func (o GeoMatchSetOutput) Arn() pulumi.StringOutput {
   227  	return o.ApplyT(func(v *GeoMatchSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   228  }
   229  
   230  // The GeoMatchConstraint objects which contain the country that you want AWS WAF to search for.
   231  func (o GeoMatchSetOutput) GeoMatchConstraints() GeoMatchSetGeoMatchConstraintArrayOutput {
   232  	return o.ApplyT(func(v *GeoMatchSet) GeoMatchSetGeoMatchConstraintArrayOutput { return v.GeoMatchConstraints }).(GeoMatchSetGeoMatchConstraintArrayOutput)
   233  }
   234  
   235  // The name or description of the GeoMatchSet.
   236  func (o GeoMatchSetOutput) Name() pulumi.StringOutput {
   237  	return o.ApplyT(func(v *GeoMatchSet) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   238  }
   239  
   240  type GeoMatchSetArrayOutput struct{ *pulumi.OutputState }
   241  
   242  func (GeoMatchSetArrayOutput) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*[]*GeoMatchSet)(nil)).Elem()
   244  }
   245  
   246  func (o GeoMatchSetArrayOutput) ToGeoMatchSetArrayOutput() GeoMatchSetArrayOutput {
   247  	return o
   248  }
   249  
   250  func (o GeoMatchSetArrayOutput) ToGeoMatchSetArrayOutputWithContext(ctx context.Context) GeoMatchSetArrayOutput {
   251  	return o
   252  }
   253  
   254  func (o GeoMatchSetArrayOutput) Index(i pulumi.IntInput) GeoMatchSetOutput {
   255  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *GeoMatchSet {
   256  		return vs[0].([]*GeoMatchSet)[vs[1].(int)]
   257  	}).(GeoMatchSetOutput)
   258  }
   259  
   260  type GeoMatchSetMapOutput struct{ *pulumi.OutputState }
   261  
   262  func (GeoMatchSetMapOutput) ElementType() reflect.Type {
   263  	return reflect.TypeOf((*map[string]*GeoMatchSet)(nil)).Elem()
   264  }
   265  
   266  func (o GeoMatchSetMapOutput) ToGeoMatchSetMapOutput() GeoMatchSetMapOutput {
   267  	return o
   268  }
   269  
   270  func (o GeoMatchSetMapOutput) ToGeoMatchSetMapOutputWithContext(ctx context.Context) GeoMatchSetMapOutput {
   271  	return o
   272  }
   273  
   274  func (o GeoMatchSetMapOutput) MapIndex(k pulumi.StringInput) GeoMatchSetOutput {
   275  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *GeoMatchSet {
   276  		return vs[0].(map[string]*GeoMatchSet)[vs[1].(string)]
   277  	}).(GeoMatchSetOutput)
   278  }
   279  
   280  func init() {
   281  	pulumi.RegisterInputType(reflect.TypeOf((*GeoMatchSetInput)(nil)).Elem(), &GeoMatchSet{})
   282  	pulumi.RegisterInputType(reflect.TypeOf((*GeoMatchSetArrayInput)(nil)).Elem(), GeoMatchSetArray{})
   283  	pulumi.RegisterInputType(reflect.TypeOf((*GeoMatchSetMapInput)(nil)).Elem(), GeoMatchSetMap{})
   284  	pulumi.RegisterOutputType(GeoMatchSetOutput{})
   285  	pulumi.RegisterOutputType(GeoMatchSetArrayOutput{})
   286  	pulumi.RegisterOutputType(GeoMatchSetMapOutput{})
   287  }