github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/waf/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 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 IPSet 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.NewIpSet(ctx, "ipset", &waf.IpSetArgs{
    32  //				Name: pulumi.String("tfIPSet"),
    33  //				IpSetDescriptors: waf.IpSetIpSetDescriptorArray{
    34  //					&waf.IpSetIpSetDescriptorArgs{
    35  //						Type:  pulumi.String("IPV4"),
    36  //						Value: pulumi.String("192.0.7.0/24"),
    37  //					},
    38  //					&waf.IpSetIpSetDescriptorArgs{
    39  //						Type:  pulumi.String("IPV4"),
    40  //						Value: pulumi.String("10.16.16.0/16"),
    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 IPSets using their ID. For example:
    57  //
    58  // ```sh
    59  // $ pulumi import aws:waf/ipSet:IpSet example a1b2c3d4-d5f6-7777-8888-9999aaaabbbbcccc
    60  // ```
    61  type IpSet struct {
    62  	pulumi.CustomResourceState
    63  
    64  	// The ARN of the WAF IPSet.
    65  	Arn pulumi.StringOutput `pulumi:"arn"`
    66  	// One or more pairs specifying the IP address type (IPV4 or IPV6) and the IP address range (in CIDR format) from which web requests originate.
    67  	IpSetDescriptors IpSetIpSetDescriptorArrayOutput `pulumi:"ipSetDescriptors"`
    68  	// The name or description of the IPSet.
    69  	Name pulumi.StringOutput `pulumi:"name"`
    70  }
    71  
    72  // NewIpSet registers a new resource with the given unique name, arguments, and options.
    73  func NewIpSet(ctx *pulumi.Context,
    74  	name string, args *IpSetArgs, opts ...pulumi.ResourceOption) (*IpSet, error) {
    75  	if args == nil {
    76  		args = &IpSetArgs{}
    77  	}
    78  
    79  	opts = internal.PkgResourceDefaultOpts(opts)
    80  	var resource IpSet
    81  	err := ctx.RegisterResource("aws:waf/ipSet:IpSet", name, args, &resource, opts...)
    82  	if err != nil {
    83  		return nil, err
    84  	}
    85  	return &resource, nil
    86  }
    87  
    88  // GetIpSet gets an existing IpSet 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 GetIpSet(ctx *pulumi.Context,
    91  	name string, id pulumi.IDInput, state *IpSetState, opts ...pulumi.ResourceOption) (*IpSet, error) {
    92  	var resource IpSet
    93  	err := ctx.ReadResource("aws:waf/ipSet:IpSet", 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 IpSet resources.
   101  type ipSetState struct {
   102  	// The ARN of the WAF IPSet.
   103  	Arn *string `pulumi:"arn"`
   104  	// One or more pairs specifying the IP address type (IPV4 or IPV6) and the IP address range (in CIDR format) from which web requests originate.
   105  	IpSetDescriptors []IpSetIpSetDescriptor `pulumi:"ipSetDescriptors"`
   106  	// The name or description of the IPSet.
   107  	Name *string `pulumi:"name"`
   108  }
   109  
   110  type IpSetState struct {
   111  	// The ARN of the WAF IPSet.
   112  	Arn pulumi.StringPtrInput
   113  	// One or more pairs specifying the IP address type (IPV4 or IPV6) and the IP address range (in CIDR format) from which web requests originate.
   114  	IpSetDescriptors IpSetIpSetDescriptorArrayInput
   115  	// The name or description of the IPSet.
   116  	Name pulumi.StringPtrInput
   117  }
   118  
   119  func (IpSetState) ElementType() reflect.Type {
   120  	return reflect.TypeOf((*ipSetState)(nil)).Elem()
   121  }
   122  
   123  type ipSetArgs struct {
   124  	// One or more pairs specifying the IP address type (IPV4 or IPV6) and the IP address range (in CIDR format) from which web requests originate.
   125  	IpSetDescriptors []IpSetIpSetDescriptor `pulumi:"ipSetDescriptors"`
   126  	// The name or description of the IPSet.
   127  	Name *string `pulumi:"name"`
   128  }
   129  
   130  // The set of arguments for constructing a IpSet resource.
   131  type IpSetArgs struct {
   132  	// One or more pairs specifying the IP address type (IPV4 or IPV6) and the IP address range (in CIDR format) from which web requests originate.
   133  	IpSetDescriptors IpSetIpSetDescriptorArrayInput
   134  	// The name or description of the IPSet.
   135  	Name pulumi.StringPtrInput
   136  }
   137  
   138  func (IpSetArgs) ElementType() reflect.Type {
   139  	return reflect.TypeOf((*ipSetArgs)(nil)).Elem()
   140  }
   141  
   142  type IpSetInput interface {
   143  	pulumi.Input
   144  
   145  	ToIpSetOutput() IpSetOutput
   146  	ToIpSetOutputWithContext(ctx context.Context) IpSetOutput
   147  }
   148  
   149  func (*IpSet) ElementType() reflect.Type {
   150  	return reflect.TypeOf((**IpSet)(nil)).Elem()
   151  }
   152  
   153  func (i *IpSet) ToIpSetOutput() IpSetOutput {
   154  	return i.ToIpSetOutputWithContext(context.Background())
   155  }
   156  
   157  func (i *IpSet) ToIpSetOutputWithContext(ctx context.Context) IpSetOutput {
   158  	return pulumi.ToOutputWithContext(ctx, i).(IpSetOutput)
   159  }
   160  
   161  // IpSetArrayInput is an input type that accepts IpSetArray and IpSetArrayOutput values.
   162  // You can construct a concrete instance of `IpSetArrayInput` via:
   163  //
   164  //	IpSetArray{ IpSetArgs{...} }
   165  type IpSetArrayInput interface {
   166  	pulumi.Input
   167  
   168  	ToIpSetArrayOutput() IpSetArrayOutput
   169  	ToIpSetArrayOutputWithContext(context.Context) IpSetArrayOutput
   170  }
   171  
   172  type IpSetArray []IpSetInput
   173  
   174  func (IpSetArray) ElementType() reflect.Type {
   175  	return reflect.TypeOf((*[]*IpSet)(nil)).Elem()
   176  }
   177  
   178  func (i IpSetArray) ToIpSetArrayOutput() IpSetArrayOutput {
   179  	return i.ToIpSetArrayOutputWithContext(context.Background())
   180  }
   181  
   182  func (i IpSetArray) ToIpSetArrayOutputWithContext(ctx context.Context) IpSetArrayOutput {
   183  	return pulumi.ToOutputWithContext(ctx, i).(IpSetArrayOutput)
   184  }
   185  
   186  // IpSetMapInput is an input type that accepts IpSetMap and IpSetMapOutput values.
   187  // You can construct a concrete instance of `IpSetMapInput` via:
   188  //
   189  //	IpSetMap{ "key": IpSetArgs{...} }
   190  type IpSetMapInput interface {
   191  	pulumi.Input
   192  
   193  	ToIpSetMapOutput() IpSetMapOutput
   194  	ToIpSetMapOutputWithContext(context.Context) IpSetMapOutput
   195  }
   196  
   197  type IpSetMap map[string]IpSetInput
   198  
   199  func (IpSetMap) ElementType() reflect.Type {
   200  	return reflect.TypeOf((*map[string]*IpSet)(nil)).Elem()
   201  }
   202  
   203  func (i IpSetMap) ToIpSetMapOutput() IpSetMapOutput {
   204  	return i.ToIpSetMapOutputWithContext(context.Background())
   205  }
   206  
   207  func (i IpSetMap) ToIpSetMapOutputWithContext(ctx context.Context) IpSetMapOutput {
   208  	return pulumi.ToOutputWithContext(ctx, i).(IpSetMapOutput)
   209  }
   210  
   211  type IpSetOutput struct{ *pulumi.OutputState }
   212  
   213  func (IpSetOutput) ElementType() reflect.Type {
   214  	return reflect.TypeOf((**IpSet)(nil)).Elem()
   215  }
   216  
   217  func (o IpSetOutput) ToIpSetOutput() IpSetOutput {
   218  	return o
   219  }
   220  
   221  func (o IpSetOutput) ToIpSetOutputWithContext(ctx context.Context) IpSetOutput {
   222  	return o
   223  }
   224  
   225  // The ARN of the WAF IPSet.
   226  func (o IpSetOutput) Arn() pulumi.StringOutput {
   227  	return o.ApplyT(func(v *IpSet) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   228  }
   229  
   230  // One or more pairs specifying the IP address type (IPV4 or IPV6) and the IP address range (in CIDR format) from which web requests originate.
   231  func (o IpSetOutput) IpSetDescriptors() IpSetIpSetDescriptorArrayOutput {
   232  	return o.ApplyT(func(v *IpSet) IpSetIpSetDescriptorArrayOutput { return v.IpSetDescriptors }).(IpSetIpSetDescriptorArrayOutput)
   233  }
   234  
   235  // The name or description of the IPSet.
   236  func (o IpSetOutput) Name() pulumi.StringOutput {
   237  	return o.ApplyT(func(v *IpSet) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   238  }
   239  
   240  type IpSetArrayOutput struct{ *pulumi.OutputState }
   241  
   242  func (IpSetArrayOutput) ElementType() reflect.Type {
   243  	return reflect.TypeOf((*[]*IpSet)(nil)).Elem()
   244  }
   245  
   246  func (o IpSetArrayOutput) ToIpSetArrayOutput() IpSetArrayOutput {
   247  	return o
   248  }
   249  
   250  func (o IpSetArrayOutput) ToIpSetArrayOutputWithContext(ctx context.Context) IpSetArrayOutput {
   251  	return o
   252  }
   253  
   254  func (o IpSetArrayOutput) Index(i pulumi.IntInput) IpSetOutput {
   255  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *IpSet {
   256  		return vs[0].([]*IpSet)[vs[1].(int)]
   257  	}).(IpSetOutput)
   258  }
   259  
   260  type IpSetMapOutput struct{ *pulumi.OutputState }
   261  
   262  func (IpSetMapOutput) ElementType() reflect.Type {
   263  	return reflect.TypeOf((*map[string]*IpSet)(nil)).Elem()
   264  }
   265  
   266  func (o IpSetMapOutput) ToIpSetMapOutput() IpSetMapOutput {
   267  	return o
   268  }
   269  
   270  func (o IpSetMapOutput) ToIpSetMapOutputWithContext(ctx context.Context) IpSetMapOutput {
   271  	return o
   272  }
   273  
   274  func (o IpSetMapOutput) MapIndex(k pulumi.StringInput) IpSetOutput {
   275  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *IpSet {
   276  		return vs[0].(map[string]*IpSet)[vs[1].(string)]
   277  	}).(IpSetOutput)
   278  }
   279  
   280  func init() {
   281  	pulumi.RegisterInputType(reflect.TypeOf((*IpSetInput)(nil)).Elem(), &IpSet{})
   282  	pulumi.RegisterInputType(reflect.TypeOf((*IpSetArrayInput)(nil)).Elem(), IpSetArray{})
   283  	pulumi.RegisterInputType(reflect.TypeOf((*IpSetMapInput)(nil)).Elem(), IpSetMap{})
   284  	pulumi.RegisterOutputType(IpSetOutput{})
   285  	pulumi.RegisterOutputType(IpSetArrayOutput{})
   286  	pulumi.RegisterOutputType(IpSetMapOutput{})
   287  }