src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

api_op_GetRoleCredentials.go (4205B)


      1 // Code generated by smithy-go-codegen DO NOT EDIT.
      2 
      3 package sso
      4 
      5 import (
      6 	"context"
      7 	"fmt"
      8 	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
      9 	"github.com/aws/aws-sdk-go-v2/service/sso/types"
     10 	"github.com/aws/smithy-go/middleware"
     11 	smithyhttp "github.com/aws/smithy-go/transport/http"
     12 )
     13 
     14 // Returns the STS short-term credentials for a given role name that is assigned
     15 // to the user.
     16 func (c *Client) GetRoleCredentials(ctx context.Context, params *GetRoleCredentialsInput, optFns ...func(*Options)) (*GetRoleCredentialsOutput, error) {
     17 	if params == nil {
     18 		params = &GetRoleCredentialsInput{}
     19 	}
     20 
     21 	result, metadata, err := c.invokeOperation(ctx, "GetRoleCredentials", params, optFns, c.addOperationGetRoleCredentialsMiddlewares)
     22 	if err != nil {
     23 		return nil, err
     24 	}
     25 
     26 	out := result.(*GetRoleCredentialsOutput)
     27 	out.ResultMetadata = metadata
     28 	return out, nil
     29 }
     30 
     31 type GetRoleCredentialsInput struct {
     32 
     33 	// The token issued by the CreateToken API call. For more information, see
     34 	// CreateToken (https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/API_CreateToken.html)
     35 	// in the IAM Identity Center OIDC API Reference Guide.
     36 	//
     37 	// This member is required.
     38 	AccessToken *string
     39 
     40 	// The identifier for the AWS account that is assigned to the user.
     41 	//
     42 	// This member is required.
     43 	AccountId *string
     44 
     45 	// The friendly name of the role that is assigned to the user.
     46 	//
     47 	// This member is required.
     48 	RoleName *string
     49 
     50 	noSmithyDocumentSerde
     51 }
     52 
     53 type GetRoleCredentialsOutput struct {
     54 
     55 	// The credentials for the role that is assigned to the user.
     56 	RoleCredentials *types.RoleCredentials
     57 
     58 	// Metadata pertaining to the operation's result.
     59 	ResultMetadata middleware.Metadata
     60 
     61 	noSmithyDocumentSerde
     62 }
     63 
     64 func (c *Client) addOperationGetRoleCredentialsMiddlewares(stack *middleware.Stack, options Options) (err error) {
     65 	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
     66 		return err
     67 	}
     68 	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRoleCredentials{}, middleware.After)
     69 	if err != nil {
     70 		return err
     71 	}
     72 	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRoleCredentials{}, middleware.After)
     73 	if err != nil {
     74 		return err
     75 	}
     76 	if err := addProtocolFinalizerMiddlewares(stack, options, "GetRoleCredentials"); err != nil {
     77 		return fmt.Errorf("add protocol finalizers: %v", err)
     78 	}
     79 
     80 	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
     81 		return err
     82 	}
     83 	if err = addSetLoggerMiddleware(stack, options); err != nil {
     84 		return err
     85 	}
     86 	if err = addClientRequestID(stack); err != nil {
     87 		return err
     88 	}
     89 	if err = addComputeContentLength(stack); err != nil {
     90 		return err
     91 	}
     92 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
     93 		return err
     94 	}
     95 	if err = addRetry(stack, options); err != nil {
     96 		return err
     97 	}
     98 	if err = addRawResponseToMetadata(stack); err != nil {
     99 		return err
    100 	}
    101 	if err = addRecordResponseTiming(stack); err != nil {
    102 		return err
    103 	}
    104 	if err = addClientUserAgent(stack, options); err != nil {
    105 		return err
    106 	}
    107 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    108 		return err
    109 	}
    110 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    111 		return err
    112 	}
    113 	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
    114 		return err
    115 	}
    116 	if err = addOpGetRoleCredentialsValidationMiddleware(stack); err != nil {
    117 		return err
    118 	}
    119 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRoleCredentials(options.Region), middleware.Before); err != nil {
    120 		return err
    121 	}
    122 	if err = addRecursionDetection(stack); err != nil {
    123 		return err
    124 	}
    125 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    126 		return err
    127 	}
    128 	if err = addResponseErrorMiddleware(stack); err != nil {
    129 		return err
    130 	}
    131 	if err = addRequestResponseLogging(stack, options); err != nil {
    132 		return err
    133 	}
    134 	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
    135 		return err
    136 	}
    137 	return nil
    138 }
    139 
    140 func newServiceMetadataMiddleware_opGetRoleCredentials(region string) *awsmiddleware.RegisterServiceMetadata {
    141 	return &awsmiddleware.RegisterServiceMetadata{
    142 		Region:        region,
    143 		ServiceID:     ServiceID,
    144 		OperationName: "GetRoleCredentials",
    145 	}
    146 }