src

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

api_op_StartDeviceAuthorization.go (3783B)


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