github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/route53/resolverRuleAssociation.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 route53
     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 Route53 Resolver rule association.
    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/route53"
    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 := route53.NewResolverRuleAssociation(ctx, "example", &route53.ResolverRuleAssociationArgs{
    33  //				ResolverRuleId: pulumi.Any(sys.Id),
    34  //				VpcId:          pulumi.Any(foo.Id),
    35  //			})
    36  //			if err != nil {
    37  //				return err
    38  //			}
    39  //			return nil
    40  //		})
    41  //	}
    42  //
    43  // ```
    44  // <!--End PulumiCodeChooser -->
    45  //
    46  // ## Import
    47  //
    48  // Using `pulumi import`, import Route53 Resolver rule associations using the `id`. For example:
    49  //
    50  // ```sh
    51  // $ pulumi import aws:route53/resolverRuleAssociation:ResolverRuleAssociation example rslvr-rrassoc-97242eaf88example
    52  // ```
    53  type ResolverRuleAssociation struct {
    54  	pulumi.CustomResourceState
    55  
    56  	// A name for the association that you're creating between a resolver rule and a VPC.
    57  	Name pulumi.StringOutput `pulumi:"name"`
    58  	// The ID of the resolver rule that you want to associate with the VPC.
    59  	ResolverRuleId pulumi.StringOutput `pulumi:"resolverRuleId"`
    60  	// The ID of the VPC that you want to associate the resolver rule with.
    61  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
    62  }
    63  
    64  // NewResolverRuleAssociation registers a new resource with the given unique name, arguments, and options.
    65  func NewResolverRuleAssociation(ctx *pulumi.Context,
    66  	name string, args *ResolverRuleAssociationArgs, opts ...pulumi.ResourceOption) (*ResolverRuleAssociation, error) {
    67  	if args == nil {
    68  		return nil, errors.New("missing one or more required arguments")
    69  	}
    70  
    71  	if args.ResolverRuleId == nil {
    72  		return nil, errors.New("invalid value for required argument 'ResolverRuleId'")
    73  	}
    74  	if args.VpcId == nil {
    75  		return nil, errors.New("invalid value for required argument 'VpcId'")
    76  	}
    77  	opts = internal.PkgResourceDefaultOpts(opts)
    78  	var resource ResolverRuleAssociation
    79  	err := ctx.RegisterResource("aws:route53/resolverRuleAssociation:ResolverRuleAssociation", name, args, &resource, opts...)
    80  	if err != nil {
    81  		return nil, err
    82  	}
    83  	return &resource, nil
    84  }
    85  
    86  // GetResolverRuleAssociation gets an existing ResolverRuleAssociation resource's state with the given name, ID, and optional
    87  // state properties that are used to uniquely qualify the lookup (nil if not required).
    88  func GetResolverRuleAssociation(ctx *pulumi.Context,
    89  	name string, id pulumi.IDInput, state *ResolverRuleAssociationState, opts ...pulumi.ResourceOption) (*ResolverRuleAssociation, error) {
    90  	var resource ResolverRuleAssociation
    91  	err := ctx.ReadResource("aws:route53/resolverRuleAssociation:ResolverRuleAssociation", name, id, state, &resource, opts...)
    92  	if err != nil {
    93  		return nil, err
    94  	}
    95  	return &resource, nil
    96  }
    97  
    98  // Input properties used for looking up and filtering ResolverRuleAssociation resources.
    99  type resolverRuleAssociationState struct {
   100  	// A name for the association that you're creating between a resolver rule and a VPC.
   101  	Name *string `pulumi:"name"`
   102  	// The ID of the resolver rule that you want to associate with the VPC.
   103  	ResolverRuleId *string `pulumi:"resolverRuleId"`
   104  	// The ID of the VPC that you want to associate the resolver rule with.
   105  	VpcId *string `pulumi:"vpcId"`
   106  }
   107  
   108  type ResolverRuleAssociationState struct {
   109  	// A name for the association that you're creating between a resolver rule and a VPC.
   110  	Name pulumi.StringPtrInput
   111  	// The ID of the resolver rule that you want to associate with the VPC.
   112  	ResolverRuleId pulumi.StringPtrInput
   113  	// The ID of the VPC that you want to associate the resolver rule with.
   114  	VpcId pulumi.StringPtrInput
   115  }
   116  
   117  func (ResolverRuleAssociationState) ElementType() reflect.Type {
   118  	return reflect.TypeOf((*resolverRuleAssociationState)(nil)).Elem()
   119  }
   120  
   121  type resolverRuleAssociationArgs struct {
   122  	// A name for the association that you're creating between a resolver rule and a VPC.
   123  	Name *string `pulumi:"name"`
   124  	// The ID of the resolver rule that you want to associate with the VPC.
   125  	ResolverRuleId string `pulumi:"resolverRuleId"`
   126  	// The ID of the VPC that you want to associate the resolver rule with.
   127  	VpcId string `pulumi:"vpcId"`
   128  }
   129  
   130  // The set of arguments for constructing a ResolverRuleAssociation resource.
   131  type ResolverRuleAssociationArgs struct {
   132  	// A name for the association that you're creating between a resolver rule and a VPC.
   133  	Name pulumi.StringPtrInput
   134  	// The ID of the resolver rule that you want to associate with the VPC.
   135  	ResolverRuleId pulumi.StringInput
   136  	// The ID of the VPC that you want to associate the resolver rule with.
   137  	VpcId pulumi.StringInput
   138  }
   139  
   140  func (ResolverRuleAssociationArgs) ElementType() reflect.Type {
   141  	return reflect.TypeOf((*resolverRuleAssociationArgs)(nil)).Elem()
   142  }
   143  
   144  type ResolverRuleAssociationInput interface {
   145  	pulumi.Input
   146  
   147  	ToResolverRuleAssociationOutput() ResolverRuleAssociationOutput
   148  	ToResolverRuleAssociationOutputWithContext(ctx context.Context) ResolverRuleAssociationOutput
   149  }
   150  
   151  func (*ResolverRuleAssociation) ElementType() reflect.Type {
   152  	return reflect.TypeOf((**ResolverRuleAssociation)(nil)).Elem()
   153  }
   154  
   155  func (i *ResolverRuleAssociation) ToResolverRuleAssociationOutput() ResolverRuleAssociationOutput {
   156  	return i.ToResolverRuleAssociationOutputWithContext(context.Background())
   157  }
   158  
   159  func (i *ResolverRuleAssociation) ToResolverRuleAssociationOutputWithContext(ctx context.Context) ResolverRuleAssociationOutput {
   160  	return pulumi.ToOutputWithContext(ctx, i).(ResolverRuleAssociationOutput)
   161  }
   162  
   163  // ResolverRuleAssociationArrayInput is an input type that accepts ResolverRuleAssociationArray and ResolverRuleAssociationArrayOutput values.
   164  // You can construct a concrete instance of `ResolverRuleAssociationArrayInput` via:
   165  //
   166  //	ResolverRuleAssociationArray{ ResolverRuleAssociationArgs{...} }
   167  type ResolverRuleAssociationArrayInput interface {
   168  	pulumi.Input
   169  
   170  	ToResolverRuleAssociationArrayOutput() ResolverRuleAssociationArrayOutput
   171  	ToResolverRuleAssociationArrayOutputWithContext(context.Context) ResolverRuleAssociationArrayOutput
   172  }
   173  
   174  type ResolverRuleAssociationArray []ResolverRuleAssociationInput
   175  
   176  func (ResolverRuleAssociationArray) ElementType() reflect.Type {
   177  	return reflect.TypeOf((*[]*ResolverRuleAssociation)(nil)).Elem()
   178  }
   179  
   180  func (i ResolverRuleAssociationArray) ToResolverRuleAssociationArrayOutput() ResolverRuleAssociationArrayOutput {
   181  	return i.ToResolverRuleAssociationArrayOutputWithContext(context.Background())
   182  }
   183  
   184  func (i ResolverRuleAssociationArray) ToResolverRuleAssociationArrayOutputWithContext(ctx context.Context) ResolverRuleAssociationArrayOutput {
   185  	return pulumi.ToOutputWithContext(ctx, i).(ResolverRuleAssociationArrayOutput)
   186  }
   187  
   188  // ResolverRuleAssociationMapInput is an input type that accepts ResolverRuleAssociationMap and ResolverRuleAssociationMapOutput values.
   189  // You can construct a concrete instance of `ResolverRuleAssociationMapInput` via:
   190  //
   191  //	ResolverRuleAssociationMap{ "key": ResolverRuleAssociationArgs{...} }
   192  type ResolverRuleAssociationMapInput interface {
   193  	pulumi.Input
   194  
   195  	ToResolverRuleAssociationMapOutput() ResolverRuleAssociationMapOutput
   196  	ToResolverRuleAssociationMapOutputWithContext(context.Context) ResolverRuleAssociationMapOutput
   197  }
   198  
   199  type ResolverRuleAssociationMap map[string]ResolverRuleAssociationInput
   200  
   201  func (ResolverRuleAssociationMap) ElementType() reflect.Type {
   202  	return reflect.TypeOf((*map[string]*ResolverRuleAssociation)(nil)).Elem()
   203  }
   204  
   205  func (i ResolverRuleAssociationMap) ToResolverRuleAssociationMapOutput() ResolverRuleAssociationMapOutput {
   206  	return i.ToResolverRuleAssociationMapOutputWithContext(context.Background())
   207  }
   208  
   209  func (i ResolverRuleAssociationMap) ToResolverRuleAssociationMapOutputWithContext(ctx context.Context) ResolverRuleAssociationMapOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(ResolverRuleAssociationMapOutput)
   211  }
   212  
   213  type ResolverRuleAssociationOutput struct{ *pulumi.OutputState }
   214  
   215  func (ResolverRuleAssociationOutput) ElementType() reflect.Type {
   216  	return reflect.TypeOf((**ResolverRuleAssociation)(nil)).Elem()
   217  }
   218  
   219  func (o ResolverRuleAssociationOutput) ToResolverRuleAssociationOutput() ResolverRuleAssociationOutput {
   220  	return o
   221  }
   222  
   223  func (o ResolverRuleAssociationOutput) ToResolverRuleAssociationOutputWithContext(ctx context.Context) ResolverRuleAssociationOutput {
   224  	return o
   225  }
   226  
   227  // A name for the association that you're creating between a resolver rule and a VPC.
   228  func (o ResolverRuleAssociationOutput) Name() pulumi.StringOutput {
   229  	return o.ApplyT(func(v *ResolverRuleAssociation) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   230  }
   231  
   232  // The ID of the resolver rule that you want to associate with the VPC.
   233  func (o ResolverRuleAssociationOutput) ResolverRuleId() pulumi.StringOutput {
   234  	return o.ApplyT(func(v *ResolverRuleAssociation) pulumi.StringOutput { return v.ResolverRuleId }).(pulumi.StringOutput)
   235  }
   236  
   237  // The ID of the VPC that you want to associate the resolver rule with.
   238  func (o ResolverRuleAssociationOutput) VpcId() pulumi.StringOutput {
   239  	return o.ApplyT(func(v *ResolverRuleAssociation) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   240  }
   241  
   242  type ResolverRuleAssociationArrayOutput struct{ *pulumi.OutputState }
   243  
   244  func (ResolverRuleAssociationArrayOutput) ElementType() reflect.Type {
   245  	return reflect.TypeOf((*[]*ResolverRuleAssociation)(nil)).Elem()
   246  }
   247  
   248  func (o ResolverRuleAssociationArrayOutput) ToResolverRuleAssociationArrayOutput() ResolverRuleAssociationArrayOutput {
   249  	return o
   250  }
   251  
   252  func (o ResolverRuleAssociationArrayOutput) ToResolverRuleAssociationArrayOutputWithContext(ctx context.Context) ResolverRuleAssociationArrayOutput {
   253  	return o
   254  }
   255  
   256  func (o ResolverRuleAssociationArrayOutput) Index(i pulumi.IntInput) ResolverRuleAssociationOutput {
   257  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResolverRuleAssociation {
   258  		return vs[0].([]*ResolverRuleAssociation)[vs[1].(int)]
   259  	}).(ResolverRuleAssociationOutput)
   260  }
   261  
   262  type ResolverRuleAssociationMapOutput struct{ *pulumi.OutputState }
   263  
   264  func (ResolverRuleAssociationMapOutput) ElementType() reflect.Type {
   265  	return reflect.TypeOf((*map[string]*ResolverRuleAssociation)(nil)).Elem()
   266  }
   267  
   268  func (o ResolverRuleAssociationMapOutput) ToResolverRuleAssociationMapOutput() ResolverRuleAssociationMapOutput {
   269  	return o
   270  }
   271  
   272  func (o ResolverRuleAssociationMapOutput) ToResolverRuleAssociationMapOutputWithContext(ctx context.Context) ResolverRuleAssociationMapOutput {
   273  	return o
   274  }
   275  
   276  func (o ResolverRuleAssociationMapOutput) MapIndex(k pulumi.StringInput) ResolverRuleAssociationOutput {
   277  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResolverRuleAssociation {
   278  		return vs[0].(map[string]*ResolverRuleAssociation)[vs[1].(string)]
   279  	}).(ResolverRuleAssociationOutput)
   280  }
   281  
   282  func init() {
   283  	pulumi.RegisterInputType(reflect.TypeOf((*ResolverRuleAssociationInput)(nil)).Elem(), &ResolverRuleAssociation{})
   284  	pulumi.RegisterInputType(reflect.TypeOf((*ResolverRuleAssociationArrayInput)(nil)).Elem(), ResolverRuleAssociationArray{})
   285  	pulumi.RegisterInputType(reflect.TypeOf((*ResolverRuleAssociationMapInput)(nil)).Elem(), ResolverRuleAssociationMap{})
   286  	pulumi.RegisterOutputType(ResolverRuleAssociationOutput{})
   287  	pulumi.RegisterOutputType(ResolverRuleAssociationArrayOutput{})
   288  	pulumi.RegisterOutputType(ResolverRuleAssociationMapOutput{})
   289  }