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// Updates the password policy settings for the AWS account.
14//
15// * This operation does
16// not support partial updates. No parameters are required, but if you do not
17// specify a parameter, that parameter's value reverts to its default value. See
18// the Request Parameters section for each parameter's default value. Also note
19// that some parameters do not allow the default parameter to be explicitly set.
20// Instead, to invoke the default value, do not include that parameter when you
21// invoke the operation.
22//
23// For more information about using a password policy, see
24// Managing an IAM password policy
25// (https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_ManagingPasswordPolicies.html)
26// in the IAM User Guide.
27func (c *Client) UpdateAccountPasswordPolicy(ctx context.Context, params *UpdateAccountPasswordPolicyInput, optFns ...func(*Options)) (*UpdateAccountPasswordPolicyOutput, error) {
28	if params == nil {
29		params = &UpdateAccountPasswordPolicyInput{}
30	}
31
32	result, metadata, err := c.invokeOperation(ctx, "UpdateAccountPasswordPolicy", params, optFns, addOperationUpdateAccountPasswordPolicyMiddlewares)
33	if err != nil {
34		return nil, err
35	}
36
37	out := result.(*UpdateAccountPasswordPolicyOutput)
38	out.ResultMetadata = metadata
39	return out, nil
40}
41
42type UpdateAccountPasswordPolicyInput struct {
43
44	// Allows all IAM users in your account to use the AWS Management Console to change
45	// their own passwords. For more information, see Letting IAM users change their
46	// own passwords
47	// (https://docs.aws.amazon.com/IAM/latest/UserGuide/HowToPwdIAMUser.html) in the
48	// IAM User Guide. If you do not specify a value for this parameter, then the
49	// operation uses the default value of false. The result is that IAM users in the
50	// account do not automatically have permissions to change their own password.
51	AllowUsersToChangePassword bool
52
53	// Prevents IAM users from setting a new password after their password has expired.
54	// The IAM user cannot be accessed until an administrator resets the password. If
55	// you do not specify a value for this parameter, then the operation uses the
56	// default value of false. The result is that IAM users can change their passwords
57	// after they expire and continue to sign in as the user.
58	HardExpiry *bool
59
60	// The number of days that an IAM user password is valid. If you do not specify a
61	// value for this parameter, then the operation uses the default value of 0. The
62	// result is that IAM user passwords never expire.
63	MaxPasswordAge *int32
64
65	// The minimum number of characters allowed in an IAM user password. If you do not
66	// specify a value for this parameter, then the operation uses the default value of
67	// 6.
68	MinimumPasswordLength *int32
69
70	// Specifies the number of previous passwords that IAM users are prevented from
71	// reusing. If you do not specify a value for this parameter, then the operation
72	// uses the default value of 0. The result is that IAM users are not prevented from
73	// reusing previous passwords.
74	PasswordReusePrevention *int32
75
76	// Specifies whether IAM user passwords must contain at least one lowercase
77	// character from the ISO basic Latin alphabet (a to z). If you do not specify a
78	// value for this parameter, then the operation uses the default value of false.
79	// The result is that passwords do not require at least one lowercase character.
80	RequireLowercaseCharacters bool
81
82	// Specifies whether IAM user passwords must contain at least one numeric character
83	// (0 to 9). If you do not specify a value for this parameter, then the operation
84	// uses the default value of false. The result is that passwords do not require at
85	// least one numeric character.
86	RequireNumbers bool
87
88	// Specifies whether IAM user passwords must contain at least one of the following
89	// non-alphanumeric characters: ! @ # $ % ^ & * ( ) _ + - = [ ] { } | ' If you do
90	// not specify a value for this parameter, then the operation uses the default
91	// value of false. The result is that passwords do not require at least one symbol
92	// character.
93	RequireSymbols bool
94
95	// Specifies whether IAM user passwords must contain at least one uppercase
96	// character from the ISO basic Latin alphabet (A to Z). If you do not specify a
97	// value for this parameter, then the operation uses the default value of false.
98	// The result is that passwords do not require at least one uppercase character.
99	RequireUppercaseCharacters bool
100}
101
102type UpdateAccountPasswordPolicyOutput struct {
103	// Metadata pertaining to the operation's result.
104	ResultMetadata middleware.Metadata
105}
106
107func addOperationUpdateAccountPasswordPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
108	err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateAccountPasswordPolicy{}, middleware.After)
109	if err != nil {
110		return err
111	}
112	err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateAccountPasswordPolicy{}, middleware.After)
113	if err != nil {
114		return err
115	}
116	if err = addSetLoggerMiddleware(stack, options); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
120		return err
121	}
122	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
123		return err
124	}
125	if err = addResolveEndpointMiddleware(stack, options); err != nil {
126		return err
127	}
128	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
129		return err
130	}
131	if err = addRetryMiddlewares(stack, options); err != nil {
132		return err
133	}
134	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
135		return err
136	}
137	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
138		return err
139	}
140	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
141		return err
142	}
143	if err = addClientUserAgent(stack); err != nil {
144		return err
145	}
146	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
147		return err
148	}
149	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
150		return err
151	}
152	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAccountPasswordPolicy(options.Region), middleware.Before); err != nil {
153		return err
154	}
155	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
156		return err
157	}
158	if err = addResponseErrorMiddleware(stack); err != nil {
159		return err
160	}
161	if err = addRequestResponseLogging(stack, options); err != nil {
162		return err
163	}
164	return nil
165}
166
167func newServiceMetadataMiddleware_opUpdateAccountPasswordPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
168	return &awsmiddleware.RegisterServiceMetadata{
169		Region:        region,
170		ServiceID:     ServiceID,
171		SigningName:   "iam",
172		OperationName: "UpdateAccountPasswordPolicy",
173	}
174}
175