1

我想使用 Go AWS SDK 在 AWS MediaLive 上创建一个频道(尝试使用 v1 和 v2)。

但我收到以下错误:

UnprocessableEntityException:无法读取未定义状态代码的属性“目标”: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: &param1,
                    Url:           destinationA.HlsIngest.IngestEndpoints[0].Url,
                    Username:      destinationA.HlsIngest.IngestEndpoints[0].Username},
                {
                    PasswordParam: &param2,
                    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操作需要输入、输入安全组等。

在我的代码中没有任何地方有属性destinationDestinations下只有字段CreateChannelInput

如果有人可以提供有关此错误的提示,我们将不胜感激。

4

1 回答 1

2

最后我所做的是从 AWS 控制台创建一个通道,然后使用以下命令将其配置导出到 JSON 文件:

aws medialive describe-channel --channel-id <my_channel_id>

每次我想使用 SDK 创建新频道时,我都会从 JSON 文件加载配置并更改一些参数(如有必要)。

于 2018-03-29T13:35:27.853 回答