repo_name
stringlengths
1
52
repo_creator
stringclasses
6 values
programming_language
stringclasses
4 values
code
stringlengths
0
9.68M
num_lines
int64
1
234k
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified managed policy from the specified IAM group. A group can // also have inline policies embedded with it. To delete an inline policy, use // DeleteGroupPolicy . For information about policies, see Managed policies and // inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. func (c *Client) DetachGroupPolicy(ctx context.Context, params *DetachGroupPolicyInput, optFns ...func(*Options)) (*DetachGroupPolicyOutput, error) { if params == nil { params = &DetachGroupPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "DetachGroupPolicy", params, optFns, c.addOperationDetachGroupPolicyMiddlewares) if err != nil { return nil, err } out := result.(*DetachGroupPolicyOutput) out.ResultMetadata = metadata return out, nil } type DetachGroupPolicyInput struct { // The name (friendly name, not ARN) of the IAM group to detach the policy from. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. GroupName *string // The Amazon Resource Name (ARN) of the IAM policy you want to detach. For more // information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicyArn *string noSmithyDocumentSerde } type DetachGroupPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDetachGroupPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpDetachGroupPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDetachGroupPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpDetachGroupPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetachGroupPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opDetachGroupPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "DetachGroupPolicy", } }
135
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified managed policy from the specified role. A role can also // have inline policies embedded with it. To delete an inline policy, use // DeleteRolePolicy . For information about policies, see Managed policies and // inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. func (c *Client) DetachRolePolicy(ctx context.Context, params *DetachRolePolicyInput, optFns ...func(*Options)) (*DetachRolePolicyOutput, error) { if params == nil { params = &DetachRolePolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "DetachRolePolicy", params, optFns, c.addOperationDetachRolePolicyMiddlewares) if err != nil { return nil, err } out := result.(*DetachRolePolicyOutput) out.ResultMetadata = metadata return out, nil } type DetachRolePolicyInput struct { // The Amazon Resource Name (ARN) of the IAM policy you want to detach. For more // information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicyArn *string // The name (friendly name, not ARN) of the IAM role to detach the policy from. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. RoleName *string noSmithyDocumentSerde } type DetachRolePolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDetachRolePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpDetachRolePolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDetachRolePolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpDetachRolePolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetachRolePolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opDetachRolePolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "DetachRolePolicy", } }
135
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified managed policy from the specified user. A user can also // have inline policies embedded with it. To delete an inline policy, use // DeleteUserPolicy . For information about policies, see Managed policies and // inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. func (c *Client) DetachUserPolicy(ctx context.Context, params *DetachUserPolicyInput, optFns ...func(*Options)) (*DetachUserPolicyOutput, error) { if params == nil { params = &DetachUserPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "DetachUserPolicy", params, optFns, c.addOperationDetachUserPolicyMiddlewares) if err != nil { return nil, err } out := result.(*DetachUserPolicyOutput) out.ResultMetadata = metadata return out, nil } type DetachUserPolicyInput struct { // The Amazon Resource Name (ARN) of the IAM policy you want to detach. For more // information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicyArn *string // The name (friendly name, not ARN) of the IAM user to detach the policy from. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } type DetachUserPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDetachUserPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpDetachUserPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDetachUserPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpDetachUserPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetachUserPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opDetachUserPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "DetachUserPolicy", } }
135
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Enables the specified MFA device and associates it with the specified IAM user. // When enabled, the MFA device is required for every subsequent login by the IAM // user associated with the device. func (c *Client) EnableMFADevice(ctx context.Context, params *EnableMFADeviceInput, optFns ...func(*Options)) (*EnableMFADeviceOutput, error) { if params == nil { params = &EnableMFADeviceInput{} } result, metadata, err := c.invokeOperation(ctx, "EnableMFADevice", params, optFns, c.addOperationEnableMFADeviceMiddlewares) if err != nil { return nil, err } out := result.(*EnableMFADeviceOutput) out.ResultMetadata = metadata return out, nil } type EnableMFADeviceInput struct { // An authentication code emitted by the device. The format for this parameter is // a string of six digits. Submit your request immediately after generating the // authentication codes. If you generate the codes and then wait too long to submit // the request, the MFA device successfully associates with the user but the MFA // device becomes out of sync. This happens because time-based one-time passwords // (TOTP) expire after a short period of time. If this happens, you can resync the // device (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_sync.html) // . // // This member is required. AuthenticationCode1 *string // A subsequent authentication code emitted by the device. The format for this // parameter is a string of six digits. Submit your request immediately after // generating the authentication codes. If you generate the codes and then wait too // long to submit the request, the MFA device successfully associates with the user // but the MFA device becomes out of sync. This happens because time-based one-time // passwords (TOTP) expire after a short period of time. If this happens, you can // resync the device (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_sync.html) // . // // This member is required. AuthenticationCode2 *string // The serial number that uniquely identifies the MFA device. For virtual MFA // devices, the serial number is the device ARN. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: =,.@:/- // // This member is required. SerialNumber *string // The name of the IAM user for whom you want to enable the MFA device. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } type EnableMFADeviceOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationEnableMFADeviceMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpEnableMFADevice{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpEnableMFADevice{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpEnableMFADeviceValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opEnableMFADevice(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opEnableMFADevice(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "EnableMFADevice", } }
158
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Generates a credential report for the Amazon Web Services account. For more // information about the credential report, see Getting credential reports (https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-reports.html) // in the IAM User Guide. func (c *Client) GenerateCredentialReport(ctx context.Context, params *GenerateCredentialReportInput, optFns ...func(*Options)) (*GenerateCredentialReportOutput, error) { if params == nil { params = &GenerateCredentialReportInput{} } result, metadata, err := c.invokeOperation(ctx, "GenerateCredentialReport", params, optFns, c.addOperationGenerateCredentialReportMiddlewares) if err != nil { return nil, err } out := result.(*GenerateCredentialReportOutput) out.ResultMetadata = metadata return out, nil } type GenerateCredentialReportInput struct { noSmithyDocumentSerde } // Contains the response to a successful GenerateCredentialReport request. type GenerateCredentialReportOutput struct { // Information about the credential report. Description *string // Information about the state of the credential report. State types.ReportStateType // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGenerateCredentialReportMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGenerateCredentialReport{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGenerateCredentialReport{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGenerateCredentialReport(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGenerateCredentialReport(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GenerateCredentialReport", } }
122
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Generates a report for service last accessed data for Organizations. You can // generate a report for any entities (organization root, organizational unit, or // account) or policies in your organization. To call this operation, you must be // signed in using your Organizations management account credentials. You can use // your long-term IAM user or root user credentials, or temporary credentials from // assuming an IAM role. SCPs must be enabled for your organization root. You must // have the required IAM and Organizations permissions. For more information, see // Refining permissions using service last accessed data (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) // in the IAM User Guide. You can generate a service last accessed data report for // entities by specifying only the entity's path. This data includes a list of // services that are allowed by any service control policies (SCPs) that apply to // the entity. You can generate a service last accessed data report for a policy by // specifying an entity's path and an optional Organizations policy ID. This data // includes a list of services that are allowed by the specified SCP. For each // service in both report types, the data includes the most recent account activity // that the policy allows to account principals in the entity or the entity's // children. For important information about the data, reporting period, // permissions required, troubleshooting, and supported Regions see Reducing // permissions using service last accessed data (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) // in the IAM User Guide. The data includes all attempts to access Amazon Web // Services, not just the successful ones. This includes all attempts that were // made using the Amazon Web Services Management Console, the Amazon Web Services // API through any of the SDKs, or any of the command line tools. An unexpected // entry in the service last accessed data does not mean that an account has been // compromised, because the request might have been denied. Refer to your // CloudTrail logs as the authoritative source for information about all API calls // and whether they were successful or denied access. For more information, see // Logging IAM events with CloudTrail (https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html) // in the IAM User Guide. This operation returns a JobId . Use this parameter in // the GetOrganizationsAccessReport operation to check the status of the report // generation. To check the status of this request, use the JobId parameter in the // GetOrganizationsAccessReport operation and test the JobStatus response // parameter. When the job is complete, you can retrieve the report. To generate a // service last accessed data report for entities, specify an entity path without // specifying the optional Organizations policy ID. The type of entity that you // specify determines the data returned in the report. // - Root – When you specify the organizations root as the entity, the resulting // report lists all of the services allowed by SCPs that are attached to your root. // For each service, the report includes data for all accounts in your organization // except the management account, because the management account is not limited by // SCPs. // - OU – When you specify an organizational unit (OU) as the entity, the // resulting report lists all of the services allowed by SCPs that are attached to // the OU and its parents. For each service, the report includes data for all // accounts in the OU or its children. This data excludes the management account, // because the management account is not limited by SCPs. // - management account – When you specify the management account, the resulting // report lists all Amazon Web Services services, because the management account is // not limited by SCPs. For each service, the report includes data for only the // management account. // - Account – When you specify another account as the entity, the resulting // report lists all of the services allowed by SCPs that are attached to the // account and its parents. For each service, the report includes data for only the // specified account. // // To generate a service last accessed data report for policies, specify an entity // path and the optional Organizations policy ID. The type of entity that you // specify determines the data returned for each service. // - Root – When you specify the root entity and a policy ID, the resulting // report lists all of the services that are allowed by the specified SCP. For each // service, the report includes data for all accounts in your organization to which // the SCP applies. This data excludes the management account, because the // management account is not limited by SCPs. If the SCP is not attached to any // entities in the organization, then the report will return a list of services // with no data. // - OU – When you specify an OU entity and a policy ID, the resulting report // lists all of the services that are allowed by the specified SCP. For each // service, the report includes data for all accounts in the OU or its children to // which the SCP applies. This means that other accounts outside the OU that are // affected by the SCP might not be included in the data. This data excludes the // management account, because the management account is not limited by SCPs. If // the SCP is not attached to the OU or one of its children, the report will return // a list of services with no data. // - management account – When you specify the management account, the resulting // report lists all Amazon Web Services services, because the management account is // not limited by SCPs. If you specify a policy ID in the CLI or API, the policy is // ignored. For each service, the report includes data for only the management // account. // - Account – When you specify another account entity and a policy ID, the // resulting report lists all of the services that are allowed by the specified // SCP. For each service, the report includes data for only the specified account. // This means that other accounts in the organization that are affected by the SCP // might not be included in the data. If the SCP is not attached to the account, // the report will return a list of services with no data. // // Service last accessed data does not use other policy types when determining // whether a principal could access a service. These other policy types include // identity-based policies, resource-based policies, access control lists, IAM // permissions boundaries, and STS assume role policies. It only applies SCP logic. // For more about the evaluation of policy types, see Evaluating policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-basics) // in the IAM User Guide. For more information about service last accessed data, // see Reducing policy scope by viewing user activity (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) // in the IAM User Guide. func (c *Client) GenerateOrganizationsAccessReport(ctx context.Context, params *GenerateOrganizationsAccessReportInput, optFns ...func(*Options)) (*GenerateOrganizationsAccessReportOutput, error) { if params == nil { params = &GenerateOrganizationsAccessReportInput{} } result, metadata, err := c.invokeOperation(ctx, "GenerateOrganizationsAccessReport", params, optFns, c.addOperationGenerateOrganizationsAccessReportMiddlewares) if err != nil { return nil, err } out := result.(*GenerateOrganizationsAccessReportOutput) out.ResultMetadata = metadata return out, nil } type GenerateOrganizationsAccessReportInput struct { // The path of the Organizations entity (root, OU, or account). You can build an // entity path using the known structure of your organization. For example, assume // that your account ID is 123456789012 and its parent OU ID is ou-rge0-awsabcde . // The organization root ID is r-f6g7h8i9j0example and your organization ID is // o-a1b2c3d4e5 . Your entity path is // o-a1b2c3d4e5/r-f6g7h8i9j0example/ou-rge0-awsabcde/123456789012 . // // This member is required. EntityPath *string // The identifier of the Organizations service control policy (SCP). This // parameter is optional. This ID is used to generate information about when an // account principal that is limited by the SCP attempted to access an Amazon Web // Services service. OrganizationsPolicyId *string noSmithyDocumentSerde } type GenerateOrganizationsAccessReportOutput struct { // The job identifier that you can use in the GetOrganizationsAccessReport // operation. JobId *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGenerateOrganizationsAccessReportMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGenerateOrganizationsAccessReport{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGenerateOrganizationsAccessReport{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGenerateOrganizationsAccessReportValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGenerateOrganizationsAccessReport(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGenerateOrganizationsAccessReport(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GenerateOrganizationsAccessReport", } }
228
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Generates a report that includes details about when an IAM resource (user, // group, role, or policy) was last used in an attempt to access Amazon Web // Services services. Recent activity usually appears within four hours. IAM // reports activity for at least the last 400 days, or less if your Region began // supporting this feature within the last year. For more information, see Regions // where data is tracked (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html#access-advisor_tracking-period) // . The service last accessed data includes all attempts to access an Amazon Web // Services API, not just the successful ones. This includes all attempts that were // made using the Amazon Web Services Management Console, the Amazon Web Services // API through any of the SDKs, or any of the command line tools. An unexpected // entry in the service last accessed data does not mean that your account has been // compromised, because the request might have been denied. Refer to your // CloudTrail logs as the authoritative source for information about all API calls // and whether they were successful or denied access. For more information, see // Logging IAM events with CloudTrail (https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html) // in the IAM User Guide. The GenerateServiceLastAccessedDetails operation returns // a JobId . Use this parameter in the following operations to retrieve the // following details from your report: // - GetServiceLastAccessedDetails – Use this operation for users, groups, roles, // or policies to list every Amazon Web Services service that the resource could // access using permissions policies. For each service, the response includes // information about the most recent access attempt. The JobId returned by // GenerateServiceLastAccessedDetail must be used by the same role within a // session, or by the same user when used to call GetServiceLastAccessedDetail . // - GetServiceLastAccessedDetailsWithEntities – Use this operation for groups // and policies to list information about the associated entities (users or roles) // that attempted to access a specific Amazon Web Services service. // // To check the status of the GenerateServiceLastAccessedDetails request, use the // JobId parameter in the same operations and test the JobStatus response // parameter. For additional information about the permissions policies that allow // an identity (user, group, or role) to access specific services, use the // ListPoliciesGrantingServiceAccess operation. Service last accessed data does not // use other policy types when determining whether a resource could access a // service. These other policy types include resource-based policies, access // control lists, Organizations policies, IAM permissions boundaries, and STS // assume role policies. It only applies permissions policy logic. For more about // the evaluation of policy types, see Evaluating policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-basics) // in the IAM User Guide. For more information about service and action last // accessed data, see Reducing permissions using service last accessed data (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) // in the IAM User Guide. func (c *Client) GenerateServiceLastAccessedDetails(ctx context.Context, params *GenerateServiceLastAccessedDetailsInput, optFns ...func(*Options)) (*GenerateServiceLastAccessedDetailsOutput, error) { if params == nil { params = &GenerateServiceLastAccessedDetailsInput{} } result, metadata, err := c.invokeOperation(ctx, "GenerateServiceLastAccessedDetails", params, optFns, c.addOperationGenerateServiceLastAccessedDetailsMiddlewares) if err != nil { return nil, err } out := result.(*GenerateServiceLastAccessedDetailsOutput) out.ResultMetadata = metadata return out, nil } type GenerateServiceLastAccessedDetailsInput struct { // The ARN of the IAM resource (user, group, role, or managed policy) used to // generate information about when the resource was last used in an attempt to // access an Amazon Web Services service. // // This member is required. Arn *string // The level of detail that you want to generate. You can specify whether you want // to generate information about the last attempt to access services or actions. If // you specify service-level granularity, this operation generates only service // data. If you specify action-level granularity, it generates service and action // data. If you don't include this optional parameter, the operation generates // service data. Granularity types.AccessAdvisorUsageGranularityType noSmithyDocumentSerde } type GenerateServiceLastAccessedDetailsOutput struct { // The JobId that you can use in the GetServiceLastAccessedDetails or // GetServiceLastAccessedDetailsWithEntities operations. The JobId returned by // GenerateServiceLastAccessedDetail must be used by the same role within a // session, or by the same user when used to call GetServiceLastAccessedDetail . JobId *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGenerateServiceLastAccessedDetailsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGenerateServiceLastAccessedDetails{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGenerateServiceLastAccessedDetails{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGenerateServiceLastAccessedDetailsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGenerateServiceLastAccessedDetails(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGenerateServiceLastAccessedDetails(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GenerateServiceLastAccessedDetails", } }
178
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves information about when the specified access key was last used. The // information includes the date and time of last use, along with the Amazon Web // Services service and Region that were specified in the last request made with // that key. func (c *Client) GetAccessKeyLastUsed(ctx context.Context, params *GetAccessKeyLastUsedInput, optFns ...func(*Options)) (*GetAccessKeyLastUsedOutput, error) { if params == nil { params = &GetAccessKeyLastUsedInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccessKeyLastUsed", params, optFns, c.addOperationGetAccessKeyLastUsedMiddlewares) if err != nil { return nil, err } out := result.(*GetAccessKeyLastUsedOutput) out.ResultMetadata = metadata return out, nil } type GetAccessKeyLastUsedInput struct { // The identifier of an access key. This parameter allows (through its regex // pattern (http://wikipedia.org/wiki/regex) ) a string of characters that can // consist of any upper or lowercased letter or digit. // // This member is required. AccessKeyId *string noSmithyDocumentSerde } // Contains the response to a successful GetAccessKeyLastUsed request. It is also // returned as a member of the AccessKeyMetaData structure returned by the // ListAccessKeys action. type GetAccessKeyLastUsedOutput struct { // Contains information about the last time the access key was used. AccessKeyLastUsed *types.AccessKeyLastUsed // The name of the IAM user that owns this access key. UserName *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccessKeyLastUsedMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetAccessKeyLastUsed{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetAccessKeyLastUsed{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetAccessKeyLastUsedValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessKeyLastUsed(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetAccessKeyLastUsed(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetAccessKeyLastUsed", } }
136
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves information about all IAM users, groups, roles, and policies in your // Amazon Web Services account, including their relationships to one another. Use // this operation to obtain a snapshot of the configuration of IAM permissions // (users, groups, roles, and policies) in your account. Policies returned by this // operation are URL-encoded compliant with RFC 3986 (https://tools.ietf.org/html/rfc3986) // . You can use a URL decoding method to convert the policy back to plain JSON // text. For example, if you use Java, you can use the decode method of the // java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs // provide similar functionality. You can optionally filter the results using the // Filter parameter. You can paginate the results using the MaxItems and Marker // parameters. func (c *Client) GetAccountAuthorizationDetails(ctx context.Context, params *GetAccountAuthorizationDetailsInput, optFns ...func(*Options)) (*GetAccountAuthorizationDetailsOutput, error) { if params == nil { params = &GetAccountAuthorizationDetailsInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccountAuthorizationDetails", params, optFns, c.addOperationGetAccountAuthorizationDetailsMiddlewares) if err != nil { return nil, err } out := result.(*GetAccountAuthorizationDetailsOutput) out.ResultMetadata = metadata return out, nil } type GetAccountAuthorizationDetailsInput struct { // A list of entity types used to filter the results. Only the entities that match // the types you specify are included in the output. Use the value // LocalManagedPolicy to include customer managed policies. The format for this // parameter is a comma-separated (if more than one) list of strings. Each string // value in the list must be one of the valid values listed below. Filter []types.EntityType // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful GetAccountAuthorizationDetails request. type GetAccountAuthorizationDetailsOutput struct { // A list containing information about IAM groups. GroupDetailList []types.GroupDetail // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // A list containing information about managed policies. Policies []types.ManagedPolicyDetail // A list containing information about IAM roles. RoleDetailList []types.RoleDetail // A list containing information about IAM users. UserDetailList []types.UserDetail // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccountAuthorizationDetailsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetAccountAuthorizationDetails{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetAccountAuthorizationDetails{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccountAuthorizationDetails(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // GetAccountAuthorizationDetailsAPIClient is a client that implements the // GetAccountAuthorizationDetails operation. type GetAccountAuthorizationDetailsAPIClient interface { GetAccountAuthorizationDetails(context.Context, *GetAccountAuthorizationDetailsInput, ...func(*Options)) (*GetAccountAuthorizationDetailsOutput, error) } var _ GetAccountAuthorizationDetailsAPIClient = (*Client)(nil) // GetAccountAuthorizationDetailsPaginatorOptions is the paginator options for // GetAccountAuthorizationDetails type GetAccountAuthorizationDetailsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // GetAccountAuthorizationDetailsPaginator is a paginator for // GetAccountAuthorizationDetails type GetAccountAuthorizationDetailsPaginator struct { options GetAccountAuthorizationDetailsPaginatorOptions client GetAccountAuthorizationDetailsAPIClient params *GetAccountAuthorizationDetailsInput nextToken *string firstPage bool } // NewGetAccountAuthorizationDetailsPaginator returns a new // GetAccountAuthorizationDetailsPaginator func NewGetAccountAuthorizationDetailsPaginator(client GetAccountAuthorizationDetailsAPIClient, params *GetAccountAuthorizationDetailsInput, optFns ...func(*GetAccountAuthorizationDetailsPaginatorOptions)) *GetAccountAuthorizationDetailsPaginator { if params == nil { params = &GetAccountAuthorizationDetailsInput{} } options := GetAccountAuthorizationDetailsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &GetAccountAuthorizationDetailsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *GetAccountAuthorizationDetailsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next GetAccountAuthorizationDetails page. func (p *GetAccountAuthorizationDetailsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetAccountAuthorizationDetailsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.GetAccountAuthorizationDetails(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opGetAccountAuthorizationDetails(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetAccountAuthorizationDetails", } }
271
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves the password policy for the Amazon Web Services account. This tells // you the complexity requirements and mandatory rotation periods for the IAM user // passwords in your account. For more information about using a password policy, // see Managing an IAM password policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_ManagingPasswordPolicies.html) // . func (c *Client) GetAccountPasswordPolicy(ctx context.Context, params *GetAccountPasswordPolicyInput, optFns ...func(*Options)) (*GetAccountPasswordPolicyOutput, error) { if params == nil { params = &GetAccountPasswordPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccountPasswordPolicy", params, optFns, c.addOperationGetAccountPasswordPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetAccountPasswordPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetAccountPasswordPolicyInput struct { noSmithyDocumentSerde } // Contains the response to a successful GetAccountPasswordPolicy request. type GetAccountPasswordPolicyOutput struct { // A structure that contains details about the account's password policy. // // This member is required. PasswordPolicy *types.PasswordPolicy // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccountPasswordPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetAccountPasswordPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetAccountPasswordPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccountPasswordPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetAccountPasswordPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetAccountPasswordPolicy", } }
123
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves information about IAM entity usage and IAM quotas in the Amazon Web // Services account. For information about IAM quotas, see IAM and STS quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html) // in the IAM User Guide. func (c *Client) GetAccountSummary(ctx context.Context, params *GetAccountSummaryInput, optFns ...func(*Options)) (*GetAccountSummaryOutput, error) { if params == nil { params = &GetAccountSummaryInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccountSummary", params, optFns, c.addOperationGetAccountSummaryMiddlewares) if err != nil { return nil, err } out := result.(*GetAccountSummaryOutput) out.ResultMetadata = metadata return out, nil } type GetAccountSummaryInput struct { noSmithyDocumentSerde } // Contains the response to a successful GetAccountSummary request. type GetAccountSummaryOutput struct { // A set of key–value pairs containing information about IAM entity usage and IAM // quotas. SummaryMap map[string]int32 // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccountSummaryMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetAccountSummary{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetAccountSummary{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccountSummary(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetAccountSummary(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetAccountSummary", } }
119
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Gets a list of all of the context keys referenced in the input policies. The // policies are supplied as a list of one or more strings. To get the context keys // from policies associated with an IAM user, group, or role, use // GetContextKeysForPrincipalPolicy . Context keys are variables maintained by // Amazon Web Services and its services that provide details about the context of // an API query request. Context keys can be evaluated by testing against a value // specified in an IAM policy. Use GetContextKeysForCustomPolicy to understand // what key names and values you must supply when you call SimulateCustomPolicy . // Note that all parameters are shown in unencoded form here for clarity but must // be URL encoded to be included as a part of a real HTML request. func (c *Client) GetContextKeysForCustomPolicy(ctx context.Context, params *GetContextKeysForCustomPolicyInput, optFns ...func(*Options)) (*GetContextKeysForCustomPolicyOutput, error) { if params == nil { params = &GetContextKeysForCustomPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetContextKeysForCustomPolicy", params, optFns, c.addOperationGetContextKeysForCustomPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetContextKeysForCustomPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetContextKeysForCustomPolicyInput struct { // A list of policies for which you want the list of context keys referenced in // those policies. Each document is specified as a string containing the complete, // valid JSON text of an IAM policy. The regex pattern (http://wikipedia.org/wiki/regex) // used to validate this parameter is a string of characters consisting of the // following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) // // This member is required. PolicyInputList []string noSmithyDocumentSerde } // Contains the response to a successful GetContextKeysForPrincipalPolicy or // GetContextKeysForCustomPolicy request. type GetContextKeysForCustomPolicyOutput struct { // The list of context keys that are referenced in the input policies. ContextKeyNames []string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetContextKeysForCustomPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetContextKeysForCustomPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetContextKeysForCustomPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetContextKeysForCustomPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetContextKeysForCustomPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetContextKeysForCustomPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetContextKeysForCustomPolicy", } }
145
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Gets a list of all of the context keys referenced in all the IAM policies that // are attached to the specified IAM entity. The entity can be an IAM user, group, // or role. If you specify a user, then the request also includes all of the // policies attached to groups that the user is a member of. You can optionally // include a list of one or more additional policies, specified as strings. If you // want to include only a list of policies by string, use // GetContextKeysForCustomPolicy instead. Note: This operation discloses // information about the permissions granted to other users. If you do not want // users to see other user's permissions, then consider allowing them to use // GetContextKeysForCustomPolicy instead. Context keys are variables maintained by // Amazon Web Services and its services that provide details about the context of // an API query request. Context keys can be evaluated by testing against a value // in an IAM policy. Use GetContextKeysForPrincipalPolicy to understand what key // names and values you must supply when you call SimulatePrincipalPolicy . func (c *Client) GetContextKeysForPrincipalPolicy(ctx context.Context, params *GetContextKeysForPrincipalPolicyInput, optFns ...func(*Options)) (*GetContextKeysForPrincipalPolicyOutput, error) { if params == nil { params = &GetContextKeysForPrincipalPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetContextKeysForPrincipalPolicy", params, optFns, c.addOperationGetContextKeysForPrincipalPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetContextKeysForPrincipalPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetContextKeysForPrincipalPolicyInput struct { // The ARN of a user, group, or role whose policies contain the context keys that // you want listed. If you specify a user, the list includes context keys that are // found in all policies that are attached to the user. The list also includes all // groups that the user is a member of. If you pick a group or a role, then it // includes only those context keys that are found in policies attached to that // entity. Note that all parameters are shown in unencoded form here for clarity, // but must be URL encoded to be included as a part of a real HTML request. For // more information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicySourceArn *string // An optional list of additional policies for which you want the list of context // keys that are referenced. The regex pattern (http://wikipedia.org/wiki/regex) // used to validate this parameter is a string of characters consisting of the // following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) PolicyInputList []string noSmithyDocumentSerde } // Contains the response to a successful GetContextKeysForPrincipalPolicy or // GetContextKeysForCustomPolicy request. type GetContextKeysForPrincipalPolicyOutput struct { // The list of context keys that are referenced in the input policies. ContextKeyNames []string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetContextKeysForPrincipalPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetContextKeysForPrincipalPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetContextKeysForPrincipalPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetContextKeysForPrincipalPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetContextKeysForPrincipalPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetContextKeysForPrincipalPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetContextKeysForPrincipalPolicy", } }
159
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // Retrieves a credential report for the Amazon Web Services account. For more // information about the credential report, see Getting credential reports (https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-reports.html) // in the IAM User Guide. func (c *Client) GetCredentialReport(ctx context.Context, params *GetCredentialReportInput, optFns ...func(*Options)) (*GetCredentialReportOutput, error) { if params == nil { params = &GetCredentialReportInput{} } result, metadata, err := c.invokeOperation(ctx, "GetCredentialReport", params, optFns, c.addOperationGetCredentialReportMiddlewares) if err != nil { return nil, err } out := result.(*GetCredentialReportOutput) out.ResultMetadata = metadata return out, nil } type GetCredentialReportInput struct { noSmithyDocumentSerde } // Contains the response to a successful GetCredentialReport request. type GetCredentialReportOutput struct { // Contains the credential report. The report is Base64-encoded. Content []byte // The date and time when the credential report was created, in ISO 8601 date-time // format (http://www.iso.org/iso/iso8601) . GeneratedTime *time.Time // The format (MIME type) of the credential report. ReportFormat types.ReportFormatType // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetCredentialReportMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetCredentialReport{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetCredentialReport{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetCredentialReport(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetCredentialReport(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetCredentialReport", } }
127
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Returns a list of IAM users that are in the specified IAM group. You can // paginate the results using the MaxItems and Marker parameters. func (c *Client) GetGroup(ctx context.Context, params *GetGroupInput, optFns ...func(*Options)) (*GetGroupOutput, error) { if params == nil { params = &GetGroupInput{} } result, metadata, err := c.invokeOperation(ctx, "GetGroup", params, optFns, c.addOperationGetGroupMiddlewares) if err != nil { return nil, err } out := result.(*GetGroupOutput) out.ResultMetadata = metadata return out, nil } type GetGroupInput struct { // The name of the group. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. GroupName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful GetGroup request. type GetGroupOutput struct { // A structure that contains details about the group. // // This member is required. Group *types.Group // A list of users in the group. // // This member is required. Users []types.User // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetGroup{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetGroup{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetGroupValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGroup(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // GetGroupAPIClient is a client that implements the GetGroup operation. type GetGroupAPIClient interface { GetGroup(context.Context, *GetGroupInput, ...func(*Options)) (*GetGroupOutput, error) } var _ GetGroupAPIClient = (*Client)(nil) // GetGroupPaginatorOptions is the paginator options for GetGroup type GetGroupPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // GetGroupPaginator is a paginator for GetGroup type GetGroupPaginator struct { options GetGroupPaginatorOptions client GetGroupAPIClient params *GetGroupInput nextToken *string firstPage bool } // NewGetGroupPaginator returns a new GetGroupPaginator func NewGetGroupPaginator(client GetGroupAPIClient, params *GetGroupInput, optFns ...func(*GetGroupPaginatorOptions)) *GetGroupPaginator { if params == nil { params = &GetGroupInput{} } options := GetGroupPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &GetGroupPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *GetGroupPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next GetGroup page. func (p *GetGroupPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetGroupOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.GetGroup(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opGetGroup(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetGroup", } }
260
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves the specified inline policy document that is embedded in the // specified IAM group. Policies returned by this operation are URL-encoded // compliant with RFC 3986 (https://tools.ietf.org/html/rfc3986) . You can use a // URL decoding method to convert the policy back to plain JSON text. For example, // if you use Java, you can use the decode method of the java.net.URLDecoder // utility class in the Java SDK. Other languages and SDKs provide similar // functionality. An IAM group can also have managed policies attached to it. To // retrieve a managed policy document that is attached to a group, use GetPolicy // to determine the policy's default version, then use GetPolicyVersion to // retrieve the policy document. For more information about policies, see Managed // policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. func (c *Client) GetGroupPolicy(ctx context.Context, params *GetGroupPolicyInput, optFns ...func(*Options)) (*GetGroupPolicyOutput, error) { if params == nil { params = &GetGroupPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetGroupPolicy", params, optFns, c.addOperationGetGroupPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetGroupPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetGroupPolicyInput struct { // The name of the group the policy is associated with. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. GroupName *string // The name of the policy document to get. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. PolicyName *string noSmithyDocumentSerde } // Contains the response to a successful GetGroupPolicy request. type GetGroupPolicyOutput struct { // The group the policy is associated with. // // This member is required. GroupName *string // The policy document. IAM stores policies in JSON format. However, resources // that were created using CloudFormation templates can be formatted in YAML. // CloudFormation always converts a YAML policy to JSON format before submitting it // to IAM. // // This member is required. PolicyDocument *string // The name of the policy. // // This member is required. PolicyName *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetGroupPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetGroupPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetGroupPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetGroupPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGroupPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetGroupPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetGroupPolicy", } }
162
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "errors" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithytime "github.com/aws/smithy-go/time" smithyhttp "github.com/aws/smithy-go/transport/http" smithywaiter "github.com/aws/smithy-go/waiter" "time" ) // Retrieves information about the specified instance profile, including the // instance profile's path, GUID, ARN, and role. For more information about // instance profiles, see About instance profiles (https://docs.aws.amazon.com/IAM/latest/UserGuide/AboutInstanceProfiles.html) // in the IAM User Guide. func (c *Client) GetInstanceProfile(ctx context.Context, params *GetInstanceProfileInput, optFns ...func(*Options)) (*GetInstanceProfileOutput, error) { if params == nil { params = &GetInstanceProfileInput{} } result, metadata, err := c.invokeOperation(ctx, "GetInstanceProfile", params, optFns, c.addOperationGetInstanceProfileMiddlewares) if err != nil { return nil, err } out := result.(*GetInstanceProfileOutput) out.ResultMetadata = metadata return out, nil } type GetInstanceProfileInput struct { // The name of the instance profile to get information about. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. InstanceProfileName *string noSmithyDocumentSerde } // Contains the response to a successful GetInstanceProfile request. type GetInstanceProfileOutput struct { // A structure containing details about the instance profile. // // This member is required. InstanceProfile *types.InstanceProfile // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetInstanceProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetInstanceProfile{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetInstanceProfile{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetInstanceProfileValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetInstanceProfile(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // GetInstanceProfileAPIClient is a client that implements the GetInstanceProfile // operation. type GetInstanceProfileAPIClient interface { GetInstanceProfile(context.Context, *GetInstanceProfileInput, ...func(*Options)) (*GetInstanceProfileOutput, error) } var _ GetInstanceProfileAPIClient = (*Client)(nil) // InstanceProfileExistsWaiterOptions are waiter options for // InstanceProfileExistsWaiter type InstanceProfileExistsWaiterOptions struct { // Set of options to modify how an operation is invoked. These apply to all // operations invoked for this client. Use functional options on operation call to // modify this list for per operation behavior. APIOptions []func(*middleware.Stack) error // MinDelay is the minimum amount of time to delay between retries. If unset, // InstanceProfileExistsWaiter will use default minimum delay of 1 seconds. Note // that MinDelay must resolve to a value lesser than or equal to the MaxDelay. MinDelay time.Duration // MaxDelay is the maximum amount of time to delay between retries. If unset or // set to zero, InstanceProfileExistsWaiter will use default max delay of 120 // seconds. Note that MaxDelay must resolve to value greater than or equal to the // MinDelay. MaxDelay time.Duration // LogWaitAttempts is used to enable logging for waiter retry attempts LogWaitAttempts bool // Retryable is function that can be used to override the service defined // waiter-behavior based on operation output, or returned error. This function is // used by the waiter to decide if a state is retryable or a terminal state. By // default service-modeled logic will populate this option. This option can thus be // used to define a custom waiter state with fall-back to service-modeled waiter // state mutators.The function returns an error in case of a failure state. In case // of retry state, this function returns a bool value of true and nil error, while // in case of success it returns a bool value of false and nil error. Retryable func(context.Context, *GetInstanceProfileInput, *GetInstanceProfileOutput, error) (bool, error) } // InstanceProfileExistsWaiter defines the waiters for InstanceProfileExists type InstanceProfileExistsWaiter struct { client GetInstanceProfileAPIClient options InstanceProfileExistsWaiterOptions } // NewInstanceProfileExistsWaiter constructs a InstanceProfileExistsWaiter. func NewInstanceProfileExistsWaiter(client GetInstanceProfileAPIClient, optFns ...func(*InstanceProfileExistsWaiterOptions)) *InstanceProfileExistsWaiter { options := InstanceProfileExistsWaiterOptions{} options.MinDelay = 1 * time.Second options.MaxDelay = 120 * time.Second options.Retryable = instanceProfileExistsStateRetryable for _, fn := range optFns { fn(&options) } return &InstanceProfileExistsWaiter{ client: client, options: options, } } // Wait calls the waiter function for InstanceProfileExists waiter. The maxWaitDur // is the maximum wait duration the waiter will wait. The maxWaitDur is required // and must be greater than zero. func (w *InstanceProfileExistsWaiter) Wait(ctx context.Context, params *GetInstanceProfileInput, maxWaitDur time.Duration, optFns ...func(*InstanceProfileExistsWaiterOptions)) error { _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) return err } // WaitForOutput calls the waiter function for InstanceProfileExists waiter and // returns the output of the successful operation. The maxWaitDur is the maximum // wait duration the waiter will wait. The maxWaitDur is required and must be // greater than zero. func (w *InstanceProfileExistsWaiter) WaitForOutput(ctx context.Context, params *GetInstanceProfileInput, maxWaitDur time.Duration, optFns ...func(*InstanceProfileExistsWaiterOptions)) (*GetInstanceProfileOutput, error) { if maxWaitDur <= 0 { return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options for _, fn := range optFns { fn(&options) } if options.MaxDelay <= 0 { options.MaxDelay = 120 * time.Second } if options.MinDelay > options.MaxDelay { return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) defer cancelFn() logger := smithywaiter.Logger{} remainingTime := maxWaitDur var attempt int64 for { attempt++ apiOptions := options.APIOptions start := time.Now() if options.LogWaitAttempts { logger.Attempt = attempt apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...) apiOptions = append(apiOptions, logger.AddLogger) } out, err := w.client.GetInstanceProfile(ctx, params, func(o *Options) { o.APIOptions = append(o.APIOptions, apiOptions...) }) retryable, err := options.Retryable(ctx, params, out, err) if err != nil { return nil, err } if !retryable { return out, nil } remainingTime -= time.Since(start) if remainingTime < options.MinDelay || remainingTime <= 0 { break } // compute exponential backoff between waiter retries delay, err := smithywaiter.ComputeDelay( attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } return nil, fmt.Errorf("exceeded max wait time for InstanceProfileExists waiter") } func instanceProfileExistsStateRetryable(ctx context.Context, input *GetInstanceProfileInput, output *GetInstanceProfileOutput, err error) (bool, error) { if err == nil { return false, nil } if err != nil { var errorType *types.NoSuchEntityException if errors.As(err, &errorType) { return true, nil } } return true, nil } func newServiceMetadataMiddleware_opGetInstanceProfile(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetInstanceProfile", } }
303
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves the user name for the specified IAM user. A login profile is created // when you create a password for the user to access the Amazon Web Services // Management Console. If the user does not exist or does not have a password, the // operation returns a 404 ( NoSuchEntity ) error. If you create an IAM user with // access to the console, the CreateDate reflects the date you created the initial // password for the user. If you create an IAM user with programmatic access, and // then later add a password for the user to access the Amazon Web Services // Management Console, the CreateDate reflects the initial password creation date. // A user with programmatic access does not have a login profile unless you create // a password for the user to access the Amazon Web Services Management Console. func (c *Client) GetLoginProfile(ctx context.Context, params *GetLoginProfileInput, optFns ...func(*Options)) (*GetLoginProfileOutput, error) { if params == nil { params = &GetLoginProfileInput{} } result, metadata, err := c.invokeOperation(ctx, "GetLoginProfile", params, optFns, c.addOperationGetLoginProfileMiddlewares) if err != nil { return nil, err } out := result.(*GetLoginProfileOutput) out.ResultMetadata = metadata return out, nil } type GetLoginProfileInput struct { // The name of the user whose login profile you want to retrieve. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } // Contains the response to a successful GetLoginProfile request. type GetLoginProfileOutput struct { // A structure containing the user name and the profile creation date for the user. // // This member is required. LoginProfile *types.LoginProfile // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetLoginProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetLoginProfile{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetLoginProfile{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetLoginProfileValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLoginProfile(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetLoginProfile(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetLoginProfile", } }
140
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // Retrieves information about an MFA device for a specified user. func (c *Client) GetMFADevice(ctx context.Context, params *GetMFADeviceInput, optFns ...func(*Options)) (*GetMFADeviceOutput, error) { if params == nil { params = &GetMFADeviceInput{} } result, metadata, err := c.invokeOperation(ctx, "GetMFADevice", params, optFns, c.addOperationGetMFADeviceMiddlewares) if err != nil { return nil, err } out := result.(*GetMFADeviceOutput) out.ResultMetadata = metadata return out, nil } type GetMFADeviceInput struct { // Serial number that uniquely identifies the MFA device. For this API, we only // accept FIDO security key ARNs (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) // . // // This member is required. SerialNumber *string // The friendly name identifying the user. UserName *string noSmithyDocumentSerde } type GetMFADeviceOutput struct { // Serial number that uniquely identifies the MFA device. For this API, we only // accept FIDO security key ARNs (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) // . // // This member is required. SerialNumber *string // The certifications of a specified user's MFA device. We currently provide // FIPS-140-2, FIPS-140-3, and FIDO certification levels obtained from FIDO // Alliance Metadata Service (MDS) (https://fidoalliance.org/metadata/) . Certifications map[string]string // The date that a specified user's MFA device was first enabled. EnableDate *time.Time // The friendly name identifying the user. UserName *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetMFADeviceMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetMFADevice{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetMFADevice{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetMFADeviceValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetMFADevice(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetMFADevice(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetMFADevice", } }
145
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // Returns information about the specified OpenID Connect (OIDC) provider resource // object in IAM. func (c *Client) GetOpenIDConnectProvider(ctx context.Context, params *GetOpenIDConnectProviderInput, optFns ...func(*Options)) (*GetOpenIDConnectProviderOutput, error) { if params == nil { params = &GetOpenIDConnectProviderInput{} } result, metadata, err := c.invokeOperation(ctx, "GetOpenIDConnectProvider", params, optFns, c.addOperationGetOpenIDConnectProviderMiddlewares) if err != nil { return nil, err } out := result.(*GetOpenIDConnectProviderOutput) out.ResultMetadata = metadata return out, nil } type GetOpenIDConnectProviderInput struct { // The Amazon Resource Name (ARN) of the OIDC provider resource object in IAM to // get information for. You can get a list of OIDC provider resource ARNs by using // the ListOpenIDConnectProviders operation. For more information about ARNs, see // Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. OpenIDConnectProviderArn *string noSmithyDocumentSerde } // Contains the response to a successful GetOpenIDConnectProvider request. type GetOpenIDConnectProviderOutput struct { // A list of client IDs (also known as audiences) that are associated with the // specified IAM OIDC provider resource object. For more information, see // CreateOpenIDConnectProvider . ClientIDList []string // The date and time when the IAM OIDC provider resource object was created in the // Amazon Web Services account. CreateDate *time.Time // A list of tags that are attached to the specified IAM OIDC provider. The // returned list of tags is sorted by tag key. For more information about tagging, // see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. Tags []types.Tag // A list of certificate thumbprints that are associated with the specified IAM // OIDC provider resource object. For more information, see // CreateOpenIDConnectProvider . ThumbprintList []string // The URL that the IAM OIDC provider resource object is associated with. For more // information, see CreateOpenIDConnectProvider . Url *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetOpenIDConnectProviderMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetOpenIDConnectProvider{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetOpenIDConnectProvider{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetOpenIDConnectProviderValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetOpenIDConnectProvider(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetOpenIDConnectProvider(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetOpenIDConnectProvider", } }
153
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // Retrieves the service last accessed data report for Organizations that was // previously generated using the GenerateOrganizationsAccessReport operation. // This operation retrieves the status of your report job and the report contents. // Depending on the parameters that you passed when you generated the report, the // data returned could include different information. For details, see // GenerateOrganizationsAccessReport . To call this operation, you must be signed // in to the management account in your organization. SCPs must be enabled for your // organization root. You must have permissions to perform this operation. For more // information, see Refining permissions using service last accessed data (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) // in the IAM User Guide. For each service that principals in an account (root // user, IAM users, or IAM roles) could access using SCPs, the operation returns // details about the most recent access attempt. If there was no attempt, the // service is listed without details about the most recent attempt to access the // service. If the operation fails, it returns the reason that it failed. By // default, the list is sorted by service namespace. func (c *Client) GetOrganizationsAccessReport(ctx context.Context, params *GetOrganizationsAccessReportInput, optFns ...func(*Options)) (*GetOrganizationsAccessReportOutput, error) { if params == nil { params = &GetOrganizationsAccessReportInput{} } result, metadata, err := c.invokeOperation(ctx, "GetOrganizationsAccessReport", params, optFns, c.addOperationGetOrganizationsAccessReportMiddlewares) if err != nil { return nil, err } out := result.(*GetOrganizationsAccessReportOutput) out.ResultMetadata = metadata return out, nil } type GetOrganizationsAccessReportInput struct { // The identifier of the request generated by the GenerateOrganizationsAccessReport // operation. // // This member is required. JobId *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The key that is used to sort the results. If you choose the namespace key, the // results are returned in alphabetical order. If you choose the time key, the // results are sorted numerically by the date and time. SortKey types.SortKeyType noSmithyDocumentSerde } type GetOrganizationsAccessReportOutput struct { // The date and time, in ISO 8601 date-time format (http://www.iso.org/iso/iso8601) // , when the report job was created. // // This member is required. JobCreationDate *time.Time // The status of the job. // // This member is required. JobStatus types.JobStatusType // An object that contains details about the most recent attempt to access the // service. AccessDetails []types.AccessDetail // Contains information about the reason that the operation failed. This data type // is used as a response element in the GetOrganizationsAccessReport , // GetServiceLastAccessedDetails , and GetServiceLastAccessedDetailsWithEntities // operations. ErrorDetails *types.ErrorDetails // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // The date and time, in ISO 8601 date-time format (http://www.iso.org/iso/iso8601) // , when the generated report job was completed or failed. This field is null if // the job is still in progress, as indicated by a job status value of IN_PROGRESS . JobCompletionDate *time.Time // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // The number of services that the applicable SCPs allow account principals to // access. NumberOfServicesAccessible *int32 // The number of services that account principals are allowed but did not attempt // to access. NumberOfServicesNotAccessed *int32 // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetOrganizationsAccessReportMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetOrganizationsAccessReport{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetOrganizationsAccessReport{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetOrganizationsAccessReportValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetOrganizationsAccessReport(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetOrganizationsAccessReport(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetOrganizationsAccessReport", } }
204
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "errors" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithytime "github.com/aws/smithy-go/time" smithyhttp "github.com/aws/smithy-go/transport/http" smithywaiter "github.com/aws/smithy-go/waiter" "time" ) // Retrieves information about the specified managed policy, including the // policy's default version and the total number of IAM users, groups, and roles to // which the policy is attached. To retrieve the list of the specific users, // groups, and roles that the policy is attached to, use ListEntitiesForPolicy . // This operation returns metadata about the policy. To retrieve the actual policy // document for a specific version of the policy, use GetPolicyVersion . This // operation retrieves information about managed policies. To retrieve information // about an inline policy that is embedded with an IAM user, group, or role, use // GetUserPolicy , GetGroupPolicy , or GetRolePolicy . For more information about // policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. func (c *Client) GetPolicy(ctx context.Context, params *GetPolicyInput, optFns ...func(*Options)) (*GetPolicyOutput, error) { if params == nil { params = &GetPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetPolicy", params, optFns, c.addOperationGetPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetPolicyInput struct { // The Amazon Resource Name (ARN) of the managed policy that you want information // about. For more information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicyArn *string noSmithyDocumentSerde } // Contains the response to a successful GetPolicy request. type GetPolicyOutput struct { // A structure containing details about the policy. Policy *types.Policy // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // GetPolicyAPIClient is a client that implements the GetPolicy operation. type GetPolicyAPIClient interface { GetPolicy(context.Context, *GetPolicyInput, ...func(*Options)) (*GetPolicyOutput, error) } var _ GetPolicyAPIClient = (*Client)(nil) // PolicyExistsWaiterOptions are waiter options for PolicyExistsWaiter type PolicyExistsWaiterOptions struct { // Set of options to modify how an operation is invoked. These apply to all // operations invoked for this client. Use functional options on operation call to // modify this list for per operation behavior. APIOptions []func(*middleware.Stack) error // MinDelay is the minimum amount of time to delay between retries. If unset, // PolicyExistsWaiter will use default minimum delay of 1 seconds. Note that // MinDelay must resolve to a value lesser than or equal to the MaxDelay. MinDelay time.Duration // MaxDelay is the maximum amount of time to delay between retries. If unset or // set to zero, PolicyExistsWaiter will use default max delay of 120 seconds. Note // that MaxDelay must resolve to value greater than or equal to the MinDelay. MaxDelay time.Duration // LogWaitAttempts is used to enable logging for waiter retry attempts LogWaitAttempts bool // Retryable is function that can be used to override the service defined // waiter-behavior based on operation output, or returned error. This function is // used by the waiter to decide if a state is retryable or a terminal state. By // default service-modeled logic will populate this option. This option can thus be // used to define a custom waiter state with fall-back to service-modeled waiter // state mutators.The function returns an error in case of a failure state. In case // of retry state, this function returns a bool value of true and nil error, while // in case of success it returns a bool value of false and nil error. Retryable func(context.Context, *GetPolicyInput, *GetPolicyOutput, error) (bool, error) } // PolicyExistsWaiter defines the waiters for PolicyExists type PolicyExistsWaiter struct { client GetPolicyAPIClient options PolicyExistsWaiterOptions } // NewPolicyExistsWaiter constructs a PolicyExistsWaiter. func NewPolicyExistsWaiter(client GetPolicyAPIClient, optFns ...func(*PolicyExistsWaiterOptions)) *PolicyExistsWaiter { options := PolicyExistsWaiterOptions{} options.MinDelay = 1 * time.Second options.MaxDelay = 120 * time.Second options.Retryable = policyExistsStateRetryable for _, fn := range optFns { fn(&options) } return &PolicyExistsWaiter{ client: client, options: options, } } // Wait calls the waiter function for PolicyExists waiter. The maxWaitDur is the // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *PolicyExistsWaiter) Wait(ctx context.Context, params *GetPolicyInput, maxWaitDur time.Duration, optFns ...func(*PolicyExistsWaiterOptions)) error { _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) return err } // WaitForOutput calls the waiter function for PolicyExists waiter and returns the // output of the successful operation. The maxWaitDur is the maximum wait duration // the waiter will wait. The maxWaitDur is required and must be greater than zero. func (w *PolicyExistsWaiter) WaitForOutput(ctx context.Context, params *GetPolicyInput, maxWaitDur time.Duration, optFns ...func(*PolicyExistsWaiterOptions)) (*GetPolicyOutput, error) { if maxWaitDur <= 0 { return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options for _, fn := range optFns { fn(&options) } if options.MaxDelay <= 0 { options.MaxDelay = 120 * time.Second } if options.MinDelay > options.MaxDelay { return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) defer cancelFn() logger := smithywaiter.Logger{} remainingTime := maxWaitDur var attempt int64 for { attempt++ apiOptions := options.APIOptions start := time.Now() if options.LogWaitAttempts { logger.Attempt = attempt apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...) apiOptions = append(apiOptions, logger.AddLogger) } out, err := w.client.GetPolicy(ctx, params, func(o *Options) { o.APIOptions = append(o.APIOptions, apiOptions...) }) retryable, err := options.Retryable(ctx, params, out, err) if err != nil { return nil, err } if !retryable { return out, nil } remainingTime -= time.Since(start) if remainingTime < options.MinDelay || remainingTime <= 0 { break } // compute exponential backoff between waiter retries delay, err := smithywaiter.ComputeDelay( attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } return nil, fmt.Errorf("exceeded max wait time for PolicyExists waiter") } func policyExistsStateRetryable(ctx context.Context, input *GetPolicyInput, output *GetPolicyOutput, err error) (bool, error) { if err == nil { return false, nil } if err != nil { var apiErr smithy.APIError ok := errors.As(err, &apiErr) if !ok { return false, fmt.Errorf("expected err to be of type smithy.APIError, got %w", err) } if "NoSuchEntity" == apiErr.ErrorCode() { return true, nil } } return true, nil } func newServiceMetadataMiddleware_opGetPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetPolicy", } }
309
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves information about the specified version of the specified managed // policy, including the policy document. Policies returned by this operation are // URL-encoded compliant with RFC 3986 (https://tools.ietf.org/html/rfc3986) . You // can use a URL decoding method to convert the policy back to plain JSON text. For // example, if you use Java, you can use the decode method of the // java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs // provide similar functionality. To list the available versions for a policy, use // ListPolicyVersions . This operation retrieves information about managed // policies. To retrieve information about an inline policy that is embedded in a // user, group, or role, use GetUserPolicy , GetGroupPolicy , or GetRolePolicy . // For more information about the types of policies, see Managed policies and // inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. For more information about managed policy versions, see // Versioning for managed policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html) // in the IAM User Guide. func (c *Client) GetPolicyVersion(ctx context.Context, params *GetPolicyVersionInput, optFns ...func(*Options)) (*GetPolicyVersionOutput, error) { if params == nil { params = &GetPolicyVersionInput{} } result, metadata, err := c.invokeOperation(ctx, "GetPolicyVersion", params, optFns, c.addOperationGetPolicyVersionMiddlewares) if err != nil { return nil, err } out := result.(*GetPolicyVersionOutput) out.ResultMetadata = metadata return out, nil } type GetPolicyVersionInput struct { // The Amazon Resource Name (ARN) of the managed policy that you want information // about. For more information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicyArn *string // Identifies the policy version to retrieve. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters that // consists of the lowercase letter 'v' followed by one or two digits, and // optionally followed by a period '.' and a string of letters and digits. // // This member is required. VersionId *string noSmithyDocumentSerde } // Contains the response to a successful GetPolicyVersion request. type GetPolicyVersionOutput struct { // A structure containing details about the policy version. PolicyVersion *types.PolicyVersion // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetPolicyVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetPolicyVersion{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetPolicyVersion{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetPolicyVersionValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPolicyVersion(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetPolicyVersion(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetPolicyVersion", } }
150
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "errors" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithytime "github.com/aws/smithy-go/time" smithyhttp "github.com/aws/smithy-go/transport/http" smithywaiter "github.com/aws/smithy-go/waiter" "time" ) // Retrieves information about the specified role, including the role's path, // GUID, ARN, and the role's trust policy that grants permission to assume the // role. For more information about roles, see Working with roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html) // . Policies returned by this operation are URL-encoded compliant with RFC 3986 (https://tools.ietf.org/html/rfc3986) // . You can use a URL decoding method to convert the policy back to plain JSON // text. For example, if you use Java, you can use the decode method of the // java.net.URLDecoder utility class in the Java SDK. Other languages and SDKs // provide similar functionality. func (c *Client) GetRole(ctx context.Context, params *GetRoleInput, optFns ...func(*Options)) (*GetRoleOutput, error) { if params == nil { params = &GetRoleInput{} } result, metadata, err := c.invokeOperation(ctx, "GetRole", params, optFns, c.addOperationGetRoleMiddlewares) if err != nil { return nil, err } out := result.(*GetRoleOutput) out.ResultMetadata = metadata return out, nil } type GetRoleInput struct { // The name of the IAM role to get information about. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. RoleName *string noSmithyDocumentSerde } // Contains the response to a successful GetRole request. type GetRoleOutput struct { // A structure containing details about the IAM role. // // This member is required. Role *types.Role // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetRoleMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetRole{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetRole{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetRoleValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRole(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // GetRoleAPIClient is a client that implements the GetRole operation. type GetRoleAPIClient interface { GetRole(context.Context, *GetRoleInput, ...func(*Options)) (*GetRoleOutput, error) } var _ GetRoleAPIClient = (*Client)(nil) // RoleExistsWaiterOptions are waiter options for RoleExistsWaiter type RoleExistsWaiterOptions struct { // Set of options to modify how an operation is invoked. These apply to all // operations invoked for this client. Use functional options on operation call to // modify this list for per operation behavior. APIOptions []func(*middleware.Stack) error // MinDelay is the minimum amount of time to delay between retries. If unset, // RoleExistsWaiter will use default minimum delay of 1 seconds. Note that MinDelay // must resolve to a value lesser than or equal to the MaxDelay. MinDelay time.Duration // MaxDelay is the maximum amount of time to delay between retries. If unset or // set to zero, RoleExistsWaiter will use default max delay of 120 seconds. Note // that MaxDelay must resolve to value greater than or equal to the MinDelay. MaxDelay time.Duration // LogWaitAttempts is used to enable logging for waiter retry attempts LogWaitAttempts bool // Retryable is function that can be used to override the service defined // waiter-behavior based on operation output, or returned error. This function is // used by the waiter to decide if a state is retryable or a terminal state. By // default service-modeled logic will populate this option. This option can thus be // used to define a custom waiter state with fall-back to service-modeled waiter // state mutators.The function returns an error in case of a failure state. In case // of retry state, this function returns a bool value of true and nil error, while // in case of success it returns a bool value of false and nil error. Retryable func(context.Context, *GetRoleInput, *GetRoleOutput, error) (bool, error) } // RoleExistsWaiter defines the waiters for RoleExists type RoleExistsWaiter struct { client GetRoleAPIClient options RoleExistsWaiterOptions } // NewRoleExistsWaiter constructs a RoleExistsWaiter. func NewRoleExistsWaiter(client GetRoleAPIClient, optFns ...func(*RoleExistsWaiterOptions)) *RoleExistsWaiter { options := RoleExistsWaiterOptions{} options.MinDelay = 1 * time.Second options.MaxDelay = 120 * time.Second options.Retryable = roleExistsStateRetryable for _, fn := range optFns { fn(&options) } return &RoleExistsWaiter{ client: client, options: options, } } // Wait calls the waiter function for RoleExists waiter. The maxWaitDur is the // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *RoleExistsWaiter) Wait(ctx context.Context, params *GetRoleInput, maxWaitDur time.Duration, optFns ...func(*RoleExistsWaiterOptions)) error { _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) return err } // WaitForOutput calls the waiter function for RoleExists waiter and returns the // output of the successful operation. The maxWaitDur is the maximum wait duration // the waiter will wait. The maxWaitDur is required and must be greater than zero. func (w *RoleExistsWaiter) WaitForOutput(ctx context.Context, params *GetRoleInput, maxWaitDur time.Duration, optFns ...func(*RoleExistsWaiterOptions)) (*GetRoleOutput, error) { if maxWaitDur <= 0 { return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options for _, fn := range optFns { fn(&options) } if options.MaxDelay <= 0 { options.MaxDelay = 120 * time.Second } if options.MinDelay > options.MaxDelay { return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) defer cancelFn() logger := smithywaiter.Logger{} remainingTime := maxWaitDur var attempt int64 for { attempt++ apiOptions := options.APIOptions start := time.Now() if options.LogWaitAttempts { logger.Attempt = attempt apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...) apiOptions = append(apiOptions, logger.AddLogger) } out, err := w.client.GetRole(ctx, params, func(o *Options) { o.APIOptions = append(o.APIOptions, apiOptions...) }) retryable, err := options.Retryable(ctx, params, out, err) if err != nil { return nil, err } if !retryable { return out, nil } remainingTime -= time.Since(start) if remainingTime < options.MinDelay || remainingTime <= 0 { break } // compute exponential backoff between waiter retries delay, err := smithywaiter.ComputeDelay( attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } return nil, fmt.Errorf("exceeded max wait time for RoleExists waiter") } func roleExistsStateRetryable(ctx context.Context, input *GetRoleInput, output *GetRoleOutput, err error) (bool, error) { if err == nil { return false, nil } if err != nil { var apiErr smithy.APIError ok := errors.As(err, &apiErr) if !ok { return false, fmt.Errorf("expected err to be of type smithy.APIError, got %w", err) } if "NoSuchEntity" == apiErr.ErrorCode() { return true, nil } } return true, nil } func newServiceMetadataMiddleware_opGetRole(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetRole", } }
309
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves the specified inline policy document that is embedded with the // specified IAM role. Policies returned by this operation are URL-encoded // compliant with RFC 3986 (https://tools.ietf.org/html/rfc3986) . You can use a // URL decoding method to convert the policy back to plain JSON text. For example, // if you use Java, you can use the decode method of the java.net.URLDecoder // utility class in the Java SDK. Other languages and SDKs provide similar // functionality. An IAM role can also have managed policies attached to it. To // retrieve a managed policy document that is attached to a role, use GetPolicy to // determine the policy's default version, then use GetPolicyVersion to retrieve // the policy document. For more information about policies, see Managed policies // and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. For more information about roles, see Using roles to // delegate permissions and federate identities (https://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html) // . func (c *Client) GetRolePolicy(ctx context.Context, params *GetRolePolicyInput, optFns ...func(*Options)) (*GetRolePolicyOutput, error) { if params == nil { params = &GetRolePolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetRolePolicy", params, optFns, c.addOperationGetRolePolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetRolePolicyOutput) out.ResultMetadata = metadata return out, nil } type GetRolePolicyInput struct { // The name of the policy document to get. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. PolicyName *string // The name of the role associated with the policy. This parameter allows (through // its regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. RoleName *string noSmithyDocumentSerde } // Contains the response to a successful GetRolePolicy request. type GetRolePolicyOutput struct { // The policy document. IAM stores policies in JSON format. However, resources // that were created using CloudFormation templates can be formatted in YAML. // CloudFormation always converts a YAML policy to JSON format before submitting it // to IAM. // // This member is required. PolicyDocument *string // The name of the policy. // // This member is required. PolicyName *string // The role the policy is associated with. // // This member is required. RoleName *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetRolePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetRolePolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetRolePolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetRolePolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRolePolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetRolePolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetRolePolicy", } }
164
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // Returns the SAML provider metadocument that was uploaded when the IAM SAML // provider resource object was created or updated. This operation requires // Signature Version 4 (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) // . func (c *Client) GetSAMLProvider(ctx context.Context, params *GetSAMLProviderInput, optFns ...func(*Options)) (*GetSAMLProviderOutput, error) { if params == nil { params = &GetSAMLProviderInput{} } result, metadata, err := c.invokeOperation(ctx, "GetSAMLProvider", params, optFns, c.addOperationGetSAMLProviderMiddlewares) if err != nil { return nil, err } out := result.(*GetSAMLProviderOutput) out.ResultMetadata = metadata return out, nil } type GetSAMLProviderInput struct { // The Amazon Resource Name (ARN) of the SAML provider resource object in IAM to // get information about. For more information about ARNs, see Amazon Resource // Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. SAMLProviderArn *string noSmithyDocumentSerde } // Contains the response to a successful GetSAMLProvider request. type GetSAMLProviderOutput struct { // The date and time when the SAML provider was created. CreateDate *time.Time // The XML metadata document that includes information about an identity provider. SAMLMetadataDocument *string // A list of tags that are attached to the specified IAM SAML provider. The // returned list of tags is sorted by tag key. For more information about tagging, // see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. Tags []types.Tag // The expiration date and time for the SAML provider. ValidUntil *time.Time // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetSAMLProviderMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetSAMLProvider{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetSAMLProvider{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetSAMLProviderValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSAMLProvider(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetSAMLProvider(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetSAMLProvider", } }
145
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves information about the specified server certificate stored in IAM. For // more information about working with server certificates, see Working with // server certificates (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html) // in the IAM User Guide. This topic includes a list of Amazon Web Services // services that can use the server certificates that you manage with IAM. func (c *Client) GetServerCertificate(ctx context.Context, params *GetServerCertificateInput, optFns ...func(*Options)) (*GetServerCertificateOutput, error) { if params == nil { params = &GetServerCertificateInput{} } result, metadata, err := c.invokeOperation(ctx, "GetServerCertificate", params, optFns, c.addOperationGetServerCertificateMiddlewares) if err != nil { return nil, err } out := result.(*GetServerCertificateOutput) out.ResultMetadata = metadata return out, nil } type GetServerCertificateInput struct { // The name of the server certificate you want to retrieve information about. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. ServerCertificateName *string noSmithyDocumentSerde } // Contains the response to a successful GetServerCertificate request. type GetServerCertificateOutput struct { // A structure containing details about the server certificate. // // This member is required. ServerCertificate *types.ServerCertificate // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetServerCertificateMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetServerCertificate{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetServerCertificate{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetServerCertificateValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetServerCertificate(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetServerCertificate(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetServerCertificate", } }
135
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // Retrieves a service last accessed report that was created using the // GenerateServiceLastAccessedDetails operation. You can use the JobId parameter // in GetServiceLastAccessedDetails to retrieve the status of your report job. // When the report is complete, you can retrieve the generated report. The report // includes a list of Amazon Web Services services that the resource (user, group, // role, or managed policy) can access. Service last accessed data does not use // other policy types when determining whether a resource could access a service. // These other policy types include resource-based policies, access control lists, // Organizations policies, IAM permissions boundaries, and STS assume role // policies. It only applies permissions policy logic. For more about the // evaluation of policy types, see Evaluating policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-basics) // in the IAM User Guide. For each service that the resource could access using // permissions policies, the operation returns details about the most recent access // attempt. If there was no attempt, the service is listed without details about // the most recent attempt to access the service. If the operation fails, the // GetServiceLastAccessedDetails operation returns the reason that it failed. The // GetServiceLastAccessedDetails operation returns a list of services. This list // includes the number of entities that have attempted to access the service and // the date and time of the last attempt. It also returns the ARN of the following // entity, depending on the resource ARN that you used to generate the report: // - User – Returns the user ARN that you used to generate the report // - Group – Returns the ARN of the group member (user) that last attempted to // access the service // - Role – Returns the role ARN that you used to generate the report // - Policy – Returns the ARN of the user or role that last used the policy to // attempt to access the service // // By default, the list is sorted by service namespace. If you specified // ACTION_LEVEL granularity when you generated the report, this operation returns // service and action last accessed data. This includes the most recent access // attempt for each tracked action within a service. Otherwise, this operation // returns only service data. For more information about service and action last // accessed data, see Reducing permissions using service last accessed data (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) // in the IAM User Guide. func (c *Client) GetServiceLastAccessedDetails(ctx context.Context, params *GetServiceLastAccessedDetailsInput, optFns ...func(*Options)) (*GetServiceLastAccessedDetailsOutput, error) { if params == nil { params = &GetServiceLastAccessedDetailsInput{} } result, metadata, err := c.invokeOperation(ctx, "GetServiceLastAccessedDetails", params, optFns, c.addOperationGetServiceLastAccessedDetailsMiddlewares) if err != nil { return nil, err } out := result.(*GetServiceLastAccessedDetailsOutput) out.ResultMetadata = metadata return out, nil } type GetServiceLastAccessedDetailsInput struct { // The ID of the request generated by the GenerateServiceLastAccessedDetails // operation. The JobId returned by GenerateServiceLastAccessedDetail must be used // by the same role within a session, or by the same user when used to call // GetServiceLastAccessedDetail . // // This member is required. JobId *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type GetServiceLastAccessedDetailsOutput struct { // The date and time, in ISO 8601 date-time format (http://www.iso.org/iso/iso8601) // , when the generated report job was completed or failed. This field is null if // the job is still in progress, as indicated by a job status value of IN_PROGRESS . // // This member is required. JobCompletionDate *time.Time // The date and time, in ISO 8601 date-time format (http://www.iso.org/iso/iso8601) // , when the report job was created. // // This member is required. JobCreationDate *time.Time // The status of the job. // // This member is required. JobStatus types.JobStatusType // A ServiceLastAccessed object that contains details about the most recent // attempt to access the service. // // This member is required. ServicesLastAccessed []types.ServiceLastAccessed // An object that contains details about the reason the operation failed. Error *types.ErrorDetails // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // The type of job. Service jobs return information about when each service was // last accessed. Action jobs also include information about when tracked actions // within the service were last accessed. JobType types.AccessAdvisorUsageGranularityType // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetServiceLastAccessedDetailsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetServiceLastAccessedDetails{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetServiceLastAccessedDetails{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetServiceLastAccessedDetailsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetServiceLastAccessedDetails(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetServiceLastAccessedDetails(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetServiceLastAccessedDetails", } }
218
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // After you generate a group or policy report using the // GenerateServiceLastAccessedDetails operation, you can use the JobId parameter // in GetServiceLastAccessedDetailsWithEntities . This operation retrieves the // status of your report job and a list of entities that could have used group or // policy permissions to access the specified service. // - Group – For a group report, this operation returns a list of users in the // group that could have used the group’s policies in an attempt to access the // service. // - Policy – For a policy report, this operation returns a list of entities // (users or roles) that could have used the policy in an attempt to access the // service. // // You can also use this operation for user or role reports to retrieve details // about those entities. If the operation fails, the // GetServiceLastAccessedDetailsWithEntities operation returns the reason that it // failed. By default, the list of associated entities is sorted by date, with the // most recent access listed first. func (c *Client) GetServiceLastAccessedDetailsWithEntities(ctx context.Context, params *GetServiceLastAccessedDetailsWithEntitiesInput, optFns ...func(*Options)) (*GetServiceLastAccessedDetailsWithEntitiesOutput, error) { if params == nil { params = &GetServiceLastAccessedDetailsWithEntitiesInput{} } result, metadata, err := c.invokeOperation(ctx, "GetServiceLastAccessedDetailsWithEntities", params, optFns, c.addOperationGetServiceLastAccessedDetailsWithEntitiesMiddlewares) if err != nil { return nil, err } out := result.(*GetServiceLastAccessedDetailsWithEntitiesOutput) out.ResultMetadata = metadata return out, nil } type GetServiceLastAccessedDetailsWithEntitiesInput struct { // The ID of the request generated by the GenerateServiceLastAccessedDetails // operation. // // This member is required. JobId *string // The service namespace for an Amazon Web Services service. Provide the service // namespace to learn when the IAM entity last attempted to access the specified // service. To learn the service namespace for a service, see Actions, resources, // and condition keys for Amazon Web Services services (https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html) // in the IAM User Guide. Choose the name of the service to view details for that // service. In the first paragraph, find the service prefix. For example, (service // prefix: a4b) . For more information about service namespaces, see Amazon Web // Services service namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces) // in the Amazon Web Services General Reference. // // This member is required. ServiceNamespace *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type GetServiceLastAccessedDetailsWithEntitiesOutput struct { // An EntityDetailsList object that contains details about when an IAM entity // (user or role) used group or policy permissions in an attempt to access the // specified Amazon Web Services service. // // This member is required. EntityDetailsList []types.EntityDetails // The date and time, in ISO 8601 date-time format (http://www.iso.org/iso/iso8601) // , when the generated report job was completed or failed. This field is null if // the job is still in progress, as indicated by a job status value of IN_PROGRESS . // // This member is required. JobCompletionDate *time.Time // The date and time, in ISO 8601 date-time format (http://www.iso.org/iso/iso8601) // , when the report job was created. // // This member is required. JobCreationDate *time.Time // The status of the job. // // This member is required. JobStatus types.JobStatusType // An object that contains details about the reason the operation failed. Error *types.ErrorDetails // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetServiceLastAccessedDetailsWithEntitiesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetServiceLastAccessedDetailsWithEntities{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetServiceLastAccessedDetailsWithEntities{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetServiceLastAccessedDetailsWithEntitiesValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetServiceLastAccessedDetailsWithEntities(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetServiceLastAccessedDetailsWithEntities(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetServiceLastAccessedDetailsWithEntities", } }
208
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves the status of your service-linked role deletion. After you use // DeleteServiceLinkedRole to submit a service-linked role for deletion, you can // use the DeletionTaskId parameter in GetServiceLinkedRoleDeletionStatus to check // the status of the deletion. If the deletion fails, this operation returns the // reason that it failed, if that information is returned by the service. func (c *Client) GetServiceLinkedRoleDeletionStatus(ctx context.Context, params *GetServiceLinkedRoleDeletionStatusInput, optFns ...func(*Options)) (*GetServiceLinkedRoleDeletionStatusOutput, error) { if params == nil { params = &GetServiceLinkedRoleDeletionStatusInput{} } result, metadata, err := c.invokeOperation(ctx, "GetServiceLinkedRoleDeletionStatus", params, optFns, c.addOperationGetServiceLinkedRoleDeletionStatusMiddlewares) if err != nil { return nil, err } out := result.(*GetServiceLinkedRoleDeletionStatusOutput) out.ResultMetadata = metadata return out, nil } type GetServiceLinkedRoleDeletionStatusInput struct { // The deletion task identifier. This identifier is returned by the // DeleteServiceLinkedRole operation in the format task/aws-service-role/// . // // This member is required. DeletionTaskId *string noSmithyDocumentSerde } type GetServiceLinkedRoleDeletionStatusOutput struct { // The status of the deletion. // // This member is required. Status types.DeletionTaskStatusType // An object that contains details about the reason the deletion failed. Reason *types.DeletionTaskFailureReasonType // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetServiceLinkedRoleDeletionStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetServiceLinkedRoleDeletionStatus{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetServiceLinkedRoleDeletionStatus{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetServiceLinkedRoleDeletionStatusValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetServiceLinkedRoleDeletionStatus(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetServiceLinkedRoleDeletionStatus(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetServiceLinkedRoleDeletionStatus", } }
135
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves the specified SSH public key, including metadata about the key. The // SSH public key retrieved by this operation is used only for authenticating the // associated IAM user to an CodeCommit repository. For more information about // using SSH keys to authenticate to an CodeCommit repository, see Set up // CodeCommit for SSH connections (https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-credentials-ssh.html) // in the CodeCommit User Guide. func (c *Client) GetSSHPublicKey(ctx context.Context, params *GetSSHPublicKeyInput, optFns ...func(*Options)) (*GetSSHPublicKeyOutput, error) { if params == nil { params = &GetSSHPublicKeyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetSSHPublicKey", params, optFns, c.addOperationGetSSHPublicKeyMiddlewares) if err != nil { return nil, err } out := result.(*GetSSHPublicKeyOutput) out.ResultMetadata = metadata return out, nil } type GetSSHPublicKeyInput struct { // Specifies the public key encoding format to use in the response. To retrieve // the public key in ssh-rsa format, use SSH . To retrieve the public key in PEM // format, use PEM . // // This member is required. Encoding types.EncodingType // The unique identifier for the SSH public key. This parameter allows (through // its regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // that can consist of any upper or lowercased letter or digit. // // This member is required. SSHPublicKeyId *string // The name of the IAM user associated with the SSH public key. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } // Contains the response to a successful GetSSHPublicKey request. type GetSSHPublicKeyOutput struct { // A structure containing details about the SSH public key. SSHPublicKey *types.SSHPublicKey // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetSSHPublicKeyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetSSHPublicKey{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetSSHPublicKey{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetSSHPublicKeyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSSHPublicKey(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetSSHPublicKey(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetSSHPublicKey", } }
148
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "errors" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithytime "github.com/aws/smithy-go/time" smithyhttp "github.com/aws/smithy-go/transport/http" smithywaiter "github.com/aws/smithy-go/waiter" "time" ) // Retrieves information about the specified IAM user, including the user's // creation date, path, unique ID, and ARN. If you do not specify a user name, IAM // determines the user name implicitly based on the Amazon Web Services access key // ID used to sign the request to this operation. func (c *Client) GetUser(ctx context.Context, params *GetUserInput, optFns ...func(*Options)) (*GetUserOutput, error) { if params == nil { params = &GetUserInput{} } result, metadata, err := c.invokeOperation(ctx, "GetUser", params, optFns, c.addOperationGetUserMiddlewares) if err != nil { return nil, err } out := result.(*GetUserOutput) out.ResultMetadata = metadata return out, nil } type GetUserInput struct { // The name of the user to get information about. This parameter is optional. If // it is not included, it defaults to the user making the request. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- UserName *string noSmithyDocumentSerde } // Contains the response to a successful GetUser request. type GetUserOutput struct { // A structure containing details about the IAM user. Due to a service issue, // password last used data does not include password use from May 3, 2018 22:50 PDT // to May 23, 2018 14:08 PDT. This affects last sign-in (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_finding-unused.html) // dates shown in the IAM console and password last used dates in the IAM // credential report (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html) // , and returned by this operation. If users signed in during the affected time, // the password last used date that is returned is the date the user last signed in // before May 3, 2018. For users that signed in after May 23, 2018 14:08 PDT, the // returned password last used date is accurate. You can use password last used // information to identify unused credentials for deletion. For example, you might // delete users who did not sign in to Amazon Web Services in the last 90 days. In // cases like this, we recommend that you adjust your evaluation window to include // dates after May 23, 2018. Alternatively, if your users use access keys to access // Amazon Web Services programmatically you can refer to access key last used // information because it is accurate for all dates. // // This member is required. User *types.User // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetUserMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetUser{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetUser{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetUser(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // GetUserAPIClient is a client that implements the GetUser operation. type GetUserAPIClient interface { GetUser(context.Context, *GetUserInput, ...func(*Options)) (*GetUserOutput, error) } var _ GetUserAPIClient = (*Client)(nil) // UserExistsWaiterOptions are waiter options for UserExistsWaiter type UserExistsWaiterOptions struct { // Set of options to modify how an operation is invoked. These apply to all // operations invoked for this client. Use functional options on operation call to // modify this list for per operation behavior. APIOptions []func(*middleware.Stack) error // MinDelay is the minimum amount of time to delay between retries. If unset, // UserExistsWaiter will use default minimum delay of 1 seconds. Note that MinDelay // must resolve to a value lesser than or equal to the MaxDelay. MinDelay time.Duration // MaxDelay is the maximum amount of time to delay between retries. If unset or // set to zero, UserExistsWaiter will use default max delay of 120 seconds. Note // that MaxDelay must resolve to value greater than or equal to the MinDelay. MaxDelay time.Duration // LogWaitAttempts is used to enable logging for waiter retry attempts LogWaitAttempts bool // Retryable is function that can be used to override the service defined // waiter-behavior based on operation output, or returned error. This function is // used by the waiter to decide if a state is retryable or a terminal state. By // default service-modeled logic will populate this option. This option can thus be // used to define a custom waiter state with fall-back to service-modeled waiter // state mutators.The function returns an error in case of a failure state. In case // of retry state, this function returns a bool value of true and nil error, while // in case of success it returns a bool value of false and nil error. Retryable func(context.Context, *GetUserInput, *GetUserOutput, error) (bool, error) } // UserExistsWaiter defines the waiters for UserExists type UserExistsWaiter struct { client GetUserAPIClient options UserExistsWaiterOptions } // NewUserExistsWaiter constructs a UserExistsWaiter. func NewUserExistsWaiter(client GetUserAPIClient, optFns ...func(*UserExistsWaiterOptions)) *UserExistsWaiter { options := UserExistsWaiterOptions{} options.MinDelay = 1 * time.Second options.MaxDelay = 120 * time.Second options.Retryable = userExistsStateRetryable for _, fn := range optFns { fn(&options) } return &UserExistsWaiter{ client: client, options: options, } } // Wait calls the waiter function for UserExists waiter. The maxWaitDur is the // maximum wait duration the waiter will wait. The maxWaitDur is required and must // be greater than zero. func (w *UserExistsWaiter) Wait(ctx context.Context, params *GetUserInput, maxWaitDur time.Duration, optFns ...func(*UserExistsWaiterOptions)) error { _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) return err } // WaitForOutput calls the waiter function for UserExists waiter and returns the // output of the successful operation. The maxWaitDur is the maximum wait duration // the waiter will wait. The maxWaitDur is required and must be greater than zero. func (w *UserExistsWaiter) WaitForOutput(ctx context.Context, params *GetUserInput, maxWaitDur time.Duration, optFns ...func(*UserExistsWaiterOptions)) (*GetUserOutput, error) { if maxWaitDur <= 0 { return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") } options := w.options for _, fn := range optFns { fn(&options) } if options.MaxDelay <= 0 { options.MaxDelay = 120 * time.Second } if options.MinDelay > options.MaxDelay { return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) } ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) defer cancelFn() logger := smithywaiter.Logger{} remainingTime := maxWaitDur var attempt int64 for { attempt++ apiOptions := options.APIOptions start := time.Now() if options.LogWaitAttempts { logger.Attempt = attempt apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...) apiOptions = append(apiOptions, logger.AddLogger) } out, err := w.client.GetUser(ctx, params, func(o *Options) { o.APIOptions = append(o.APIOptions, apiOptions...) }) retryable, err := options.Retryable(ctx, params, out, err) if err != nil { return nil, err } if !retryable { return out, nil } remainingTime -= time.Since(start) if remainingTime < options.MinDelay || remainingTime <= 0 { break } // compute exponential backoff between waiter retries delay, err := smithywaiter.ComputeDelay( attempt, options.MinDelay, options.MaxDelay, remainingTime, ) if err != nil { return nil, fmt.Errorf("error computing waiter delay, %w", err) } remainingTime -= delay // sleep for the delay amount before invoking a request if err := smithytime.SleepWithContext(ctx, delay); err != nil { return nil, fmt.Errorf("request cancelled while waiting, %w", err) } } return nil, fmt.Errorf("exceeded max wait time for UserExists waiter") } func userExistsStateRetryable(ctx context.Context, input *GetUserInput, output *GetUserOutput, err error) (bool, error) { if err == nil { return false, nil } if err != nil { var apiErr smithy.APIError ok := errors.As(err, &apiErr) if !ok { return false, fmt.Errorf("expected err to be of type smithy.APIError, got %w", err) } if "NoSuchEntity" == apiErr.ErrorCode() { return true, nil } } return true, nil } func newServiceMetadataMiddleware_opGetUser(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetUser", } }
315
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves the specified inline policy document that is embedded in the // specified IAM user. Policies returned by this operation are URL-encoded // compliant with RFC 3986 (https://tools.ietf.org/html/rfc3986) . You can use a // URL decoding method to convert the policy back to plain JSON text. For example, // if you use Java, you can use the decode method of the java.net.URLDecoder // utility class in the Java SDK. Other languages and SDKs provide similar // functionality. An IAM user can also have managed policies attached to it. To // retrieve a managed policy document that is attached to a user, use GetPolicy to // determine the policy's default version. Then use GetPolicyVersion to retrieve // the policy document. For more information about policies, see Managed policies // and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. func (c *Client) GetUserPolicy(ctx context.Context, params *GetUserPolicyInput, optFns ...func(*Options)) (*GetUserPolicyOutput, error) { if params == nil { params = &GetUserPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetUserPolicy", params, optFns, c.addOperationGetUserPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetUserPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetUserPolicyInput struct { // The name of the policy document to get. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. PolicyName *string // The name of the user who the policy is associated with. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } // Contains the response to a successful GetUserPolicy request. type GetUserPolicyOutput struct { // The policy document. IAM stores policies in JSON format. However, resources // that were created using CloudFormation templates can be formatted in YAML. // CloudFormation always converts a YAML policy to JSON format before submitting it // to IAM. // // This member is required. PolicyDocument *string // The name of the policy. // // This member is required. PolicyName *string // The user the policy is associated with. // // This member is required. UserName *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetUserPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpGetUserPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetUserPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpGetUserPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetUserPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opGetUserPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "GetUserPolicy", } }
162
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Returns information about the access key IDs associated with the specified IAM // user. If there is none, the operation returns an empty list. Although each user // is limited to a small number of keys, you can still paginate the results using // the MaxItems and Marker parameters. If the UserName is not specified, the user // name is determined implicitly based on the Amazon Web Services access key ID // used to sign the request. If a temporary access key is used, then UserName is // required. If a long-term key is assigned to the user, then UserName is not // required. This operation works for access keys under the Amazon Web Services // account. Consequently, you can use this operation to manage Amazon Web Services // account root user credentials even if the Amazon Web Services account has no // associated users. To ensure the security of your Amazon Web Services account, // the secret access key is accessible only during key and user creation. func (c *Client) ListAccessKeys(ctx context.Context, params *ListAccessKeysInput, optFns ...func(*Options)) (*ListAccessKeysOutput, error) { if params == nil { params = &ListAccessKeysInput{} } result, metadata, err := c.invokeOperation(ctx, "ListAccessKeys", params, optFns, c.addOperationListAccessKeysMiddlewares) if err != nil { return nil, err } out := result.(*ListAccessKeysOutput) out.ResultMetadata = metadata return out, nil } type ListAccessKeysInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The name of the user. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- UserName *string noSmithyDocumentSerde } // Contains the response to a successful ListAccessKeys request. type ListAccessKeysOutput struct { // A list of objects containing metadata about the access keys. // // This member is required. AccessKeyMetadata []types.AccessKeyMetadata // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListAccessKeysMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListAccessKeys{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListAccessKeys{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAccessKeys(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListAccessKeysAPIClient is a client that implements the ListAccessKeys // operation. type ListAccessKeysAPIClient interface { ListAccessKeys(context.Context, *ListAccessKeysInput, ...func(*Options)) (*ListAccessKeysOutput, error) } var _ ListAccessKeysAPIClient = (*Client)(nil) // ListAccessKeysPaginatorOptions is the paginator options for ListAccessKeys type ListAccessKeysPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListAccessKeysPaginator is a paginator for ListAccessKeys type ListAccessKeysPaginator struct { options ListAccessKeysPaginatorOptions client ListAccessKeysAPIClient params *ListAccessKeysInput nextToken *string firstPage bool } // NewListAccessKeysPaginator returns a new ListAccessKeysPaginator func NewListAccessKeysPaginator(client ListAccessKeysAPIClient, params *ListAccessKeysInput, optFns ...func(*ListAccessKeysPaginatorOptions)) *ListAccessKeysPaginator { if params == nil { params = &ListAccessKeysInput{} } options := ListAccessKeysPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListAccessKeysPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListAccessKeysPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListAccessKeys page. func (p *ListAccessKeysPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAccessKeysOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListAccessKeys(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListAccessKeys(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListAccessKeys", } }
261
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the account alias associated with the Amazon Web Services account (Note: // you can have only one). For information about using an Amazon Web Services // account alias, see Creating, deleting, and listing an Amazon Web Services // account alias (https://docs.aws.amazon.com/signin/latest/userguide/CreateAccountAlias.html) // in the Amazon Web Services Sign-In User Guide. func (c *Client) ListAccountAliases(ctx context.Context, params *ListAccountAliasesInput, optFns ...func(*Options)) (*ListAccountAliasesOutput, error) { if params == nil { params = &ListAccountAliasesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListAccountAliases", params, optFns, c.addOperationListAccountAliasesMiddlewares) if err != nil { return nil, err } out := result.(*ListAccountAliasesOutput) out.ResultMetadata = metadata return out, nil } type ListAccountAliasesInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful ListAccountAliases request. type ListAccountAliasesOutput struct { // A list of aliases associated with the account. Amazon Web Services supports // only one alias per account. // // This member is required. AccountAliases []string // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListAccountAliasesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListAccountAliases{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListAccountAliases{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAccountAliases(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListAccountAliasesAPIClient is a client that implements the ListAccountAliases // operation. type ListAccountAliasesAPIClient interface { ListAccountAliases(context.Context, *ListAccountAliasesInput, ...func(*Options)) (*ListAccountAliasesOutput, error) } var _ ListAccountAliasesAPIClient = (*Client)(nil) // ListAccountAliasesPaginatorOptions is the paginator options for // ListAccountAliases type ListAccountAliasesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListAccountAliasesPaginator is a paginator for ListAccountAliases type ListAccountAliasesPaginator struct { options ListAccountAliasesPaginatorOptions client ListAccountAliasesAPIClient params *ListAccountAliasesInput nextToken *string firstPage bool } // NewListAccountAliasesPaginator returns a new ListAccountAliasesPaginator func NewListAccountAliasesPaginator(client ListAccountAliasesAPIClient, params *ListAccountAliasesInput, optFns ...func(*ListAccountAliasesPaginatorOptions)) *ListAccountAliasesPaginator { if params == nil { params = &ListAccountAliasesInput{} } options := ListAccountAliasesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListAccountAliasesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListAccountAliasesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListAccountAliases page. func (p *ListAccountAliasesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAccountAliasesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListAccountAliases(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListAccountAliases(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListAccountAliases", } }
249
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists all managed policies that are attached to the specified IAM group. An IAM // group can also have inline policies embedded with it. To list the inline // policies for a group, use ListGroupPolicies . For information about policies, // see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. You can paginate the results using the MaxItems and // Marker parameters. You can use the PathPrefix parameter to limit the list of // policies to only those matching the specified path prefix. If there are no // policies attached to the specified group (or none that match the specified path // prefix), the operation returns an empty list. func (c *Client) ListAttachedGroupPolicies(ctx context.Context, params *ListAttachedGroupPoliciesInput, optFns ...func(*Options)) (*ListAttachedGroupPoliciesOutput, error) { if params == nil { params = &ListAttachedGroupPoliciesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListAttachedGroupPolicies", params, optFns, c.addOperationListAttachedGroupPoliciesMiddlewares) if err != nil { return nil, err } out := result.(*ListAttachedGroupPoliciesOutput) out.ResultMetadata = metadata return out, nil } type ListAttachedGroupPoliciesInput struct { // The name (friendly name, not ARN) of the group to list attached policies for. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. GroupName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. This parameter is optional. If it is // not included, it defaults to a slash (/), listing all policies. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of either a forward slash (/) by itself or a string // that must begin and end with forward slashes. In addition, it can contain any // ASCII character from the ! ( \u0021 ) through the DEL character ( \u007F ), // including most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string noSmithyDocumentSerde } // Contains the response to a successful ListAttachedGroupPolicies request. type ListAttachedGroupPoliciesOutput struct { // A list of the attached policies. AttachedPolicies []types.AttachedPolicy // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListAttachedGroupPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListAttachedGroupPolicies{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListAttachedGroupPolicies{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListAttachedGroupPoliciesValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAttachedGroupPolicies(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListAttachedGroupPoliciesAPIClient is a client that implements the // ListAttachedGroupPolicies operation. type ListAttachedGroupPoliciesAPIClient interface { ListAttachedGroupPolicies(context.Context, *ListAttachedGroupPoliciesInput, ...func(*Options)) (*ListAttachedGroupPoliciesOutput, error) } var _ ListAttachedGroupPoliciesAPIClient = (*Client)(nil) // ListAttachedGroupPoliciesPaginatorOptions is the paginator options for // ListAttachedGroupPolicies type ListAttachedGroupPoliciesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListAttachedGroupPoliciesPaginator is a paginator for ListAttachedGroupPolicies type ListAttachedGroupPoliciesPaginator struct { options ListAttachedGroupPoliciesPaginatorOptions client ListAttachedGroupPoliciesAPIClient params *ListAttachedGroupPoliciesInput nextToken *string firstPage bool } // NewListAttachedGroupPoliciesPaginator returns a new // ListAttachedGroupPoliciesPaginator func NewListAttachedGroupPoliciesPaginator(client ListAttachedGroupPoliciesAPIClient, params *ListAttachedGroupPoliciesInput, optFns ...func(*ListAttachedGroupPoliciesPaginatorOptions)) *ListAttachedGroupPoliciesPaginator { if params == nil { params = &ListAttachedGroupPoliciesInput{} } options := ListAttachedGroupPoliciesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListAttachedGroupPoliciesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListAttachedGroupPoliciesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListAttachedGroupPolicies page. func (p *ListAttachedGroupPoliciesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAttachedGroupPoliciesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListAttachedGroupPolicies(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListAttachedGroupPolicies(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListAttachedGroupPolicies", } }
273
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists all managed policies that are attached to the specified IAM role. An IAM // role can also have inline policies embedded with it. To list the inline policies // for a role, use ListRolePolicies . For information about policies, see Managed // policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. You can paginate the results using the MaxItems and // Marker parameters. You can use the PathPrefix parameter to limit the list of // policies to only those matching the specified path prefix. If there are no // policies attached to the specified role (or none that match the specified path // prefix), the operation returns an empty list. func (c *Client) ListAttachedRolePolicies(ctx context.Context, params *ListAttachedRolePoliciesInput, optFns ...func(*Options)) (*ListAttachedRolePoliciesOutput, error) { if params == nil { params = &ListAttachedRolePoliciesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListAttachedRolePolicies", params, optFns, c.addOperationListAttachedRolePoliciesMiddlewares) if err != nil { return nil, err } out := result.(*ListAttachedRolePoliciesOutput) out.ResultMetadata = metadata return out, nil } type ListAttachedRolePoliciesInput struct { // The name (friendly name, not ARN) of the role to list attached policies for. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. RoleName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. This parameter is optional. If it is // not included, it defaults to a slash (/), listing all policies. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of either a forward slash (/) by itself or a string // that must begin and end with forward slashes. In addition, it can contain any // ASCII character from the ! ( \u0021 ) through the DEL character ( \u007F ), // including most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string noSmithyDocumentSerde } // Contains the response to a successful ListAttachedRolePolicies request. type ListAttachedRolePoliciesOutput struct { // A list of the attached policies. AttachedPolicies []types.AttachedPolicy // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListAttachedRolePoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListAttachedRolePolicies{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListAttachedRolePolicies{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListAttachedRolePoliciesValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAttachedRolePolicies(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListAttachedRolePoliciesAPIClient is a client that implements the // ListAttachedRolePolicies operation. type ListAttachedRolePoliciesAPIClient interface { ListAttachedRolePolicies(context.Context, *ListAttachedRolePoliciesInput, ...func(*Options)) (*ListAttachedRolePoliciesOutput, error) } var _ ListAttachedRolePoliciesAPIClient = (*Client)(nil) // ListAttachedRolePoliciesPaginatorOptions is the paginator options for // ListAttachedRolePolicies type ListAttachedRolePoliciesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListAttachedRolePoliciesPaginator is a paginator for ListAttachedRolePolicies type ListAttachedRolePoliciesPaginator struct { options ListAttachedRolePoliciesPaginatorOptions client ListAttachedRolePoliciesAPIClient params *ListAttachedRolePoliciesInput nextToken *string firstPage bool } // NewListAttachedRolePoliciesPaginator returns a new // ListAttachedRolePoliciesPaginator func NewListAttachedRolePoliciesPaginator(client ListAttachedRolePoliciesAPIClient, params *ListAttachedRolePoliciesInput, optFns ...func(*ListAttachedRolePoliciesPaginatorOptions)) *ListAttachedRolePoliciesPaginator { if params == nil { params = &ListAttachedRolePoliciesInput{} } options := ListAttachedRolePoliciesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListAttachedRolePoliciesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListAttachedRolePoliciesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListAttachedRolePolicies page. func (p *ListAttachedRolePoliciesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAttachedRolePoliciesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListAttachedRolePolicies(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListAttachedRolePolicies(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListAttachedRolePolicies", } }
273
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists all managed policies that are attached to the specified IAM user. An IAM // user can also have inline policies embedded with it. To list the inline policies // for a user, use ListUserPolicies . For information about policies, see Managed // policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. You can paginate the results using the MaxItems and // Marker parameters. You can use the PathPrefix parameter to limit the list of // policies to only those matching the specified path prefix. If there are no // policies attached to the specified group (or none that match the specified path // prefix), the operation returns an empty list. func (c *Client) ListAttachedUserPolicies(ctx context.Context, params *ListAttachedUserPoliciesInput, optFns ...func(*Options)) (*ListAttachedUserPoliciesOutput, error) { if params == nil { params = &ListAttachedUserPoliciesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListAttachedUserPolicies", params, optFns, c.addOperationListAttachedUserPoliciesMiddlewares) if err != nil { return nil, err } out := result.(*ListAttachedUserPoliciesOutput) out.ResultMetadata = metadata return out, nil } type ListAttachedUserPoliciesInput struct { // The name (friendly name, not ARN) of the user to list attached policies for. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. UserName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. This parameter is optional. If it is // not included, it defaults to a slash (/), listing all policies. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of either a forward slash (/) by itself or a string // that must begin and end with forward slashes. In addition, it can contain any // ASCII character from the ! ( \u0021 ) through the DEL character ( \u007F ), // including most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string noSmithyDocumentSerde } // Contains the response to a successful ListAttachedUserPolicies request. type ListAttachedUserPoliciesOutput struct { // A list of the attached policies. AttachedPolicies []types.AttachedPolicy // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListAttachedUserPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListAttachedUserPolicies{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListAttachedUserPolicies{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListAttachedUserPoliciesValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAttachedUserPolicies(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListAttachedUserPoliciesAPIClient is a client that implements the // ListAttachedUserPolicies operation. type ListAttachedUserPoliciesAPIClient interface { ListAttachedUserPolicies(context.Context, *ListAttachedUserPoliciesInput, ...func(*Options)) (*ListAttachedUserPoliciesOutput, error) } var _ ListAttachedUserPoliciesAPIClient = (*Client)(nil) // ListAttachedUserPoliciesPaginatorOptions is the paginator options for // ListAttachedUserPolicies type ListAttachedUserPoliciesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListAttachedUserPoliciesPaginator is a paginator for ListAttachedUserPolicies type ListAttachedUserPoliciesPaginator struct { options ListAttachedUserPoliciesPaginatorOptions client ListAttachedUserPoliciesAPIClient params *ListAttachedUserPoliciesInput nextToken *string firstPage bool } // NewListAttachedUserPoliciesPaginator returns a new // ListAttachedUserPoliciesPaginator func NewListAttachedUserPoliciesPaginator(client ListAttachedUserPoliciesAPIClient, params *ListAttachedUserPoliciesInput, optFns ...func(*ListAttachedUserPoliciesPaginatorOptions)) *ListAttachedUserPoliciesPaginator { if params == nil { params = &ListAttachedUserPoliciesInput{} } options := ListAttachedUserPoliciesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListAttachedUserPoliciesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListAttachedUserPoliciesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListAttachedUserPolicies page. func (p *ListAttachedUserPoliciesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAttachedUserPoliciesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListAttachedUserPolicies(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListAttachedUserPolicies(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListAttachedUserPolicies", } }
273
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists all IAM users, groups, and roles that the specified managed policy is // attached to. You can use the optional EntityFilter parameter to limit the // results to a particular type of entity (users, groups, or roles). For example, // to list only the roles that are attached to the specified policy, set // EntityFilter to Role . You can paginate the results using the MaxItems and // Marker parameters. func (c *Client) ListEntitiesForPolicy(ctx context.Context, params *ListEntitiesForPolicyInput, optFns ...func(*Options)) (*ListEntitiesForPolicyOutput, error) { if params == nil { params = &ListEntitiesForPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "ListEntitiesForPolicy", params, optFns, c.addOperationListEntitiesForPolicyMiddlewares) if err != nil { return nil, err } out := result.(*ListEntitiesForPolicyOutput) out.ResultMetadata = metadata return out, nil } type ListEntitiesForPolicyInput struct { // The Amazon Resource Name (ARN) of the IAM policy for which you want the // versions. For more information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicyArn *string // The entity type to use for filtering the results. For example, when EntityFilter // is Role , only the roles that are attached to the specified policy are returned. // This parameter is optional. If it is not included, all attached entities (users, // groups, and roles) are returned. The argument for this parameter must be one of // the valid values listed below. EntityFilter types.EntityType // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. This parameter is optional. If it is // not included, it defaults to a slash (/), listing all entities. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of either a forward slash (/) by itself or a string // that must begin and end with forward slashes. In addition, it can contain any // ASCII character from the ! ( \u0021 ) through the DEL character ( \u007F ), // including most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string // The policy usage method to use for filtering the results. To list only // permissions policies, set PolicyUsageFilter to PermissionsPolicy . To list only // the policies used to set permissions boundaries, set the value to // PermissionsBoundary . This parameter is optional. If it is not included, all // policies are returned. PolicyUsageFilter types.PolicyUsageType noSmithyDocumentSerde } // Contains the response to a successful ListEntitiesForPolicy request. type ListEntitiesForPolicyOutput struct { // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // A list of IAM groups that the policy is attached to. PolicyGroups []types.PolicyGroup // A list of IAM roles that the policy is attached to. PolicyRoles []types.PolicyRole // A list of IAM users that the policy is attached to. PolicyUsers []types.PolicyUser // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListEntitiesForPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListEntitiesForPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListEntitiesForPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListEntitiesForPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListEntitiesForPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListEntitiesForPolicyAPIClient is a client that implements the // ListEntitiesForPolicy operation. type ListEntitiesForPolicyAPIClient interface { ListEntitiesForPolicy(context.Context, *ListEntitiesForPolicyInput, ...func(*Options)) (*ListEntitiesForPolicyOutput, error) } var _ ListEntitiesForPolicyAPIClient = (*Client)(nil) // ListEntitiesForPolicyPaginatorOptions is the paginator options for // ListEntitiesForPolicy type ListEntitiesForPolicyPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListEntitiesForPolicyPaginator is a paginator for ListEntitiesForPolicy type ListEntitiesForPolicyPaginator struct { options ListEntitiesForPolicyPaginatorOptions client ListEntitiesForPolicyAPIClient params *ListEntitiesForPolicyInput nextToken *string firstPage bool } // NewListEntitiesForPolicyPaginator returns a new ListEntitiesForPolicyPaginator func NewListEntitiesForPolicyPaginator(client ListEntitiesForPolicyAPIClient, params *ListEntitiesForPolicyInput, optFns ...func(*ListEntitiesForPolicyPaginatorOptions)) *ListEntitiesForPolicyPaginator { if params == nil { params = &ListEntitiesForPolicyInput{} } options := ListEntitiesForPolicyPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListEntitiesForPolicyPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListEntitiesForPolicyPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListEntitiesForPolicy page. func (p *ListEntitiesForPolicyPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListEntitiesForPolicyOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListEntitiesForPolicy(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListEntitiesForPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListEntitiesForPolicy", } }
287
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the names of the inline policies that are embedded in the specified IAM // group. An IAM group can also have managed policies attached to it. To list the // managed policies that are attached to a group, use ListAttachedGroupPolicies . // For more information about policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. You can paginate the results using the MaxItems and // Marker parameters. If there are no inline policies embedded with the specified // group, the operation returns an empty list. func (c *Client) ListGroupPolicies(ctx context.Context, params *ListGroupPoliciesInput, optFns ...func(*Options)) (*ListGroupPoliciesOutput, error) { if params == nil { params = &ListGroupPoliciesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListGroupPolicies", params, optFns, c.addOperationListGroupPoliciesMiddlewares) if err != nil { return nil, err } out := result.(*ListGroupPoliciesOutput) out.ResultMetadata = metadata return out, nil } type ListGroupPoliciesInput struct { // The name of the group to list policies for. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. GroupName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful ListGroupPolicies request. type ListGroupPoliciesOutput struct { // A list of policy names. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. PolicyNames []string // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListGroupPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListGroupPolicies{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListGroupPolicies{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListGroupPoliciesValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListGroupPolicies(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListGroupPoliciesAPIClient is a client that implements the ListGroupPolicies // operation. type ListGroupPoliciesAPIClient interface { ListGroupPolicies(context.Context, *ListGroupPoliciesInput, ...func(*Options)) (*ListGroupPoliciesOutput, error) } var _ ListGroupPoliciesAPIClient = (*Client)(nil) // ListGroupPoliciesPaginatorOptions is the paginator options for ListGroupPolicies type ListGroupPoliciesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListGroupPoliciesPaginator is a paginator for ListGroupPolicies type ListGroupPoliciesPaginator struct { options ListGroupPoliciesPaginatorOptions client ListGroupPoliciesAPIClient params *ListGroupPoliciesInput nextToken *string firstPage bool } // NewListGroupPoliciesPaginator returns a new ListGroupPoliciesPaginator func NewListGroupPoliciesPaginator(client ListGroupPoliciesAPIClient, params *ListGroupPoliciesInput, optFns ...func(*ListGroupPoliciesPaginatorOptions)) *ListGroupPoliciesPaginator { if params == nil { params = &ListGroupPoliciesInput{} } options := ListGroupPoliciesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListGroupPoliciesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListGroupPoliciesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListGroupPolicies page. func (p *ListGroupPoliciesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListGroupPoliciesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListGroupPolicies(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListGroupPolicies(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListGroupPolicies", } }
263
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the IAM groups that have the specified path prefix. You can paginate the // results using the MaxItems and Marker parameters. func (c *Client) ListGroups(ctx context.Context, params *ListGroupsInput, optFns ...func(*Options)) (*ListGroupsOutput, error) { if params == nil { params = &ListGroupsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListGroups", params, optFns, c.addOperationListGroupsMiddlewares) if err != nil { return nil, err } out := result.(*ListGroupsOutput) out.ResultMetadata = metadata return out, nil } type ListGroupsInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. For example, the prefix // /division_abc/subdivision_xyz/ gets all groups whose path starts with // /division_abc/subdivision_xyz/ . This parameter is optional. If it is not // included, it defaults to a slash (/), listing all groups. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of either a forward slash (/) by itself or a string that // must begin and end with forward slashes. In addition, it can contain any ASCII // character from the ! ( \u0021 ) through the DEL character ( \u007F ), including // most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string noSmithyDocumentSerde } // Contains the response to a successful ListGroups request. type ListGroupsOutput struct { // A list of groups. // // This member is required. Groups []types.Group // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListGroups{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListGroups{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListGroups(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListGroupsAPIClient is a client that implements the ListGroups operation. type ListGroupsAPIClient interface { ListGroups(context.Context, *ListGroupsInput, ...func(*Options)) (*ListGroupsOutput, error) } var _ ListGroupsAPIClient = (*Client)(nil) // ListGroupsPaginatorOptions is the paginator options for ListGroups type ListGroupsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListGroupsPaginator is a paginator for ListGroups type ListGroupsPaginator struct { options ListGroupsPaginatorOptions client ListGroupsAPIClient params *ListGroupsInput nextToken *string firstPage bool } // NewListGroupsPaginator returns a new ListGroupsPaginator func NewListGroupsPaginator(client ListGroupsAPIClient, params *ListGroupsInput, optFns ...func(*ListGroupsPaginatorOptions)) *ListGroupsPaginator { if params == nil { params = &ListGroupsInput{} } options := ListGroupsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListGroupsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListGroupsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListGroups page. func (p *ListGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListGroupsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListGroups(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListGroups(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListGroups", } }
255
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the IAM groups that the specified IAM user belongs to. You can paginate // the results using the MaxItems and Marker parameters. func (c *Client) ListGroupsForUser(ctx context.Context, params *ListGroupsForUserInput, optFns ...func(*Options)) (*ListGroupsForUserOutput, error) { if params == nil { params = &ListGroupsForUserInput{} } result, metadata, err := c.invokeOperation(ctx, "ListGroupsForUser", params, optFns, c.addOperationListGroupsForUserMiddlewares) if err != nil { return nil, err } out := result.(*ListGroupsForUserOutput) out.ResultMetadata = metadata return out, nil } type ListGroupsForUserInput struct { // The name of the user to list groups for. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. UserName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful ListGroupsForUser request. type ListGroupsForUserOutput struct { // A list of groups. // // This member is required. Groups []types.Group // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListGroupsForUserMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListGroupsForUser{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListGroupsForUser{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListGroupsForUserValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListGroupsForUser(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListGroupsForUserAPIClient is a client that implements the ListGroupsForUser // operation. type ListGroupsForUserAPIClient interface { ListGroupsForUser(context.Context, *ListGroupsForUserInput, ...func(*Options)) (*ListGroupsForUserOutput, error) } var _ ListGroupsForUserAPIClient = (*Client)(nil) // ListGroupsForUserPaginatorOptions is the paginator options for ListGroupsForUser type ListGroupsForUserPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListGroupsForUserPaginator is a paginator for ListGroupsForUser type ListGroupsForUserPaginator struct { options ListGroupsForUserPaginatorOptions client ListGroupsForUserAPIClient params *ListGroupsForUserInput nextToken *string firstPage bool } // NewListGroupsForUserPaginator returns a new ListGroupsForUserPaginator func NewListGroupsForUserPaginator(client ListGroupsForUserAPIClient, params *ListGroupsForUserInput, optFns ...func(*ListGroupsForUserPaginatorOptions)) *ListGroupsForUserPaginator { if params == nil { params = &ListGroupsForUserInput{} } options := ListGroupsForUserPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListGroupsForUserPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListGroupsForUserPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListGroupsForUser page. func (p *ListGroupsForUserPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListGroupsForUserOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListGroupsForUser(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListGroupsForUser(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListGroupsForUser", } }
256
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the instance profiles that have the specified path prefix. If there are // none, the operation returns an empty list. For more information about instance // profiles, see About instance profiles (https://docs.aws.amazon.com/IAM/latest/UserGuide/AboutInstanceProfiles.html) // . IAM resource-listing operations return a subset of the available attributes // for the resource. For example, this operation does not return tags, even though // they are an attribute of the returned object. To view all of the information for // an instance profile, see GetInstanceProfile . You can paginate the results using // the MaxItems and Marker parameters. func (c *Client) ListInstanceProfiles(ctx context.Context, params *ListInstanceProfilesInput, optFns ...func(*Options)) (*ListInstanceProfilesOutput, error) { if params == nil { params = &ListInstanceProfilesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListInstanceProfiles", params, optFns, c.addOperationListInstanceProfilesMiddlewares) if err != nil { return nil, err } out := result.(*ListInstanceProfilesOutput) out.ResultMetadata = metadata return out, nil } type ListInstanceProfilesInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. For example, the prefix // /application_abc/component_xyz/ gets all instance profiles whose path starts // with /application_abc/component_xyz/ . This parameter is optional. If it is not // included, it defaults to a slash (/), listing all instance profiles. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of either a forward slash (/) by itself or a // string that must begin and end with forward slashes. In addition, it can contain // any ASCII character from the ! ( \u0021 ) through the DEL character ( \u007F ), // including most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string noSmithyDocumentSerde } // Contains the response to a successful ListInstanceProfiles request. type ListInstanceProfilesOutput struct { // A list of instance profiles. // // This member is required. InstanceProfiles []types.InstanceProfile // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListInstanceProfilesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListInstanceProfiles{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListInstanceProfiles{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListInstanceProfiles(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListInstanceProfilesAPIClient is a client that implements the // ListInstanceProfiles operation. type ListInstanceProfilesAPIClient interface { ListInstanceProfiles(context.Context, *ListInstanceProfilesInput, ...func(*Options)) (*ListInstanceProfilesOutput, error) } var _ ListInstanceProfilesAPIClient = (*Client)(nil) // ListInstanceProfilesPaginatorOptions is the paginator options for // ListInstanceProfiles type ListInstanceProfilesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListInstanceProfilesPaginator is a paginator for ListInstanceProfiles type ListInstanceProfilesPaginator struct { options ListInstanceProfilesPaginatorOptions client ListInstanceProfilesAPIClient params *ListInstanceProfilesInput nextToken *string firstPage bool } // NewListInstanceProfilesPaginator returns a new ListInstanceProfilesPaginator func NewListInstanceProfilesPaginator(client ListInstanceProfilesAPIClient, params *ListInstanceProfilesInput, optFns ...func(*ListInstanceProfilesPaginatorOptions)) *ListInstanceProfilesPaginator { if params == nil { params = &ListInstanceProfilesInput{} } options := ListInstanceProfilesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListInstanceProfilesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListInstanceProfilesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListInstanceProfiles page. func (p *ListInstanceProfilesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListInstanceProfilesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListInstanceProfiles(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListInstanceProfiles(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListInstanceProfiles", } }
263
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the instance profiles that have the specified associated IAM role. If // there are none, the operation returns an empty list. For more information about // instance profiles, go to About instance profiles (https://docs.aws.amazon.com/IAM/latest/UserGuide/AboutInstanceProfiles.html) // . You can paginate the results using the MaxItems and Marker parameters. func (c *Client) ListInstanceProfilesForRole(ctx context.Context, params *ListInstanceProfilesForRoleInput, optFns ...func(*Options)) (*ListInstanceProfilesForRoleOutput, error) { if params == nil { params = &ListInstanceProfilesForRoleInput{} } result, metadata, err := c.invokeOperation(ctx, "ListInstanceProfilesForRole", params, optFns, c.addOperationListInstanceProfilesForRoleMiddlewares) if err != nil { return nil, err } out := result.(*ListInstanceProfilesForRoleOutput) out.ResultMetadata = metadata return out, nil } type ListInstanceProfilesForRoleInput struct { // The name of the role to list instance profiles for. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. RoleName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful ListInstanceProfilesForRole request. type ListInstanceProfilesForRoleOutput struct { // A list of instance profiles. // // This member is required. InstanceProfiles []types.InstanceProfile // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListInstanceProfilesForRoleMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListInstanceProfilesForRole{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListInstanceProfilesForRole{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListInstanceProfilesForRoleValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListInstanceProfilesForRole(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListInstanceProfilesForRoleAPIClient is a client that implements the // ListInstanceProfilesForRole operation. type ListInstanceProfilesForRoleAPIClient interface { ListInstanceProfilesForRole(context.Context, *ListInstanceProfilesForRoleInput, ...func(*Options)) (*ListInstanceProfilesForRoleOutput, error) } var _ ListInstanceProfilesForRoleAPIClient = (*Client)(nil) // ListInstanceProfilesForRolePaginatorOptions is the paginator options for // ListInstanceProfilesForRole type ListInstanceProfilesForRolePaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListInstanceProfilesForRolePaginator is a paginator for // ListInstanceProfilesForRole type ListInstanceProfilesForRolePaginator struct { options ListInstanceProfilesForRolePaginatorOptions client ListInstanceProfilesForRoleAPIClient params *ListInstanceProfilesForRoleInput nextToken *string firstPage bool } // NewListInstanceProfilesForRolePaginator returns a new // ListInstanceProfilesForRolePaginator func NewListInstanceProfilesForRolePaginator(client ListInstanceProfilesForRoleAPIClient, params *ListInstanceProfilesForRoleInput, optFns ...func(*ListInstanceProfilesForRolePaginatorOptions)) *ListInstanceProfilesForRolePaginator { if params == nil { params = &ListInstanceProfilesForRoleInput{} } options := ListInstanceProfilesForRolePaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListInstanceProfilesForRolePaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListInstanceProfilesForRolePaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListInstanceProfilesForRole page. func (p *ListInstanceProfilesForRolePaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListInstanceProfilesForRoleOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListInstanceProfilesForRole(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListInstanceProfilesForRole(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListInstanceProfilesForRole", } }
261
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the tags that are attached to the specified IAM instance profile. The // returned list of tags is sorted by tag key. For more information about tagging, // see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) ListInstanceProfileTags(ctx context.Context, params *ListInstanceProfileTagsInput, optFns ...func(*Options)) (*ListInstanceProfileTagsOutput, error) { if params == nil { params = &ListInstanceProfileTagsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListInstanceProfileTags", params, optFns, c.addOperationListInstanceProfileTagsMiddlewares) if err != nil { return nil, err } out := result.(*ListInstanceProfileTagsOutput) out.ResultMetadata = metadata return out, nil } type ListInstanceProfileTagsInput struct { // The name of the IAM instance profile whose tags you want to see. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. InstanceProfileName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type ListInstanceProfileTagsOutput struct { // The list of tags that are currently attached to the IAM instance profile. Each // tag consists of a key name and an associated value. If no tags are attached to // the specified resource, the response contains an empty list. // // This member is required. Tags []types.Tag // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListInstanceProfileTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListInstanceProfileTags{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListInstanceProfileTags{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListInstanceProfileTagsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListInstanceProfileTags(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListInstanceProfileTagsAPIClient is a client that implements the // ListInstanceProfileTags operation. type ListInstanceProfileTagsAPIClient interface { ListInstanceProfileTags(context.Context, *ListInstanceProfileTagsInput, ...func(*Options)) (*ListInstanceProfileTagsOutput, error) } var _ ListInstanceProfileTagsAPIClient = (*Client)(nil) // ListInstanceProfileTagsPaginatorOptions is the paginator options for // ListInstanceProfileTags type ListInstanceProfileTagsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListInstanceProfileTagsPaginator is a paginator for ListInstanceProfileTags type ListInstanceProfileTagsPaginator struct { options ListInstanceProfileTagsPaginatorOptions client ListInstanceProfileTagsAPIClient params *ListInstanceProfileTagsInput nextToken *string firstPage bool } // NewListInstanceProfileTagsPaginator returns a new // ListInstanceProfileTagsPaginator func NewListInstanceProfileTagsPaginator(client ListInstanceProfileTagsAPIClient, params *ListInstanceProfileTagsInput, optFns ...func(*ListInstanceProfileTagsPaginatorOptions)) *ListInstanceProfileTagsPaginator { if params == nil { params = &ListInstanceProfileTagsInput{} } options := ListInstanceProfileTagsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListInstanceProfileTagsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListInstanceProfileTagsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListInstanceProfileTags page. func (p *ListInstanceProfileTagsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListInstanceProfileTagsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListInstanceProfileTags(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListInstanceProfileTags(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListInstanceProfileTags", } }
261
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the MFA devices for an IAM user. If the request includes a IAM user name, // then this operation lists all the MFA devices associated with the specified // user. If you do not specify a user name, IAM determines the user name implicitly // based on the Amazon Web Services access key ID signing the request for this // operation. You can paginate the results using the MaxItems and Marker // parameters. func (c *Client) ListMFADevices(ctx context.Context, params *ListMFADevicesInput, optFns ...func(*Options)) (*ListMFADevicesOutput, error) { if params == nil { params = &ListMFADevicesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListMFADevices", params, optFns, c.addOperationListMFADevicesMiddlewares) if err != nil { return nil, err } out := result.(*ListMFADevicesOutput) out.ResultMetadata = metadata return out, nil } type ListMFADevicesInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The name of the user whose MFA devices you want to list. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- UserName *string noSmithyDocumentSerde } // Contains the response to a successful ListMFADevices request. type ListMFADevicesOutput struct { // A list of MFA devices. // // This member is required. MFADevices []types.MFADevice // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListMFADevicesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListMFADevices{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListMFADevices{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListMFADevices(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListMFADevicesAPIClient is a client that implements the ListMFADevices // operation. type ListMFADevicesAPIClient interface { ListMFADevices(context.Context, *ListMFADevicesInput, ...func(*Options)) (*ListMFADevicesOutput, error) } var _ ListMFADevicesAPIClient = (*Client)(nil) // ListMFADevicesPaginatorOptions is the paginator options for ListMFADevices type ListMFADevicesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListMFADevicesPaginator is a paginator for ListMFADevices type ListMFADevicesPaginator struct { options ListMFADevicesPaginatorOptions client ListMFADevicesAPIClient params *ListMFADevicesInput nextToken *string firstPage bool } // NewListMFADevicesPaginator returns a new ListMFADevicesPaginator func NewListMFADevicesPaginator(client ListMFADevicesAPIClient, params *ListMFADevicesInput, optFns ...func(*ListMFADevicesPaginatorOptions)) *ListMFADevicesPaginator { if params == nil { params = &ListMFADevicesInput{} } options := ListMFADevicesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListMFADevicesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListMFADevicesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListMFADevices page. func (p *ListMFADevicesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListMFADevicesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListMFADevices(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListMFADevices(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListMFADevices", } }
255
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the tags that are attached to the specified IAM virtual multi-factor // authentication (MFA) device. The returned list of tags is sorted by tag key. For // more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) ListMFADeviceTags(ctx context.Context, params *ListMFADeviceTagsInput, optFns ...func(*Options)) (*ListMFADeviceTagsOutput, error) { if params == nil { params = &ListMFADeviceTagsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListMFADeviceTags", params, optFns, c.addOperationListMFADeviceTagsMiddlewares) if err != nil { return nil, err } out := result.(*ListMFADeviceTagsOutput) out.ResultMetadata = metadata return out, nil } type ListMFADeviceTagsInput struct { // The unique identifier for the IAM virtual MFA device whose tags you want to // see. For virtual MFA devices, the serial number is the same as the ARN. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. SerialNumber *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type ListMFADeviceTagsOutput struct { // The list of tags that are currently attached to the virtual MFA device. Each // tag consists of a key name and an associated value. If no tags are attached to // the specified resource, the response contains an empty list. // // This member is required. Tags []types.Tag // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListMFADeviceTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListMFADeviceTags{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListMFADeviceTags{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListMFADeviceTagsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListMFADeviceTags(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListMFADeviceTagsAPIClient is a client that implements the ListMFADeviceTags // operation. type ListMFADeviceTagsAPIClient interface { ListMFADeviceTags(context.Context, *ListMFADeviceTagsInput, ...func(*Options)) (*ListMFADeviceTagsOutput, error) } var _ ListMFADeviceTagsAPIClient = (*Client)(nil) // ListMFADeviceTagsPaginatorOptions is the paginator options for ListMFADeviceTags type ListMFADeviceTagsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListMFADeviceTagsPaginator is a paginator for ListMFADeviceTags type ListMFADeviceTagsPaginator struct { options ListMFADeviceTagsPaginatorOptions client ListMFADeviceTagsAPIClient params *ListMFADeviceTagsInput nextToken *string firstPage bool } // NewListMFADeviceTagsPaginator returns a new ListMFADeviceTagsPaginator func NewListMFADeviceTagsPaginator(client ListMFADeviceTagsAPIClient, params *ListMFADeviceTagsInput, optFns ...func(*ListMFADeviceTagsPaginatorOptions)) *ListMFADeviceTagsPaginator { if params == nil { params = &ListMFADeviceTagsInput{} } options := ListMFADeviceTagsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListMFADeviceTagsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListMFADeviceTagsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListMFADeviceTags page. func (p *ListMFADeviceTagsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListMFADeviceTagsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListMFADeviceTags(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListMFADeviceTags(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListMFADeviceTags", } }
260
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists information about the IAM OpenID Connect (OIDC) provider resource objects // defined in the Amazon Web Services account. IAM resource-listing operations // return a subset of the available attributes for the resource. For example, this // operation does not return tags, even though they are an attribute of the // returned object. To view all of the information for an OIDC provider, see // GetOpenIDConnectProvider . func (c *Client) ListOpenIDConnectProviders(ctx context.Context, params *ListOpenIDConnectProvidersInput, optFns ...func(*Options)) (*ListOpenIDConnectProvidersOutput, error) { if params == nil { params = &ListOpenIDConnectProvidersInput{} } result, metadata, err := c.invokeOperation(ctx, "ListOpenIDConnectProviders", params, optFns, c.addOperationListOpenIDConnectProvidersMiddlewares) if err != nil { return nil, err } out := result.(*ListOpenIDConnectProvidersOutput) out.ResultMetadata = metadata return out, nil } type ListOpenIDConnectProvidersInput struct { noSmithyDocumentSerde } // Contains the response to a successful ListOpenIDConnectProviders request. type ListOpenIDConnectProvidersOutput struct { // The list of IAM OIDC provider resource objects defined in the Amazon Web // Services account. OpenIDConnectProviderList []types.OpenIDConnectProviderListEntry // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListOpenIDConnectProvidersMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListOpenIDConnectProviders{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListOpenIDConnectProviders{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListOpenIDConnectProviders(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opListOpenIDConnectProviders(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListOpenIDConnectProviders", } }
123
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the tags that are attached to the specified OpenID Connect // (OIDC)-compatible identity provider. The returned list of tags is sorted by tag // key. For more information, see About web identity federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html) // . For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) ListOpenIDConnectProviderTags(ctx context.Context, params *ListOpenIDConnectProviderTagsInput, optFns ...func(*Options)) (*ListOpenIDConnectProviderTagsOutput, error) { if params == nil { params = &ListOpenIDConnectProviderTagsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListOpenIDConnectProviderTags", params, optFns, c.addOperationListOpenIDConnectProviderTagsMiddlewares) if err != nil { return nil, err } out := result.(*ListOpenIDConnectProviderTagsOutput) out.ResultMetadata = metadata return out, nil } type ListOpenIDConnectProviderTagsInput struct { // The ARN of the OpenID Connect (OIDC) identity provider whose tags you want to // see. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. OpenIDConnectProviderArn *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type ListOpenIDConnectProviderTagsOutput struct { // The list of tags that are currently attached to the OpenID Connect (OIDC) // identity provider. Each tag consists of a key name and an associated value. If // no tags are attached to the specified resource, the response contains an empty // list. // // This member is required. Tags []types.Tag // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListOpenIDConnectProviderTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListOpenIDConnectProviderTags{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListOpenIDConnectProviderTags{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListOpenIDConnectProviderTagsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListOpenIDConnectProviderTags(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListOpenIDConnectProviderTagsAPIClient is a client that implements the // ListOpenIDConnectProviderTags operation. type ListOpenIDConnectProviderTagsAPIClient interface { ListOpenIDConnectProviderTags(context.Context, *ListOpenIDConnectProviderTagsInput, ...func(*Options)) (*ListOpenIDConnectProviderTagsOutput, error) } var _ ListOpenIDConnectProviderTagsAPIClient = (*Client)(nil) // ListOpenIDConnectProviderTagsPaginatorOptions is the paginator options for // ListOpenIDConnectProviderTags type ListOpenIDConnectProviderTagsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListOpenIDConnectProviderTagsPaginator is a paginator for // ListOpenIDConnectProviderTags type ListOpenIDConnectProviderTagsPaginator struct { options ListOpenIDConnectProviderTagsPaginatorOptions client ListOpenIDConnectProviderTagsAPIClient params *ListOpenIDConnectProviderTagsInput nextToken *string firstPage bool } // NewListOpenIDConnectProviderTagsPaginator returns a new // ListOpenIDConnectProviderTagsPaginator func NewListOpenIDConnectProviderTagsPaginator(client ListOpenIDConnectProviderTagsAPIClient, params *ListOpenIDConnectProviderTagsInput, optFns ...func(*ListOpenIDConnectProviderTagsPaginatorOptions)) *ListOpenIDConnectProviderTagsPaginator { if params == nil { params = &ListOpenIDConnectProviderTagsInput{} } options := ListOpenIDConnectProviderTagsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListOpenIDConnectProviderTagsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListOpenIDConnectProviderTagsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListOpenIDConnectProviderTags page. func (p *ListOpenIDConnectProviderTagsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListOpenIDConnectProviderTagsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListOpenIDConnectProviderTags(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListOpenIDConnectProviderTags(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListOpenIDConnectProviderTags", } }
265
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists all the managed policies that are available in your Amazon Web Services // account, including your own customer-defined managed policies and all Amazon Web // Services managed policies. You can filter the list of policies that is returned // using the optional OnlyAttached , Scope , and PathPrefix parameters. For // example, to list only the customer managed policies in your Amazon Web Services // account, set Scope to Local . To list only Amazon Web Services managed policies, // set Scope to AWS . You can paginate the results using the MaxItems and Marker // parameters. For more information about managed policies, see Managed policies // and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. IAM resource-listing operations return a subset of the // available attributes for the resource. For example, this operation does not // return tags, even though they are an attribute of the returned object. To view // all of the information for a customer manged policy, see GetPolicy . func (c *Client) ListPolicies(ctx context.Context, params *ListPoliciesInput, optFns ...func(*Options)) (*ListPoliciesOutput, error) { if params == nil { params = &ListPoliciesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListPolicies", params, optFns, c.addOperationListPoliciesMiddlewares) if err != nil { return nil, err } out := result.(*ListPoliciesOutput) out.ResultMetadata = metadata return out, nil } type ListPoliciesInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // A flag to filter the results to only the attached policies. When OnlyAttached // is true , the returned list contains only the policies that are attached to an // IAM user, group, or role. When OnlyAttached is false , or when the parameter is // not included, all policies are returned. OnlyAttached bool // The path prefix for filtering the results. This parameter is optional. If it is // not included, it defaults to a slash (/), listing all policies. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of either a forward slash (/) by itself or a string // that must begin and end with forward slashes. In addition, it can contain any // ASCII character from the ! ( \u0021 ) through the DEL character ( \u007F ), // including most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string // The policy usage method to use for filtering the results. To list only // permissions policies, set PolicyUsageFilter to PermissionsPolicy . To list only // the policies used to set permissions boundaries, set the value to // PermissionsBoundary . This parameter is optional. If it is not included, all // policies are returned. PolicyUsageFilter types.PolicyUsageType // The scope to use for filtering the results. To list only Amazon Web Services // managed policies, set Scope to AWS . To list only the customer managed policies // in your Amazon Web Services account, set Scope to Local . This parameter is // optional. If it is not included, or if it is set to All , all policies are // returned. Scope types.PolicyScopeType noSmithyDocumentSerde } // Contains the response to a successful ListPolicies request. type ListPoliciesOutput struct { // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // A list of policies. Policies []types.Policy // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListPolicies{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListPolicies{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListPolicies(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListPoliciesAPIClient is a client that implements the ListPolicies operation. type ListPoliciesAPIClient interface { ListPolicies(context.Context, *ListPoliciesInput, ...func(*Options)) (*ListPoliciesOutput, error) } var _ ListPoliciesAPIClient = (*Client)(nil) // ListPoliciesPaginatorOptions is the paginator options for ListPolicies type ListPoliciesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListPoliciesPaginator is a paginator for ListPolicies type ListPoliciesPaginator struct { options ListPoliciesPaginatorOptions client ListPoliciesAPIClient params *ListPoliciesInput nextToken *string firstPage bool } // NewListPoliciesPaginator returns a new ListPoliciesPaginator func NewListPoliciesPaginator(client ListPoliciesAPIClient, params *ListPoliciesInput, optFns ...func(*ListPoliciesPaginatorOptions)) *ListPoliciesPaginator { if params == nil { params = &ListPoliciesInput{} } options := ListPoliciesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListPoliciesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListPoliciesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListPolicies page. func (p *ListPoliciesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListPoliciesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListPolicies(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListPolicies(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListPolicies", } }
282
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Retrieves a list of policies that the IAM identity (user, group, or role) can // use to access each specified service. This operation does not use other policy // types when determining whether a resource could access a service. These other // policy types include resource-based policies, access control lists, // Organizations policies, IAM permissions boundaries, and STS assume role // policies. It only applies permissions policy logic. For more about the // evaluation of policy types, see Evaluating policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-basics) // in the IAM User Guide. The list of policies returned by the operation depends on // the ARN of the identity that you provide. // - User – The list of policies includes the managed and inline policies that // are attached to the user directly. The list also includes any additional managed // and inline policies that are attached to the group to which the user belongs. // - Group – The list of policies includes only the managed and inline policies // that are attached to the group directly. Policies that are attached to the // group’s user are not included. // - Role – The list of policies includes only the managed and inline policies // that are attached to the role. // // For each managed policy, this operation returns the ARN and policy name. For // each inline policy, it returns the policy name and the entity to which it is // attached. Inline policies do not have an ARN. For more information about these // policy types, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html) // in the IAM User Guide. Policies that are attached to users and roles as // permissions boundaries are not returned. To view which managed policy is // currently used to set the permissions boundary for a user or role, use the // GetUser or GetRole operations. func (c *Client) ListPoliciesGrantingServiceAccess(ctx context.Context, params *ListPoliciesGrantingServiceAccessInput, optFns ...func(*Options)) (*ListPoliciesGrantingServiceAccessOutput, error) { if params == nil { params = &ListPoliciesGrantingServiceAccessInput{} } result, metadata, err := c.invokeOperation(ctx, "ListPoliciesGrantingServiceAccess", params, optFns, c.addOperationListPoliciesGrantingServiceAccessMiddlewares) if err != nil { return nil, err } out := result.(*ListPoliciesGrantingServiceAccessOutput) out.ResultMetadata = metadata return out, nil } type ListPoliciesGrantingServiceAccessInput struct { // The ARN of the IAM identity (user, group, or role) whose policies you want to // list. // // This member is required. Arn *string // The service namespace for the Amazon Web Services services whose policies you // want to list. To learn the service namespace for a service, see Actions, // resources, and condition keys for Amazon Web Services services (https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html) // in the IAM User Guide. Choose the name of the service to view details for that // service. In the first paragraph, find the service prefix. For example, (service // prefix: a4b) . For more information about service namespaces, see Amazon Web // Services service namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces) // in the Amazon Web Services General Reference. // // This member is required. ServiceNamespaces []string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string noSmithyDocumentSerde } type ListPoliciesGrantingServiceAccessOutput struct { // A ListPoliciesGrantingServiceAccess object that contains details about the // permissions policies attached to the specified identity (user, group, or role). // // This member is required. PoliciesGrantingServiceAccess []types.ListPoliciesGrantingServiceAccessEntry // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. We recommend that you check // IsTruncated after every call to ensure that you receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListPoliciesGrantingServiceAccessMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListPoliciesGrantingServiceAccess{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListPoliciesGrantingServiceAccess{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListPoliciesGrantingServiceAccessValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListPoliciesGrantingServiceAccess(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opListPoliciesGrantingServiceAccess(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListPoliciesGrantingServiceAccess", } }
182
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the tags that are attached to the specified IAM customer managed policy. // The returned list of tags is sorted by tag key. For more information about // tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) ListPolicyTags(ctx context.Context, params *ListPolicyTagsInput, optFns ...func(*Options)) (*ListPolicyTagsOutput, error) { if params == nil { params = &ListPolicyTagsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListPolicyTags", params, optFns, c.addOperationListPolicyTagsMiddlewares) if err != nil { return nil, err } out := result.(*ListPolicyTagsOutput) out.ResultMetadata = metadata return out, nil } type ListPolicyTagsInput struct { // The ARN of the IAM customer managed policy whose tags you want to see. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. PolicyArn *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type ListPolicyTagsOutput struct { // The list of tags that are currently attached to the IAM customer managed // policy. Each tag consists of a key name and an associated value. If no tags are // attached to the specified resource, the response contains an empty list. // // This member is required. Tags []types.Tag // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListPolicyTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListPolicyTags{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListPolicyTags{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListPolicyTagsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListPolicyTags(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListPolicyTagsAPIClient is a client that implements the ListPolicyTags // operation. type ListPolicyTagsAPIClient interface { ListPolicyTags(context.Context, *ListPolicyTagsInput, ...func(*Options)) (*ListPolicyTagsOutput, error) } var _ ListPolicyTagsAPIClient = (*Client)(nil) // ListPolicyTagsPaginatorOptions is the paginator options for ListPolicyTags type ListPolicyTagsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListPolicyTagsPaginator is a paginator for ListPolicyTags type ListPolicyTagsPaginator struct { options ListPolicyTagsPaginatorOptions client ListPolicyTagsAPIClient params *ListPolicyTagsInput nextToken *string firstPage bool } // NewListPolicyTagsPaginator returns a new ListPolicyTagsPaginator func NewListPolicyTagsPaginator(client ListPolicyTagsAPIClient, params *ListPolicyTagsInput, optFns ...func(*ListPolicyTagsPaginatorOptions)) *ListPolicyTagsPaginator { if params == nil { params = &ListPolicyTagsInput{} } options := ListPolicyTagsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListPolicyTagsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListPolicyTagsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListPolicyTags page. func (p *ListPolicyTagsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListPolicyTagsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListPolicyTags(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListPolicyTags(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListPolicyTags", } }
259
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists information about the versions of the specified managed policy, including // the version that is currently set as the policy's default version. For more // information about managed policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. func (c *Client) ListPolicyVersions(ctx context.Context, params *ListPolicyVersionsInput, optFns ...func(*Options)) (*ListPolicyVersionsOutput, error) { if params == nil { params = &ListPolicyVersionsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListPolicyVersions", params, optFns, c.addOperationListPolicyVersionsMiddlewares) if err != nil { return nil, err } out := result.(*ListPolicyVersionsOutput) out.ResultMetadata = metadata return out, nil } type ListPolicyVersionsInput struct { // The Amazon Resource Name (ARN) of the IAM policy for which you want the // versions. For more information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicyArn *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful ListPolicyVersions request. type ListPolicyVersionsOutput struct { // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // A list of policy versions. For more information about managed policy versions, // see Versioning for managed policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html) // in the IAM User Guide. Versions []types.PolicyVersion // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListPolicyVersionsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListPolicyVersions{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListPolicyVersions{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListPolicyVersionsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListPolicyVersions(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListPolicyVersionsAPIClient is a client that implements the ListPolicyVersions // operation. type ListPolicyVersionsAPIClient interface { ListPolicyVersions(context.Context, *ListPolicyVersionsInput, ...func(*Options)) (*ListPolicyVersionsOutput, error) } var _ ListPolicyVersionsAPIClient = (*Client)(nil) // ListPolicyVersionsPaginatorOptions is the paginator options for // ListPolicyVersions type ListPolicyVersionsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListPolicyVersionsPaginator is a paginator for ListPolicyVersions type ListPolicyVersionsPaginator struct { options ListPolicyVersionsPaginatorOptions client ListPolicyVersionsAPIClient params *ListPolicyVersionsInput nextToken *string firstPage bool } // NewListPolicyVersionsPaginator returns a new ListPolicyVersionsPaginator func NewListPolicyVersionsPaginator(client ListPolicyVersionsAPIClient, params *ListPolicyVersionsInput, optFns ...func(*ListPolicyVersionsPaginatorOptions)) *ListPolicyVersionsPaginator { if params == nil { params = &ListPolicyVersionsInput{} } options := ListPolicyVersionsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListPolicyVersionsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListPolicyVersionsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListPolicyVersions page. func (p *ListPolicyVersionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListPolicyVersionsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListPolicyVersions(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListPolicyVersions(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListPolicyVersions", } }
258
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the names of the inline policies that are embedded in the specified IAM // role. An IAM role can also have managed policies attached to it. To list the // managed policies that are attached to a role, use ListAttachedRolePolicies . For // more information about policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. You can paginate the results using the MaxItems and // Marker parameters. If there are no inline policies embedded with the specified // role, the operation returns an empty list. func (c *Client) ListRolePolicies(ctx context.Context, params *ListRolePoliciesInput, optFns ...func(*Options)) (*ListRolePoliciesOutput, error) { if params == nil { params = &ListRolePoliciesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListRolePolicies", params, optFns, c.addOperationListRolePoliciesMiddlewares) if err != nil { return nil, err } out := result.(*ListRolePoliciesOutput) out.ResultMetadata = metadata return out, nil } type ListRolePoliciesInput struct { // The name of the role to list policies for. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. RoleName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful ListRolePolicies request. type ListRolePoliciesOutput struct { // A list of policy names. // // This member is required. PolicyNames []string // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListRolePoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListRolePolicies{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListRolePolicies{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListRolePoliciesValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRolePolicies(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListRolePoliciesAPIClient is a client that implements the ListRolePolicies // operation. type ListRolePoliciesAPIClient interface { ListRolePolicies(context.Context, *ListRolePoliciesInput, ...func(*Options)) (*ListRolePoliciesOutput, error) } var _ ListRolePoliciesAPIClient = (*Client)(nil) // ListRolePoliciesPaginatorOptions is the paginator options for ListRolePolicies type ListRolePoliciesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListRolePoliciesPaginator is a paginator for ListRolePolicies type ListRolePoliciesPaginator struct { options ListRolePoliciesPaginatorOptions client ListRolePoliciesAPIClient params *ListRolePoliciesInput nextToken *string firstPage bool } // NewListRolePoliciesPaginator returns a new ListRolePoliciesPaginator func NewListRolePoliciesPaginator(client ListRolePoliciesAPIClient, params *ListRolePoliciesInput, optFns ...func(*ListRolePoliciesPaginatorOptions)) *ListRolePoliciesPaginator { if params == nil { params = &ListRolePoliciesInput{} } options := ListRolePoliciesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListRolePoliciesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListRolePoliciesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListRolePolicies page. func (p *ListRolePoliciesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRolePoliciesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListRolePolicies(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListRolePolicies(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListRolePolicies", } }
260
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the IAM roles that have the specified path prefix. If there are none, the // operation returns an empty list. For more information about roles, see Working // with roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html) // . IAM resource-listing operations return a subset of the available attributes // for the resource. This operation does not return the following attributes, even // though they are an attribute of the returned object: // - PermissionsBoundary // - RoleLastUsed // - Tags // // To view all of the information for a role, see GetRole . You can paginate the // results using the MaxItems and Marker parameters. func (c *Client) ListRoles(ctx context.Context, params *ListRolesInput, optFns ...func(*Options)) (*ListRolesOutput, error) { if params == nil { params = &ListRolesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListRoles", params, optFns, c.addOperationListRolesMiddlewares) if err != nil { return nil, err } out := result.(*ListRolesOutput) out.ResultMetadata = metadata return out, nil } type ListRolesInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. For example, the prefix // /application_abc/component_xyz/ gets all roles whose path starts with // /application_abc/component_xyz/ . This parameter is optional. If it is not // included, it defaults to a slash (/), listing all roles. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of either a forward slash (/) by itself or a string that // must begin and end with forward slashes. In addition, it can contain any ASCII // character from the ! ( \u0021 ) through the DEL character ( \u007F ), including // most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string noSmithyDocumentSerde } // Contains the response to a successful ListRoles request. type ListRolesOutput struct { // A list of roles. // // This member is required. Roles []types.Role // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListRolesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListRoles{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListRoles{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRoles(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListRolesAPIClient is a client that implements the ListRoles operation. type ListRolesAPIClient interface { ListRoles(context.Context, *ListRolesInput, ...func(*Options)) (*ListRolesOutput, error) } var _ ListRolesAPIClient = (*Client)(nil) // ListRolesPaginatorOptions is the paginator options for ListRoles type ListRolesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListRolesPaginator is a paginator for ListRoles type ListRolesPaginator struct { options ListRolesPaginatorOptions client ListRolesAPIClient params *ListRolesInput nextToken *string firstPage bool } // NewListRolesPaginator returns a new ListRolesPaginator func NewListRolesPaginator(client ListRolesAPIClient, params *ListRolesInput, optFns ...func(*ListRolesPaginatorOptions)) *ListRolesPaginator { if params == nil { params = &ListRolesInput{} } options := ListRolesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListRolesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListRolesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListRoles page. func (p *ListRolesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRolesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListRoles(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListRoles(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListRoles", } }
265
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the tags that are attached to the specified role. The returned list of // tags is sorted by tag key. For more information about tagging, see Tagging IAM // resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) in the // IAM User Guide. func (c *Client) ListRoleTags(ctx context.Context, params *ListRoleTagsInput, optFns ...func(*Options)) (*ListRoleTagsOutput, error) { if params == nil { params = &ListRoleTagsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListRoleTags", params, optFns, c.addOperationListRoleTagsMiddlewares) if err != nil { return nil, err } out := result.(*ListRoleTagsOutput) out.ResultMetadata = metadata return out, nil } type ListRoleTagsInput struct { // The name of the IAM role for which you want to see the list of tags. This // parameter accepts (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters that consist of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. RoleName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type ListRoleTagsOutput struct { // The list of tags that are currently attached to the role. Each tag consists of // a key name and an associated value. If no tags are attached to the specified // resource, the response contains an empty list. // // This member is required. Tags []types.Tag // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListRoleTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListRoleTags{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListRoleTags{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListRoleTagsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRoleTags(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListRoleTagsAPIClient is a client that implements the ListRoleTags operation. type ListRoleTagsAPIClient interface { ListRoleTags(context.Context, *ListRoleTagsInput, ...func(*Options)) (*ListRoleTagsOutput, error) } var _ ListRoleTagsAPIClient = (*Client)(nil) // ListRoleTagsPaginatorOptions is the paginator options for ListRoleTags type ListRoleTagsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListRoleTagsPaginator is a paginator for ListRoleTags type ListRoleTagsPaginator struct { options ListRoleTagsPaginatorOptions client ListRoleTagsAPIClient params *ListRoleTagsInput nextToken *string firstPage bool } // NewListRoleTagsPaginator returns a new ListRoleTagsPaginator func NewListRoleTagsPaginator(client ListRoleTagsAPIClient, params *ListRoleTagsInput, optFns ...func(*ListRoleTagsPaginatorOptions)) *ListRoleTagsPaginator { if params == nil { params = &ListRoleTagsInput{} } options := ListRoleTagsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListRoleTagsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListRoleTagsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListRoleTags page. func (p *ListRoleTagsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRoleTagsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListRoleTags(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListRoleTags(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListRoleTags", } }
259
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the SAML provider resource objects defined in IAM in the account. IAM // resource-listing operations return a subset of the available attributes for the // resource. For example, this operation does not return tags, even though they are // an attribute of the returned object. To view all of the information for a SAML // provider, see GetSAMLProvider . This operation requires Signature Version 4 (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html) // . func (c *Client) ListSAMLProviders(ctx context.Context, params *ListSAMLProvidersInput, optFns ...func(*Options)) (*ListSAMLProvidersOutput, error) { if params == nil { params = &ListSAMLProvidersInput{} } result, metadata, err := c.invokeOperation(ctx, "ListSAMLProviders", params, optFns, c.addOperationListSAMLProvidersMiddlewares) if err != nil { return nil, err } out := result.(*ListSAMLProvidersOutput) out.ResultMetadata = metadata return out, nil } type ListSAMLProvidersInput struct { noSmithyDocumentSerde } // Contains the response to a successful ListSAMLProviders request. type ListSAMLProvidersOutput struct { // The list of SAML provider resource objects defined in IAM for this Amazon Web // Services account. SAMLProviderList []types.SAMLProviderListEntry // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListSAMLProvidersMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListSAMLProviders{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListSAMLProviders{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListSAMLProviders(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opListSAMLProviders(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListSAMLProviders", } }
123
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the tags that are attached to the specified Security Assertion Markup // Language (SAML) identity provider. The returned list of tags is sorted by tag // key. For more information, see About SAML 2.0-based federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) // . For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) ListSAMLProviderTags(ctx context.Context, params *ListSAMLProviderTagsInput, optFns ...func(*Options)) (*ListSAMLProviderTagsOutput, error) { if params == nil { params = &ListSAMLProviderTagsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListSAMLProviderTags", params, optFns, c.addOperationListSAMLProviderTagsMiddlewares) if err != nil { return nil, err } out := result.(*ListSAMLProviderTagsOutput) out.ResultMetadata = metadata return out, nil } type ListSAMLProviderTagsInput struct { // The ARN of the Security Assertion Markup Language (SAML) identity provider // whose tags you want to see. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. SAMLProviderArn *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type ListSAMLProviderTagsOutput struct { // The list of tags that are currently attached to the Security Assertion Markup // Language (SAML) identity provider. Each tag consists of a key name and an // associated value. If no tags are attached to the specified resource, the // response contains an empty list. // // This member is required. Tags []types.Tag // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListSAMLProviderTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListSAMLProviderTags{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListSAMLProviderTags{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListSAMLProviderTagsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListSAMLProviderTags(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListSAMLProviderTagsAPIClient is a client that implements the // ListSAMLProviderTags operation. type ListSAMLProviderTagsAPIClient interface { ListSAMLProviderTags(context.Context, *ListSAMLProviderTagsInput, ...func(*Options)) (*ListSAMLProviderTagsOutput, error) } var _ ListSAMLProviderTagsAPIClient = (*Client)(nil) // ListSAMLProviderTagsPaginatorOptions is the paginator options for // ListSAMLProviderTags type ListSAMLProviderTagsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListSAMLProviderTagsPaginator is a paginator for ListSAMLProviderTags type ListSAMLProviderTagsPaginator struct { options ListSAMLProviderTagsPaginatorOptions client ListSAMLProviderTagsAPIClient params *ListSAMLProviderTagsInput nextToken *string firstPage bool } // NewListSAMLProviderTagsPaginator returns a new ListSAMLProviderTagsPaginator func NewListSAMLProviderTagsPaginator(client ListSAMLProviderTagsAPIClient, params *ListSAMLProviderTagsInput, optFns ...func(*ListSAMLProviderTagsPaginatorOptions)) *ListSAMLProviderTagsPaginator { if params == nil { params = &ListSAMLProviderTagsInput{} } options := ListSAMLProviderTagsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListSAMLProviderTagsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListSAMLProviderTagsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListSAMLProviderTags page. func (p *ListSAMLProviderTagsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListSAMLProviderTagsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListSAMLProviderTags(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListSAMLProviderTags(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListSAMLProviderTags", } }
263
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the server certificates stored in IAM that have the specified path // prefix. If none exist, the operation returns an empty list. You can paginate the // results using the MaxItems and Marker parameters. For more information about // working with server certificates, see Working with server certificates (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html) // in the IAM User Guide. This topic also includes a list of Amazon Web Services // services that can use the server certificates that you manage with IAM. IAM // resource-listing operations return a subset of the available attributes for the // resource. For example, this operation does not return tags, even though they are // an attribute of the returned object. To view all of the information for a // servercertificate, see GetServerCertificate . func (c *Client) ListServerCertificates(ctx context.Context, params *ListServerCertificatesInput, optFns ...func(*Options)) (*ListServerCertificatesOutput, error) { if params == nil { params = &ListServerCertificatesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListServerCertificates", params, optFns, c.addOperationListServerCertificatesMiddlewares) if err != nil { return nil, err } out := result.(*ListServerCertificatesOutput) out.ResultMetadata = metadata return out, nil } type ListServerCertificatesInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. For example: /company/servercerts // would get all server certificates for which the path starts with // /company/servercerts . This parameter is optional. If it is not included, it // defaults to a slash (/), listing all server certificates. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of either a forward slash (/) by itself or a string that // must begin and end with forward slashes. In addition, it can contain any ASCII // character from the ! ( \u0021 ) through the DEL character ( \u007F ), including // most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string noSmithyDocumentSerde } // Contains the response to a successful ListServerCertificates request. type ListServerCertificatesOutput struct { // A list of server certificates. // // This member is required. ServerCertificateMetadataList []types.ServerCertificateMetadata // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListServerCertificatesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListServerCertificates{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListServerCertificates{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListServerCertificates(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListServerCertificatesAPIClient is a client that implements the // ListServerCertificates operation. type ListServerCertificatesAPIClient interface { ListServerCertificates(context.Context, *ListServerCertificatesInput, ...func(*Options)) (*ListServerCertificatesOutput, error) } var _ ListServerCertificatesAPIClient = (*Client)(nil) // ListServerCertificatesPaginatorOptions is the paginator options for // ListServerCertificates type ListServerCertificatesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListServerCertificatesPaginator is a paginator for ListServerCertificates type ListServerCertificatesPaginator struct { options ListServerCertificatesPaginatorOptions client ListServerCertificatesAPIClient params *ListServerCertificatesInput nextToken *string firstPage bool } // NewListServerCertificatesPaginator returns a new ListServerCertificatesPaginator func NewListServerCertificatesPaginator(client ListServerCertificatesAPIClient, params *ListServerCertificatesInput, optFns ...func(*ListServerCertificatesPaginatorOptions)) *ListServerCertificatesPaginator { if params == nil { params = &ListServerCertificatesInput{} } options := ListServerCertificatesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListServerCertificatesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListServerCertificatesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListServerCertificates page. func (p *ListServerCertificatesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListServerCertificatesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListServerCertificates(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListServerCertificates(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListServerCertificates", } }
265
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the tags that are attached to the specified IAM server certificate. The // returned list of tags is sorted by tag key. For more information about tagging, // see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. For certificates in a Region supported by Certificate // Manager (ACM), we recommend that you don't use IAM server certificates. Instead, // use ACM to provision, manage, and deploy your server certificates. For more // information about IAM server certificates, Working with server certificates (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html) // in the IAM User Guide. func (c *Client) ListServerCertificateTags(ctx context.Context, params *ListServerCertificateTagsInput, optFns ...func(*Options)) (*ListServerCertificateTagsOutput, error) { if params == nil { params = &ListServerCertificateTagsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListServerCertificateTags", params, optFns, c.addOperationListServerCertificateTagsMiddlewares) if err != nil { return nil, err } out := result.(*ListServerCertificateTagsOutput) out.ResultMetadata = metadata return out, nil } type ListServerCertificateTagsInput struct { // The name of the IAM server certificate whose tags you want to see. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. ServerCertificateName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type ListServerCertificateTagsOutput struct { // The list of tags that are currently attached to the IAM server certificate. // Each tag consists of a key name and an associated value. If no tags are attached // to the specified resource, the response contains an empty list. // // This member is required. Tags []types.Tag // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListServerCertificateTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListServerCertificateTags{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListServerCertificateTags{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListServerCertificateTagsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListServerCertificateTags(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListServerCertificateTagsAPIClient is a client that implements the // ListServerCertificateTags operation. type ListServerCertificateTagsAPIClient interface { ListServerCertificateTags(context.Context, *ListServerCertificateTagsInput, ...func(*Options)) (*ListServerCertificateTagsOutput, error) } var _ ListServerCertificateTagsAPIClient = (*Client)(nil) // ListServerCertificateTagsPaginatorOptions is the paginator options for // ListServerCertificateTags type ListServerCertificateTagsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListServerCertificateTagsPaginator is a paginator for ListServerCertificateTags type ListServerCertificateTagsPaginator struct { options ListServerCertificateTagsPaginatorOptions client ListServerCertificateTagsAPIClient params *ListServerCertificateTagsInput nextToken *string firstPage bool } // NewListServerCertificateTagsPaginator returns a new // ListServerCertificateTagsPaginator func NewListServerCertificateTagsPaginator(client ListServerCertificateTagsAPIClient, params *ListServerCertificateTagsInput, optFns ...func(*ListServerCertificateTagsPaginatorOptions)) *ListServerCertificateTagsPaginator { if params == nil { params = &ListServerCertificateTagsInput{} } options := ListServerCertificateTagsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListServerCertificateTagsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListServerCertificateTagsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListServerCertificateTags page. func (p *ListServerCertificateTagsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListServerCertificateTagsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListServerCertificateTags(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListServerCertificateTags(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListServerCertificateTags", } }
265
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Returns information about the service-specific credentials associated with the // specified IAM user. If none exists, the operation returns an empty list. The // service-specific credentials returned by this operation are used only for // authenticating the IAM user to a specific service. For more information about // using service-specific credentials to authenticate to an Amazon Web Services // service, see Set up service-specific credentials (https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html) // in the CodeCommit User Guide. func (c *Client) ListServiceSpecificCredentials(ctx context.Context, params *ListServiceSpecificCredentialsInput, optFns ...func(*Options)) (*ListServiceSpecificCredentialsOutput, error) { if params == nil { params = &ListServiceSpecificCredentialsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListServiceSpecificCredentials", params, optFns, c.addOperationListServiceSpecificCredentialsMiddlewares) if err != nil { return nil, err } out := result.(*ListServiceSpecificCredentialsOutput) out.ResultMetadata = metadata return out, nil } type ListServiceSpecificCredentialsInput struct { // Filters the returned results to only those for the specified Amazon Web // Services service. If not specified, then Amazon Web Services returns // service-specific credentials for all services. ServiceName *string // The name of the user whose service-specific credentials you want information // about. If this value is not specified, then the operation assumes the user whose // credentials are used to call the operation. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- UserName *string noSmithyDocumentSerde } type ListServiceSpecificCredentialsOutput struct { // A list of structures that each contain details about a service-specific // credential. ServiceSpecificCredentials []types.ServiceSpecificCredentialMetadata // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListServiceSpecificCredentialsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListServiceSpecificCredentials{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListServiceSpecificCredentials{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListServiceSpecificCredentials(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opListServiceSpecificCredentials(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListServiceSpecificCredentials", } }
137
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Returns information about the signing certificates associated with the // specified IAM user. If none exists, the operation returns an empty list. // Although each user is limited to a small number of signing certificates, you can // still paginate the results using the MaxItems and Marker parameters. If the // UserName field is not specified, the user name is determined implicitly based on // the Amazon Web Services access key ID used to sign the request for this // operation. This operation works for access keys under the Amazon Web Services // account. Consequently, you can use this operation to manage Amazon Web Services // account root user credentials even if the Amazon Web Services account has no // associated users. func (c *Client) ListSigningCertificates(ctx context.Context, params *ListSigningCertificatesInput, optFns ...func(*Options)) (*ListSigningCertificatesOutput, error) { if params == nil { params = &ListSigningCertificatesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListSigningCertificates", params, optFns, c.addOperationListSigningCertificatesMiddlewares) if err != nil { return nil, err } out := result.(*ListSigningCertificatesOutput) out.ResultMetadata = metadata return out, nil } type ListSigningCertificatesInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The name of the IAM user whose signing certificates you want to examine. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- UserName *string noSmithyDocumentSerde } // Contains the response to a successful ListSigningCertificates request. type ListSigningCertificatesOutput struct { // A list of the user's signing certificate information. // // This member is required. Certificates []types.SigningCertificate // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListSigningCertificatesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListSigningCertificates{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListSigningCertificates{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListSigningCertificates(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListSigningCertificatesAPIClient is a client that implements the // ListSigningCertificates operation. type ListSigningCertificatesAPIClient interface { ListSigningCertificates(context.Context, *ListSigningCertificatesInput, ...func(*Options)) (*ListSigningCertificatesOutput, error) } var _ ListSigningCertificatesAPIClient = (*Client)(nil) // ListSigningCertificatesPaginatorOptions is the paginator options for // ListSigningCertificates type ListSigningCertificatesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListSigningCertificatesPaginator is a paginator for ListSigningCertificates type ListSigningCertificatesPaginator struct { options ListSigningCertificatesPaginatorOptions client ListSigningCertificatesAPIClient params *ListSigningCertificatesInput nextToken *string firstPage bool } // NewListSigningCertificatesPaginator returns a new // ListSigningCertificatesPaginator func NewListSigningCertificatesPaginator(client ListSigningCertificatesAPIClient, params *ListSigningCertificatesInput, optFns ...func(*ListSigningCertificatesPaginatorOptions)) *ListSigningCertificatesPaginator { if params == nil { params = &ListSigningCertificatesInput{} } options := ListSigningCertificatesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListSigningCertificatesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListSigningCertificatesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListSigningCertificates page. func (p *ListSigningCertificatesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListSigningCertificatesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListSigningCertificates(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListSigningCertificates(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListSigningCertificates", } }
261
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Returns information about the SSH public keys associated with the specified IAM // user. If none exists, the operation returns an empty list. The SSH public keys // returned by this operation are used only for authenticating the IAM user to an // CodeCommit repository. For more information about using SSH keys to authenticate // to an CodeCommit repository, see Set up CodeCommit for SSH connections (https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-credentials-ssh.html) // in the CodeCommit User Guide. Although each user is limited to a small number of // keys, you can still paginate the results using the MaxItems and Marker // parameters. func (c *Client) ListSSHPublicKeys(ctx context.Context, params *ListSSHPublicKeysInput, optFns ...func(*Options)) (*ListSSHPublicKeysOutput, error) { if params == nil { params = &ListSSHPublicKeysInput{} } result, metadata, err := c.invokeOperation(ctx, "ListSSHPublicKeys", params, optFns, c.addOperationListSSHPublicKeysMiddlewares) if err != nil { return nil, err } out := result.(*ListSSHPublicKeysOutput) out.ResultMetadata = metadata return out, nil } type ListSSHPublicKeysInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The name of the IAM user to list SSH public keys for. If none is specified, the // UserName field is determined implicitly based on the Amazon Web Services access // key used to sign the request. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- UserName *string noSmithyDocumentSerde } // Contains the response to a successful ListSSHPublicKeys request. type ListSSHPublicKeysOutput struct { // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // A list of the SSH public keys assigned to IAM user. SSHPublicKeys []types.SSHPublicKeyMetadata // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListSSHPublicKeysMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListSSHPublicKeys{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListSSHPublicKeys{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListSSHPublicKeys(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListSSHPublicKeysAPIClient is a client that implements the ListSSHPublicKeys // operation. type ListSSHPublicKeysAPIClient interface { ListSSHPublicKeys(context.Context, *ListSSHPublicKeysInput, ...func(*Options)) (*ListSSHPublicKeysOutput, error) } var _ ListSSHPublicKeysAPIClient = (*Client)(nil) // ListSSHPublicKeysPaginatorOptions is the paginator options for ListSSHPublicKeys type ListSSHPublicKeysPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListSSHPublicKeysPaginator is a paginator for ListSSHPublicKeys type ListSSHPublicKeysPaginator struct { options ListSSHPublicKeysPaginatorOptions client ListSSHPublicKeysAPIClient params *ListSSHPublicKeysInput nextToken *string firstPage bool } // NewListSSHPublicKeysPaginator returns a new ListSSHPublicKeysPaginator func NewListSSHPublicKeysPaginator(client ListSSHPublicKeysAPIClient, params *ListSSHPublicKeysInput, optFns ...func(*ListSSHPublicKeysPaginatorOptions)) *ListSSHPublicKeysPaginator { if params == nil { params = &ListSSHPublicKeysInput{} } options := ListSSHPublicKeysPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListSSHPublicKeysPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListSSHPublicKeysPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListSSHPublicKeys page. func (p *ListSSHPublicKeysPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListSSHPublicKeysOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListSSHPublicKeys(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListSSHPublicKeys(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListSSHPublicKeys", } }
257
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the names of the inline policies embedded in the specified IAM user. An // IAM user can also have managed policies attached to it. To list the managed // policies that are attached to a user, use ListAttachedUserPolicies . For more // information about policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. You can paginate the results using the MaxItems and // Marker parameters. If there are no inline policies embedded with the specified // user, the operation returns an empty list. func (c *Client) ListUserPolicies(ctx context.Context, params *ListUserPoliciesInput, optFns ...func(*Options)) (*ListUserPoliciesOutput, error) { if params == nil { params = &ListUserPoliciesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListUserPolicies", params, optFns, c.addOperationListUserPoliciesMiddlewares) if err != nil { return nil, err } out := result.(*ListUserPoliciesOutput) out.ResultMetadata = metadata return out, nil } type ListUserPoliciesInput struct { // The name of the user to list policies for. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. UserName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful ListUserPolicies request. type ListUserPoliciesOutput struct { // A list of policy names. // // This member is required. PolicyNames []string // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListUserPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListUserPolicies{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListUserPolicies{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListUserPoliciesValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListUserPolicies(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListUserPoliciesAPIClient is a client that implements the ListUserPolicies // operation. type ListUserPoliciesAPIClient interface { ListUserPolicies(context.Context, *ListUserPoliciesInput, ...func(*Options)) (*ListUserPoliciesOutput, error) } var _ ListUserPoliciesAPIClient = (*Client)(nil) // ListUserPoliciesPaginatorOptions is the paginator options for ListUserPolicies type ListUserPoliciesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListUserPoliciesPaginator is a paginator for ListUserPolicies type ListUserPoliciesPaginator struct { options ListUserPoliciesPaginatorOptions client ListUserPoliciesAPIClient params *ListUserPoliciesInput nextToken *string firstPage bool } // NewListUserPoliciesPaginator returns a new ListUserPoliciesPaginator func NewListUserPoliciesPaginator(client ListUserPoliciesAPIClient, params *ListUserPoliciesInput, optFns ...func(*ListUserPoliciesPaginatorOptions)) *ListUserPoliciesPaginator { if params == nil { params = &ListUserPoliciesInput{} } options := ListUserPoliciesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListUserPoliciesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListUserPoliciesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListUserPolicies page. func (p *ListUserPoliciesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListUserPoliciesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListUserPolicies(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListUserPolicies(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListUserPolicies", } }
260
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the IAM users that have the specified path prefix. If no path prefix is // specified, the operation returns all users in the Amazon Web Services account. // If there are none, the operation returns an empty list. IAM resource-listing // operations return a subset of the available attributes for the resource. This // operation does not return the following attributes, even though they are an // attribute of the returned object: // - PermissionsBoundary // - Tags // // To view all of the information for a user, see GetUser . You can paginate the // results using the MaxItems and Marker parameters. func (c *Client) ListUsers(ctx context.Context, params *ListUsersInput, optFns ...func(*Options)) (*ListUsersOutput, error) { if params == nil { params = &ListUsersInput{} } result, metadata, err := c.invokeOperation(ctx, "ListUsers", params, optFns, c.addOperationListUsersMiddlewares) if err != nil { return nil, err } out := result.(*ListUsersOutput) out.ResultMetadata = metadata return out, nil } type ListUsersInput struct { // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The path prefix for filtering the results. For example: // /division_abc/subdivision_xyz/ , which would get all user names whose path // starts with /division_abc/subdivision_xyz/ . This parameter is optional. If it // is not included, it defaults to a slash (/), listing all user names. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of either a forward slash (/) by itself or a // string that must begin and end with forward slashes. In addition, it can contain // any ASCII character from the ! ( \u0021 ) through the DEL character ( \u007F ), // including most punctuation characters, digits, and upper and lowercased letters. PathPrefix *string noSmithyDocumentSerde } // Contains the response to a successful ListUsers request. type ListUsersOutput struct { // A list of users. // // This member is required. Users []types.User // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListUsersMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListUsers{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListUsers{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListUsers(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListUsersAPIClient is a client that implements the ListUsers operation. type ListUsersAPIClient interface { ListUsers(context.Context, *ListUsersInput, ...func(*Options)) (*ListUsersOutput, error) } var _ ListUsersAPIClient = (*Client)(nil) // ListUsersPaginatorOptions is the paginator options for ListUsers type ListUsersPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListUsersPaginator is a paginator for ListUsers type ListUsersPaginator struct { options ListUsersPaginatorOptions client ListUsersAPIClient params *ListUsersInput nextToken *string firstPage bool } // NewListUsersPaginator returns a new ListUsersPaginator func NewListUsersPaginator(client ListUsersAPIClient, params *ListUsersInput, optFns ...func(*ListUsersPaginatorOptions)) *ListUsersPaginator { if params == nil { params = &ListUsersInput{} } options := ListUsersPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListUsersPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListUsersPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListUsers page. func (p *ListUsersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListUsersOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListUsers(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListUsers(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListUsers", } }
264
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the tags that are attached to the specified IAM user. The returned list // of tags is sorted by tag key. For more information about tagging, see Tagging // IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) in // the IAM User Guide. func (c *Client) ListUserTags(ctx context.Context, params *ListUserTagsInput, optFns ...func(*Options)) (*ListUserTagsOutput, error) { if params == nil { params = &ListUserTagsInput{} } result, metadata, err := c.invokeOperation(ctx, "ListUserTags", params, optFns, c.addOperationListUserTagsMiddlewares) if err != nil { return nil, err } out := result.(*ListUserTagsOutput) out.ResultMetadata = metadata return out, nil } type ListUserTagsInput struct { // The name of the IAM user whose tags you want to see. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } type ListUserTagsOutput struct { // The list of tags that are currently attached to the user. Each tag consists of // a key name and an associated value. If no tags are attached to the specified // resource, the response contains an empty list. // // This member is required. Tags []types.Tag // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListUserTagsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListUserTags{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListUserTags{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpListUserTagsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListUserTags(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListUserTagsAPIClient is a client that implements the ListUserTags operation. type ListUserTagsAPIClient interface { ListUserTags(context.Context, *ListUserTagsInput, ...func(*Options)) (*ListUserTagsOutput, error) } var _ ListUserTagsAPIClient = (*Client)(nil) // ListUserTagsPaginatorOptions is the paginator options for ListUserTags type ListUserTagsPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListUserTagsPaginator is a paginator for ListUserTags type ListUserTagsPaginator struct { options ListUserTagsPaginatorOptions client ListUserTagsAPIClient params *ListUserTagsInput nextToken *string firstPage bool } // NewListUserTagsPaginator returns a new ListUserTagsPaginator func NewListUserTagsPaginator(client ListUserTagsAPIClient, params *ListUserTagsInput, optFns ...func(*ListUserTagsPaginatorOptions)) *ListUserTagsPaginator { if params == nil { params = &ListUserTagsInput{} } options := ListUserTagsPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListUserTagsPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListUserTagsPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListUserTags page. func (p *ListUserTagsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListUserTagsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListUserTags(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListUserTags(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListUserTags", } }
258
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Lists the virtual MFA devices defined in the Amazon Web Services account by // assignment status. If you do not specify an assignment status, the operation // returns a list of all virtual MFA devices. Assignment status can be Assigned , // Unassigned , or Any . IAM resource-listing operations return a subset of the // available attributes for the resource. For example, this operation does not // return tags, even though they are an attribute of the returned object. To view // tag information for a virtual MFA device, see ListMFADeviceTags . You can // paginate the results using the MaxItems and Marker parameters. func (c *Client) ListVirtualMFADevices(ctx context.Context, params *ListVirtualMFADevicesInput, optFns ...func(*Options)) (*ListVirtualMFADevicesOutput, error) { if params == nil { params = &ListVirtualMFADevicesInput{} } result, metadata, err := c.invokeOperation(ctx, "ListVirtualMFADevices", params, optFns, c.addOperationListVirtualMFADevicesMiddlewares) if err != nil { return nil, err } out := result.(*ListVirtualMFADevicesOutput) out.ResultMetadata = metadata return out, nil } type ListVirtualMFADevicesInput struct { // The status ( Unassigned or Assigned ) of the devices to list. If you do not // specify an AssignmentStatus , the operation defaults to Any , which lists both // assigned and unassigned virtual MFA devices., AssignmentStatus types.AssignmentStatusType // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 noSmithyDocumentSerde } // Contains the response to a successful ListVirtualMFADevices request. type ListVirtualMFADevicesOutput struct { // The list of virtual MFA devices in the current account that match the // AssignmentStatus value that was passed in the request. // // This member is required. VirtualMFADevices []types.VirtualMFADevice // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationListVirtualMFADevicesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpListVirtualMFADevices{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpListVirtualMFADevices{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListVirtualMFADevices(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // ListVirtualMFADevicesAPIClient is a client that implements the // ListVirtualMFADevices operation. type ListVirtualMFADevicesAPIClient interface { ListVirtualMFADevices(context.Context, *ListVirtualMFADevicesInput, ...func(*Options)) (*ListVirtualMFADevicesOutput, error) } var _ ListVirtualMFADevicesAPIClient = (*Client)(nil) // ListVirtualMFADevicesPaginatorOptions is the paginator options for // ListVirtualMFADevices type ListVirtualMFADevicesPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // ListVirtualMFADevicesPaginator is a paginator for ListVirtualMFADevices type ListVirtualMFADevicesPaginator struct { options ListVirtualMFADevicesPaginatorOptions client ListVirtualMFADevicesAPIClient params *ListVirtualMFADevicesInput nextToken *string firstPage bool } // NewListVirtualMFADevicesPaginator returns a new ListVirtualMFADevicesPaginator func NewListVirtualMFADevicesPaginator(client ListVirtualMFADevicesAPIClient, params *ListVirtualMFADevicesInput, optFns ...func(*ListVirtualMFADevicesPaginatorOptions)) *ListVirtualMFADevicesPaginator { if params == nil { params = &ListVirtualMFADevicesInput{} } options := ListVirtualMFADevicesPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &ListVirtualMFADevicesPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListVirtualMFADevicesPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next ListVirtualMFADevices page. func (p *ListVirtualMFADevicesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListVirtualMFADevicesOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.ListVirtualMFADevices(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opListVirtualMFADevices(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ListVirtualMFADevices", } }
258
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds or updates an inline policy document that is embedded in the specified IAM // group. A user can also have managed policies attached to it. To attach a managed // policy to a group, use AttachGroupPolicy (https://docs.aws.amazon.com/IAM/latest/APIReference/API_AttachGroupPolicy.html) // . To create a new managed policy, use CreatePolicy (https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreatePolicy.html) // . For information about policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. For information about the maximum number of inline // policies that you can embed in a group, see IAM and STS quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html) // in the IAM User Guide. Because policy documents can be large, you should use // POST rather than GET when calling PutGroupPolicy . For general information about // using the Query API with IAM, see Making query requests (https://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) // in the IAM User Guide. func (c *Client) PutGroupPolicy(ctx context.Context, params *PutGroupPolicyInput, optFns ...func(*Options)) (*PutGroupPolicyOutput, error) { if params == nil { params = &PutGroupPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "PutGroupPolicy", params, optFns, c.addOperationPutGroupPolicyMiddlewares) if err != nil { return nil, err } out := result.(*PutGroupPolicyOutput) out.ResultMetadata = metadata return out, nil } type PutGroupPolicyInput struct { // The name of the group to associate the policy with. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@-. // // This member is required. GroupName *string // The policy document. You must provide policies in JSON format in IAM. However, // for CloudFormation templates formatted in YAML, you can provide the policy in // JSON or YAML format. CloudFormation always converts a YAML policy to JSON format // before submitting it to = IAM. The regex pattern (http://wikipedia.org/wiki/regex) // used to validate this parameter is a string of characters consisting of the // following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) // // This member is required. PolicyDocument *string // The name of the policy document. This parameter allows (through its regex // pattern (http://wikipedia.org/wiki/regex) ) a string of characters consisting of // upper and lowercase alphanumeric characters with no spaces. You can also include // any of the following characters: _+=,.@- // // This member is required. PolicyName *string noSmithyDocumentSerde } type PutGroupPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutGroupPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpPutGroupPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpPutGroupPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpPutGroupPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutGroupPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutGroupPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "PutGroupPolicy", } }
157
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds or updates the policy that is specified as the IAM role's permissions // boundary. You can use an Amazon Web Services managed policy or a customer // managed policy to set the boundary for a role. Use the boundary to control the // maximum permissions that the role can have. Setting a permissions boundary is an // advanced feature that can affect the permissions for the role. You cannot set // the boundary for a service-linked role. Policies used as permissions boundaries // do not provide permissions. You must also attach a permissions policy to the // role. To learn how the effective permissions for a role are evaluated, see IAM // JSON policy evaluation logic (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html) // in the IAM User Guide. func (c *Client) PutRolePermissionsBoundary(ctx context.Context, params *PutRolePermissionsBoundaryInput, optFns ...func(*Options)) (*PutRolePermissionsBoundaryOutput, error) { if params == nil { params = &PutRolePermissionsBoundaryInput{} } result, metadata, err := c.invokeOperation(ctx, "PutRolePermissionsBoundary", params, optFns, c.addOperationPutRolePermissionsBoundaryMiddlewares) if err != nil { return nil, err } out := result.(*PutRolePermissionsBoundaryOutput) out.ResultMetadata = metadata return out, nil } type PutRolePermissionsBoundaryInput struct { // The ARN of the managed policy that is used to set the permissions boundary for // the role. A permissions boundary policy defines the maximum permissions that // identity-based policies can grant to an entity, but does not grant permissions. // Permissions boundaries do not define the maximum permissions that a // resource-based policy can grant to an entity. To learn more, see Permissions // boundaries for IAM entities (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) // in the IAM User Guide. For more information about policy types, see Policy // types (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policy-types) // in the IAM User Guide. // // This member is required. PermissionsBoundary *string // The name (friendly name, not ARN) of the IAM role for which you want to set the // permissions boundary. // // This member is required. RoleName *string noSmithyDocumentSerde } type PutRolePermissionsBoundaryOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutRolePermissionsBoundaryMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpPutRolePermissionsBoundary{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpPutRolePermissionsBoundary{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpPutRolePermissionsBoundaryValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutRolePermissionsBoundary(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutRolePermissionsBoundary(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "PutRolePermissionsBoundary", } }
143
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds or updates an inline policy document that is embedded in the specified IAM // role. When you embed an inline policy in a role, the inline policy is used as // part of the role's access (permissions) policy. The role's trust policy is // created at the same time as the role, using CreateRole (https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateRole.html) // . You can update a role's trust policy using UpdateAssumerolePolicy (https://docs.aws.amazon.com/IAM/latest/APIReference/API_UpdateAssumeRolePolicy.html) // . For more information about IAM roles, see Using roles to delegate permissions // and federate identities (https://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html) // . A role can also have a managed policy attached to it. To attach a managed // policy to a role, use AttachRolePolicy (https://docs.aws.amazon.com/IAM/latest/APIReference/API_AttachRolePolicy.html) // . To create a new managed policy, use CreatePolicy (https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreatePolicy.html) // . For information about policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. For information about the maximum number of inline // policies that you can embed with a role, see IAM and STS quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html) // in the IAM User Guide. Because policy documents can be large, you should use // POST rather than GET when calling PutRolePolicy . For general information about // using the Query API with IAM, see Making query requests (https://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) // in the IAM User Guide. func (c *Client) PutRolePolicy(ctx context.Context, params *PutRolePolicyInput, optFns ...func(*Options)) (*PutRolePolicyOutput, error) { if params == nil { params = &PutRolePolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "PutRolePolicy", params, optFns, c.addOperationPutRolePolicyMiddlewares) if err != nil { return nil, err } out := result.(*PutRolePolicyOutput) out.ResultMetadata = metadata return out, nil } type PutRolePolicyInput struct { // The policy document. You must provide policies in JSON format in IAM. However, // for CloudFormation templates formatted in YAML, you can provide the policy in // JSON or YAML format. CloudFormation always converts a YAML policy to JSON format // before submitting it to IAM. The regex pattern (http://wikipedia.org/wiki/regex) // used to validate this parameter is a string of characters consisting of the // following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) // // This member is required. PolicyDocument *string // The name of the policy document. This parameter allows (through its regex // pattern (http://wikipedia.org/wiki/regex) ) a string of characters consisting of // upper and lowercase alphanumeric characters with no spaces. You can also include // any of the following characters: _+=,.@- // // This member is required. PolicyName *string // The name of the role to associate the policy with. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. RoleName *string noSmithyDocumentSerde } type PutRolePolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutRolePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpPutRolePolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpPutRolePolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpPutRolePolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutRolePolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutRolePolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "PutRolePolicy", } }
163
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds or updates the policy that is specified as the IAM user's permissions // boundary. You can use an Amazon Web Services managed policy or a customer // managed policy to set the boundary for a user. Use the boundary to control the // maximum permissions that the user can have. Setting a permissions boundary is an // advanced feature that can affect the permissions for the user. Policies that are // used as permissions boundaries do not provide permissions. You must also attach // a permissions policy to the user. To learn how the effective permissions for a // user are evaluated, see IAM JSON policy evaluation logic (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html) // in the IAM User Guide. func (c *Client) PutUserPermissionsBoundary(ctx context.Context, params *PutUserPermissionsBoundaryInput, optFns ...func(*Options)) (*PutUserPermissionsBoundaryOutput, error) { if params == nil { params = &PutUserPermissionsBoundaryInput{} } result, metadata, err := c.invokeOperation(ctx, "PutUserPermissionsBoundary", params, optFns, c.addOperationPutUserPermissionsBoundaryMiddlewares) if err != nil { return nil, err } out := result.(*PutUserPermissionsBoundaryOutput) out.ResultMetadata = metadata return out, nil } type PutUserPermissionsBoundaryInput struct { // The ARN of the managed policy that is used to set the permissions boundary for // the user. A permissions boundary policy defines the maximum permissions that // identity-based policies can grant to an entity, but does not grant permissions. // Permissions boundaries do not define the maximum permissions that a // resource-based policy can grant to an entity. To learn more, see Permissions // boundaries for IAM entities (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) // in the IAM User Guide. For more information about policy types, see Policy // types (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policy-types) // in the IAM User Guide. // // This member is required. PermissionsBoundary *string // The name (friendly name, not ARN) of the IAM user for which you want to set the // permissions boundary. // // This member is required. UserName *string noSmithyDocumentSerde } type PutUserPermissionsBoundaryOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutUserPermissionsBoundaryMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpPutUserPermissionsBoundary{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpPutUserPermissionsBoundary{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpPutUserPermissionsBoundaryValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutUserPermissionsBoundary(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutUserPermissionsBoundary(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "PutUserPermissionsBoundary", } }
142
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds or updates an inline policy document that is embedded in the specified IAM // user. An IAM user can also have a managed policy attached to it. To attach a // managed policy to a user, use AttachUserPolicy (https://docs.aws.amazon.com/IAM/latest/APIReference/API_AttachUserPolicy.html) // . To create a new managed policy, use CreatePolicy (https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreatePolicy.html) // . For information about policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. For information about the maximum number of inline // policies that you can embed in a user, see IAM and STS quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html) // in the IAM User Guide. Because policy documents can be large, you should use // POST rather than GET when calling PutUserPolicy . For general information about // using the Query API with IAM, see Making query requests (https://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html) // in the IAM User Guide. func (c *Client) PutUserPolicy(ctx context.Context, params *PutUserPolicyInput, optFns ...func(*Options)) (*PutUserPolicyOutput, error) { if params == nil { params = &PutUserPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "PutUserPolicy", params, optFns, c.addOperationPutUserPolicyMiddlewares) if err != nil { return nil, err } out := result.(*PutUserPolicyOutput) out.ResultMetadata = metadata return out, nil } type PutUserPolicyInput struct { // The policy document. You must provide policies in JSON format in IAM. However, // for CloudFormation templates formatted in YAML, you can provide the policy in // JSON or YAML format. CloudFormation always converts a YAML policy to JSON format // before submitting it to IAM. The regex pattern (http://wikipedia.org/wiki/regex) // used to validate this parameter is a string of characters consisting of the // following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) // // This member is required. PolicyDocument *string // The name of the policy document. This parameter allows (through its regex // pattern (http://wikipedia.org/wiki/regex) ) a string of characters consisting of // upper and lowercase alphanumeric characters with no spaces. You can also include // any of the following characters: _+=,.@- // // This member is required. PolicyName *string // The name of the user to associate the policy with. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } type PutUserPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutUserPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpPutUserPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpPutUserPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpPutUserPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutUserPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutUserPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "PutUserPolicy", } }
157
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified client ID (also known as audience) from the list of // client IDs registered for the specified IAM OpenID Connect (OIDC) provider // resource object. This operation is idempotent; it does not fail or return an // error if you try to remove a client ID that does not exist. func (c *Client) RemoveClientIDFromOpenIDConnectProvider(ctx context.Context, params *RemoveClientIDFromOpenIDConnectProviderInput, optFns ...func(*Options)) (*RemoveClientIDFromOpenIDConnectProviderOutput, error) { if params == nil { params = &RemoveClientIDFromOpenIDConnectProviderInput{} } result, metadata, err := c.invokeOperation(ctx, "RemoveClientIDFromOpenIDConnectProvider", params, optFns, c.addOperationRemoveClientIDFromOpenIDConnectProviderMiddlewares) if err != nil { return nil, err } out := result.(*RemoveClientIDFromOpenIDConnectProviderOutput) out.ResultMetadata = metadata return out, nil } type RemoveClientIDFromOpenIDConnectProviderInput struct { // The client ID (also known as audience) to remove from the IAM OIDC provider // resource. For more information about client IDs, see CreateOpenIDConnectProvider // . // // This member is required. ClientID *string // The Amazon Resource Name (ARN) of the IAM OIDC provider resource to remove the // client ID from. You can get a list of OIDC provider ARNs by using the // ListOpenIDConnectProviders operation. For more information about ARNs, see // Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. OpenIDConnectProviderArn *string noSmithyDocumentSerde } type RemoveClientIDFromOpenIDConnectProviderOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationRemoveClientIDFromOpenIDConnectProviderMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpRemoveClientIDFromOpenIDConnectProvider{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpRemoveClientIDFromOpenIDConnectProvider{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpRemoveClientIDFromOpenIDConnectProviderValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRemoveClientIDFromOpenIDConnectProvider(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opRemoveClientIDFromOpenIDConnectProvider(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "RemoveClientIDFromOpenIDConnectProvider", } }
134
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified IAM role from the specified EC2 instance profile. Make // sure that you do not have any Amazon EC2 instances running with the role you are // about to remove from the instance profile. Removing a role from an instance // profile that is associated with a running instance might break any applications // running on the instance. For more information about IAM roles, see Working with // roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html) . // For more information about instance profiles, see About instance profiles (https://docs.aws.amazon.com/IAM/latest/UserGuide/AboutInstanceProfiles.html) // . func (c *Client) RemoveRoleFromInstanceProfile(ctx context.Context, params *RemoveRoleFromInstanceProfileInput, optFns ...func(*Options)) (*RemoveRoleFromInstanceProfileOutput, error) { if params == nil { params = &RemoveRoleFromInstanceProfileInput{} } result, metadata, err := c.invokeOperation(ctx, "RemoveRoleFromInstanceProfile", params, optFns, c.addOperationRemoveRoleFromInstanceProfileMiddlewares) if err != nil { return nil, err } out := result.(*RemoveRoleFromInstanceProfileOutput) out.ResultMetadata = metadata return out, nil } type RemoveRoleFromInstanceProfileInput struct { // The name of the instance profile to update. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- // // This member is required. InstanceProfileName *string // The name of the role to remove. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. RoleName *string noSmithyDocumentSerde } type RemoveRoleFromInstanceProfileOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationRemoveRoleFromInstanceProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpRemoveRoleFromInstanceProfile{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpRemoveRoleFromInstanceProfile{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpRemoveRoleFromInstanceProfileValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRemoveRoleFromInstanceProfile(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opRemoveRoleFromInstanceProfile(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "RemoveRoleFromInstanceProfile", } }
138
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified user from the specified group. func (c *Client) RemoveUserFromGroup(ctx context.Context, params *RemoveUserFromGroupInput, optFns ...func(*Options)) (*RemoveUserFromGroupOutput, error) { if params == nil { params = &RemoveUserFromGroupInput{} } result, metadata, err := c.invokeOperation(ctx, "RemoveUserFromGroup", params, optFns, c.addOperationRemoveUserFromGroupMiddlewares) if err != nil { return nil, err } out := result.(*RemoveUserFromGroupOutput) out.ResultMetadata = metadata return out, nil } type RemoveUserFromGroupInput struct { // The name of the group to update. This parameter allows (through its regex // pattern (http://wikipedia.org/wiki/regex) ) a string of characters consisting of // upper and lowercase alphanumeric characters with no spaces. You can also include // any of the following characters: _+=,.@- // // This member is required. GroupName *string // The name of the user to remove. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } type RemoveUserFromGroupOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationRemoveUserFromGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpRemoveUserFromGroup{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpRemoveUserFromGroup{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpRemoveUserFromGroupValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRemoveUserFromGroup(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opRemoveUserFromGroup(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "RemoveUserFromGroup", } }
131
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Resets the password for a service-specific credential. The new password is // Amazon Web Services generated and cryptographically strong. It cannot be // configured by the user. Resetting the password immediately invalidates the // previous password associated with this user. func (c *Client) ResetServiceSpecificCredential(ctx context.Context, params *ResetServiceSpecificCredentialInput, optFns ...func(*Options)) (*ResetServiceSpecificCredentialOutput, error) { if params == nil { params = &ResetServiceSpecificCredentialInput{} } result, metadata, err := c.invokeOperation(ctx, "ResetServiceSpecificCredential", params, optFns, c.addOperationResetServiceSpecificCredentialMiddlewares) if err != nil { return nil, err } out := result.(*ResetServiceSpecificCredentialOutput) out.ResultMetadata = metadata return out, nil } type ResetServiceSpecificCredentialInput struct { // The unique identifier of the service-specific credential. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters that can consist of any upper or lowercased letter or digit. // // This member is required. ServiceSpecificCredentialId *string // The name of the IAM user associated with the service-specific credential. If // this value is not specified, then the operation assumes the user whose // credentials are used to call the operation. This parameter allows (through its // regex pattern (http://wikipedia.org/wiki/regex) ) a string of characters // consisting of upper and lowercase alphanumeric characters with no spaces. You // can also include any of the following characters: _+=,.@- UserName *string noSmithyDocumentSerde } type ResetServiceSpecificCredentialOutput struct { // A structure with details about the updated service-specific credential, // including the new password. This is the only time that you can access the // password. You cannot recover the password later, but you can reset it again. ServiceSpecificCredential *types.ServiceSpecificCredential // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationResetServiceSpecificCredentialMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpResetServiceSpecificCredential{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpResetServiceSpecificCredential{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpResetServiceSpecificCredentialValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opResetServiceSpecificCredential(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opResetServiceSpecificCredential(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ResetServiceSpecificCredential", } }
140
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Synchronizes the specified MFA device with its IAM resource object on the // Amazon Web Services servers. For more information about creating and working // with virtual MFA devices, see Using a virtual MFA device (https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_VirtualMFA.html) // in the IAM User Guide. func (c *Client) ResyncMFADevice(ctx context.Context, params *ResyncMFADeviceInput, optFns ...func(*Options)) (*ResyncMFADeviceOutput, error) { if params == nil { params = &ResyncMFADeviceInput{} } result, metadata, err := c.invokeOperation(ctx, "ResyncMFADevice", params, optFns, c.addOperationResyncMFADeviceMiddlewares) if err != nil { return nil, err } out := result.(*ResyncMFADeviceOutput) out.ResultMetadata = metadata return out, nil } type ResyncMFADeviceInput struct { // An authentication code emitted by the device. The format for this parameter is // a sequence of six digits. // // This member is required. AuthenticationCode1 *string // A subsequent authentication code emitted by the device. The format for this // parameter is a sequence of six digits. // // This member is required. AuthenticationCode2 *string // Serial number that uniquely identifies the MFA device. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. SerialNumber *string // The name of the user whose MFA device you want to resynchronize. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } type ResyncMFADeviceOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationResyncMFADeviceMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpResyncMFADevice{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpResyncMFADevice{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpResyncMFADeviceValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opResyncMFADevice(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opResyncMFADevice(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "ResyncMFADevice", } }
146
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Sets the specified version of the specified policy as the policy's default // (operative) version. This operation affects all users, groups, and roles that // the policy is attached to. To list the users, groups, and roles that the policy // is attached to, use ListEntitiesForPolicy . For information about managed // policies, see Managed policies and inline policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html) // in the IAM User Guide. func (c *Client) SetDefaultPolicyVersion(ctx context.Context, params *SetDefaultPolicyVersionInput, optFns ...func(*Options)) (*SetDefaultPolicyVersionOutput, error) { if params == nil { params = &SetDefaultPolicyVersionInput{} } result, metadata, err := c.invokeOperation(ctx, "SetDefaultPolicyVersion", params, optFns, c.addOperationSetDefaultPolicyVersionMiddlewares) if err != nil { return nil, err } out := result.(*SetDefaultPolicyVersionOutput) out.ResultMetadata = metadata return out, nil } type SetDefaultPolicyVersionInput struct { // The Amazon Resource Name (ARN) of the IAM policy whose default version you want // to set. For more information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicyArn *string // The version of the policy to set as the default (operative) version. For more // information about managed policy versions, see Versioning for managed policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-versions.html) // in the IAM User Guide. // // This member is required. VersionId *string noSmithyDocumentSerde } type SetDefaultPolicyVersionOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationSetDefaultPolicyVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpSetDefaultPolicyVersion{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpSetDefaultPolicyVersion{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpSetDefaultPolicyVersionValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSetDefaultPolicyVersion(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opSetDefaultPolicyVersion(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "SetDefaultPolicyVersion", } }
134
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Sets the specified version of the global endpoint token as the token version // used for the Amazon Web Services account. By default, Security Token Service // (STS) is available as a global service, and all STS requests go to a single // endpoint at https://sts.amazonaws.com . Amazon Web Services recommends using // Regional STS endpoints to reduce latency, build in redundancy, and increase // session token availability. For information about Regional endpoints for STS, // see Security Token Service endpoints and quotas (https://docs.aws.amazon.com/general/latest/gr/sts.html) // in the Amazon Web Services General Reference. If you make an STS call to the // global endpoint, the resulting session tokens might be valid in some Regions but // not others. It depends on the version that is set in this operation. Version 1 // tokens are valid only in Amazon Web Services Regions that are available by // default. These tokens do not work in manually enabled Regions, such as Asia // Pacific (Hong Kong). Version 2 tokens are valid in all Regions. However, version // 2 tokens are longer and might affect systems where you temporarily store tokens. // For information, see Activating and deactivating STS in an Amazon Web Services // Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. To view the current session token version, see the // GlobalEndpointTokenVersion entry in the response of the GetAccountSummary // operation. func (c *Client) SetSecurityTokenServicePreferences(ctx context.Context, params *SetSecurityTokenServicePreferencesInput, optFns ...func(*Options)) (*SetSecurityTokenServicePreferencesOutput, error) { if params == nil { params = &SetSecurityTokenServicePreferencesInput{} } result, metadata, err := c.invokeOperation(ctx, "SetSecurityTokenServicePreferences", params, optFns, c.addOperationSetSecurityTokenServicePreferencesMiddlewares) if err != nil { return nil, err } out := result.(*SetSecurityTokenServicePreferencesOutput) out.ResultMetadata = metadata return out, nil } type SetSecurityTokenServicePreferencesInput struct { // The version of the global endpoint token. Version 1 tokens are valid only in // Amazon Web Services Regions that are available by default. These tokens do not // work in manually enabled Regions, such as Asia Pacific (Hong Kong). Version 2 // tokens are valid in all Regions. However, version 2 tokens are longer and might // affect systems where you temporarily store tokens. For information, see // Activating and deactivating STS in an Amazon Web Services Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html) // in the IAM User Guide. // // This member is required. GlobalEndpointTokenVersion types.GlobalEndpointTokenVersion noSmithyDocumentSerde } type SetSecurityTokenServicePreferencesOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationSetSecurityTokenServicePreferencesMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpSetSecurityTokenServicePreferences{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpSetSecurityTokenServicePreferences{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpSetSecurityTokenServicePreferencesValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSetSecurityTokenServicePreferences(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opSetSecurityTokenServicePreferences(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "SetSecurityTokenServicePreferences", } }
145
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Simulate how a set of IAM policies and optionally a resource-based policy works // with a list of API operations and Amazon Web Services resources to determine the // policies' effective permissions. The policies are provided as strings. The // simulation does not perform the API operations; it only checks the authorization // to determine if the simulated policies allow or deny the operations. You can // simulate resources that don't exist in your account. If you want to simulate // existing policies that are attached to an IAM user, group, or role, use // SimulatePrincipalPolicy instead. Context keys are variables that are maintained // by Amazon Web Services and its services and which provide details about the // context of an API query request. You can use the Condition element of an IAM // policy to evaluate context keys. To get the list of context keys that the // policies require for correct simulation, use GetContextKeysForCustomPolicy . If // the output is long, you can use MaxItems and Marker parameters to paginate the // results. The IAM policy simulator evaluates statements in the identity-based // policy and the inputs that you provide during simulation. The policy simulator // results can differ from your live Amazon Web Services environment. We recommend // that you check your policies against your live Amazon Web Services environment // after testing using the policy simulator to confirm that you have the desired // results. For more information about using the policy simulator, see Testing IAM // policies with the IAM policy simulator (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html) // in the IAM User Guide. func (c *Client) SimulateCustomPolicy(ctx context.Context, params *SimulateCustomPolicyInput, optFns ...func(*Options)) (*SimulateCustomPolicyOutput, error) { if params == nil { params = &SimulateCustomPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "SimulateCustomPolicy", params, optFns, c.addOperationSimulateCustomPolicyMiddlewares) if err != nil { return nil, err } out := result.(*SimulateCustomPolicyOutput) out.ResultMetadata = metadata return out, nil } type SimulateCustomPolicyInput struct { // A list of names of API operations to evaluate in the simulation. Each operation // is evaluated against each resource. Each operation must include the service // identifier, such as iam:CreateUser . This operation does not support using // wildcards (*) in an action name. // // This member is required. ActionNames []string // A list of policy documents to include in the simulation. Each document is // specified as a string containing the complete, valid JSON text of an IAM policy. // Do not include any resource-based policies in this parameter. Any resource-based // policy must be submitted with the ResourcePolicy parameter. The policies cannot // be "scope-down" policies, such as you could include in a call to // GetFederationToken (https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetFederationToken.html) // or one of the AssumeRole (https://docs.aws.amazon.com/IAM/latest/APIReference/API_AssumeRole.html) // API operations. In other words, do not use policies designed to restrict what a // user can do while using the temporary credentials. The maximum length of the // policy document that you can pass in this operation, including whitespace, is // listed below. To view the maximum character counts of a managed policy with no // whitespaces, see IAM and STS character quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entity-length) // . The regex pattern (http://wikipedia.org/wiki/regex) used to validate this // parameter is a string of characters consisting of the following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) // // This member is required. PolicyInputList []string // The ARN of the IAM user that you want to use as the simulated caller of the API // operations. CallerArn is required if you include a ResourcePolicy so that the // policy's Principal element has a value to use in evaluating the policy. You can // specify only the ARN of an IAM user. You cannot specify the ARN of an assumed // role, federated user, or a service principal. CallerArn *string // A list of context keys and corresponding values for the simulation to use. // Whenever a context key is evaluated in one of the simulated IAM permissions // policies, the corresponding value is supplied. ContextEntries []types.ContextEntry // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The IAM permissions boundary policy to simulate. The permissions boundary sets // the maximum permissions that an IAM entity can have. You can input only one // permissions boundary when you pass a policy to this operation. For more // information about permissions boundaries, see Permissions boundaries for IAM // entities (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) // in the IAM User Guide. The policy input is specified as a string that contains // the complete, valid JSON text of a permissions boundary policy. The maximum // length of the policy document that you can pass in this operation, including // whitespace, is listed below. To view the maximum character counts of a managed // policy with no whitespaces, see IAM and STS character quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entity-length) // . The regex pattern (http://wikipedia.org/wiki/regex) used to validate this // parameter is a string of characters consisting of the following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) PermissionsBoundaryPolicyInputList []string // A list of ARNs of Amazon Web Services resources to include in the simulation. // If this parameter is not provided, then the value defaults to * (all // resources). Each API in the ActionNames parameter is evaluated for each // resource in this list. The simulation determines the access result (allowed or // denied) of each combination and reports it in the response. You can simulate // resources that don't exist in your account. The simulation does not // automatically retrieve policies for the specified resources. If you want to // include a resource policy in the simulation, then you must include the policy as // a string in the ResourcePolicy parameter. If you include a ResourcePolicy , then // it must be applicable to all of the resources included in the simulation or you // receive an invalid input error. For more information about ARNs, see Amazon // Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. Simulation of resource-based // policies isn't supported for IAM roles. ResourceArns []string // Specifies the type of simulation to run. Different API operations that support // resource-based policies require different combinations of resources. By // specifying the type of simulation to run, you enable the policy simulator to // enforce the presence of the required resources to ensure reliable simulation // results. If your simulation does not match one of the following scenarios, then // you can omit this parameter. The following list shows each of the supported // scenario values and the resources that you must define to run the simulation. // Each of the EC2 scenarios requires that you specify instance, image, and // security group resources. If your scenario includes an EBS volume, then you must // specify that volume as a resource. If the EC2 scenario includes VPC, then you // must supply the network interface resource. If it includes an IP subnet, then // you must specify the subnet resource. For more information on the EC2 scenario // options, see Supported platforms (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html) // in the Amazon EC2 User Guide. // - EC2-VPC-InstanceStore instance, image, security group, network interface // - EC2-VPC-InstanceStore-Subnet instance, image, security group, network // interface, subnet // - EC2-VPC-EBS instance, image, security group, network interface, volume // - EC2-VPC-EBS-Subnet instance, image, security group, network interface, // subnet, volume ResourceHandlingOption *string // An ARN representing the Amazon Web Services account ID that specifies the owner // of any simulated resource that does not identify its owner in the resource ARN. // Examples of resource ARNs include an S3 bucket or object. If ResourceOwner is // specified, it is also used as the account owner of any ResourcePolicy included // in the simulation. If the ResourceOwner parameter is not specified, then the // owner of the resources and the resource policy defaults to the account of the // identity provided in CallerArn . This parameter is required only if you specify // a resource-based policy and account that owns the resource is different from the // account that owns the simulated calling user CallerArn . The ARN for an account // uses the following syntax: arn:aws:iam::AWS-account-ID:root . For example, to // represent the account with the 112233445566 ID, use the following ARN: // arn:aws:iam::112233445566-ID:root . ResourceOwner *string // A resource-based policy to include in the simulation provided as a string. Each // resource in the simulation is treated as if it had this policy attached. You can // include only one resource-based policy in a simulation. The maximum length of // the policy document that you can pass in this operation, including whitespace, // is listed below. To view the maximum character counts of a managed policy with // no whitespaces, see IAM and STS character quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entity-length) // . The regex pattern (http://wikipedia.org/wiki/regex) used to validate this // parameter is a string of characters consisting of the following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) // Simulation of resource-based policies isn't supported for IAM roles. ResourcePolicy *string noSmithyDocumentSerde } // Contains the response to a successful SimulatePrincipalPolicy or // SimulateCustomPolicy request. type SimulateCustomPolicyOutput struct { // The results of the simulation. EvaluationResults []types.EvaluationResult // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationSimulateCustomPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpSimulateCustomPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpSimulateCustomPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpSimulateCustomPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSimulateCustomPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // SimulateCustomPolicyAPIClient is a client that implements the // SimulateCustomPolicy operation. type SimulateCustomPolicyAPIClient interface { SimulateCustomPolicy(context.Context, *SimulateCustomPolicyInput, ...func(*Options)) (*SimulateCustomPolicyOutput, error) } var _ SimulateCustomPolicyAPIClient = (*Client)(nil) // SimulateCustomPolicyPaginatorOptions is the paginator options for // SimulateCustomPolicy type SimulateCustomPolicyPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // SimulateCustomPolicyPaginator is a paginator for SimulateCustomPolicy type SimulateCustomPolicyPaginator struct { options SimulateCustomPolicyPaginatorOptions client SimulateCustomPolicyAPIClient params *SimulateCustomPolicyInput nextToken *string firstPage bool } // NewSimulateCustomPolicyPaginator returns a new SimulateCustomPolicyPaginator func NewSimulateCustomPolicyPaginator(client SimulateCustomPolicyAPIClient, params *SimulateCustomPolicyInput, optFns ...func(*SimulateCustomPolicyPaginatorOptions)) *SimulateCustomPolicyPaginator { if params == nil { params = &SimulateCustomPolicyInput{} } options := SimulateCustomPolicyPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &SimulateCustomPolicyPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *SimulateCustomPolicyPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next SimulateCustomPolicy page. func (p *SimulateCustomPolicyPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*SimulateCustomPolicyOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.SimulateCustomPolicy(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opSimulateCustomPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "SimulateCustomPolicy", } }
400
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Simulate how a set of IAM policies attached to an IAM entity works with a list // of API operations and Amazon Web Services resources to determine the policies' // effective permissions. The entity can be an IAM user, group, or role. If you // specify a user, then the simulation also includes all of the policies that are // attached to groups that the user belongs to. You can simulate resources that // don't exist in your account. You can optionally include a list of one or more // additional policies specified as strings to include in the simulation. If you // want to simulate only policies specified as strings, use SimulateCustomPolicy // instead. You can also optionally include one resource-based policy to be // evaluated with each of the resources included in the simulation for IAM users // only. The simulation does not perform the API operations; it only checks the // authorization to determine if the simulated policies allow or deny the // operations. Note: This operation discloses information about the permissions // granted to other users. If you do not want users to see other user's // permissions, then consider allowing them to use SimulateCustomPolicy instead. // Context keys are variables maintained by Amazon Web Services and its services // that provide details about the context of an API query request. You can use the // Condition element of an IAM policy to evaluate context keys. To get the list of // context keys that the policies require for correct simulation, use // GetContextKeysForPrincipalPolicy . If the output is long, you can use the // MaxItems and Marker parameters to paginate the results. The IAM policy // simulator evaluates statements in the identity-based policy and the inputs that // you provide during simulation. The policy simulator results can differ from your // live Amazon Web Services environment. We recommend that you check your policies // against your live Amazon Web Services environment after testing using the policy // simulator to confirm that you have the desired results. For more information // about using the policy simulator, see Testing IAM policies with the IAM policy // simulator (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html) // in the IAM User Guide. func (c *Client) SimulatePrincipalPolicy(ctx context.Context, params *SimulatePrincipalPolicyInput, optFns ...func(*Options)) (*SimulatePrincipalPolicyOutput, error) { if params == nil { params = &SimulatePrincipalPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "SimulatePrincipalPolicy", params, optFns, c.addOperationSimulatePrincipalPolicyMiddlewares) if err != nil { return nil, err } out := result.(*SimulatePrincipalPolicyOutput) out.ResultMetadata = metadata return out, nil } type SimulatePrincipalPolicyInput struct { // A list of names of API operations to evaluate in the simulation. Each operation // is evaluated for each resource. Each operation must include the service // identifier, such as iam:CreateUser . // // This member is required. ActionNames []string // The Amazon Resource Name (ARN) of a user, group, or role whose policies you // want to include in the simulation. If you specify a user, group, or role, the // simulation includes all policies that are associated with that entity. If you // specify a user, the simulation also includes all policies that are attached to // any groups the user belongs to. The maximum length of the policy document that // you can pass in this operation, including whitespace, is listed below. To view // the maximum character counts of a managed policy with no whitespaces, see IAM // and STS character quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entity-length) // . For more information about ARNs, see Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. // // This member is required. PolicySourceArn *string // The ARN of the IAM user that you want to specify as the simulated caller of the // API operations. If you do not specify a CallerArn , it defaults to the ARN of // the user that you specify in PolicySourceArn , if you specified a user. If you // include both a PolicySourceArn (for example, // arn:aws:iam::123456789012:user/David ) and a CallerArn (for example, // arn:aws:iam::123456789012:user/Bob ), the result is that you simulate calling // the API operations as Bob, as if Bob had David's policies. You can specify only // the ARN of an IAM user. You cannot specify the ARN of an assumed role, federated // user, or a service principal. CallerArn is required if you include a // ResourcePolicy and the PolicySourceArn is not the ARN for an IAM user. This is // required so that the resource-based policy's Principal element has a value to // use in evaluating the policy. For more information about ARNs, see Amazon // Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. CallerArn *string // A list of context keys and corresponding values for the simulation to use. // Whenever a context key is evaluated in one of the simulated IAM permissions // policies, the corresponding value is supplied. ContextEntries []types.ContextEntry // Use this parameter only when paginating results and only after you receive a // response indicating that the results are truncated. Set it to the value of the // Marker element in the response that you received to indicate where the next call // should start. Marker *string // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. MaxItems *int32 // The IAM permissions boundary policy to simulate. The permissions boundary sets // the maximum permissions that the entity can have. You can input only one // permissions boundary when you pass a policy to this operation. An IAM entity can // only have one permissions boundary in effect at a time. For example, if a // permissions boundary is attached to an entity and you pass in a different // permissions boundary policy using this parameter, then the new permissions // boundary policy is used for the simulation. For more information about // permissions boundaries, see Permissions boundaries for IAM entities (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html) // in the IAM User Guide. The policy input is specified as a string containing the // complete, valid JSON text of a permissions boundary policy. The maximum length // of the policy document that you can pass in this operation, including // whitespace, is listed below. To view the maximum character counts of a managed // policy with no whitespaces, see IAM and STS character quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entity-length) // . The regex pattern (http://wikipedia.org/wiki/regex) used to validate this // parameter is a string of characters consisting of the following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) PermissionsBoundaryPolicyInputList []string // An optional list of additional policy documents to include in the simulation. // Each document is specified as a string containing the complete, valid JSON text // of an IAM policy. The regex pattern (http://wikipedia.org/wiki/regex) used to // validate this parameter is a string of characters consisting of the following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) PolicyInputList []string // A list of ARNs of Amazon Web Services resources to include in the simulation. // If this parameter is not provided, then the value defaults to * (all // resources). Each API in the ActionNames parameter is evaluated for each // resource in this list. The simulation determines the access result (allowed or // denied) of each combination and reports it in the response. You can simulate // resources that don't exist in your account. The simulation does not // automatically retrieve policies for the specified resources. If you want to // include a resource policy in the simulation, then you must include the policy as // a string in the ResourcePolicy parameter. For more information about ARNs, see // Amazon Resource Names (ARNs) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // in the Amazon Web Services General Reference. Simulation of resource-based // policies isn't supported for IAM roles. ResourceArns []string // Specifies the type of simulation to run. Different API operations that support // resource-based policies require different combinations of resources. By // specifying the type of simulation to run, you enable the policy simulator to // enforce the presence of the required resources to ensure reliable simulation // results. If your simulation does not match one of the following scenarios, then // you can omit this parameter. The following list shows each of the supported // scenario values and the resources that you must define to run the simulation. // Each of the EC2 scenarios requires that you specify instance, image, and // security group resources. If your scenario includes an EBS volume, then you must // specify that volume as a resource. If the EC2 scenario includes VPC, then you // must supply the network interface resource. If it includes an IP subnet, then // you must specify the subnet resource. For more information on the EC2 scenario // options, see Supported platforms (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html) // in the Amazon EC2 User Guide. // - EC2-VPC-InstanceStore instance, image, security group, network interface // - EC2-VPC-InstanceStore-Subnet instance, image, security group, network // interface, subnet // - EC2-VPC-EBS instance, image, security group, network interface, volume // - EC2-VPC-EBS-Subnet instance, image, security group, network interface, // subnet, volume ResourceHandlingOption *string // An Amazon Web Services account ID that specifies the owner of any simulated // resource that does not identify its owner in the resource ARN. Examples of // resource ARNs include an S3 bucket or object. If ResourceOwner is specified, it // is also used as the account owner of any ResourcePolicy included in the // simulation. If the ResourceOwner parameter is not specified, then the owner of // the resources and the resource policy defaults to the account of the identity // provided in CallerArn . This parameter is required only if you specify a // resource-based policy and account that owns the resource is different from the // account that owns the simulated calling user CallerArn . ResourceOwner *string // A resource-based policy to include in the simulation provided as a string. Each // resource in the simulation is treated as if it had this policy attached. You can // include only one resource-based policy in a simulation. The maximum length of // the policy document that you can pass in this operation, including whitespace, // is listed below. To view the maximum character counts of a managed policy with // no whitespaces, see IAM and STS character quotas (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html#reference_iam-quotas-entity-length) // . The regex pattern (http://wikipedia.org/wiki/regex) used to validate this // parameter is a string of characters consisting of the following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) // Simulation of resource-based policies isn't supported for IAM roles. ResourcePolicy *string noSmithyDocumentSerde } // Contains the response to a successful SimulatePrincipalPolicy or // SimulateCustomPolicy request. type SimulatePrincipalPolicyOutput struct { // The results of the simulation. EvaluationResults []types.EvaluationResult // A flag that indicates whether there are more items to return. If your results // were truncated, you can make a subsequent pagination request using the Marker // request parameter to retrieve more items. Note that IAM might return fewer than // the MaxItems number of results even when there are more results available. We // recommend that you check IsTruncated after every call to ensure that you // receive all your results. IsTruncated bool // When IsTruncated is true , this element is present and contains the value to use // for the Marker parameter in a subsequent pagination request. Marker *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationSimulatePrincipalPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpSimulatePrincipalPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpSimulatePrincipalPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpSimulatePrincipalPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSimulatePrincipalPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } // SimulatePrincipalPolicyAPIClient is a client that implements the // SimulatePrincipalPolicy operation. type SimulatePrincipalPolicyAPIClient interface { SimulatePrincipalPolicy(context.Context, *SimulatePrincipalPolicyInput, ...func(*Options)) (*SimulatePrincipalPolicyOutput, error) } var _ SimulatePrincipalPolicyAPIClient = (*Client)(nil) // SimulatePrincipalPolicyPaginatorOptions is the paginator options for // SimulatePrincipalPolicy type SimulatePrincipalPolicyPaginatorOptions struct { // Use this only when paginating results to indicate the maximum number of items // you want in the response. If additional items exist beyond the maximum you // specify, the IsTruncated response element is true . If you do not include this // parameter, the number of items defaults to 100. Note that IAM might return fewer // results, even when there are more results available. In that case, the // IsTruncated response element returns true , and Marker contains a value to // include in the subsequent call that tells the service where to continue from. Limit int32 // Set to true if pagination should stop if the service returns a pagination token // that matches the most recent token provided to the service. StopOnDuplicateToken bool } // SimulatePrincipalPolicyPaginator is a paginator for SimulatePrincipalPolicy type SimulatePrincipalPolicyPaginator struct { options SimulatePrincipalPolicyPaginatorOptions client SimulatePrincipalPolicyAPIClient params *SimulatePrincipalPolicyInput nextToken *string firstPage bool } // NewSimulatePrincipalPolicyPaginator returns a new // SimulatePrincipalPolicyPaginator func NewSimulatePrincipalPolicyPaginator(client SimulatePrincipalPolicyAPIClient, params *SimulatePrincipalPolicyInput, optFns ...func(*SimulatePrincipalPolicyPaginatorOptions)) *SimulatePrincipalPolicyPaginator { if params == nil { params = &SimulatePrincipalPolicyInput{} } options := SimulatePrincipalPolicyPaginatorOptions{} if params.MaxItems != nil { options.Limit = *params.MaxItems } for _, fn := range optFns { fn(&options) } return &SimulatePrincipalPolicyPaginator{ options: options, client: client, params: params, firstPage: true, nextToken: params.Marker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *SimulatePrincipalPolicyPaginator) HasMorePages() bool { return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) } // NextPage retrieves the next SimulatePrincipalPolicy page. func (p *SimulatePrincipalPolicyPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*SimulatePrincipalPolicyOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.Marker = p.nextToken var limit *int32 if p.options.Limit > 0 { limit = &p.options.Limit } params.MaxItems = limit result, err := p.client.SimulatePrincipalPolicy(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.nextToken p.nextToken = result.Marker if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { p.nextToken = nil } return result, nil } func newServiceMetadataMiddleware_opSimulatePrincipalPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "SimulatePrincipalPolicy", } }
417
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds one or more tags to an IAM instance profile. If a tag with the same key // name already exists, then that tag is overwritten with the new value. Each tag // consists of a key name and an associated value. By assigning tags to your // resources, you can do the following: // // - Administrative grouping and discovery - Attach tags to resources to aid in // organization and search. For example, you could search for all resources with // the key name Project and the value MyImportantProject. Or search for all // resources with the key name Cost Center and the value 41200. // // - Access control - Include tags in IAM user-based and resource-based // policies. You can use tags to restrict access to only an IAM instance profile // that has a specified tag attached. For examples of policies that show how to use // tags to control access, see Control access using IAM tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) // in the IAM User Guide. // // - If any one of the tags is invalid or if you exceed the allowed maximum // number of tags, then the entire request fails and the resource is not created. // For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. // // - Amazon Web Services always interprets the tag Value as a single string. If // you need to store an array, you can store comma-separated values in the string. // However, you must interpret the value in your code. func (c *Client) TagInstanceProfile(ctx context.Context, params *TagInstanceProfileInput, optFns ...func(*Options)) (*TagInstanceProfileOutput, error) { if params == nil { params = &TagInstanceProfileInput{} } result, metadata, err := c.invokeOperation(ctx, "TagInstanceProfile", params, optFns, c.addOperationTagInstanceProfileMiddlewares) if err != nil { return nil, err } out := result.(*TagInstanceProfileOutput) out.ResultMetadata = metadata return out, nil } type TagInstanceProfileInput struct { // The name of the IAM instance profile to which you want to add tags. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. InstanceProfileName *string // The list of tags that you want to attach to the IAM instance profile. Each tag // consists of a key name and an associated value. // // This member is required. Tags []types.Tag noSmithyDocumentSerde } type TagInstanceProfileOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationTagInstanceProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpTagInstanceProfile{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpTagInstanceProfile{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpTagInstanceProfileValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagInstanceProfile(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opTagInstanceProfile(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "TagInstanceProfile", } }
153
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds one or more tags to an IAM virtual multi-factor authentication (MFA) // device. If a tag with the same key name already exists, then that tag is // overwritten with the new value. A tag consists of a key name and an associated // value. By assigning tags to your resources, you can do the following: // // - Administrative grouping and discovery - Attach tags to resources to aid in // organization and search. For example, you could search for all resources with // the key name Project and the value MyImportantProject. Or search for all // resources with the key name Cost Center and the value 41200. // // - Access control - Include tags in IAM user-based and resource-based // policies. You can use tags to restrict access to only an IAM virtual MFA device // that has a specified tag attached. For examples of policies that show how to use // tags to control access, see Control access using IAM tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) // in the IAM User Guide. // // - If any one of the tags is invalid or if you exceed the allowed maximum // number of tags, then the entire request fails and the resource is not created. // For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. // // - Amazon Web Services always interprets the tag Value as a single string. If // you need to store an array, you can store comma-separated values in the string. // However, you must interpret the value in your code. func (c *Client) TagMFADevice(ctx context.Context, params *TagMFADeviceInput, optFns ...func(*Options)) (*TagMFADeviceOutput, error) { if params == nil { params = &TagMFADeviceInput{} } result, metadata, err := c.invokeOperation(ctx, "TagMFADevice", params, optFns, c.addOperationTagMFADeviceMiddlewares) if err != nil { return nil, err } out := result.(*TagMFADeviceOutput) out.ResultMetadata = metadata return out, nil } type TagMFADeviceInput struct { // The unique identifier for the IAM virtual MFA device to which you want to add // tags. For virtual MFA devices, the serial number is the same as the ARN. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. SerialNumber *string // The list of tags that you want to attach to the IAM virtual MFA device. Each // tag consists of a key name and an associated value. // // This member is required. Tags []types.Tag noSmithyDocumentSerde } type TagMFADeviceOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationTagMFADeviceMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpTagMFADevice{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpTagMFADevice{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpTagMFADeviceValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagMFADevice(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opTagMFADevice(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "TagMFADevice", } }
154
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds one or more tags to an OpenID Connect (OIDC)-compatible identity provider. // For more information about these providers, see About web identity federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html) // . If a tag with the same key name already exists, then that tag is overwritten // with the new value. A tag consists of a key name and an associated value. By // assigning tags to your resources, you can do the following: // // - Administrative grouping and discovery - Attach tags to resources to aid in // organization and search. For example, you could search for all resources with // the key name Project and the value MyImportantProject. Or search for all // resources with the key name Cost Center and the value 41200. // // - Access control - Include tags in IAM identity-based and resource-based // policies. You can use tags to restrict access to only an OIDC provider that has // a specified tag attached. For examples of policies that show how to use tags to // control access, see Control access using IAM tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) // in the IAM User Guide. // // - If any one of the tags is invalid or if you exceed the allowed maximum // number of tags, then the entire request fails and the resource is not created. // For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. // // - Amazon Web Services always interprets the tag Value as a single string. If // you need to store an array, you can store comma-separated values in the string. // However, you must interpret the value in your code. func (c *Client) TagOpenIDConnectProvider(ctx context.Context, params *TagOpenIDConnectProviderInput, optFns ...func(*Options)) (*TagOpenIDConnectProviderOutput, error) { if params == nil { params = &TagOpenIDConnectProviderInput{} } result, metadata, err := c.invokeOperation(ctx, "TagOpenIDConnectProvider", params, optFns, c.addOperationTagOpenIDConnectProviderMiddlewares) if err != nil { return nil, err } out := result.(*TagOpenIDConnectProviderOutput) out.ResultMetadata = metadata return out, nil } type TagOpenIDConnectProviderInput struct { // The ARN of the OIDC identity provider in IAM to which you want to add tags. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. OpenIDConnectProviderArn *string // The list of tags that you want to attach to the OIDC identity provider in IAM. // Each tag consists of a key name and an associated value. // // This member is required. Tags []types.Tag noSmithyDocumentSerde } type TagOpenIDConnectProviderOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationTagOpenIDConnectProviderMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpTagOpenIDConnectProvider{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpTagOpenIDConnectProvider{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpTagOpenIDConnectProviderValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagOpenIDConnectProvider(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opTagOpenIDConnectProvider(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "TagOpenIDConnectProvider", } }
155
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds one or more tags to an IAM customer managed policy. If a tag with the same // key name already exists, then that tag is overwritten with the new value. A tag // consists of a key name and an associated value. By assigning tags to your // resources, you can do the following: // // - Administrative grouping and discovery - Attach tags to resources to aid in // organization and search. For example, you could search for all resources with // the key name Project and the value MyImportantProject. Or search for all // resources with the key name Cost Center and the value 41200. // // - Access control - Include tags in IAM user-based and resource-based // policies. You can use tags to restrict access to only an IAM customer managed // policy that has a specified tag attached. For examples of policies that show how // to use tags to control access, see Control access using IAM tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) // in the IAM User Guide. // // - If any one of the tags is invalid or if you exceed the allowed maximum // number of tags, then the entire request fails and the resource is not created. // For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. // // - Amazon Web Services always interprets the tag Value as a single string. If // you need to store an array, you can store comma-separated values in the string. // However, you must interpret the value in your code. func (c *Client) TagPolicy(ctx context.Context, params *TagPolicyInput, optFns ...func(*Options)) (*TagPolicyOutput, error) { if params == nil { params = &TagPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "TagPolicy", params, optFns, c.addOperationTagPolicyMiddlewares) if err != nil { return nil, err } out := result.(*TagPolicyOutput) out.ResultMetadata = metadata return out, nil } type TagPolicyInput struct { // The ARN of the IAM customer managed policy to which you want to add tags. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. PolicyArn *string // The list of tags that you want to attach to the IAM customer managed policy. // Each tag consists of a key name and an associated value. // // This member is required. Tags []types.Tag noSmithyDocumentSerde } type TagPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationTagPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpTagPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpTagPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpTagPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opTagPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "TagPolicy", } }
153
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds one or more tags to an IAM role. The role can be a regular role or a // service-linked role. If a tag with the same key name already exists, then that // tag is overwritten with the new value. A tag consists of a key name and an // associated value. By assigning tags to your resources, you can do the following: // // - Administrative grouping and discovery - Attach tags to resources to aid in // organization and search. For example, you could search for all resources with // the key name Project and the value MyImportantProject. Or search for all // resources with the key name Cost Center and the value 41200. // // - Access control - Include tags in IAM user-based and resource-based // policies. You can use tags to restrict access to only an IAM role that has a // specified tag attached. You can also restrict access to only those resources // that have a certain tag attached. For examples of policies that show how to use // tags to control access, see Control access using IAM tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) // in the IAM User Guide. // // - Cost allocation - Use tags to help track which individuals and teams are // using which Amazon Web Services resources. // // - If any one of the tags is invalid or if you exceed the allowed maximum // number of tags, then the entire request fails and the resource is not created. // For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. // // - Amazon Web Services always interprets the tag Value as a single string. If // you need to store an array, you can store comma-separated values in the string. // However, you must interpret the value in your code. // // For more information about tagging, see Tagging IAM identities (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) TagRole(ctx context.Context, params *TagRoleInput, optFns ...func(*Options)) (*TagRoleOutput, error) { if params == nil { params = &TagRoleInput{} } result, metadata, err := c.invokeOperation(ctx, "TagRole", params, optFns, c.addOperationTagRoleMiddlewares) if err != nil { return nil, err } out := result.(*TagRoleOutput) out.ResultMetadata = metadata return out, nil } type TagRoleInput struct { // The name of the IAM role to which you want to add tags. This parameter accepts // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters that consist of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. RoleName *string // The list of tags that you want to attach to the IAM role. Each tag consists of // a key name and an associated value. // // This member is required. Tags []types.Tag noSmithyDocumentSerde } type TagRoleOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationTagRoleMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpTagRole{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpTagRole{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpTagRoleValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagRole(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opTagRole(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "TagRole", } }
160
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds one or more tags to a Security Assertion Markup Language (SAML) identity // provider. For more information about these providers, see About SAML 2.0-based // federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html) // . If a tag with the same key name already exists, then that tag is overwritten // with the new value. A tag consists of a key name and an associated value. By // assigning tags to your resources, you can do the following: // // - Administrative grouping and discovery - Attach tags to resources to aid in // organization and search. For example, you could search for all resources with // the key name Project and the value MyImportantProject. Or search for all // resources with the key name Cost Center and the value 41200. // // - Access control - Include tags in IAM user-based and resource-based // policies. You can use tags to restrict access to only a SAML identity provider // that has a specified tag attached. For examples of policies that show how to use // tags to control access, see Control access using IAM tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) // in the IAM User Guide. // // - If any one of the tags is invalid or if you exceed the allowed maximum // number of tags, then the entire request fails and the resource is not created. // For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. // // - Amazon Web Services always interprets the tag Value as a single string. If // you need to store an array, you can store comma-separated values in the string. // However, you must interpret the value in your code. func (c *Client) TagSAMLProvider(ctx context.Context, params *TagSAMLProviderInput, optFns ...func(*Options)) (*TagSAMLProviderOutput, error) { if params == nil { params = &TagSAMLProviderInput{} } result, metadata, err := c.invokeOperation(ctx, "TagSAMLProvider", params, optFns, c.addOperationTagSAMLProviderMiddlewares) if err != nil { return nil, err } out := result.(*TagSAMLProviderOutput) out.ResultMetadata = metadata return out, nil } type TagSAMLProviderInput struct { // The ARN of the SAML identity provider in IAM to which you want to add tags. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. SAMLProviderArn *string // The list of tags that you want to attach to the SAML identity provider in IAM. // Each tag consists of a key name and an associated value. // // This member is required. Tags []types.Tag noSmithyDocumentSerde } type TagSAMLProviderOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationTagSAMLProviderMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpTagSAMLProvider{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpTagSAMLProvider{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpTagSAMLProviderValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagSAMLProvider(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opTagSAMLProvider(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "TagSAMLProvider", } }
156
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds one or more tags to an IAM server certificate. If a tag with the same key // name already exists, then that tag is overwritten with the new value. For // certificates in a Region supported by Certificate Manager (ACM), we recommend // that you don't use IAM server certificates. Instead, use ACM to provision, // manage, and deploy your server certificates. For more information about IAM // server certificates, Working with server certificates (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html) // in the IAM User Guide. A tag consists of a key name and an associated value. By // assigning tags to your resources, you can do the following: // // - Administrative grouping and discovery - Attach tags to resources to aid in // organization and search. For example, you could search for all resources with // the key name Project and the value MyImportantProject. Or search for all // resources with the key name Cost Center and the value 41200. // // - Access control - Include tags in IAM user-based and resource-based // policies. You can use tags to restrict access to only a server certificate that // has a specified tag attached. For examples of policies that show how to use tags // to control access, see Control access using IAM tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) // in the IAM User Guide. // // - Cost allocation - Use tags to help track which individuals and teams are // using which Amazon Web Services resources. // // - If any one of the tags is invalid or if you exceed the allowed maximum // number of tags, then the entire request fails and the resource is not created. // For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. // // - Amazon Web Services always interprets the tag Value as a single string. If // you need to store an array, you can store comma-separated values in the string. // However, you must interpret the value in your code. func (c *Client) TagServerCertificate(ctx context.Context, params *TagServerCertificateInput, optFns ...func(*Options)) (*TagServerCertificateOutput, error) { if params == nil { params = &TagServerCertificateInput{} } result, metadata, err := c.invokeOperation(ctx, "TagServerCertificate", params, optFns, c.addOperationTagServerCertificateMiddlewares) if err != nil { return nil, err } out := result.(*TagServerCertificateOutput) out.ResultMetadata = metadata return out, nil } type TagServerCertificateInput struct { // The name of the IAM server certificate to which you want to add tags. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. ServerCertificateName *string // The list of tags that you want to attach to the IAM server certificate. Each // tag consists of a key name and an associated value. // // This member is required. Tags []types.Tag noSmithyDocumentSerde } type TagServerCertificateOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationTagServerCertificateMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpTagServerCertificate{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpTagServerCertificate{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpTagServerCertificateValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagServerCertificate(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opTagServerCertificate(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "TagServerCertificate", } }
160
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Adds one or more tags to an IAM user. If a tag with the same key name already // exists, then that tag is overwritten with the new value. A tag consists of a key // name and an associated value. By assigning tags to your resources, you can do // the following: // // - Administrative grouping and discovery - Attach tags to resources to aid in // organization and search. For example, you could search for all resources with // the key name Project and the value MyImportantProject. Or search for all // resources with the key name Cost Center and the value 41200. // // - Access control - Include tags in IAM identity-based and resource-based // policies. You can use tags to restrict access to only an IAM requesting user // that has a specified tag attached. You can also restrict access to only those // resources that have a certain tag attached. For examples of policies that show // how to use tags to control access, see Control access using IAM tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) // in the IAM User Guide. // // - Cost allocation - Use tags to help track which individuals and teams are // using which Amazon Web Services resources. // // - If any one of the tags is invalid or if you exceed the allowed maximum // number of tags, then the entire request fails and the resource is not created. // For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. // // - Amazon Web Services always interprets the tag Value as a single string. If // you need to store an array, you can store comma-separated values in the string. // However, you must interpret the value in your code. // // For more information about tagging, see Tagging IAM identities (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) TagUser(ctx context.Context, params *TagUserInput, optFns ...func(*Options)) (*TagUserOutput, error) { if params == nil { params = &TagUserInput{} } result, metadata, err := c.invokeOperation(ctx, "TagUser", params, optFns, c.addOperationTagUserMiddlewares) if err != nil { return nil, err } out := result.(*TagUserOutput) out.ResultMetadata = metadata return out, nil } type TagUserInput struct { // The list of tags that you want to attach to the IAM user. Each tag consists of // a key name and an associated value. // // This member is required. Tags []types.Tag // The name of the IAM user to which you want to add tags. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } type TagUserOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationTagUserMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpTagUser{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpTagUser{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpTagUserValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagUser(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opTagUser(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "TagUser", } }
160
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified tags from the IAM instance profile. For more information // about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) UntagInstanceProfile(ctx context.Context, params *UntagInstanceProfileInput, optFns ...func(*Options)) (*UntagInstanceProfileOutput, error) { if params == nil { params = &UntagInstanceProfileInput{} } result, metadata, err := c.invokeOperation(ctx, "UntagInstanceProfile", params, optFns, c.addOperationUntagInstanceProfileMiddlewares) if err != nil { return nil, err } out := result.(*UntagInstanceProfileOutput) out.ResultMetadata = metadata return out, nil } type UntagInstanceProfileInput struct { // The name of the IAM instance profile from which you want to remove tags. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. InstanceProfileName *string // A list of key names as a simple array of strings. The tags with matching keys // are removed from the specified instance profile. // // This member is required. TagKeys []string noSmithyDocumentSerde } type UntagInstanceProfileOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUntagInstanceProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUntagInstanceProfile{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUntagInstanceProfile{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUntagInstanceProfileValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagInstanceProfile(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUntagInstanceProfile(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UntagInstanceProfile", } }
131
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified tags from the IAM virtual multi-factor authentication // (MFA) device. For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) UntagMFADevice(ctx context.Context, params *UntagMFADeviceInput, optFns ...func(*Options)) (*UntagMFADeviceOutput, error) { if params == nil { params = &UntagMFADeviceInput{} } result, metadata, err := c.invokeOperation(ctx, "UntagMFADevice", params, optFns, c.addOperationUntagMFADeviceMiddlewares) if err != nil { return nil, err } out := result.(*UntagMFADeviceOutput) out.ResultMetadata = metadata return out, nil } type UntagMFADeviceInput struct { // The unique identifier for the IAM virtual MFA device from which you want to // remove tags. For virtual MFA devices, the serial number is the same as the ARN. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. SerialNumber *string // A list of key names as a simple array of strings. The tags with matching keys // are removed from the specified instance profile. // // This member is required. TagKeys []string noSmithyDocumentSerde } type UntagMFADeviceOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUntagMFADeviceMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUntagMFADevice{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUntagMFADevice{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUntagMFADeviceValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagMFADevice(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUntagMFADevice(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UntagMFADevice", } }
133
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified tags from the specified OpenID Connect (OIDC)-compatible // identity provider in IAM. For more information about OIDC providers, see About // web identity federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html) // . For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) UntagOpenIDConnectProvider(ctx context.Context, params *UntagOpenIDConnectProviderInput, optFns ...func(*Options)) (*UntagOpenIDConnectProviderOutput, error) { if params == nil { params = &UntagOpenIDConnectProviderInput{} } result, metadata, err := c.invokeOperation(ctx, "UntagOpenIDConnectProvider", params, optFns, c.addOperationUntagOpenIDConnectProviderMiddlewares) if err != nil { return nil, err } out := result.(*UntagOpenIDConnectProviderOutput) out.ResultMetadata = metadata return out, nil } type UntagOpenIDConnectProviderInput struct { // The ARN of the OIDC provider in IAM from which you want to remove tags. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. OpenIDConnectProviderArn *string // A list of key names as a simple array of strings. The tags with matching keys // are removed from the specified OIDC provider. // // This member is required. TagKeys []string noSmithyDocumentSerde } type UntagOpenIDConnectProviderOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUntagOpenIDConnectProviderMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUntagOpenIDConnectProvider{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUntagOpenIDConnectProvider{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUntagOpenIDConnectProviderValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagOpenIDConnectProvider(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUntagOpenIDConnectProvider(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UntagOpenIDConnectProvider", } }
133
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified tags from the customer managed policy. For more // information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) UntagPolicy(ctx context.Context, params *UntagPolicyInput, optFns ...func(*Options)) (*UntagPolicyOutput, error) { if params == nil { params = &UntagPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "UntagPolicy", params, optFns, c.addOperationUntagPolicyMiddlewares) if err != nil { return nil, err } out := result.(*UntagPolicyOutput) out.ResultMetadata = metadata return out, nil } type UntagPolicyInput struct { // The ARN of the IAM customer managed policy from which you want to remove tags. // This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. PolicyArn *string // A list of key names as a simple array of strings. The tags with matching keys // are removed from the specified policy. // // This member is required. TagKeys []string noSmithyDocumentSerde } type UntagPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUntagPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUntagPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUntagPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUntagPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUntagPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UntagPolicy", } }
132
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified tags from the role. For more information about tagging, // see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) UntagRole(ctx context.Context, params *UntagRoleInput, optFns ...func(*Options)) (*UntagRoleOutput, error) { if params == nil { params = &UntagRoleInput{} } result, metadata, err := c.invokeOperation(ctx, "UntagRole", params, optFns, c.addOperationUntagRoleMiddlewares) if err != nil { return nil, err } out := result.(*UntagRoleOutput) out.ResultMetadata = metadata return out, nil } type UntagRoleInput struct { // The name of the IAM role from which you want to remove tags. This parameter // accepts (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters that consist of upper and lowercase alphanumeric characters with // no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. RoleName *string // A list of key names as a simple array of strings. The tags with matching keys // are removed from the specified role. // // This member is required. TagKeys []string noSmithyDocumentSerde } type UntagRoleOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUntagRoleMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUntagRole{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUntagRole{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUntagRoleValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagRole(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUntagRole(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UntagRole", } }
131
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified tags from the specified Security Assertion Markup // Language (SAML) identity provider in IAM. For more information about these // providers, see About web identity federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc.html) // . For more information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) UntagSAMLProvider(ctx context.Context, params *UntagSAMLProviderInput, optFns ...func(*Options)) (*UntagSAMLProviderOutput, error) { if params == nil { params = &UntagSAMLProviderInput{} } result, metadata, err := c.invokeOperation(ctx, "UntagSAMLProvider", params, optFns, c.addOperationUntagSAMLProviderMiddlewares) if err != nil { return nil, err } out := result.(*UntagSAMLProviderOutput) out.ResultMetadata = metadata return out, nil } type UntagSAMLProviderInput struct { // The ARN of the SAML identity provider in IAM from which you want to remove // tags. This parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) // ) a string of characters consisting of upper and lowercase alphanumeric // characters with no spaces. You can also include any of the following characters: // _+=,.@- // // This member is required. SAMLProviderArn *string // A list of key names as a simple array of strings. The tags with matching keys // are removed from the specified SAML identity provider. // // This member is required. TagKeys []string noSmithyDocumentSerde } type UntagSAMLProviderOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUntagSAMLProviderMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUntagSAMLProvider{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUntagSAMLProvider{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUntagSAMLProviderValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagSAMLProvider(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUntagSAMLProvider(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UntagSAMLProvider", } }
134
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified tags from the IAM server certificate. For more // information about tagging, see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. For certificates in a Region supported by Certificate // Manager (ACM), we recommend that you don't use IAM server certificates. Instead, // use ACM to provision, manage, and deploy your server certificates. For more // information about IAM server certificates, Working with server certificates (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_server-certs.html) // in the IAM User Guide. func (c *Client) UntagServerCertificate(ctx context.Context, params *UntagServerCertificateInput, optFns ...func(*Options)) (*UntagServerCertificateOutput, error) { if params == nil { params = &UntagServerCertificateInput{} } result, metadata, err := c.invokeOperation(ctx, "UntagServerCertificate", params, optFns, c.addOperationUntagServerCertificateMiddlewares) if err != nil { return nil, err } out := result.(*UntagServerCertificateOutput) out.ResultMetadata = metadata return out, nil } type UntagServerCertificateInput struct { // The name of the IAM server certificate from which you want to remove tags. This // parameter allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) // a string of characters consisting of upper and lowercase alphanumeric characters // with no spaces. You can also include any of the following characters: _+=,.@- // // This member is required. ServerCertificateName *string // A list of key names as a simple array of strings. The tags with matching keys // are removed from the specified IAM server certificate. // // This member is required. TagKeys []string noSmithyDocumentSerde } type UntagServerCertificateOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUntagServerCertificateMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUntagServerCertificate{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUntagServerCertificate{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUntagServerCertificateValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagServerCertificate(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUntagServerCertificate(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UntagServerCertificate", } }
135
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Removes the specified tags from the user. For more information about tagging, // see Tagging IAM resources (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html) // in the IAM User Guide. func (c *Client) UntagUser(ctx context.Context, params *UntagUserInput, optFns ...func(*Options)) (*UntagUserOutput, error) { if params == nil { params = &UntagUserInput{} } result, metadata, err := c.invokeOperation(ctx, "UntagUser", params, optFns, c.addOperationUntagUserMiddlewares) if err != nil { return nil, err } out := result.(*UntagUserOutput) out.ResultMetadata = metadata return out, nil } type UntagUserInput struct { // A list of key names as a simple array of strings. The tags with matching keys // are removed from the specified user. // // This member is required. TagKeys []string // The name of the IAM user from which you want to remove tags. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. UserName *string noSmithyDocumentSerde } type UntagUserOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUntagUserMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUntagUser{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUntagUser{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUntagUserValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagUser(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUntagUser(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UntagUser", } }
131
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/iam/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Changes the status of the specified access key from Active to Inactive, or vice // versa. This operation can be used to disable a user's key as part of a key // rotation workflow. If the UserName is not specified, the user name is // determined implicitly based on the Amazon Web Services access key ID used to // sign the request. If a temporary access key is used, then UserName is required. // If a long-term key is assigned to the user, then UserName is not required. This // operation works for access keys under the Amazon Web Services account. // Consequently, you can use this operation to manage Amazon Web Services account // root user credentials even if the Amazon Web Services account has no associated // users. For information about rotating keys, see Managing keys and certificates (https://docs.aws.amazon.com/IAM/latest/UserGuide/ManagingCredentials.html) // in the IAM User Guide. func (c *Client) UpdateAccessKey(ctx context.Context, params *UpdateAccessKeyInput, optFns ...func(*Options)) (*UpdateAccessKeyOutput, error) { if params == nil { params = &UpdateAccessKeyInput{} } result, metadata, err := c.invokeOperation(ctx, "UpdateAccessKey", params, optFns, c.addOperationUpdateAccessKeyMiddlewares) if err != nil { return nil, err } out := result.(*UpdateAccessKeyOutput) out.ResultMetadata = metadata return out, nil } type UpdateAccessKeyInput struct { // The access key ID of the secret access key you want to update. This parameter // allows (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string // of characters that can consist of any upper or lowercased letter or digit. // // This member is required. AccessKeyId *string // The status you want to assign to the secret access key. Active means that the // key can be used for programmatic calls to Amazon Web Services, while Inactive // means that the key cannot be used. // // This member is required. Status types.StatusType // The name of the user whose key you want to update. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- UserName *string noSmithyDocumentSerde } type UpdateAccessKeyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUpdateAccessKeyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateAccessKey{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateAccessKey{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUpdateAccessKeyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAccessKey(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUpdateAccessKey(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UpdateAccessKey", } }
146
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Updates the password policy settings for the Amazon Web Services account. This // operation does not support partial updates. No parameters are required, but if // you do not specify a parameter, that parameter's value reverts to its default // value. See the Request Parameters section for each parameter's default value. // Also note that some parameters do not allow the default parameter to be // explicitly set. Instead, to invoke the default value, do not include that // parameter when you invoke the operation. For more information about using a // password policy, see Managing an IAM password policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_ManagingPasswordPolicies.html) // in the IAM User Guide. func (c *Client) UpdateAccountPasswordPolicy(ctx context.Context, params *UpdateAccountPasswordPolicyInput, optFns ...func(*Options)) (*UpdateAccountPasswordPolicyOutput, error) { if params == nil { params = &UpdateAccountPasswordPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "UpdateAccountPasswordPolicy", params, optFns, c.addOperationUpdateAccountPasswordPolicyMiddlewares) if err != nil { return nil, err } out := result.(*UpdateAccountPasswordPolicyOutput) out.ResultMetadata = metadata return out, nil } type UpdateAccountPasswordPolicyInput struct { // Allows all IAM users in your account to use the Amazon Web Services Management // Console to change their own passwords. For more information, see Permitting IAM // users to change their own passwords (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_enable-user-change.html) // in the IAM User Guide. If you do not specify a value for this parameter, then // the operation uses the default value of false . The result is that IAM users in // the account do not automatically have permissions to change their own password. AllowUsersToChangePassword bool // Prevents IAM users who are accessing the account via the Amazon Web Services // Management Console from setting a new console password after their password has // expired. The IAM user cannot access the console until an administrator resets // the password. If you do not specify a value for this parameter, then the // operation uses the default value of false . The result is that IAM users can // change their passwords after they expire and continue to sign in as the user. In // the Amazon Web Services Management Console, the custom password policy option // Allow users to change their own password gives IAM users permissions to // iam:ChangePassword for only their user and to the iam:GetAccountPasswordPolicy // action. This option does not attach a permissions policy to each user, rather // the permissions are applied at the account-level for all users by IAM. IAM users // with iam:ChangePassword permission and active access keys can reset their own // expired console password using the CLI or API. HardExpiry *bool // The number of days that an IAM user password is valid. If you do not specify a // value for this parameter, then the operation uses the default value of 0 . The // result is that IAM user passwords never expire. MaxPasswordAge *int32 // The minimum number of characters allowed in an IAM user password. If you do not // specify a value for this parameter, then the operation uses the default value of // 6 . MinimumPasswordLength *int32 // Specifies the number of previous passwords that IAM users are prevented from // reusing. If you do not specify a value for this parameter, then the operation // uses the default value of 0 . The result is that IAM users are not prevented // from reusing previous passwords. PasswordReusePrevention *int32 // Specifies whether IAM user passwords must contain at least one lowercase // character from the ISO basic Latin alphabet (a to z). If you do not specify a // value for this parameter, then the operation uses the default value of false . // The result is that passwords do not require at least one lowercase character. RequireLowercaseCharacters bool // Specifies whether IAM user passwords must contain at least one numeric // character (0 to 9). If you do not specify a value for this parameter, then the // operation uses the default value of false . The result is that passwords do not // require at least one numeric character. RequireNumbers bool // Specifies whether IAM user passwords must contain at least one of the following // non-alphanumeric characters: ! @ # $ % ^ & * ( ) _ + - = [ ] { } | ' If you do // not specify a value for this parameter, then the operation uses the default // value of false . The result is that passwords do not require at least one symbol // character. RequireSymbols bool // Specifies whether IAM user passwords must contain at least one uppercase // character from the ISO basic Latin alphabet (A to Z). If you do not specify a // value for this parameter, then the operation uses the default value of false . // The result is that passwords do not require at least one uppercase character. RequireUppercaseCharacters bool noSmithyDocumentSerde } type UpdateAccountPasswordPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUpdateAccountPasswordPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateAccountPasswordPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateAccountPasswordPolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAccountPasswordPolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUpdateAccountPasswordPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UpdateAccountPasswordPolicy", } }
184
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package iam import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Updates the policy that grants an IAM entity permission to assume a role. This // is typically referred to as the "role trust policy". For more information about // roles, see Using roles to delegate permissions and federate identities (https://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html) // . func (c *Client) UpdateAssumeRolePolicy(ctx context.Context, params *UpdateAssumeRolePolicyInput, optFns ...func(*Options)) (*UpdateAssumeRolePolicyOutput, error) { if params == nil { params = &UpdateAssumeRolePolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "UpdateAssumeRolePolicy", params, optFns, c.addOperationUpdateAssumeRolePolicyMiddlewares) if err != nil { return nil, err } out := result.(*UpdateAssumeRolePolicyOutput) out.ResultMetadata = metadata return out, nil } type UpdateAssumeRolePolicyInput struct { // The policy that grants an entity permission to assume the role. You must // provide policies in JSON format in IAM. However, for CloudFormation templates // formatted in YAML, you can provide the policy in JSON or YAML format. // CloudFormation always converts a YAML policy to JSON format before submitting it // to IAM. The regex pattern (http://wikipedia.org/wiki/regex) used to validate // this parameter is a string of characters consisting of the following: // - Any printable ASCII character ranging from the space character ( \u0020 ) // through the end of the ASCII character range // - The printable characters in the Basic Latin and Latin-1 Supplement // character set (through \u00FF ) // - The special characters tab ( \u0009 ), line feed ( \u000A ), and carriage // return ( \u000D ) // // This member is required. PolicyDocument *string // The name of the role to update with the new policy. This parameter allows // (through its regex pattern (http://wikipedia.org/wiki/regex) ) a string of // characters consisting of upper and lowercase alphanumeric characters with no // spaces. You can also include any of the following characters: _+=,.@- // // This member is required. RoleName *string noSmithyDocumentSerde } type UpdateAssumeRolePolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUpdateAssumeRolePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsAwsquery_serializeOpUpdateAssumeRolePolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsAwsquery_deserializeOpUpdateAssumeRolePolicy{}, middleware.After) if err != nil { return err } if err = addSetLoggerMiddleware(stack, options); err != nil { return err } if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { return err } if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { return err } if err = addResolveEndpointMiddleware(stack, options); err != nil { return err } if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { return err } if err = addRetryMiddlewares(stack, options); err != nil { return err } if err = addHTTPSignerV4Middleware(stack, options); err != nil { return err } if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { return err } if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { return err } if err = addClientUserAgent(stack); err != nil { return err } if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { return err } if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { return err } if err = addOpUpdateAssumeRolePolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAssumeRolePolicy(options.Region), middleware.Before); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRequestIDRetrieverMiddleware(stack); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUpdateAssumeRolePolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "iam", OperationName: "UpdateAssumeRolePolicy", } }
142