// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package iam import ( "context" "time" "github.com/aws/aws-sdk-go-v2/aws" ) // WaitUntilInstanceProfileExists uses the IAM API operation // GetInstanceProfile to wait for a condition to be met before returning. // If the condition is not met within the max attempt window, an error will // be returned. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. func (c *Client) WaitUntilInstanceProfileExists(ctx context.Context, input *GetInstanceProfileInput, opts ...aws.WaiterOption) error { w := aws.Waiter{ Name: "WaitUntilInstanceProfileExists", MaxAttempts: 40, Delay: aws.ConstantWaiterDelay(1 * time.Second), Acceptors: []aws.WaiterAcceptor{ { State: aws.SuccessWaiterState, Matcher: aws.StatusWaiterMatch, Expected: 200, }, { State: aws.RetryWaiterState, Matcher: aws.StatusWaiterMatch, Expected: 404, }, }, Logger: c.Config.Logger, NewRequest: func(opts []aws.Option) (*aws.Request, error) { var inCpy *GetInstanceProfileInput if input != nil { tmp := *input inCpy = &tmp } req := c.GetInstanceProfileRequest(inCpy) req.SetContext(ctx) req.ApplyOptions(opts...) return req.Request, nil }, } w.ApplyOptions(opts...) return w.Wait(ctx) } // WaitUntilPolicyExists uses the IAM API operation // GetPolicy to wait for a condition to be met before returning. // If the condition is not met within the max attempt window, an error will // be returned. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. func (c *Client) WaitUntilPolicyExists(ctx context.Context, input *GetPolicyInput, opts ...aws.WaiterOption) error { w := aws.Waiter{ Name: "WaitUntilPolicyExists", MaxAttempts: 20, Delay: aws.ConstantWaiterDelay(1 * time.Second), Acceptors: []aws.WaiterAcceptor{ { State: aws.SuccessWaiterState, Matcher: aws.StatusWaiterMatch, Expected: 200, }, { State: aws.RetryWaiterState, Matcher: aws.ErrorWaiterMatch, Expected: "NoSuchEntity", }, }, Logger: c.Config.Logger, NewRequest: func(opts []aws.Option) (*aws.Request, error) { var inCpy *GetPolicyInput if input != nil { tmp := *input inCpy = &tmp } req := c.GetPolicyRequest(inCpy) req.SetContext(ctx) req.ApplyOptions(opts...) return req.Request, nil }, } w.ApplyOptions(opts...) return w.Wait(ctx) } // WaitUntilRoleExists uses the IAM API operation // GetRole to wait for a condition to be met before returning. // If the condition is not met within the max attempt window, an error will // be returned. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. func (c *Client) WaitUntilRoleExists(ctx context.Context, input *GetRoleInput, opts ...aws.WaiterOption) error { w := aws.Waiter{ Name: "WaitUntilRoleExists", MaxAttempts: 20, Delay: aws.ConstantWaiterDelay(1 * time.Second), Acceptors: []aws.WaiterAcceptor{ { State: aws.SuccessWaiterState, Matcher: aws.StatusWaiterMatch, Expected: 200, }, { State: aws.RetryWaiterState, Matcher: aws.ErrorWaiterMatch, Expected: "NoSuchEntity", }, }, Logger: c.Config.Logger, NewRequest: func(opts []aws.Option) (*aws.Request, error) { var inCpy *GetRoleInput if input != nil { tmp := *input inCpy = &tmp } req := c.GetRoleRequest(inCpy) req.SetContext(ctx) req.ApplyOptions(opts...) return req.Request, nil }, } w.ApplyOptions(opts...) return w.Wait(ctx) } // WaitUntilUserExists uses the IAM API operation // GetUser to wait for a condition to be met before returning. // If the condition is not met within the max attempt window, an error will // be returned. // // The context must be non-nil and will be used for request cancellation. If // the context is nil a panic will occur. In the future the SDK may create // sub-contexts for http.Requests. See https://golang.org/pkg/context/ // for more information on using Contexts. func (c *Client) WaitUntilUserExists(ctx context.Context, input *GetUserInput, opts ...aws.WaiterOption) error { w := aws.Waiter{ Name: "WaitUntilUserExists", MaxAttempts: 20, Delay: aws.ConstantWaiterDelay(1 * time.Second), Acceptors: []aws.WaiterAcceptor{ { State: aws.SuccessWaiterState, Matcher: aws.StatusWaiterMatch, Expected: 200, }, { State: aws.RetryWaiterState, Matcher: aws.ErrorWaiterMatch, Expected: "NoSuchEntity", }, }, Logger: c.Config.Logger, NewRequest: func(opts []aws.Option) (*aws.Request, error) { var inCpy *GetUserInput if input != nil { tmp := *input inCpy = &tmp } req := c.GetUserRequest(inCpy) req.SetContext(ctx) req.ApplyOptions(opts...) return req.Request, nil }, } w.ApplyOptions(opts...) return w.Wait(ctx) }