github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/route53/getResolverRules.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  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // `route53.getResolverRules` provides details about a set of Route53 Resolver rules.
    15  //
    16  // ## Example Usage
    17  //
    18  // ### Retrieving the default resolver rule
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := route53.GetResolverRules(ctx, &route53.GetResolverRulesArgs{
    34  //				OwnerId:     pulumi.StringRef("Route 53 Resolver"),
    35  //				RuleType:    pulumi.StringRef("RECURSIVE"),
    36  //				ShareStatus: pulumi.StringRef("NOT_SHARED"),
    37  //			}, nil)
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			return nil
    42  //		})
    43  //	}
    44  //
    45  // ```
    46  // <!--End PulumiCodeChooser -->
    47  //
    48  // ### Retrieving forward rules shared with me
    49  //
    50  // <!--Start PulumiCodeChooser -->
    51  // ```go
    52  // package main
    53  //
    54  // import (
    55  //
    56  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    57  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    58  //
    59  // )
    60  //
    61  //	func main() {
    62  //		pulumi.Run(func(ctx *pulumi.Context) error {
    63  //			_, err := route53.GetResolverRules(ctx, &route53.GetResolverRulesArgs{
    64  //				RuleType:    pulumi.StringRef("FORWARD"),
    65  //				ShareStatus: pulumi.StringRef("SHARED_WITH_ME"),
    66  //			}, nil)
    67  //			if err != nil {
    68  //				return err
    69  //			}
    70  //			return nil
    71  //		})
    72  //	}
    73  //
    74  // ```
    75  // <!--End PulumiCodeChooser -->
    76  //
    77  // ### Retrieving rules by name regex
    78  //
    79  // Resolver rules whose name contains `abc`.
    80  //
    81  // <!--Start PulumiCodeChooser -->
    82  // ```go
    83  // package main
    84  //
    85  // import (
    86  //
    87  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/route53"
    88  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    89  //
    90  // )
    91  //
    92  //	func main() {
    93  //		pulumi.Run(func(ctx *pulumi.Context) error {
    94  //			_, err := route53.GetResolverRules(ctx, &route53.GetResolverRulesArgs{
    95  //				NameRegex: pulumi.StringRef(".*abc.*"),
    96  //			}, nil)
    97  //			if err != nil {
    98  //				return err
    99  //			}
   100  //			return nil
   101  //		})
   102  //	}
   103  //
   104  // ```
   105  // <!--End PulumiCodeChooser -->
   106  func GetResolverRules(ctx *pulumi.Context, args *GetResolverRulesArgs, opts ...pulumi.InvokeOption) (*GetResolverRulesResult, error) {
   107  	opts = internal.PkgInvokeDefaultOpts(opts)
   108  	var rv GetResolverRulesResult
   109  	err := ctx.Invoke("aws:route53/getResolverRules:getResolverRules", args, &rv, opts...)
   110  	if err != nil {
   111  		return nil, err
   112  	}
   113  	return &rv, nil
   114  }
   115  
   116  // A collection of arguments for invoking getResolverRules.
   117  type GetResolverRulesArgs struct {
   118  	// Regex string to filter resolver rule names.
   119  	// The filtering is done locally, so could have a performance impact if the result is large.
   120  	// This argument should be used along with other arguments to limit the number of results returned.
   121  	NameRegex *string `pulumi:"nameRegex"`
   122  	// When the desired resolver rules are shared with another AWS account, the account ID of the account that the rules are shared with.
   123  	OwnerId *string `pulumi:"ownerId"`
   124  	// ID of the outbound resolver endpoint for the desired resolver rules.
   125  	ResolverEndpointId *string `pulumi:"resolverEndpointId"`
   126  	// Rule type of the desired resolver rules. Valid values are `FORWARD`, `SYSTEM` and `RECURSIVE`.
   127  	RuleType *string `pulumi:"ruleType"`
   128  	// Whether the desired resolver rules are shared and, if so, whether the current account is sharing the rules with another account, or another account is sharing the rules with the current account. Valid values are `NOT_SHARED`, `SHARED_BY_ME` or `SHARED_WITH_ME`
   129  	ShareStatus *string `pulumi:"shareStatus"`
   130  }
   131  
   132  // A collection of values returned by getResolverRules.
   133  type GetResolverRulesResult struct {
   134  	// The provider-assigned unique ID for this managed resource.
   135  	Id                 string  `pulumi:"id"`
   136  	NameRegex          *string `pulumi:"nameRegex"`
   137  	OwnerId            *string `pulumi:"ownerId"`
   138  	ResolverEndpointId *string `pulumi:"resolverEndpointId"`
   139  	// IDs of the matched resolver rules.
   140  	ResolverRuleIds []string `pulumi:"resolverRuleIds"`
   141  	RuleType        *string  `pulumi:"ruleType"`
   142  	ShareStatus     *string  `pulumi:"shareStatus"`
   143  }
   144  
   145  func GetResolverRulesOutput(ctx *pulumi.Context, args GetResolverRulesOutputArgs, opts ...pulumi.InvokeOption) GetResolverRulesResultOutput {
   146  	return pulumi.ToOutputWithContext(context.Background(), args).
   147  		ApplyT(func(v interface{}) (GetResolverRulesResult, error) {
   148  			args := v.(GetResolverRulesArgs)
   149  			r, err := GetResolverRules(ctx, &args, opts...)
   150  			var s GetResolverRulesResult
   151  			if r != nil {
   152  				s = *r
   153  			}
   154  			return s, err
   155  		}).(GetResolverRulesResultOutput)
   156  }
   157  
   158  // A collection of arguments for invoking getResolverRules.
   159  type GetResolverRulesOutputArgs struct {
   160  	// Regex string to filter resolver rule names.
   161  	// The filtering is done locally, so could have a performance impact if the result is large.
   162  	// This argument should be used along with other arguments to limit the number of results returned.
   163  	NameRegex pulumi.StringPtrInput `pulumi:"nameRegex"`
   164  	// When the desired resolver rules are shared with another AWS account, the account ID of the account that the rules are shared with.
   165  	OwnerId pulumi.StringPtrInput `pulumi:"ownerId"`
   166  	// ID of the outbound resolver endpoint for the desired resolver rules.
   167  	ResolverEndpointId pulumi.StringPtrInput `pulumi:"resolverEndpointId"`
   168  	// Rule type of the desired resolver rules. Valid values are `FORWARD`, `SYSTEM` and `RECURSIVE`.
   169  	RuleType pulumi.StringPtrInput `pulumi:"ruleType"`
   170  	// Whether the desired resolver rules are shared and, if so, whether the current account is sharing the rules with another account, or another account is sharing the rules with the current account. Valid values are `NOT_SHARED`, `SHARED_BY_ME` or `SHARED_WITH_ME`
   171  	ShareStatus pulumi.StringPtrInput `pulumi:"shareStatus"`
   172  }
   173  
   174  func (GetResolverRulesOutputArgs) ElementType() reflect.Type {
   175  	return reflect.TypeOf((*GetResolverRulesArgs)(nil)).Elem()
   176  }
   177  
   178  // A collection of values returned by getResolverRules.
   179  type GetResolverRulesResultOutput struct{ *pulumi.OutputState }
   180  
   181  func (GetResolverRulesResultOutput) ElementType() reflect.Type {
   182  	return reflect.TypeOf((*GetResolverRulesResult)(nil)).Elem()
   183  }
   184  
   185  func (o GetResolverRulesResultOutput) ToGetResolverRulesResultOutput() GetResolverRulesResultOutput {
   186  	return o
   187  }
   188  
   189  func (o GetResolverRulesResultOutput) ToGetResolverRulesResultOutputWithContext(ctx context.Context) GetResolverRulesResultOutput {
   190  	return o
   191  }
   192  
   193  // The provider-assigned unique ID for this managed resource.
   194  func (o GetResolverRulesResultOutput) Id() pulumi.StringOutput {
   195  	return o.ApplyT(func(v GetResolverRulesResult) string { return v.Id }).(pulumi.StringOutput)
   196  }
   197  
   198  func (o GetResolverRulesResultOutput) NameRegex() pulumi.StringPtrOutput {
   199  	return o.ApplyT(func(v GetResolverRulesResult) *string { return v.NameRegex }).(pulumi.StringPtrOutput)
   200  }
   201  
   202  func (o GetResolverRulesResultOutput) OwnerId() pulumi.StringPtrOutput {
   203  	return o.ApplyT(func(v GetResolverRulesResult) *string { return v.OwnerId }).(pulumi.StringPtrOutput)
   204  }
   205  
   206  func (o GetResolverRulesResultOutput) ResolverEndpointId() pulumi.StringPtrOutput {
   207  	return o.ApplyT(func(v GetResolverRulesResult) *string { return v.ResolverEndpointId }).(pulumi.StringPtrOutput)
   208  }
   209  
   210  // IDs of the matched resolver rules.
   211  func (o GetResolverRulesResultOutput) ResolverRuleIds() pulumi.StringArrayOutput {
   212  	return o.ApplyT(func(v GetResolverRulesResult) []string { return v.ResolverRuleIds }).(pulumi.StringArrayOutput)
   213  }
   214  
   215  func (o GetResolverRulesResultOutput) RuleType() pulumi.StringPtrOutput {
   216  	return o.ApplyT(func(v GetResolverRulesResult) *string { return v.RuleType }).(pulumi.StringPtrOutput)
   217  }
   218  
   219  func (o GetResolverRulesResultOutput) ShareStatus() pulumi.StringPtrOutput {
   220  	return o.ApplyT(func(v GetResolverRulesResult) *string { return v.ShareStatus }).(pulumi.StringPtrOutput)
   221  }
   222  
   223  func init() {
   224  	pulumi.RegisterOutputType(GetResolverRulesResultOutput{})
   225  }