github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/organizations/getPolicy.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 organizations
     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  // Data source for managing an AWS Organizations Policy.
    15  //
    16  // ## Example Usage
    17  func LookupPolicy(ctx *pulumi.Context, args *LookupPolicyArgs, opts ...pulumi.InvokeOption) (*LookupPolicyResult, error) {
    18  	opts = internal.PkgInvokeDefaultOpts(opts)
    19  	var rv LookupPolicyResult
    20  	err := ctx.Invoke("aws:organizations/getPolicy:getPolicy", args, &rv, opts...)
    21  	if err != nil {
    22  		return nil, err
    23  	}
    24  	return &rv, nil
    25  }
    26  
    27  // A collection of arguments for invoking getPolicy.
    28  type LookupPolicyArgs struct {
    29  	// The unique identifier (ID) of the policy that you want more details on. Policy id starts with a "p-" followed by 8-28 lowercase or uppercase letters, digits, and underscores.
    30  	PolicyId string `pulumi:"policyId"`
    31  }
    32  
    33  // A collection of values returned by getPolicy.
    34  type LookupPolicyResult struct {
    35  	// The Amazon Resource Name of the policy.
    36  	Arn string `pulumi:"arn"`
    37  	// Indicates if a policy is an AWS managed policy.
    38  	AwsManaged bool `pulumi:"awsManaged"`
    39  	// The text content of the policy.
    40  	Content string `pulumi:"content"`
    41  	// The description of the policy.
    42  	Description string `pulumi:"description"`
    43  	// The provider-assigned unique ID for this managed resource.
    44  	Id string `pulumi:"id"`
    45  	// The friendly name of the policy.
    46  	Name     string `pulumi:"name"`
    47  	PolicyId string `pulumi:"policyId"`
    48  	// The type of policy values can be `SERVICE_CONTROL_POLICY | TAG_POLICY | BACKUP_POLICY | AISERVICES_OPT_OUT_POLICY`
    49  	Type string `pulumi:"type"`
    50  }
    51  
    52  func LookupPolicyOutput(ctx *pulumi.Context, args LookupPolicyOutputArgs, opts ...pulumi.InvokeOption) LookupPolicyResultOutput {
    53  	return pulumi.ToOutputWithContext(context.Background(), args).
    54  		ApplyT(func(v interface{}) (LookupPolicyResult, error) {
    55  			args := v.(LookupPolicyArgs)
    56  			r, err := LookupPolicy(ctx, &args, opts...)
    57  			var s LookupPolicyResult
    58  			if r != nil {
    59  				s = *r
    60  			}
    61  			return s, err
    62  		}).(LookupPolicyResultOutput)
    63  }
    64  
    65  // A collection of arguments for invoking getPolicy.
    66  type LookupPolicyOutputArgs struct {
    67  	// The unique identifier (ID) of the policy that you want more details on. Policy id starts with a "p-" followed by 8-28 lowercase or uppercase letters, digits, and underscores.
    68  	PolicyId pulumi.StringInput `pulumi:"policyId"`
    69  }
    70  
    71  func (LookupPolicyOutputArgs) ElementType() reflect.Type {
    72  	return reflect.TypeOf((*LookupPolicyArgs)(nil)).Elem()
    73  }
    74  
    75  // A collection of values returned by getPolicy.
    76  type LookupPolicyResultOutput struct{ *pulumi.OutputState }
    77  
    78  func (LookupPolicyResultOutput) ElementType() reflect.Type {
    79  	return reflect.TypeOf((*LookupPolicyResult)(nil)).Elem()
    80  }
    81  
    82  func (o LookupPolicyResultOutput) ToLookupPolicyResultOutput() LookupPolicyResultOutput {
    83  	return o
    84  }
    85  
    86  func (o LookupPolicyResultOutput) ToLookupPolicyResultOutputWithContext(ctx context.Context) LookupPolicyResultOutput {
    87  	return o
    88  }
    89  
    90  // The Amazon Resource Name of the policy.
    91  func (o LookupPolicyResultOutput) Arn() pulumi.StringOutput {
    92  	return o.ApplyT(func(v LookupPolicyResult) string { return v.Arn }).(pulumi.StringOutput)
    93  }
    94  
    95  // Indicates if a policy is an AWS managed policy.
    96  func (o LookupPolicyResultOutput) AwsManaged() pulumi.BoolOutput {
    97  	return o.ApplyT(func(v LookupPolicyResult) bool { return v.AwsManaged }).(pulumi.BoolOutput)
    98  }
    99  
   100  // The text content of the policy.
   101  func (o LookupPolicyResultOutput) Content() pulumi.StringOutput {
   102  	return o.ApplyT(func(v LookupPolicyResult) string { return v.Content }).(pulumi.StringOutput)
   103  }
   104  
   105  // The description of the policy.
   106  func (o LookupPolicyResultOutput) Description() pulumi.StringOutput {
   107  	return o.ApplyT(func(v LookupPolicyResult) string { return v.Description }).(pulumi.StringOutput)
   108  }
   109  
   110  // The provider-assigned unique ID for this managed resource.
   111  func (o LookupPolicyResultOutput) Id() pulumi.StringOutput {
   112  	return o.ApplyT(func(v LookupPolicyResult) string { return v.Id }).(pulumi.StringOutput)
   113  }
   114  
   115  // The friendly name of the policy.
   116  func (o LookupPolicyResultOutput) Name() pulumi.StringOutput {
   117  	return o.ApplyT(func(v LookupPolicyResult) string { return v.Name }).(pulumi.StringOutput)
   118  }
   119  
   120  func (o LookupPolicyResultOutput) PolicyId() pulumi.StringOutput {
   121  	return o.ApplyT(func(v LookupPolicyResult) string { return v.PolicyId }).(pulumi.StringOutput)
   122  }
   123  
   124  // The type of policy values can be `SERVICE_CONTROL_POLICY | TAG_POLICY | BACKUP_POLICY | AISERVICES_OPT_OUT_POLICY`
   125  func (o LookupPolicyResultOutput) Type() pulumi.StringOutput {
   126  	return o.ApplyT(func(v LookupPolicyResult) string { return v.Type }).(pulumi.StringOutput)
   127  }
   128  
   129  func init() {
   130  	pulumi.RegisterOutputType(LookupPolicyResultOutput{})
   131  }