aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go')
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go
index 6c14336..802ac88 100644
--- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go
+++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go
@@ -158,6 +158,37 @@ func (l *HandlerList) RemoveByName(name string) {
158 } 158 }
159} 159}
160 160
161// SwapNamed will swap out any existing handlers with the same name as the
162// passed in NamedHandler returning true if handlers were swapped. False is
163// returned otherwise.
164func (l *HandlerList) SwapNamed(n NamedHandler) (swapped bool) {
165 for i := 0; i < len(l.list); i++ {
166 if l.list[i].Name == n.Name {
167 l.list[i].Fn = n.Fn
168 swapped = true
169 }
170 }
171
172 return swapped
173}
174
175// SetBackNamed will replace the named handler if it exists in the handler list.
176// If the handler does not exist the handler will be added to the end of the list.
177func (l *HandlerList) SetBackNamed(n NamedHandler) {
178 if !l.SwapNamed(n) {
179 l.PushBackNamed(n)
180 }
181}
182
183// SetFrontNamed will replace the named handler if it exists in the handler list.
184// If the handler does not exist the handler will be added to the beginning of
185// the list.
186func (l *HandlerList) SetFrontNamed(n NamedHandler) {
187 if !l.SwapNamed(n) {
188 l.PushFrontNamed(n)
189 }
190}
191
161// Run executes all handlers in the list with a given request object. 192// Run executes all handlers in the list with a given request object.
162func (l *HandlerList) Run(r *Request) { 193func (l *HandlerList) Run(r *Request) {
163 for i, h := range l.list { 194 for i, h := range l.list {