-
Notifications
You must be signed in to change notification settings - Fork 0
/
op_ListExports.go
154 lines (119 loc) · 4.4 KB
/
op_ListExports.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package dyno
import (
"context"
ddb "github.com/aws/aws-sdk-go-v2/service/dynamodb"
"sync"
)
// ListExports executes ListExports operation and returns a ListExports operation
func (s *Session) ListExports(input *ddb.ListExportsInput, mw ...ListExportsMiddleWare) *ListExports {
return NewListExports(input, mw...).Invoke(s.ctx, s.ddb)
}
// ListExports executes a ListExports operation with a ListExportsInput in this pool and returns the ListExports operation
func (p *Pool) ListExports(input *ddb.ListExportsInput, mw ...ListExportsMiddleWare) *ListExports {
op := NewListExports(input, mw...)
p.Do(op) // run the operation in the pool
return op
}
// ListExportsContext represents an exhaustive ListExports operation request context
type ListExportsContext struct {
context.Context
Input *ddb.ListExportsInput
Client *ddb.Client
}
// ListExportsOutput represents the output for the ListExports operation
type ListExportsOutput struct {
out *ddb.ListExportsOutput
err error
mu sync.RWMutex
}
// Set sets the output
func (o *ListExportsOutput) Set(out *ddb.ListExportsOutput, err error) {
o.mu.Lock()
o.out = out
o.err = err
o.mu.Unlock()
}
// Get gets the output
func (o *ListExportsOutput) Get() (out *ddb.ListExportsOutput, err error) {
o.mu.Lock()
out = o.out
err = o.err
o.mu.Unlock()
return
}
// ListExportsHandler represents a handler for ListExports requests
type ListExportsHandler interface {
HandleListExports(ctx *ListExportsContext, output *ListExportsOutput)
}
// ListExportsHandlerFunc is a ListExportsHandler function
type ListExportsHandlerFunc func(ctx *ListExportsContext, output *ListExportsOutput)
// HandleListExports implements ListExportsHandler
func (h ListExportsHandlerFunc) HandleListExports(ctx *ListExportsContext, output *ListExportsOutput) {
h(ctx, output)
}
// ListExportsFinalHandler is the final ListExportsHandler that executes a dynamodb ListExports operation
type ListExportsFinalHandler struct{}
// HandleListExports implements the ListExportsHandler
func (h *ListExportsFinalHandler) HandleListExports(ctx *ListExportsContext, output *ListExportsOutput) {
output.Set(ctx.Client.ListExports(ctx, ctx.Input))
}
// ListExportsMiddleWare is a middleware function use for wrapping ListExportsHandler requests
type ListExportsMiddleWare interface {
ListExportsMiddleWare(next ListExportsHandler) ListExportsHandler
}
// ListExportsMiddleWareFunc is a functional ListExportsMiddleWare
type ListExportsMiddleWareFunc func(next ListExportsHandler) ListExportsHandler
// ListExportsMiddleWare implements the ListExportsMiddleWare interface
func (mw ListExportsMiddleWareFunc) ListExportsMiddleWare(next ListExportsHandler) ListExportsHandler {
return mw(next)
}
// ListExports represents a ListExports operation
type ListExports struct {
*BaseOperation
input *ddb.ListExportsInput
middleWares []ListExportsMiddleWare
}
// NewListExports creates a new ListExports operation
func NewListExports(input *ddb.ListExportsInput, mws ...ListExportsMiddleWare) *ListExports {
return &ListExports{
BaseOperation: NewOperation(),
input: input,
middleWares: mws,
}
}
// Invoke invokes the ListExports operation in a goroutine and returns a ListExports operation
func (op *ListExports) Invoke(ctx context.Context, client *ddb.Client) *ListExports {
op.SetRunning() // operation now waiting for a response
go op.InvokeDynoOperation(ctx, client)
return op
}
// InvokeDynoOperation invokes the ListExports operation
func (op *ListExports) InvokeDynoOperation(ctx context.Context, client *ddb.Client) {
output := new(ListExportsOutput)
defer func() { op.SetResponse(output.Get()) }()
var h ListExportsHandler
h = new(ListExportsFinalHandler)
// loop in reverse to preserve middleware order
for i := len(op.middleWares) - 1; i >= 0; i-- {
h = op.middleWares[i].ListExportsMiddleWare(h)
}
requestCtx := &ListExportsContext{
Context: ctx,
Client: client,
Input: op.input,
}
h.HandleListExports(requestCtx, output)
}
// Await waits for the ListExports operation to be fulfilled and then returns a ListExportsOutput and error
func (op *ListExports) Await() (*ddb.ListExportsOutput, error) {
out, err := op.BaseOperation.Await()
if out == nil {
return nil, err
}
return out.(*ddb.ListExportsOutput), err
}
// NewListExportsInput creates a new ListExportsInput
func NewListExportsInput() *ddb.ListExportsInput {
return &ddb.ListExportsInput{}
}
// todo: ListAllExports operation