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/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Changes the password for the specified IAM user. You can use the AWS CLI, the
14// AWS API, or the Users page in the IAM console to change the password for any IAM
15// user. Use ChangePassword to change your own password in the My Security
16// Credentials page in the AWS Management Console. For more information about
17// modifying passwords, see Managing passwords
18// (https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_ManagingLogins.html) in
19// the IAM User Guide.
20func (c *Client) UpdateLoginProfile(ctx context.Context, params *UpdateLoginProfileInput, optFns ...func(*Options)) (*UpdateLoginProfileOutput, error) {
21	if params == nil {
22		params = &UpdateLoginProfileInput{}
23	}
24
25	result, metadata, err := c.invokeOperation(ctx, "UpdateLoginProfile", params, optFns, addOperationUpdateLoginProfileMiddlewares)
26	if err != nil {
27		return nil, err
28	}
29
30	out := result.(*UpdateLoginProfileOutput)
31	out.ResultMetadata = metadata
32	return out, nil
33}
34
35type UpdateLoginProfileInput struct {
36
37	// The name of the user whose password you want to update. This parameter allows
38	// (through its regex pattern (http://wikipedia.org/wiki/regex)) a string of
39	// characters consisting of upper and lowercase alphanumeric characters with no
40	// spaces. You can also include any of the following characters: _+=,.@-
41	//
42	// This member is required.
43	UserName *string
44
45	// The new password for the specified IAM user. The regex pattern
46	// (http://wikipedia.org/wiki/regex) used to validate this parameter is a string of
47	// characters consisting of the following:
48	//
49	// * Any printable ASCII character ranging
50	// from the space character (\u0020) through the end of the ASCII character
51	// range
52	//
53	// * The printable characters in the Basic Latin and Latin-1 Supplement
54	// character set (through \u00FF)
55	//
56	// * The special characters tab (\u0009), line feed
57	// (\u000A), and carriage return (\u000D)
58	//
59	// However, the format can be further
60	// restricted by the account administrator by setting a password policy on the AWS
61	// account. For more information, see UpdateAccountPasswordPolicy.
62	Password *string
63
64	// Allows this new password to be used only once by requiring the specified IAM
65	// user to set a new password on next sign-in.
66	PasswordResetRequired *bool
67}
68
69type UpdateLoginProfileOutput struct {
70	// Metadata pertaining to the operation's result.
71	ResultMetadata middleware.Metadata
72}
73
74func addOperationUpdateLoginProfileMiddlewares(stack *middleware.Stack, options Options) (err error) {
75	err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateLoginProfile{}, middleware.After)
76	if err != nil {
77		return err
78	}
79	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateLoginProfile{}, middleware.After)
80	if err != nil {
81		return err
82	}
83	if err = addSetLoggerMiddleware(stack, options); err != nil {
84		return err
85	}
86	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
87		return err
88	}
89	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
90		return err
91	}
92	if err = addResolveEndpointMiddleware(stack, options); err != nil {
93		return err
94	}
95	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
96		return err
97	}
98	if err = addRetryMiddlewares(stack, options); err != nil {
99		return err
100	}
101	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
102		return err
103	}
104	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
108		return err
109	}
110	if err = addClientUserAgent(stack); err != nil {
111		return err
112	}
113	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
117		return err
118	}
119	if err = addOpUpdateLoginProfileValidationMiddleware(stack); err != nil {
120		return err
121	}
122	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateLoginProfile(options.Region), middleware.Before); 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	return nil
135}
136
137func newServiceMetadataMiddleware_opUpdateLoginProfile(region string) *awsmiddleware.RegisterServiceMetadata {
138	return &awsmiddleware.RegisterServiceMetadata{
139		Region:        region,
140		ServiceID:     ServiceID,
141		SigningName:   "iam",
142		OperationName: "UpdateLoginProfile",
143	}
144}
145