api_op_RegisterClient.go

  1// Code generated by smithy-go-codegen DO NOT EDIT.
  2
  3package ssooidc
  4
  5import (
  6	"context"
  7	"fmt"
  8	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
  9	"github.com/aws/smithy-go/middleware"
 10	smithyhttp "github.com/aws/smithy-go/transport/http"
 11)
 12
 13// Registers a client with IAM Identity Center. This allows clients to initiate
 14// device authorization. The output should be persisted for reuse through many
 15// authentication requests.
 16func (c *Client) RegisterClient(ctx context.Context, params *RegisterClientInput, optFns ...func(*Options)) (*RegisterClientOutput, error) {
 17	if params == nil {
 18		params = &RegisterClientInput{}
 19	}
 20
 21	result, metadata, err := c.invokeOperation(ctx, "RegisterClient", params, optFns, c.addOperationRegisterClientMiddlewares)
 22	if err != nil {
 23		return nil, err
 24	}
 25
 26	out := result.(*RegisterClientOutput)
 27	out.ResultMetadata = metadata
 28	return out, nil
 29}
 30
 31type RegisterClientInput struct {
 32
 33	// The friendly name of the client.
 34	//
 35	// This member is required.
 36	ClientName *string
 37
 38	// The type of client. The service supports only public as a client type. Anything
 39	// other than public will be rejected by the service.
 40	//
 41	// This member is required.
 42	ClientType *string
 43
 44	// This IAM Identity Center application ARN is used to define
 45	// administrator-managed configuration for public client access to resources. At
 46	// authorization, the scopes, grants, and redirect URI available to this client
 47	// will be restricted by this application resource.
 48	EntitledApplicationArn *string
 49
 50	// The list of OAuth 2.0 grant types that are defined by the client. This list is
 51	// used to restrict the token granting flows available to the client.
 52	GrantTypes []string
 53
 54	// The IAM Identity Center Issuer URL associated with an instance of IAM Identity
 55	// Center. This value is needed for user access to resources through the client.
 56	IssuerUrl *string
 57
 58	// The list of redirect URI that are defined by the client. At completion of
 59	// authorization, this list is used to restrict what locations the user agent can
 60	// be redirected back to.
 61	RedirectUris []string
 62
 63	// The list of scopes that are defined by the client. Upon authorization, this
 64	// list is used to restrict permissions when granting an access token.
 65	Scopes []string
 66
 67	noSmithyDocumentSerde
 68}
 69
 70type RegisterClientOutput struct {
 71
 72	// An endpoint that the client can use to request authorization.
 73	AuthorizationEndpoint *string
 74
 75	// The unique identifier string for each client. This client uses this identifier
 76	// to get authenticated by the service in subsequent calls.
 77	ClientId *string
 78
 79	// Indicates the time at which the clientId and clientSecret were issued.
 80	ClientIdIssuedAt int64
 81
 82	// A secret string generated for the client. The client will use this string to
 83	// get authenticated by the service in subsequent calls.
 84	ClientSecret *string
 85
 86	// Indicates the time at which the clientId and clientSecret will become invalid.
 87	ClientSecretExpiresAt int64
 88
 89	// An endpoint that the client can use to create tokens.
 90	TokenEndpoint *string
 91
 92	// Metadata pertaining to the operation's result.
 93	ResultMetadata middleware.Metadata
 94
 95	noSmithyDocumentSerde
 96}
 97
 98func (c *Client) addOperationRegisterClientMiddlewares(stack *middleware.Stack, options Options) (err error) {
 99	if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
100		return err
101	}
102	err = stack.Serialize.Add(&awsRestjson1_serializeOpRegisterClient{}, middleware.After)
103	if err != nil {
104		return err
105	}
106	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRegisterClient{}, middleware.After)
107	if err != nil {
108		return err
109	}
110	if err := addProtocolFinalizerMiddlewares(stack, options, "RegisterClient"); err != nil {
111		return fmt.Errorf("add protocol finalizers: %v", err)
112	}
113
114	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
115		return err
116	}
117	if err = addSetLoggerMiddleware(stack, options); err != nil {
118		return err
119	}
120	if err = addClientRequestID(stack); err != nil {
121		return err
122	}
123	if err = addComputeContentLength(stack); err != nil {
124		return err
125	}
126	if err = addResolveEndpointMiddleware(stack, options); err != nil {
127		return err
128	}
129	if err = addRetry(stack, options); err != nil {
130		return err
131	}
132	if err = addRawResponseToMetadata(stack); err != nil {
133		return err
134	}
135	if err = addRecordResponseTiming(stack); err != nil {
136		return err
137	}
138	if err = addClientUserAgent(stack, options); err != nil {
139		return err
140	}
141	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
142		return err
143	}
144	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
145		return err
146	}
147	if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addTimeOffsetBuild(stack, c); err != nil {
151		return err
152	}
153	if err = addUserAgentRetryMode(stack, options); err != nil {
154		return err
155	}
156	if err = addOpRegisterClientValidationMiddleware(stack); err != nil {
157		return err
158	}
159	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRegisterClient(options.Region), middleware.Before); err != nil {
160		return err
161	}
162	if err = addRecursionDetection(stack); err != nil {
163		return err
164	}
165	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
166		return err
167	}
168	if err = addResponseErrorMiddleware(stack); err != nil {
169		return err
170	}
171	if err = addRequestResponseLogging(stack, options); err != nil {
172		return err
173	}
174	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
175		return err
176	}
177	return nil
178}
179
180func newServiceMetadataMiddleware_opRegisterClient(region string) *awsmiddleware.RegisterServiceMetadata {
181	return &awsmiddleware.RegisterServiceMetadata{
182		Region:        region,
183		ServiceID:     ServiceID,
184		OperationName: "RegisterClient",
185	}
186}