-
Notifications
You must be signed in to change notification settings - Fork 598
/
api_op_UpdateChannel.go
232 lines (188 loc) · 6.47 KB
/
api_op_UpdateChannel.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
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package medialive
import (
"context"
"fmt"
"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"
)
// Please also see https://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/UpdateChannelRequest
type UpdateChannelInput struct {
_ struct{} `type:"structure"`
// ChannelId is a required field
ChannelId *string `location:"uri" locationName:"channelId" type:"string" required:"true"`
Destinations []OutputDestination `locationName:"destinations" type:"list"`
// Encoder Settings
EncoderSettings *EncoderSettings `locationName:"encoderSettings" type:"structure"`
InputAttachments []InputAttachment `locationName:"inputAttachments" type:"list"`
InputSpecification *InputSpecification `locationName:"inputSpecification" type:"structure"`
// The log level the user wants for their channel.
LogLevel LogLevel `locationName:"logLevel" type:"string" enum:"true"`
Name *string `locationName:"name" type:"string"`
RoleArn *string `locationName:"roleArn" type:"string"`
}
// String returns the string representation
func (s UpdateChannelInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *UpdateChannelInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "UpdateChannelInput"}
if s.ChannelId == nil {
invalidParams.Add(aws.NewErrParamRequired("ChannelId"))
}
if s.Destinations != nil {
for i, v := range s.Destinations {
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Destinations", i), err.(aws.ErrInvalidParams))
}
}
}
if s.EncoderSettings != nil {
if err := s.EncoderSettings.Validate(); err != nil {
invalidParams.AddNested("EncoderSettings", err.(aws.ErrInvalidParams))
}
}
if s.InputAttachments != nil {
for i, v := range s.InputAttachments {
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "InputAttachments", i), err.(aws.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s UpdateChannelInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.Destinations != nil {
v := s.Destinations
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "destinations", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddFields(v1)
}
ls0.End()
}
if s.EncoderSettings != nil {
v := s.EncoderSettings
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "encoderSettings", v, metadata)
}
if s.InputAttachments != nil {
v := s.InputAttachments
metadata := protocol.Metadata{}
ls0 := e.List(protocol.BodyTarget, "inputAttachments", metadata)
ls0.Start()
for _, v1 := range v {
ls0.ListAddFields(v1)
}
ls0.End()
}
if s.InputSpecification != nil {
v := s.InputSpecification
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "inputSpecification", v, metadata)
}
if len(s.LogLevel) > 0 {
v := s.LogLevel
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "logLevel", protocol.QuotedValue{ValueMarshaler: v}, metadata)
}
if s.Name != nil {
v := *s.Name
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "name", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.RoleArn != nil {
v := *s.RoleArn
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "roleArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.ChannelId != nil {
v := *s.ChannelId
metadata := protocol.Metadata{}
e.SetValue(protocol.PathTarget, "channelId", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/UpdateChannelResponse
type UpdateChannelOutput struct {
_ struct{} `type:"structure"`
Channel *Channel `locationName:"channel" type:"structure"`
}
// String returns the string representation
func (s UpdateChannelOutput) String() string {
return awsutil.Prettify(s)
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s UpdateChannelOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.Channel != nil {
v := s.Channel
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "channel", v, metadata)
}
return nil
}
const opUpdateChannel = "UpdateChannel"
// UpdateChannelRequest returns a request value for making API operation for
// AWS Elemental MediaLive.
//
// Updates a channel.
//
// // Example sending a request using UpdateChannelRequest.
// req := client.UpdateChannelRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/medialive-2017-10-14/UpdateChannel
func (c *Client) UpdateChannelRequest(input *UpdateChannelInput) UpdateChannelRequest {
op := &aws.Operation{
Name: opUpdateChannel,
HTTPMethod: "PUT",
HTTPPath: "/prod/channels/{channelId}",
}
if input == nil {
input = &UpdateChannelInput{}
}
req := c.newRequest(op, input, &UpdateChannelOutput{})
return UpdateChannelRequest{Request: req, Input: input, Copy: c.UpdateChannelRequest}
}
// UpdateChannelRequest is the request type for the
// UpdateChannel API operation.
type UpdateChannelRequest struct {
*aws.Request
Input *UpdateChannelInput
Copy func(*UpdateChannelInput) UpdateChannelRequest
}
// Send marshals and sends the UpdateChannel API request.
func (r UpdateChannelRequest) Send(ctx context.Context) (*UpdateChannelResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &UpdateChannelResponse{
UpdateChannelOutput: r.Request.Data.(*UpdateChannelOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// UpdateChannelResponse is the response type for the
// UpdateChannel API operation.
type UpdateChannelResponse struct {
*UpdateChannelOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// UpdateChannel request.
func (r *UpdateChannelResponse) SDKResponseMetdata() *aws.Response {
return r.response
}