/
getPolicy.go
70 lines (65 loc) · 1.93 KB
/
getPolicy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package iam
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// This data source can be used to fetch information about a specific
// IAM policy.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v3/go/aws/iam"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := iam.LookupPolicy(ctx, &iam.LookupPolicyArgs{
// Arn: "arn:aws:iam::123456789012:policy/UsersManageOwnCredentials",
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
func LookupPolicy(ctx *pulumi.Context, args *LookupPolicyArgs, opts ...pulumi.InvokeOption) (*LookupPolicyResult, error) {
var rv LookupPolicyResult
err := ctx.Invoke("aws:iam/getPolicy:getPolicy", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getPolicy.
type LookupPolicyArgs struct {
// ARN of the IAM policy.
Arn string `pulumi:"arn"`
// Key-value mapping of tags for the IAM Policy
Tags map[string]string `pulumi:"tags"`
}
// A collection of values returned by getPolicy.
type LookupPolicyResult struct {
// The Amazon Resource Name (ARN) specifying the policy.
Arn string `pulumi:"arn"`
// The description of the policy.
Description string `pulumi:"description"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The name of the IAM policy.
Name string `pulumi:"name"`
// The path to the policy.
Path string `pulumi:"path"`
// The policy document of the policy.
Policy string `pulumi:"policy"`
// The policy's ID.
PolicyId string `pulumi:"policyId"`
// Key-value mapping of tags for the IAM Policy
Tags map[string]string `pulumi:"tags"`
}