1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package organizations 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/organizations/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Returns the contents of the effective policy for specified policy type and 15// account. The effective policy is the aggregation of any policies of the 16// specified type that the account inherits, plus any policy of that type that is 17// directly attached to the account. This operation applies only to policy types 18// other than service control policies (SCPs). For more information about policy 19// inheritance, see How Policy Inheritance Works 20// (http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies-inheritance.html) 21// in the AWS Organizations User Guide. This operation can be called only from the 22// organization's management account or by a member account that is a delegated 23// administrator for an AWS service. 24func (c *Client) DescribeEffectivePolicy(ctx context.Context, params *DescribeEffectivePolicyInput, optFns ...func(*Options)) (*DescribeEffectivePolicyOutput, error) { 25 if params == nil { 26 params = &DescribeEffectivePolicyInput{} 27 } 28 29 result, metadata, err := c.invokeOperation(ctx, "DescribeEffectivePolicy", params, optFns, addOperationDescribeEffectivePolicyMiddlewares) 30 if err != nil { 31 return nil, err 32 } 33 34 out := result.(*DescribeEffectivePolicyOutput) 35 out.ResultMetadata = metadata 36 return out, nil 37} 38 39type DescribeEffectivePolicyInput struct { 40 41 // The type of policy that you want information about. You can specify one of the 42 // following values: 43 // 44 // * AISERVICES_OPT_OUT_POLICY 45 // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html) 46 // 47 // * 48 // BACKUP_POLICY 49 // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup.html) 50 // 51 // * 52 // TAG_POLICY 53 // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies.html) 54 // 55 // This member is required. 56 PolicyType types.EffectivePolicyType 57 58 // When you're signed in as the management account, specify the ID of the account 59 // that you want details about. Specifying an organization root or organizational 60 // unit (OU) as the target is not supported. 61 TargetId *string 62} 63 64type DescribeEffectivePolicyOutput struct { 65 66 // The contents of the effective policy. 67 EffectivePolicy *types.EffectivePolicy 68 69 // Metadata pertaining to the operation's result. 70 ResultMetadata middleware.Metadata 71} 72 73func addOperationDescribeEffectivePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { 74 err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeEffectivePolicy{}, middleware.After) 75 if err != nil { 76 return err 77 } 78 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeEffectivePolicy{}, middleware.After) 79 if err != nil { 80 return err 81 } 82 if err = addSetLoggerMiddleware(stack, options); err != nil { 83 return err 84 } 85 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 86 return err 87 } 88 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 89 return err 90 } 91 if err = addResolveEndpointMiddleware(stack, options); err != nil { 92 return err 93 } 94 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 95 return err 96 } 97 if err = addRetryMiddlewares(stack, options); err != nil { 98 return err 99 } 100 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 101 return err 102 } 103 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 104 return err 105 } 106 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 107 return err 108 } 109 if err = addClientUserAgent(stack); err != nil { 110 return err 111 } 112 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 113 return err 114 } 115 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 116 return err 117 } 118 if err = addOpDescribeEffectivePolicyValidationMiddleware(stack); err != nil { 119 return err 120 } 121 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeEffectivePolicy(options.Region), middleware.Before); err != nil { 122 return err 123 } 124 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 125 return err 126 } 127 if err = addResponseErrorMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addRequestResponseLogging(stack, options); err != nil { 131 return err 132 } 133 return nil 134} 135 136func newServiceMetadataMiddleware_opDescribeEffectivePolicy(region string) *awsmiddleware.RegisterServiceMetadata { 137 return &awsmiddleware.RegisterServiceMetadata{ 138 Region: region, 139 ServiceID: ServiceID, 140 SigningName: "organizations", 141 OperationName: "DescribeEffectivePolicy", 142 } 143} 144