api_op_DecodeAuthorizationMessage.go (4404B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package sts 4 5 import ( 6 "context" 7 8 "github.com/aws/smithy-go/middleware" 9 ) 10 11 // Decodes additional information about the authorization status of a request from 12 // an encoded message returned in response to an Amazon Web Services request. 13 // 14 // For example, if a user is not authorized to perform an operation that he or she 15 // has requested, the request returns a Client.UnauthorizedOperation response (an 16 // HTTP 403 response). Some Amazon Web Services operations additionally return an 17 // encoded message that can provide details about this authorization failure. 18 // 19 // Only certain Amazon Web Services operations return an encoded authorization 20 // message. The documentation for an individual operation indicates whether that 21 // operation returns an encoded message in addition to returning an HTTP code. 22 // 23 // The message is encoded because the details of the authorization status can 24 // contain privileged information that the user who requested the operation should 25 // not see. To decode an authorization status message, a user must be granted 26 // permissions through an IAM [policy]to request the DecodeAuthorizationMessage ( 27 // sts:DecodeAuthorizationMessage ) action. 28 // 29 // The decoded message includes the following type of information: 30 // 31 // - Whether the request was denied due to an explicit deny or due to the 32 // absence of an explicit allow. For more information, see [Determining Whether a Request is Allowed or Denied]in the IAM User 33 // Guide. 34 // 35 // - The principal who made the request. 36 // 37 // - The requested action. 38 // 39 // - The requested resource. 40 // 41 // - The values of condition keys in the context of the user's request. 42 // 43 // [Determining Whether a Request is Allowed or Denied]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow 44 // [policy]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html 45 func (c *Client) DecodeAuthorizationMessage(ctx context.Context, params *DecodeAuthorizationMessageInput, optFns ...func(*Options)) (*DecodeAuthorizationMessageOutput, error) { 46 if params == nil { 47 params = &DecodeAuthorizationMessageInput{} 48 } 49 50 result, metadata, err := c.invokeOperation(ctx, "DecodeAuthorizationMessage", params, optFns, c.addOperationDecodeAuthorizationMessageMiddlewares) 51 if err != nil { 52 return nil, err 53 } 54 55 out := result.(*DecodeAuthorizationMessageOutput) 56 out.ResultMetadata = metadata 57 return out, nil 58 } 59 60 type DecodeAuthorizationMessageInput struct { 61 62 // The encoded message that was returned with the response. 63 // 64 // This member is required. 65 EncodedMessage *string 66 67 noSmithyDocumentSerde 68 } 69 70 // A document that contains additional information about the authorization status 71 // of a request from an encoded message that is returned in response to an Amazon 72 // Web Services request. 73 type DecodeAuthorizationMessageOutput struct { 74 75 // The API returns a response with the decoded message. 76 DecodedMessage *string 77 78 // Metadata pertaining to the operation's result. 79 ResultMetadata middleware.Metadata 80 81 noSmithyDocumentSerde 82 } 83 84 func (c *Client) addOperationDecodeAuthorizationMessageMiddlewares(stack *middleware.Stack, options Options) (err error) { 85 err = stack.Serialize.Add(&awsAwsquery_serializeOpDecodeAuthorizationMessage{}, middleware.After) 86 if err != nil { 87 return err 88 } 89 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDecodeAuthorizationMessage{}, middleware.After) 90 if err != nil { 91 return err 92 } 93 94 if err = addComputeContentLength(stack); err != nil { 95 return err 96 } 97 if err = addResolveEndpointMiddleware(stack, options); err != nil { 98 return err 99 } 100 if err = addComputePayloadSHA256(stack); err != nil { 101 return err 102 } 103 if err = addRecordResponseTiming(stack, options); err != nil { 104 return err 105 } 106 if err = addCredentialSource(stack, options); err != nil { 107 return err 108 } 109 if err = addOpDecodeAuthorizationMessageValidationMiddleware(stack); err != nil { 110 return err 111 } 112 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 113 return err 114 } 115 if err = addResponseErrorMiddleware(stack); err != nil { 116 return err 117 } 118 if err = addRequestResponseLogging(stack, options); err != nil { 119 return err 120 } 121 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 122 return err 123 } 124 if err = addInterceptors(stack, options); err != nil { 125 return err 126 } 127 return nil 128 }