forked from aws/aws-sdk-go-v2
/
api.go
407 lines (337 loc) · 13.9 KB
/
api.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package connect
import (
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
const opStartOutboundVoiceContact = "StartOutboundVoiceContact"
// StartOutboundVoiceContactRequest is a API request type for the StartOutboundVoiceContact API operation.
type StartOutboundVoiceContactRequest struct {
*aws.Request
Input *StartOutboundVoiceContactInput
Copy func(*StartOutboundVoiceContactInput) StartOutboundVoiceContactRequest
}
// Send marshals and sends the StartOutboundVoiceContact API request.
func (r StartOutboundVoiceContactRequest) Send() (*StartOutboundVoiceContactOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*StartOutboundVoiceContactOutput), nil
}
// StartOutboundVoiceContactRequest returns a request value for making API operation for
// Amazon Connect Service.
//
// The StartOutboundVoiceContact operation initiates a contact flow to place
// an outbound call to a customer.
//
// There is a throttling limit placed on usage of the API that includes a RateLimit
// of 2 per second, and a BurstLimit of 5 per second.
//
// If you are using an IAM account, it must have permissions to the connect:StartOutboundVoiceContact
// action.
//
// // Example sending a request using the StartOutboundVoiceContactRequest method.
// req := client.StartOutboundVoiceContactRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StartOutboundVoiceContact
func (c *Connect) StartOutboundVoiceContactRequest(input *StartOutboundVoiceContactInput) StartOutboundVoiceContactRequest {
op := &aws.Operation{
Name: opStartOutboundVoiceContact,
HTTPMethod: "PUT",
HTTPPath: "/contact/outbound-voice",
}
if input == nil {
input = &StartOutboundVoiceContactInput{}
}
output := &StartOutboundVoiceContactOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return StartOutboundVoiceContactRequest{Request: req, Input: input, Copy: c.StartOutboundVoiceContactRequest}
}
const opStopContact = "StopContact"
// StopContactRequest is a API request type for the StopContact API operation.
type StopContactRequest struct {
*aws.Request
Input *StopContactInput
Copy func(*StopContactInput) StopContactRequest
}
// Send marshals and sends the StopContact API request.
func (r StopContactRequest) Send() (*StopContactOutput, error) {
err := r.Request.Send()
if err != nil {
return nil, err
}
return r.Request.Data.(*StopContactOutput), nil
}
// StopContactRequest returns a request value for making API operation for
// Amazon Connect Service.
//
// Ends the contact initiated by the StartOutboundVoiceContact operation.
//
// If you are using an IAM account, it must have permissions to the connect:StopContact
// operation.
//
// // Example sending a request using the StopContactRequest method.
// req := client.StopContactRequest(params)
// resp, err := req.Send()
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StopContact
func (c *Connect) StopContactRequest(input *StopContactInput) StopContactRequest {
op := &aws.Operation{
Name: opStopContact,
HTTPMethod: "POST",
HTTPPath: "/contact/stop",
}
if input == nil {
input = &StopContactInput{}
}
output := &StopContactOutput{}
req := c.newRequest(op, input, output)
output.responseMetadata = aws.Response{Request: req}
return StopContactRequest{Request: req, Input: input, Copy: c.StopContactRequest}
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StartOutboundVoiceContactRequest
type StartOutboundVoiceContactInput struct {
_ struct{} `type:"structure"`
// Specify a custom key-value pair using an attribute map. The attributes are
// standard Amazon Connect attributes, and can be accessed in contact flows
// just like any other contact attributes.
//
// There can be up to 32,768 UTF-8 bytes across all key-value pairs. Attribute
// keys can include only alphanumeric, dash, and underscore characters.
//
// For example, to play a greeting when the customer answers the call, you can
// pass the customer name in attributes similar to the following:
Attributes map[string]string `type:"map"`
// A unique, case-sensitive identifier that you provide to ensure the idempotency
// of the request. The token is valid for 7 days after creation. If a contact
// is already started, the contact ID is returned. If the contact is disconnected,
// a new contact is started.
ClientToken *string `type:"string" idempotencyToken:"true"`
// The identifier for the contact flow to execute for the outbound call. This
// is a GUID value only. Amazon Resource Name (ARN) values are not supported.
//
// To find the ContactFlowId, open the contact flow to use in the Amazon Connect
// contact flow designer. The ID for the contact flow is displayed in the address
// bar as part of the URL. For example, an address displayed when you open a
// contact flow is similar to the following: https://myconnectinstance.awsapps.com/connect/contact-flows/edit?id=arn:aws:connect:us-east-1:361814831152:instance/2fb42df9-78a2-4b99-b484-f5cf80dc300c/contact-flow/b0b8f2dd-ed1b-4c44-af36-ce189a178181.
// At the end of the URL, you see contact-flow/b0b8f2dd-ed1b-4c44-af36-ce189a178181.
// The ContactFlowID for this contact flow is b0b8f2dd-ed1b-4c44-af36-ce189a178181.
// Make sure to include only the GUID after the "contact-flow/" in your requests.
//
// ContactFlowId is a required field
ContactFlowId *string `type:"string" required:"true"`
// The phone number, in E.164 format, of the customer to call with the outbound
// contact.
//
// DestinationPhoneNumber is a required field
DestinationPhoneNumber *string `type:"string" required:"true"`
// The identifier for your Amazon Connect instance. To find the InstanceId value
// for your Amazon Connect instance, open the Amazon Connect console (https://console.aws.amazon.com/connect/).
// Select the instance alias of the instance and view the instance ID in the
// Overview section. For example, the instance ID is the set of characters at
// the end of the instance ARN, after "instance/", such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.
//
// InstanceId is a required field
InstanceId *string `type:"string" required:"true"`
// The queue to which to add the call. If you specify a queue, the phone displayed
// for caller ID is the phone number defined for the queue. If you do not specify
// a queue, the queue used is the queue defined in the contact flow specified
// by ContactFlowId.
//
// To find the QueueId, open the queue to use in the Amazon Connect queue editor.
// The ID for the queue is displayed in the address bar as part of the URL.
// For example, the QueueId value is the set of characters at the end of the
// URL, after "queue/", such as aeg40574-2d01-51c3-73d6-bf8624d2168c.
QueueId *string `type:"string"`
// The phone number, in E.164 format, associated with your Amazon Connect instance
// to use to place the outbound call.
SourcePhoneNumber *string `type:"string"`
}
// String returns the string representation
func (s StartOutboundVoiceContactInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s StartOutboundVoiceContactInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *StartOutboundVoiceContactInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "StartOutboundVoiceContactInput"}
if s.ContactFlowId == nil {
invalidParams.Add(aws.NewErrParamRequired("ContactFlowId"))
}
if s.DestinationPhoneNumber == nil {
invalidParams.Add(aws.NewErrParamRequired("DestinationPhoneNumber"))
}
if s.InstanceId == nil {
invalidParams.Add(aws.NewErrParamRequired("InstanceId"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s StartOutboundVoiceContactInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/x-amz-json-1.1"), protocol.Metadata{})
if len(s.Attributes) > 0 {
v := s.Attributes
metadata := protocol.Metadata{}
ms0 := e.Map(protocol.BodyTarget, "Attributes", metadata)
ms0.Start()
for k1, v1 := range v {
ms0.MapSetValue(k1, protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v1)})
}
ms0.End()
}
var ClientToken string
if s.ClientToken != nil {
ClientToken = *s.ClientToken
} else {
ClientToken = protocol.GetIdempotencyToken()
}
{
v := ClientToken
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "ClientToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.ContactFlowId != nil {
v := *s.ContactFlowId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "ContactFlowId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.DestinationPhoneNumber != nil {
v := *s.DestinationPhoneNumber
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "DestinationPhoneNumber", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.InstanceId != nil {
v := *s.InstanceId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "InstanceId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.QueueId != nil {
v := *s.QueueId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "QueueId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.SourcePhoneNumber != nil {
v := *s.SourcePhoneNumber
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "SourcePhoneNumber", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StartOutboundVoiceContactResponse
type StartOutboundVoiceContactOutput struct {
_ struct{} `type:"structure"`
responseMetadata aws.Response
// The unique identifier of this contact within your Amazon Connect instance.
ContactId *string `min:"1" type:"string"`
}
// String returns the string representation
func (s StartOutboundVoiceContactOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s StartOutboundVoiceContactOutput) GoString() string {
return s.String()
}
// SDKResponseMetdata return sthe response metadata for the API.
func (s StartOutboundVoiceContactOutput) SDKResponseMetadata() aws.Response {
return s.responseMetadata
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s StartOutboundVoiceContactOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.ContactId != nil {
v := *s.ContactId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "ContactId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StopContactRequest
type StopContactInput struct {
_ struct{} `type:"structure"`
// The unique identifier of the contact to end. This is the ContactId value
// returned from the StartOutboundVoiceContact operation.
//
// ContactId is a required field
ContactId *string `min:"1" type:"string" required:"true"`
// The identifier of the Amazon Connect instance in which the contact is active.
//
// InstanceId is a required field
InstanceId *string `type:"string" required:"true"`
}
// String returns the string representation
func (s StopContactInput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s StopContactInput) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *StopContactInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "StopContactInput"}
if s.ContactId == nil {
invalidParams.Add(aws.NewErrParamRequired("ContactId"))
}
if s.ContactId != nil && len(*s.ContactId) < 1 {
invalidParams.Add(aws.NewErrParamMinLen("ContactId", 1))
}
if s.InstanceId == nil {
invalidParams.Add(aws.NewErrParamRequired("InstanceId"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s StopContactInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/x-amz-json-1.1"), protocol.Metadata{})
if s.ContactId != nil {
v := *s.ContactId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "ContactId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.InstanceId != nil {
v := *s.InstanceId
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "InstanceId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/connect-2017-08-08/StopContactResponse
type StopContactOutput struct {
_ struct{} `type:"structure"`
responseMetadata aws.Response
}
// String returns the string representation
func (s StopContactOutput) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s StopContactOutput) GoString() string {
return s.String()
}
// SDKResponseMetdata return sthe response metadata for the API.
func (s StopContactOutput) SDKResponseMetadata() aws.Response {
return s.responseMetadata
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s StopContactOutput) MarshalFields(e protocol.FieldEncoder) error {
return nil
}