github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/wafv2/webAclAssociation.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  // Creates a WAFv2 Web ACL Association.
    16  //
    17  // > **NOTE on associating a WAFv2 Web ACL with a Cloudfront distribution:** Do not use this resource to associate a WAFv2 Web ACL with a Cloudfront Distribution. The [AWS API call backing this resource](https://docs.aws.amazon.com/waf/latest/APIReference/API_AssociateWebACL.html) notes that you should use the `webAclId` property on the `cloudfrontDistribution` instead.
    18  //
    19  // ## Import
    20  //
    21  // Using `pulumi import`, import WAFv2 Web ACL Association using `WEB_ACL_ARN,RESOURCE_ARN`. For example:
    22  //
    23  // ```sh
    24  // $ pulumi import aws:wafv2/webAclAssociation:WebAclAssociation example arn:aws:wafv2:...7ce849ea,arn:aws:apigateway:...ages/name
    25  // ```
    26  //
    27  // [1]: https://docs.aws.amazon.com/waf/latest/APIReference/API_AssociateWebACL.html
    28  type WebAclAssociation struct {
    29  	pulumi.CustomResourceState
    30  
    31  	// The Amazon Resource Name (ARN) of the resource to associate with the web ACL. This must be an ARN of an Application Load Balancer, an Amazon API Gateway stage (REST only, HTTP is unsupported), an Amazon Cognito User Pool, an Amazon AppSync GraphQL API, an Amazon App Runner service, or an Amazon Verified Access instance.
    32  	ResourceArn pulumi.StringOutput `pulumi:"resourceArn"`
    33  	// The Amazon Resource Name (ARN) of the Web ACL that you want to associate with the resource.
    34  	WebAclArn pulumi.StringOutput `pulumi:"webAclArn"`
    35  }
    36  
    37  // NewWebAclAssociation registers a new resource with the given unique name, arguments, and options.
    38  func NewWebAclAssociation(ctx *pulumi.Context,
    39  	name string, args *WebAclAssociationArgs, opts ...pulumi.ResourceOption) (*WebAclAssociation, error) {
    40  	if args == nil {
    41  		return nil, errors.New("missing one or more required arguments")
    42  	}
    43  
    44  	if args.ResourceArn == nil {
    45  		return nil, errors.New("invalid value for required argument 'ResourceArn'")
    46  	}
    47  	if args.WebAclArn == nil {
    48  		return nil, errors.New("invalid value for required argument 'WebAclArn'")
    49  	}
    50  	opts = internal.PkgResourceDefaultOpts(opts)
    51  	var resource WebAclAssociation
    52  	err := ctx.RegisterResource("aws:wafv2/webAclAssociation:WebAclAssociation", name, args, &resource, opts...)
    53  	if err != nil {
    54  		return nil, err
    55  	}
    56  	return &resource, nil
    57  }
    58  
    59  // GetWebAclAssociation gets an existing WebAclAssociation resource's state with the given name, ID, and optional
    60  // state properties that are used to uniquely qualify the lookup (nil if not required).
    61  func GetWebAclAssociation(ctx *pulumi.Context,
    62  	name string, id pulumi.IDInput, state *WebAclAssociationState, opts ...pulumi.ResourceOption) (*WebAclAssociation, error) {
    63  	var resource WebAclAssociation
    64  	err := ctx.ReadResource("aws:wafv2/webAclAssociation:WebAclAssociation", name, id, state, &resource, opts...)
    65  	if err != nil {
    66  		return nil, err
    67  	}
    68  	return &resource, nil
    69  }
    70  
    71  // Input properties used for looking up and filtering WebAclAssociation resources.
    72  type webAclAssociationState struct {
    73  	// The Amazon Resource Name (ARN) of the resource to associate with the web ACL. This must be an ARN of an Application Load Balancer, an Amazon API Gateway stage (REST only, HTTP is unsupported), an Amazon Cognito User Pool, an Amazon AppSync GraphQL API, an Amazon App Runner service, or an Amazon Verified Access instance.
    74  	ResourceArn *string `pulumi:"resourceArn"`
    75  	// The Amazon Resource Name (ARN) of the Web ACL that you want to associate with the resource.
    76  	WebAclArn *string `pulumi:"webAclArn"`
    77  }
    78  
    79  type WebAclAssociationState struct {
    80  	// The Amazon Resource Name (ARN) of the resource to associate with the web ACL. This must be an ARN of an Application Load Balancer, an Amazon API Gateway stage (REST only, HTTP is unsupported), an Amazon Cognito User Pool, an Amazon AppSync GraphQL API, an Amazon App Runner service, or an Amazon Verified Access instance.
    81  	ResourceArn pulumi.StringPtrInput
    82  	// The Amazon Resource Name (ARN) of the Web ACL that you want to associate with the resource.
    83  	WebAclArn pulumi.StringPtrInput
    84  }
    85  
    86  func (WebAclAssociationState) ElementType() reflect.Type {
    87  	return reflect.TypeOf((*webAclAssociationState)(nil)).Elem()
    88  }
    89  
    90  type webAclAssociationArgs struct {
    91  	// The Amazon Resource Name (ARN) of the resource to associate with the web ACL. This must be an ARN of an Application Load Balancer, an Amazon API Gateway stage (REST only, HTTP is unsupported), an Amazon Cognito User Pool, an Amazon AppSync GraphQL API, an Amazon App Runner service, or an Amazon Verified Access instance.
    92  	ResourceArn string `pulumi:"resourceArn"`
    93  	// The Amazon Resource Name (ARN) of the Web ACL that you want to associate with the resource.
    94  	WebAclArn string `pulumi:"webAclArn"`
    95  }
    96  
    97  // The set of arguments for constructing a WebAclAssociation resource.
    98  type WebAclAssociationArgs struct {
    99  	// The Amazon Resource Name (ARN) of the resource to associate with the web ACL. This must be an ARN of an Application Load Balancer, an Amazon API Gateway stage (REST only, HTTP is unsupported), an Amazon Cognito User Pool, an Amazon AppSync GraphQL API, an Amazon App Runner service, or an Amazon Verified Access instance.
   100  	ResourceArn pulumi.StringInput
   101  	// The Amazon Resource Name (ARN) of the Web ACL that you want to associate with the resource.
   102  	WebAclArn pulumi.StringInput
   103  }
   104  
   105  func (WebAclAssociationArgs) ElementType() reflect.Type {
   106  	return reflect.TypeOf((*webAclAssociationArgs)(nil)).Elem()
   107  }
   108  
   109  type WebAclAssociationInput interface {
   110  	pulumi.Input
   111  
   112  	ToWebAclAssociationOutput() WebAclAssociationOutput
   113  	ToWebAclAssociationOutputWithContext(ctx context.Context) WebAclAssociationOutput
   114  }
   115  
   116  func (*WebAclAssociation) ElementType() reflect.Type {
   117  	return reflect.TypeOf((**WebAclAssociation)(nil)).Elem()
   118  }
   119  
   120  func (i *WebAclAssociation) ToWebAclAssociationOutput() WebAclAssociationOutput {
   121  	return i.ToWebAclAssociationOutputWithContext(context.Background())
   122  }
   123  
   124  func (i *WebAclAssociation) ToWebAclAssociationOutputWithContext(ctx context.Context) WebAclAssociationOutput {
   125  	return pulumi.ToOutputWithContext(ctx, i).(WebAclAssociationOutput)
   126  }
   127  
   128  // WebAclAssociationArrayInput is an input type that accepts WebAclAssociationArray and WebAclAssociationArrayOutput values.
   129  // You can construct a concrete instance of `WebAclAssociationArrayInput` via:
   130  //
   131  //	WebAclAssociationArray{ WebAclAssociationArgs{...} }
   132  type WebAclAssociationArrayInput interface {
   133  	pulumi.Input
   134  
   135  	ToWebAclAssociationArrayOutput() WebAclAssociationArrayOutput
   136  	ToWebAclAssociationArrayOutputWithContext(context.Context) WebAclAssociationArrayOutput
   137  }
   138  
   139  type WebAclAssociationArray []WebAclAssociationInput
   140  
   141  func (WebAclAssociationArray) ElementType() reflect.Type {
   142  	return reflect.TypeOf((*[]*WebAclAssociation)(nil)).Elem()
   143  }
   144  
   145  func (i WebAclAssociationArray) ToWebAclAssociationArrayOutput() WebAclAssociationArrayOutput {
   146  	return i.ToWebAclAssociationArrayOutputWithContext(context.Background())
   147  }
   148  
   149  func (i WebAclAssociationArray) ToWebAclAssociationArrayOutputWithContext(ctx context.Context) WebAclAssociationArrayOutput {
   150  	return pulumi.ToOutputWithContext(ctx, i).(WebAclAssociationArrayOutput)
   151  }
   152  
   153  // WebAclAssociationMapInput is an input type that accepts WebAclAssociationMap and WebAclAssociationMapOutput values.
   154  // You can construct a concrete instance of `WebAclAssociationMapInput` via:
   155  //
   156  //	WebAclAssociationMap{ "key": WebAclAssociationArgs{...} }
   157  type WebAclAssociationMapInput interface {
   158  	pulumi.Input
   159  
   160  	ToWebAclAssociationMapOutput() WebAclAssociationMapOutput
   161  	ToWebAclAssociationMapOutputWithContext(context.Context) WebAclAssociationMapOutput
   162  }
   163  
   164  type WebAclAssociationMap map[string]WebAclAssociationInput
   165  
   166  func (WebAclAssociationMap) ElementType() reflect.Type {
   167  	return reflect.TypeOf((*map[string]*WebAclAssociation)(nil)).Elem()
   168  }
   169  
   170  func (i WebAclAssociationMap) ToWebAclAssociationMapOutput() WebAclAssociationMapOutput {
   171  	return i.ToWebAclAssociationMapOutputWithContext(context.Background())
   172  }
   173  
   174  func (i WebAclAssociationMap) ToWebAclAssociationMapOutputWithContext(ctx context.Context) WebAclAssociationMapOutput {
   175  	return pulumi.ToOutputWithContext(ctx, i).(WebAclAssociationMapOutput)
   176  }
   177  
   178  type WebAclAssociationOutput struct{ *pulumi.OutputState }
   179  
   180  func (WebAclAssociationOutput) ElementType() reflect.Type {
   181  	return reflect.TypeOf((**WebAclAssociation)(nil)).Elem()
   182  }
   183  
   184  func (o WebAclAssociationOutput) ToWebAclAssociationOutput() WebAclAssociationOutput {
   185  	return o
   186  }
   187  
   188  func (o WebAclAssociationOutput) ToWebAclAssociationOutputWithContext(ctx context.Context) WebAclAssociationOutput {
   189  	return o
   190  }
   191  
   192  // The Amazon Resource Name (ARN) of the resource to associate with the web ACL. This must be an ARN of an Application Load Balancer, an Amazon API Gateway stage (REST only, HTTP is unsupported), an Amazon Cognito User Pool, an Amazon AppSync GraphQL API, an Amazon App Runner service, or an Amazon Verified Access instance.
   193  func (o WebAclAssociationOutput) ResourceArn() pulumi.StringOutput {
   194  	return o.ApplyT(func(v *WebAclAssociation) pulumi.StringOutput { return v.ResourceArn }).(pulumi.StringOutput)
   195  }
   196  
   197  // The Amazon Resource Name (ARN) of the Web ACL that you want to associate with the resource.
   198  func (o WebAclAssociationOutput) WebAclArn() pulumi.StringOutput {
   199  	return o.ApplyT(func(v *WebAclAssociation) pulumi.StringOutput { return v.WebAclArn }).(pulumi.StringOutput)
   200  }
   201  
   202  type WebAclAssociationArrayOutput struct{ *pulumi.OutputState }
   203  
   204  func (WebAclAssociationArrayOutput) ElementType() reflect.Type {
   205  	return reflect.TypeOf((*[]*WebAclAssociation)(nil)).Elem()
   206  }
   207  
   208  func (o WebAclAssociationArrayOutput) ToWebAclAssociationArrayOutput() WebAclAssociationArrayOutput {
   209  	return o
   210  }
   211  
   212  func (o WebAclAssociationArrayOutput) ToWebAclAssociationArrayOutputWithContext(ctx context.Context) WebAclAssociationArrayOutput {
   213  	return o
   214  }
   215  
   216  func (o WebAclAssociationArrayOutput) Index(i pulumi.IntInput) WebAclAssociationOutput {
   217  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *WebAclAssociation {
   218  		return vs[0].([]*WebAclAssociation)[vs[1].(int)]
   219  	}).(WebAclAssociationOutput)
   220  }
   221  
   222  type WebAclAssociationMapOutput struct{ *pulumi.OutputState }
   223  
   224  func (WebAclAssociationMapOutput) ElementType() reflect.Type {
   225  	return reflect.TypeOf((*map[string]*WebAclAssociation)(nil)).Elem()
   226  }
   227  
   228  func (o WebAclAssociationMapOutput) ToWebAclAssociationMapOutput() WebAclAssociationMapOutput {
   229  	return o
   230  }
   231  
   232  func (o WebAclAssociationMapOutput) ToWebAclAssociationMapOutputWithContext(ctx context.Context) WebAclAssociationMapOutput {
   233  	return o
   234  }
   235  
   236  func (o WebAclAssociationMapOutput) MapIndex(k pulumi.StringInput) WebAclAssociationOutput {
   237  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *WebAclAssociation {
   238  		return vs[0].(map[string]*WebAclAssociation)[vs[1].(string)]
   239  	}).(WebAclAssociationOutput)
   240  }
   241  
   242  func init() {
   243  	pulumi.RegisterInputType(reflect.TypeOf((*WebAclAssociationInput)(nil)).Elem(), &WebAclAssociation{})
   244  	pulumi.RegisterInputType(reflect.TypeOf((*WebAclAssociationArrayInput)(nil)).Elem(), WebAclAssociationArray{})
   245  	pulumi.RegisterInputType(reflect.TypeOf((*WebAclAssociationMapInput)(nil)).Elem(), WebAclAssociationMap{})
   246  	pulumi.RegisterOutputType(WebAclAssociationOutput{})
   247  	pulumi.RegisterOutputType(WebAclAssociationArrayOutput{})
   248  	pulumi.RegisterOutputType(WebAclAssociationMapOutput{})
   249  }