我想使用Go AWS SDK在AWS MediaLive上创建一个频道(同时使用v1和v2)。
但是我收到以下错误:
UnprocessableEntityException:无法读取属性' destination'未定义的 状态码:422,请求ID:5429aaff-fab9-11e7-843e-ed86ee7cfb22
CreateChannel
命令看起来像(这适用于SDK v1):
req, err := svc.CreateChannel(&medialive.CreateChannelInput{
Destinations: []*medialive.OutputDestination{
&medialive.OutputDestination{
Id: &destinationID,
Settings: []*medialive.OutputDestinationSettings{
{
PasswordParam: ¶m1,
Url: destinationA.HlsIngest.IngestEndpoints[0].Url,
Username: destinationA.HlsIngest.IngestEndpoints[0].Username},
{
PasswordParam: ¶m2,
Url: destinationB.HlsIngest.IngestEndpoints[0].Url,
Username: destinationB.HlsIngest.IngestEndpoints[0].Username,
},
},
},
},
EncoderSettings: &medialive.EncoderSettings{
OutputGroups: []*medialive.OutputGroup{&medialive.OutputGroup{
OutputGroupSettings: &medialive.OutputGroupSettings{
HlsGroupSettings: &medialive.HlsGroupSettings{
HlsCdnSettings: &medialive.HlsCdnSettings{
HlsWebdavSettings: &medialive.HlsWebdavSettings{},
},
},
},
Outputs: []*medialive.Output{&medialive.Output{}},
}},
VideoDescriptions: []*medialive.VideoDescription{&medialive.VideoDescription{
Height: &videoHeight,
Width: &videoWidth,
CodecSettings: &medialive.VideoCodecSettings{
H264Settings: &medialive.H264Settings{
FramerateDenominator: &framerate,
},
},
}},
},
InputAttachments: []*medialive.InputAttachment{&medialive.InputAttachment{InputId: input.Input.Id}},
Name: &channelName,
RoleArn: &arn,
})
显然,代码包含许多先前已初始化/创建的变量,因为CreateChannel
操作需要输入,输入安全组等。
我的代码中没有一个属性destination
。 Destinations
下只有CreateChannelInput
字段。
如果有人可以提供有关此错误的提示,我们将不胜感激。
答案 0 :(得分:1)
最后我做的是从AWS控制台创建一个频道,然后使用以下命令将其配置导出到JSON文件:
aws medialive describe-channel --channel-id <my_channel_id>
每次我想使用SDK创建新频道时,我都会从JSON文件加载配置并在必要时更改一些参数。