code.dwrz.net

Go monorepo.
Log | Files | Refs

api_op_StartDeviceAuthorization.go (4617B)


      1 // Code generated by smithy-go-codegen DO NOT EDIT.
      2 
      3 package ssooidc
      4 
      5 import (
      6 	"context"
      7 	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
      8 	"github.com/aws/smithy-go/middleware"
      9 	smithyhttp "github.com/aws/smithy-go/transport/http"
     10 )
     11 
     12 // Initiates device authorization by requesting a pair of verification codes from
     13 // the authorization service.
     14 func (c *Client) StartDeviceAuthorization(ctx context.Context, params *StartDeviceAuthorizationInput, optFns ...func(*Options)) (*StartDeviceAuthorizationOutput, error) {
     15 	if params == nil {
     16 		params = &StartDeviceAuthorizationInput{}
     17 	}
     18 
     19 	result, metadata, err := c.invokeOperation(ctx, "StartDeviceAuthorization", params, optFns, c.addOperationStartDeviceAuthorizationMiddlewares)
     20 	if err != nil {
     21 		return nil, err
     22 	}
     23 
     24 	out := result.(*StartDeviceAuthorizationOutput)
     25 	out.ResultMetadata = metadata
     26 	return out, nil
     27 }
     28 
     29 type StartDeviceAuthorizationInput struct {
     30 
     31 	// The unique identifier string for the client that is registered with IAM Identity
     32 	// Center. This value should come from the persisted result of the RegisterClient
     33 	// API operation.
     34 	//
     35 	// This member is required.
     36 	ClientId *string
     37 
     38 	// A secret string that is generated for the client. This value should come from
     39 	// the persisted result of the RegisterClient API operation.
     40 	//
     41 	// This member is required.
     42 	ClientSecret *string
     43 
     44 	// The URL for the AWS access portal. For more information, see Using the AWS
     45 	// access portal
     46 	// (https://docs.aws.amazon.com/singlesignon/latest/userguide/using-the-portal.html)
     47 	// in the IAM Identity Center User Guide.
     48 	//
     49 	// This member is required.
     50 	StartUrl *string
     51 
     52 	noSmithyDocumentSerde
     53 }
     54 
     55 type StartDeviceAuthorizationOutput struct {
     56 
     57 	// The short-lived code that is used by the device when polling for a session
     58 	// token.
     59 	DeviceCode *string
     60 
     61 	// Indicates the number of seconds in which the verification code will become
     62 	// invalid.
     63 	ExpiresIn int32
     64 
     65 	// Indicates the number of seconds the client must wait between attempts when
     66 	// polling for a session.
     67 	Interval int32
     68 
     69 	// A one-time user verification code. This is needed to authorize an in-use device.
     70 	UserCode *string
     71 
     72 	// The URI of the verification page that takes the userCode to authorize the
     73 	// device.
     74 	VerificationUri *string
     75 
     76 	// An alternate URL that the client can use to automatically launch a browser. This
     77 	// process skips the manual step in which the user visits the verification page and
     78 	// enters their code.
     79 	VerificationUriComplete *string
     80 
     81 	// Metadata pertaining to the operation's result.
     82 	ResultMetadata middleware.Metadata
     83 
     84 	noSmithyDocumentSerde
     85 }
     86 
     87 func (c *Client) addOperationStartDeviceAuthorizationMiddlewares(stack *middleware.Stack, options Options) (err error) {
     88 	err = stack.Serialize.Add(&awsRestjson1_serializeOpStartDeviceAuthorization{}, middleware.After)
     89 	if err != nil {
     90 		return err
     91 	}
     92 	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartDeviceAuthorization{}, middleware.After)
     93 	if err != nil {
     94 		return err
     95 	}
     96 	if err = addSetLoggerMiddleware(stack, options); err != nil {
     97 		return err
     98 	}
     99 	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
    100 		return err
    101 	}
    102 	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
    103 		return err
    104 	}
    105 	if err = addResolveEndpointMiddleware(stack, options); err != nil {
    106 		return err
    107 	}
    108 	if err = addRetryMiddlewares(stack, options); err != nil {
    109 		return err
    110 	}
    111 	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
    112 		return err
    113 	}
    114 	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
    115 		return err
    116 	}
    117 	if err = addClientUserAgent(stack); err != nil {
    118 		return err
    119 	}
    120 	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
    121 		return err
    122 	}
    123 	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
    124 		return err
    125 	}
    126 	if err = addOpStartDeviceAuthorizationValidationMiddleware(stack); err != nil {
    127 		return err
    128 	}
    129 	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartDeviceAuthorization(options.Region), middleware.Before); err != nil {
    130 		return err
    131 	}
    132 	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
    133 		return err
    134 	}
    135 	if err = addResponseErrorMiddleware(stack); err != nil {
    136 		return err
    137 	}
    138 	if err = addRequestResponseLogging(stack, options); err != nil {
    139 		return err
    140 	}
    141 	return nil
    142 }
    143 
    144 func newServiceMetadataMiddleware_opStartDeviceAuthorization(region string) *awsmiddleware.RegisterServiceMetadata {
    145 	return &awsmiddleware.RegisterServiceMetadata{
    146 		Region:        region,
    147 		ServiceID:     ServiceID,
    148 		OperationName: "StartDeviceAuthorization",
    149 	}
    150 }