1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package iam
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/iam/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Sets the status of an IAM user's SSH public key to active or inactive. SSH
15// public keys that are inactive cannot be used for authentication. This operation
16// can be used to disable a user's SSH public key as part of a key rotation work
17// flow. The SSH public key affected by this operation is used only for
18// authenticating the associated IAM user to an AWS CodeCommit repository. For more
19// information about using SSH keys to authenticate to an AWS CodeCommit
20// repository, see Set up AWS CodeCommit for SSH Connections
21// (https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-credentials-ssh.html)
22// in the AWS CodeCommit User Guide.
23func (c *Client) UpdateSSHPublicKey(ctx context.Context, params *UpdateSSHPublicKeyInput, optFns ...func(*Options)) (*UpdateSSHPublicKeyOutput, error) {
24	if params == nil {
25		params = &UpdateSSHPublicKeyInput{}
26	}
27
28	result, metadata, err := c.invokeOperation(ctx, "UpdateSSHPublicKey", params, optFns, addOperationUpdateSSHPublicKeyMiddlewares)
29	if err != nil {
30		return nil, err
31	}
32
33	out := result.(*UpdateSSHPublicKeyOutput)
34	out.ResultMetadata = metadata
35	return out, nil
36}
37
38type UpdateSSHPublicKeyInput struct {
39
40	// The unique identifier for the SSH public key. This parameter allows (through its
41	// regex pattern (http://wikipedia.org/wiki/regex)) a string of characters that can
42	// consist of any upper or lowercased letter or digit.
43	//
44	// This member is required.
45	SSHPublicKeyId *string
46
47	// The status to assign to the SSH public key. Active means that the key can be
48	// used for authentication with an AWS CodeCommit repository. Inactive means that
49	// the key cannot be used.
50	//
51	// This member is required.
52	Status types.StatusType
53
54	// The name of the IAM user associated with the SSH public key. This parameter
55	// allows (through its regex pattern (http://wikipedia.org/wiki/regex)) a string of
56	// characters consisting of upper and lowercase alphanumeric characters with no
57	// spaces. You can also include any of the following characters: _+=,.@-
58	//
59	// This member is required.
60	UserName *string
61}
62
63type UpdateSSHPublicKeyOutput struct {
64	// Metadata pertaining to the operation's result.
65	ResultMetadata middleware.Metadata
66}
67
68func addOperationUpdateSSHPublicKeyMiddlewares(stack *middleware.Stack, options Options) (err error) {
69	err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateSSHPublicKey{}, middleware.After)
70	if err != nil {
71		return err
72	}
73	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateSSHPublicKey{}, middleware.After)
74	if err != nil {
75		return err
76	}
77	if err = addSetLoggerMiddleware(stack, options); err != nil {
78		return err
79	}
80	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
81		return err
82	}
83	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
84		return err
85	}
86	if err = addResolveEndpointMiddleware(stack, options); err != nil {
87		return err
88	}
89	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
90		return err
91	}
92	if err = addRetryMiddlewares(stack, options); err != nil {
93		return err
94	}
95	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
96		return err
97	}
98	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
99		return err
100	}
101	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
102		return err
103	}
104	if err = addClientUserAgent(stack); 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 = addOpUpdateSSHPublicKeyValidationMiddleware(stack); err != nil {
114		return err
115	}
116	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateSSHPublicKey(options.Region), middleware.Before); err != nil {
117		return err
118	}
119	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addResponseErrorMiddleware(stack); err != nil {
123		return err
124	}
125	if err = addRequestResponseLogging(stack, options); err != nil {
126		return err
127	}
128	return nil
129}
130
131func newServiceMetadataMiddleware_opUpdateSSHPublicKey(region string) *awsmiddleware.RegisterServiceMetadata {
132	return &awsmiddleware.RegisterServiceMetadata{
133		Region:        region,
134		ServiceID:     ServiceID,
135		SigningName:   "iam",
136		OperationName: "UpdateSSHPublicKey",
137	}
138}
139