github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/wafv2/ipSet.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 a WAFv2 IP 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.NewIpSet(ctx, "example", &wafv2.IpSetArgs{
    33  //				Name:             pulumi.String("example"),
    34  //				Description:      pulumi.String("Example IP set"),
    35  //				Scope:            pulumi.String("REGIONAL"),
    36  //				IpAddressVersion: pulumi.String("IPV4"),
    37  //				Addresses: pulumi.StringArray{
    38  //					pulumi.String("1.2.3.4/32"),
    39  //					pulumi.String("5.6.7.8/32"),
    40  //				},
    41  //				Tags: pulumi.StringMap{
    42  //					"Tag1": pulumi.String("Value1"),
    43  //					"Tag2": pulumi.String("Value2"),
    44  //				},
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			return nil
    50  //		})
    51  //	}
    52  //
    53  // ```
    54  // <!--End PulumiCodeChooser -->
    55  //
    56  // ## Import
    57  //
    58  // Using `pulumi import`, import WAFv2 IP Sets using `ID/name/scope`. For example:
    59  //
    60  // ```sh
    61  // $ pulumi import aws:wafv2/ipSet:IpSet example a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc/example/REGIONAL
    62  // ```
    63  type IpSet struct {
    64  	pulumi.CustomResourceState
    65  
    66  	// Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for `/0`.
    67  	Addresses pulumi.StringArrayOutput `pulumi:"addresses"`
    68  	// The Amazon Resource Name (ARN) of the IP set.
    69  	Arn pulumi.StringOutput `pulumi:"arn"`
    70  	// A friendly description of the IP set.
    71  	Description pulumi.StringPtrOutput `pulumi:"description"`
    72  	// Specify IPV4 or IPV6. Valid values are `IPV4` or `IPV6`.
    73  	IpAddressVersion pulumi.StringOutput `pulumi:"ipAddressVersion"`
    74  	LockToken        pulumi.StringOutput `pulumi:"lockToken"`
    75  	// A friendly name of the IP set.
    76  	Name pulumi.StringOutput `pulumi:"name"`
    77  	// 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 (N. Virginia).
    78  	Scope pulumi.StringOutput `pulumi:"scope"`
    79  	// 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.
    80  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    81  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    82  	//
    83  	// Deprecated: Please use `tags` instead.
    84  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    85  }
    86  
    87  // NewIpSet registers a new resource with the given unique name, arguments, and options.
    88  func NewIpSet(ctx *pulumi.Context,
    89  	name string, args *IpSetArgs, opts ...pulumi.ResourceOption) (*IpSet, error) {
    90  	if args == nil {
    91  		return nil, errors.New("missing one or more required arguments")
    92  	}
    93  
    94  	if args.IpAddressVersion == nil {
    95  		return nil, errors.New("invalid value for required argument 'IpAddressVersion'")
    96  	}
    97  	if args.Scope == nil {
    98  		return nil, errors.New("invalid value for required argument 'Scope'")
    99  	}
   100  	opts = internal.PkgResourceDefaultOpts(opts)
   101  	var resource IpSet
   102  	err := ctx.RegisterResource("aws:wafv2/ipSet:IpSet", name, args, &resource, opts...)
   103  	if err != nil {
   104  		return nil, err
   105  	}
   106  	return &resource, nil
   107  }
   108  
   109  // GetIpSet gets an existing IpSet resource's state with the given name, ID, and optional
   110  // state properties that are used to uniquely qualify the lookup (nil if not required).
   111  func GetIpSet(ctx *pulumi.Context,
   112  	name string, id pulumi.IDInput, state *IpSetState, opts ...pulumi.ResourceOption) (*IpSet, error) {
   113  	var resource IpSet
   114  	err := ctx.ReadResource("aws:wafv2/ipSet:IpSet", name, id, state, &resource, opts...)
   115  	if err != nil {
   116  		return nil, err
   117  	}
   118  	return &resource, nil
   119  }
   120  
   121  // Input properties used for looking up and filtering IpSet resources.
   122  type ipSetState struct {
   123  	// Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for `/0`.
   124  	Addresses []string `pulumi:"addresses"`
   125  	// The Amazon Resource Name (ARN) of the IP set.
   126  	Arn *string `pulumi:"arn"`
   127  	// A friendly description of the IP set.
   128  	Description *string `pulumi:"description"`
   129  	// Specify IPV4 or IPV6. Valid values are `IPV4` or `IPV6`.
   130  	IpAddressVersion *string `pulumi:"ipAddressVersion"`
   131  	LockToken        *string `pulumi:"lockToken"`
   132  	// A friendly name of the IP set.
   133  	Name *string `pulumi:"name"`
   134  	// 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 (N. Virginia).
   135  	Scope *string `pulumi:"scope"`
   136  	// 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.
   137  	Tags map[string]string `pulumi:"tags"`
   138  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   139  	//
   140  	// Deprecated: Please use `tags` instead.
   141  	TagsAll map[string]string `pulumi:"tagsAll"`
   142  }
   143  
   144  type IpSetState struct {
   145  	// Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for `/0`.
   146  	Addresses pulumi.StringArrayInput
   147  	// The Amazon Resource Name (ARN) of the IP set.
   148  	Arn pulumi.StringPtrInput
   149  	// A friendly description of the IP set.
   150  	Description pulumi.StringPtrInput
   151  	// Specify IPV4 or IPV6. Valid values are `IPV4` or `IPV6`.
   152  	IpAddressVersion pulumi.StringPtrInput
   153  	LockToken        pulumi.StringPtrInput
   154  	// A friendly name of the IP set.
   155  	Name pulumi.StringPtrInput
   156  	// 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 (N. Virginia).
   157  	Scope pulumi.StringPtrInput
   158  	// 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.
   159  	Tags pulumi.StringMapInput
   160  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   161  	//
   162  	// Deprecated: Please use `tags` instead.
   163  	TagsAll pulumi.StringMapInput
   164  }
   165  
   166  func (IpSetState) ElementType() reflect.Type {
   167  	return reflect.TypeOf((*ipSetState)(nil)).Elem()
   168  }
   169  
   170  type ipSetArgs struct {
   171  	// Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for `/0`.
   172  	Addresses []string `pulumi:"addresses"`
   173  	// A friendly description of the IP set.
   174  	Description *string `pulumi:"description"`
   175  	// Specify IPV4 or IPV6. Valid values are `IPV4` or `IPV6`.
   176  	IpAddressVersion string `pulumi:"ipAddressVersion"`
   177  	// A friendly name of the IP set.
   178  	Name *string `pulumi:"name"`
   179  	// 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 (N. Virginia).
   180  	Scope string `pulumi:"scope"`
   181  	// 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.
   182  	Tags map[string]string `pulumi:"tags"`
   183  }
   184  
   185  // The set of arguments for constructing a IpSet resource.
   186  type IpSetArgs struct {
   187  	// Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for `/0`.
   188  	Addresses pulumi.StringArrayInput
   189  	// A friendly description of the IP set.
   190  	Description pulumi.StringPtrInput
   191  	// Specify IPV4 or IPV6. Valid values are `IPV4` or `IPV6`.
   192  	IpAddressVersion pulumi.StringInput
   193  	// A friendly name of the IP set.
   194  	Name pulumi.StringPtrInput
   195  	// 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 (N. Virginia).
   196  	Scope pulumi.StringInput
   197  	// 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.
   198  	Tags pulumi.StringMapInput
   199  }
   200  
   201  func (IpSetArgs) ElementType() reflect.Type {
   202  	return reflect.TypeOf((*ipSetArgs)(nil)).Elem()
   203  }
   204  
   205  type IpSetInput interface {
   206  	pulumi.Input
   207  
   208  	ToIpSetOutput() IpSetOutput
   209  	ToIpSetOutputWithContext(ctx context.Context) IpSetOutput
   210  }
   211  
   212  func (*IpSet) ElementType() reflect.Type {
   213  	return reflect.TypeOf((**IpSet)(nil)).Elem()
   214  }
   215  
   216  func (i *IpSet) ToIpSetOutput() IpSetOutput {
   217  	return i.ToIpSetOutputWithContext(context.Background())
   218  }
   219  
   220  func (i *IpSet) ToIpSetOutputWithContext(ctx context.Context) IpSetOutput {
   221  	return pulumi.ToOutputWithContext(ctx, i).(IpSetOutput)
   222  }
   223  
   224  // IpSetArrayInput is an input type that accepts IpSetArray and IpSetArrayOutput values.
   225  // You can construct a concrete instance of `IpSetArrayInput` via:
   226  //
   227  //	IpSetArray{ IpSetArgs{...} }
   228  type IpSetArrayInput interface {
   229  	pulumi.Input
   230  
   231  	ToIpSetArrayOutput() IpSetArrayOutput
   232  	ToIpSetArrayOutputWithContext(context.Context) IpSetArrayOutput
   233  }
   234  
   235  type IpSetArray []IpSetInput
   236  
   237  func (IpSetArray) ElementType() reflect.Type {
   238  	return reflect.TypeOf((*[]*IpSet)(nil)).Elem()
   239  }
   240  
   241  func (i IpSetArray) ToIpSetArrayOutput() IpSetArrayOutput {
   242  	return i.ToIpSetArrayOutputWithContext(context.Background())
   243  }
   244  
   245  func (i IpSetArray) ToIpSetArrayOutputWithContext(ctx context.Context) IpSetArrayOutput {
   246  	return pulumi.ToOutputWithContext(ctx, i).(IpSetArrayOutput)
   247  }
   248  
   249  // IpSetMapInput is an input type that accepts IpSetMap and IpSetMapOutput values.
   250  // You can construct a concrete instance of `IpSetMapInput` via:
   251  //
   252  //	IpSetMap{ "key": IpSetArgs{...} }
   253  type IpSetMapInput interface {
   254  	pulumi.Input
   255  
   256  	ToIpSetMapOutput() IpSetMapOutput
   257  	ToIpSetMapOutputWithContext(context.Context) IpSetMapOutput
   258  }
   259  
   260  type IpSetMap map[string]IpSetInput
   261  
   262  func (IpSetMap) ElementType() reflect.Type {
   263  	return reflect.TypeOf((*map[string]*IpSet)(nil)).Elem()
   264  }
   265  
   266  func (i IpSetMap) ToIpSetMapOutput() IpSetMapOutput {
   267  	return i.ToIpSetMapOutputWithContext(context.Background())
   268  }
   269  
   270  func (i IpSetMap) ToIpSetMapOutputWithContext(ctx context.Context) IpSetMapOutput {
   271  	return pulumi.ToOutputWithContext(ctx, i).(IpSetMapOutput)
   272  }
   273  
   274  type IpSetOutput struct{ *pulumi.OutputState }
   275  
   276  func (IpSetOutput) ElementType() reflect.Type {
   277  	return reflect.TypeOf((**IpSet)(nil)).Elem()
   278  }
   279  
   280  func (o IpSetOutput) ToIpSetOutput() IpSetOutput {
   281  	return o
   282  }
   283  
   284  func (o IpSetOutput) ToIpSetOutputWithContext(ctx context.Context) IpSetOutput {
   285  	return o
   286  }
   287  
   288  // Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for `/0`.
   289  func (o IpSetOutput) Addresses() pulumi.StringArrayOutput {
   290  	return o.ApplyT(func(v *IpSet) pulumi.StringArrayOutput { return v.Addresses }).(pulumi.StringArrayOutput)
   291  }
   292  
   293  // The Amazon Resource Name (ARN) of the IP set.
   294  func (o IpSetOutput) Arn() pulumi.StringOutput {
   295  	return o.ApplyT(func(v *IpSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   296  }
   297  
   298  // A friendly description of the IP set.
   299  func (o IpSetOutput) Description() pulumi.StringPtrOutput {
   300  	return o.ApplyT(func(v *IpSet) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   301  }
   302  
   303  // Specify IPV4 or IPV6. Valid values are `IPV4` or `IPV6`.
   304  func (o IpSetOutput) IpAddressVersion() pulumi.StringOutput {
   305  	return o.ApplyT(func(v *IpSet) pulumi.StringOutput { return v.IpAddressVersion }).(pulumi.StringOutput)
   306  }
   307  
   308  func (o IpSetOutput) LockToken() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *IpSet) pulumi.StringOutput { return v.LockToken }).(pulumi.StringOutput)
   310  }
   311  
   312  // A friendly name of the IP set.
   313  func (o IpSetOutput) Name() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *IpSet) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   315  }
   316  
   317  // 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 (N. Virginia).
   318  func (o IpSetOutput) Scope() pulumi.StringOutput {
   319  	return o.ApplyT(func(v *IpSet) pulumi.StringOutput { return v.Scope }).(pulumi.StringOutput)
   320  }
   321  
   322  // 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.
   323  func (o IpSetOutput) Tags() pulumi.StringMapOutput {
   324  	return o.ApplyT(func(v *IpSet) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   325  }
   326  
   327  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   328  //
   329  // Deprecated: Please use `tags` instead.
   330  func (o IpSetOutput) TagsAll() pulumi.StringMapOutput {
   331  	return o.ApplyT(func(v *IpSet) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   332  }
   333  
   334  type IpSetArrayOutput struct{ *pulumi.OutputState }
   335  
   336  func (IpSetArrayOutput) ElementType() reflect.Type {
   337  	return reflect.TypeOf((*[]*IpSet)(nil)).Elem()
   338  }
   339  
   340  func (o IpSetArrayOutput) ToIpSetArrayOutput() IpSetArrayOutput {
   341  	return o
   342  }
   343  
   344  func (o IpSetArrayOutput) ToIpSetArrayOutputWithContext(ctx context.Context) IpSetArrayOutput {
   345  	return o
   346  }
   347  
   348  func (o IpSetArrayOutput) Index(i pulumi.IntInput) IpSetOutput {
   349  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *IpSet {
   350  		return vs[0].([]*IpSet)[vs[1].(int)]
   351  	}).(IpSetOutput)
   352  }
   353  
   354  type IpSetMapOutput struct{ *pulumi.OutputState }
   355  
   356  func (IpSetMapOutput) ElementType() reflect.Type {
   357  	return reflect.TypeOf((*map[string]*IpSet)(nil)).Elem()
   358  }
   359  
   360  func (o IpSetMapOutput) ToIpSetMapOutput() IpSetMapOutput {
   361  	return o
   362  }
   363  
   364  func (o IpSetMapOutput) ToIpSetMapOutputWithContext(ctx context.Context) IpSetMapOutput {
   365  	return o
   366  }
   367  
   368  func (o IpSetMapOutput) MapIndex(k pulumi.StringInput) IpSetOutput {
   369  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *IpSet {
   370  		return vs[0].(map[string]*IpSet)[vs[1].(string)]
   371  	}).(IpSetOutput)
   372  }
   373  
   374  func init() {
   375  	pulumi.RegisterInputType(reflect.TypeOf((*IpSetInput)(nil)).Elem(), &IpSet{})
   376  	pulumi.RegisterInputType(reflect.TypeOf((*IpSetArrayInput)(nil)).Elem(), IpSetArray{})
   377  	pulumi.RegisterInputType(reflect.TypeOf((*IpSetMapInput)(nil)).Elem(), IpSetMap{})
   378  	pulumi.RegisterOutputType(IpSetOutput{})
   379  	pulumi.RegisterOutputType(IpSetArrayOutput{})
   380  	pulumi.RegisterOutputType(IpSetMapOutput{})
   381  }