github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/backup/getSelection.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 backup
     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  // Use this data source to get information on an existing backup selection.
    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/backup"
    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 := backup.LookupSelection(ctx, &backup.LookupSelectionArgs{
    32  //				PlanId:      exampleAwsBackupPlan.Id,
    33  //				SelectionId: "selection-id-example",
    34  //			}, nil)
    35  //			if err != nil {
    36  //				return err
    37  //			}
    38  //			return nil
    39  //		})
    40  //	}
    41  //
    42  // ```
    43  // <!--End PulumiCodeChooser -->
    44  func LookupSelection(ctx *pulumi.Context, args *LookupSelectionArgs, opts ...pulumi.InvokeOption) (*LookupSelectionResult, error) {
    45  	opts = internal.PkgInvokeDefaultOpts(opts)
    46  	var rv LookupSelectionResult
    47  	err := ctx.Invoke("aws:backup/getSelection:getSelection", args, &rv, opts...)
    48  	if err != nil {
    49  		return nil, err
    50  	}
    51  	return &rv, nil
    52  }
    53  
    54  // A collection of arguments for invoking getSelection.
    55  type LookupSelectionArgs struct {
    56  	// Backup plan ID associated with the selection of resources.
    57  	PlanId string `pulumi:"planId"`
    58  	// Backup selection ID.
    59  	SelectionId string `pulumi:"selectionId"`
    60  }
    61  
    62  // A collection of values returned by getSelection.
    63  type LookupSelectionResult struct {
    64  	// ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the [AWS Backup Developer Guide](https://docs.aws.amazon.com/aws-backup/latest/devguide/access-control.html#managed-policies) for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
    65  	IamRoleArn string `pulumi:"iamRoleArn"`
    66  	// The provider-assigned unique ID for this managed resource.
    67  	Id string `pulumi:"id"`
    68  	// Display name of a resource selection document.
    69  	Name   string `pulumi:"name"`
    70  	PlanId string `pulumi:"planId"`
    71  	// An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
    72  	Resources   []string `pulumi:"resources"`
    73  	SelectionId string   `pulumi:"selectionId"`
    74  }
    75  
    76  func LookupSelectionOutput(ctx *pulumi.Context, args LookupSelectionOutputArgs, opts ...pulumi.InvokeOption) LookupSelectionResultOutput {
    77  	return pulumi.ToOutputWithContext(context.Background(), args).
    78  		ApplyT(func(v interface{}) (LookupSelectionResult, error) {
    79  			args := v.(LookupSelectionArgs)
    80  			r, err := LookupSelection(ctx, &args, opts...)
    81  			var s LookupSelectionResult
    82  			if r != nil {
    83  				s = *r
    84  			}
    85  			return s, err
    86  		}).(LookupSelectionResultOutput)
    87  }
    88  
    89  // A collection of arguments for invoking getSelection.
    90  type LookupSelectionOutputArgs struct {
    91  	// Backup plan ID associated with the selection of resources.
    92  	PlanId pulumi.StringInput `pulumi:"planId"`
    93  	// Backup selection ID.
    94  	SelectionId pulumi.StringInput `pulumi:"selectionId"`
    95  }
    96  
    97  func (LookupSelectionOutputArgs) ElementType() reflect.Type {
    98  	return reflect.TypeOf((*LookupSelectionArgs)(nil)).Elem()
    99  }
   100  
   101  // A collection of values returned by getSelection.
   102  type LookupSelectionResultOutput struct{ *pulumi.OutputState }
   103  
   104  func (LookupSelectionResultOutput) ElementType() reflect.Type {
   105  	return reflect.TypeOf((*LookupSelectionResult)(nil)).Elem()
   106  }
   107  
   108  func (o LookupSelectionResultOutput) ToLookupSelectionResultOutput() LookupSelectionResultOutput {
   109  	return o
   110  }
   111  
   112  func (o LookupSelectionResultOutput) ToLookupSelectionResultOutputWithContext(ctx context.Context) LookupSelectionResultOutput {
   113  	return o
   114  }
   115  
   116  // ARN of the IAM role that AWS Backup uses to authenticate when restoring and backing up the target resource. See the [AWS Backup Developer Guide](https://docs.aws.amazon.com/aws-backup/latest/devguide/access-control.html#managed-policies) for additional information about using AWS managed policies or creating custom policies attached to the IAM role.
   117  func (o LookupSelectionResultOutput) IamRoleArn() pulumi.StringOutput {
   118  	return o.ApplyT(func(v LookupSelectionResult) string { return v.IamRoleArn }).(pulumi.StringOutput)
   119  }
   120  
   121  // The provider-assigned unique ID for this managed resource.
   122  func (o LookupSelectionResultOutput) Id() pulumi.StringOutput {
   123  	return o.ApplyT(func(v LookupSelectionResult) string { return v.Id }).(pulumi.StringOutput)
   124  }
   125  
   126  // Display name of a resource selection document.
   127  func (o LookupSelectionResultOutput) Name() pulumi.StringOutput {
   128  	return o.ApplyT(func(v LookupSelectionResult) string { return v.Name }).(pulumi.StringOutput)
   129  }
   130  
   131  func (o LookupSelectionResultOutput) PlanId() pulumi.StringOutput {
   132  	return o.ApplyT(func(v LookupSelectionResult) string { return v.PlanId }).(pulumi.StringOutput)
   133  }
   134  
   135  // An array of strings that either contain Amazon Resource Names (ARNs) or match patterns of resources to assign to a backup plan..
   136  func (o LookupSelectionResultOutput) Resources() pulumi.StringArrayOutput {
   137  	return o.ApplyT(func(v LookupSelectionResult) []string { return v.Resources }).(pulumi.StringArrayOutput)
   138  }
   139  
   140  func (o LookupSelectionResultOutput) SelectionId() pulumi.StringOutput {
   141  	return o.ApplyT(func(v LookupSelectionResult) string { return v.SelectionId }).(pulumi.StringOutput)
   142  }
   143  
   144  func init() {
   145  	pulumi.RegisterOutputType(LookupSelectionResultOutput{})
   146  }