github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/licensemanager/getLicenseGrants.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 licensemanager 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 // This resource can be used to get a set of license grant ARNs matching a filter. 15 // 16 // ## Example Usage 17 // 18 // The following shows getting all license grant ARNs granted to your account. 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "fmt" 27 // 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/licensemanager" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // current, err := aws.GetCallerIdentity(ctx, nil, nil) 37 // if err != nil { 38 // return err 39 // } 40 // _, err = licensemanager.GetLicenseGrants(ctx, &licensemanager.GetLicenseGrantsArgs{ 41 // Filters: []licensemanager.GetLicenseGrantsFilter{ 42 // { 43 // Name: "GranteePrincipalARN", 44 // Values: []string{ 45 // fmt.Sprintf("arn:aws:iam::%v:root", current.AccountId), 46 // }, 47 // }, 48 // }, 49 // }, nil) 50 // if err != nil { 51 // return err 52 // } 53 // return nil 54 // }) 55 // } 56 // 57 // ``` 58 // <!--End PulumiCodeChooser --> 59 func GetLicenseGrants(ctx *pulumi.Context, args *GetLicenseGrantsArgs, opts ...pulumi.InvokeOption) (*GetLicenseGrantsResult, error) { 60 opts = internal.PkgInvokeDefaultOpts(opts) 61 var rv GetLicenseGrantsResult 62 err := ctx.Invoke("aws:licensemanager/getLicenseGrants:getLicenseGrants", args, &rv, opts...) 63 if err != nil { 64 return nil, err 65 } 66 return &rv, nil 67 } 68 69 // A collection of arguments for invoking getLicenseGrants. 70 type GetLicenseGrantsArgs struct { 71 // Custom filter block as described below. 72 // 73 // More complex filters can be expressed using one or more `filter` sub-blocks, 74 // which take the following arguments: 75 Filters []GetLicenseGrantsFilter `pulumi:"filters"` 76 } 77 78 // A collection of values returned by getLicenseGrants. 79 type GetLicenseGrantsResult struct { 80 // List of all the license grant ARNs found. 81 Arns []string `pulumi:"arns"` 82 Filters []GetLicenseGrantsFilter `pulumi:"filters"` 83 // The provider-assigned unique ID for this managed resource. 84 Id string `pulumi:"id"` 85 } 86 87 func GetLicenseGrantsOutput(ctx *pulumi.Context, args GetLicenseGrantsOutputArgs, opts ...pulumi.InvokeOption) GetLicenseGrantsResultOutput { 88 return pulumi.ToOutputWithContext(context.Background(), args). 89 ApplyT(func(v interface{}) (GetLicenseGrantsResult, error) { 90 args := v.(GetLicenseGrantsArgs) 91 r, err := GetLicenseGrants(ctx, &args, opts...) 92 var s GetLicenseGrantsResult 93 if r != nil { 94 s = *r 95 } 96 return s, err 97 }).(GetLicenseGrantsResultOutput) 98 } 99 100 // A collection of arguments for invoking getLicenseGrants. 101 type GetLicenseGrantsOutputArgs struct { 102 // Custom filter block as described below. 103 // 104 // More complex filters can be expressed using one or more `filter` sub-blocks, 105 // which take the following arguments: 106 Filters GetLicenseGrantsFilterArrayInput `pulumi:"filters"` 107 } 108 109 func (GetLicenseGrantsOutputArgs) ElementType() reflect.Type { 110 return reflect.TypeOf((*GetLicenseGrantsArgs)(nil)).Elem() 111 } 112 113 // A collection of values returned by getLicenseGrants. 114 type GetLicenseGrantsResultOutput struct{ *pulumi.OutputState } 115 116 func (GetLicenseGrantsResultOutput) ElementType() reflect.Type { 117 return reflect.TypeOf((*GetLicenseGrantsResult)(nil)).Elem() 118 } 119 120 func (o GetLicenseGrantsResultOutput) ToGetLicenseGrantsResultOutput() GetLicenseGrantsResultOutput { 121 return o 122 } 123 124 func (o GetLicenseGrantsResultOutput) ToGetLicenseGrantsResultOutputWithContext(ctx context.Context) GetLicenseGrantsResultOutput { 125 return o 126 } 127 128 // List of all the license grant ARNs found. 129 func (o GetLicenseGrantsResultOutput) Arns() pulumi.StringArrayOutput { 130 return o.ApplyT(func(v GetLicenseGrantsResult) []string { return v.Arns }).(pulumi.StringArrayOutput) 131 } 132 133 func (o GetLicenseGrantsResultOutput) Filters() GetLicenseGrantsFilterArrayOutput { 134 return o.ApplyT(func(v GetLicenseGrantsResult) []GetLicenseGrantsFilter { return v.Filters }).(GetLicenseGrantsFilterArrayOutput) 135 } 136 137 // The provider-assigned unique ID for this managed resource. 138 func (o GetLicenseGrantsResultOutput) Id() pulumi.StringOutput { 139 return o.ApplyT(func(v GetLicenseGrantsResult) string { return v.Id }).(pulumi.StringOutput) 140 } 141 142 func init() { 143 pulumi.RegisterOutputType(GetLicenseGrantsResultOutput{}) 144 }