diff --git a/.changelog/27823.txt b/.changelog/27823.txt new file mode 100644 index 00000000000..84458baf812 --- /dev/null +++ b/.changelog/27823.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_medialive_channel: Add support for more `output`, `output_groups`, `audio_descriptions` and `video_descriptions` in `encoder_settings`. Add support for `input_settings` in `input_attachments` +``` \ No newline at end of file diff --git a/internal/service/medialive/channel.go b/internal/service/medialive/channel.go index 8a6eb68f34e..3328d28781d 100644 --- a/internal/service/medialive/channel.go +++ b/internal/service/medialive/channel.go @@ -62,6 +62,7 @@ func ResourceChannel() *schema.Resource { "channel_class": { Type: schema.TypeString, Required: true, + ForceNew: true, ValidateDiagFunc: enum.Validate[types.ChannelClass](), }, "channel_id": { @@ -394,7 +395,7 @@ func ResourceChannel() *schema.Resource { Optional: true, ValidateDiagFunc: enum.Validate[types.EmbeddedConvert608To708](), }, - "scte_20_detection": { + "scte20_detection": { Type: schema.TypeString, Optional: true, ValidateDiagFunc: enum.Validate[types.EmbeddedScte20Detection](), @@ -410,7 +411,7 @@ func ResourceChannel() *schema.Resource { }, }, }, - "scte_20_source_settings": { + "scte20_source_settings": { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -428,7 +429,7 @@ func ResourceChannel() *schema.Resource { }, }, }, - "scte_27_source_settings": { + "scte27_source_settings": { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -487,106 +488,106 @@ func ResourceChannel() *schema.Resource { }, }, }, - "deblock_filter": { - Type: schema.TypeString, - Optional: true, - ValidateDiagFunc: enum.Validate[types.InputDeblockFilter](), - }, - "denoise_filter": { - Type: schema.TypeString, - Optional: true, - ValidateDiagFunc: enum.Validate[types.InputDenoiseFilter](), - }, - "filter_strength": { - Type: schema.TypeInt, - Optional: true, - ValidateDiagFunc: validation.ToDiagFunc(validation.IntBetween(1, 5)), - }, - "input_filter": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateDiagFunc: enum.Validate[types.InputFilter](), - }, - "network_input_settings": { + }, + }, + }, + "deblock_filter": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.InputDeblockFilter](), + }, + "denoise_filter": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.InputDenoiseFilter](), + }, + "filter_strength": { + Type: schema.TypeInt, + Optional: true, + ValidateDiagFunc: validation.ToDiagFunc(validation.IntBetween(1, 5)), + }, + "input_filter": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateDiagFunc: enum.Validate[types.InputFilter](), + }, + "network_input_settings": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "hls_input_settings": { Type: schema.TypeList, Optional: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "hls_input_settings": { - Type: schema.TypeList, + "bandwidth": { + Type: schema.TypeInt, + Optional: true, + }, + "buffer_segments": { + Type: schema.TypeInt, Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "bandwidth": { - Type: schema.TypeInt, - Optional: true, - }, - "buffer_segments": { - Type: schema.TypeInt, - Optional: true, - }, - "retries": { - Type: schema.TypeInt, - Optional: true, - }, - "retry_interval": { - Type: schema.TypeInt, - Optional: true, - }, - "scte_35_source": { - Type: schema.TypeString, - Optional: true, - ValidateDiagFunc: enum.Validate[types.HlsScte35SourceType](), - }, - }, - }, }, - "server_validation": { + "retries": { + Type: schema.TypeInt, + Optional: true, + }, + "retry_interval": { + Type: schema.TypeInt, + Optional: true, + }, + "scte35_source": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: enum.Validate[types.NetworkInputServerValidation](), + ValidateDiagFunc: enum.Validate[types.HlsScte35SourceType](), }, }, }, }, - "scte_35_pid": { - Type: schema.TypeInt, - Optional: true, - }, - "smpte_2038_data_preference": { + "server_validation": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: enum.Validate[types.Smpte2038DataPreference](), + ValidateDiagFunc: enum.Validate[types.NetworkInputServerValidation](), }, - "source_end_behavior": { + }, + }, + }, + "scte35_pid": { + Type: schema.TypeInt, + Optional: true, + }, + "smpte2038_data_preference": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.Smpte2038DataPreference](), + }, + "source_end_behavior": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.InputSourceEndBehavior](), + }, + "video_selector": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "color_space": { Type: schema.TypeString, Optional: true, - ValidateDiagFunc: enum.Validate[types.InputSourceEndBehavior](), + ValidateDiagFunc: enum.Validate[types.VideoSelectorColorSpace](), }, - "video_selector": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "color_space": { - Type: schema.TypeString, - Optional: true, - ValidateDiagFunc: enum.Validate[types.VideoSelectorColorSpace](), - }, - // TODO implement color_space_settings - "color_space_usage": { - Type: schema.TypeString, - Optional: true, - ValidateDiagFunc: enum.Validate[types.VideoSelectorColorSpaceUsage](), - }, - // TODO implement selector_settings - }, - }, + // TODO implement color_space_settings + "color_space_usage": { + Type: schema.TypeString, + Optional: true, + ValidateDiagFunc: enum.Validate[types.VideoSelectorColorSpaceUsage](), }, + // TODO implement selector_settings }, }, }, @@ -847,10 +848,18 @@ func resourceChannelUpdate(ctx context.Context, d *schema.ResourceData, meta int in.EncoderSettings = expandChannelEncoderSettings(d.Get("encoder_settings").([]interface{})) } + if d.HasChange("input_attachments") { + in.InputAttachments = expandChannelInputAttachments(d.Get("input_attachments").(*schema.Set).List()) + } + if d.HasChange("input_specification") { in.InputSpecification = expandChannelInputSpecification(d.Get("input_specification").([]interface{})) } + if d.HasChange("log_level") { + in.LogLevel = types.LogLevel(d.Get("log_level").(string)) + } + if d.HasChange("maintenance") { in.Maintenance = expandChannelMaintenanceUpdate(d.Get("maintenance").([]interface{})) } @@ -1038,11 +1047,39 @@ func expandInputAttachmentInputSettings(tfList []interface{}) *types.InputSettin m := tfList[0].(map[string]interface{}) - var is types.InputSettings + var out types.InputSettings + if v, ok := m["audio_selector"].([]interface{}); ok && len(v) > 0 { + out.AudioSelectors = expandInputAttachmentInputSettingsAudioSelectors(v) + } if v, ok := m["audio_selector"].([]interface{}); ok && len(v) > 0 { - is.AudioSelectors = expandInputAttachmentInputSettingsAudioSelectors(v) + out.CaptionSelectors = expandInputAttachmentInputSettingsCaptionSelectors(v) + } + if v, ok := m["deblock_filter"].(string); ok && v != "" { + out.DeblockFilter = types.InputDeblockFilter(v) + } + if v, ok := m["denoise_filter"].(string); ok && v != "" { + out.DenoiseFilter = types.InputDenoiseFilter(v) + } + if v, ok := m["filter_strength"].(int); ok { + out.FilterStrength = int32(v) + } + if v, ok := m["input_filter"].(string); ok && v != "" { + out.InputFilter = types.InputFilter(v) + } + if v, ok := m["network_input_settings"].([]interface{}); ok && len(v) > 0 { + out.NetworkInputSettings = expandInputAttachmentInputSettingsNetworkInputSettings(v) + } + if v, ok := m["scte35_pid"].(int); ok { + out.Scte35Pid = int32(v) + } + if v, ok := m["smpte2038_data_preference"].(string); ok && v != "" { + out.Smpte2038DataPreference = types.Smpte2038DataPreference(v) + } + if v, ok := m["source_end_behavior"].(string); ok && v != "" { + out.SourceEndBehavior = types.InputSourceEndBehavior(v) } - return &is + + return &out } func expandInputAttachmentInputSettingsAudioSelectors(tfList []interface{}) []types.AudioSelector { @@ -1065,6 +1102,74 @@ func expandInputAttachmentInputSettingsAudioSelectors(tfList []interface{}) []ty return as } +func expandInputAttachmentInputSettingsCaptionSelectors(tfList []interface{}) []types.CaptionSelector { + var out []types.CaptionSelector + for _, v := range tfList { + m, ok := v.(map[string]interface{}) + if !ok { + continue + } + + var o types.CaptionSelector + if v, ok := m["name"].(string); ok && v != "" { + o.Name = aws.String(v) + } + if v, ok := m["language_code"].(string); ok && v != "" { + o.LanguageCode = aws.String(v) + } + // TODO selectorSettings + + out = append(out, o) + } + + return out +} + +func expandInputAttachmentInputSettingsNetworkInputSettings(tfList []interface{}) *types.NetworkInputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.NetworkInputSettings + if v, ok := m["hls_input_settings"].([]interface{}); ok && len(v) > 0 { + out.HlsInputSettings = expandNetworkInputSettingsHLSInputSettings(v) + } + if v, ok := m["server_validation"].(string); ok && v != "" { + out.ServerValidation = types.NetworkInputServerValidation(v) + } + + return &out +} + +func expandNetworkInputSettingsHLSInputSettings(tfList []interface{}) *types.HlsInputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.HlsInputSettings + if v, ok := m["bandwidth"].(int); ok { + out.Bandwidth = int32(v) + } + if v, ok := m["buffer_segments"].(int); ok { + out.BufferSegments = int32(v) + } + if v, ok := m["retries"].(int); ok { + out.Retries = int32(v) + } + if v, ok := m["retry_interval"].(int); ok { + out.RetryInterval = int32(v) + } + if v, ok := m["scte35_source"].(string); ok && v != "" { + out.Scte35Source = types.HlsScte35SourceType(v) + } + + return &out +} + func flattenChannelInputAttachments(tfList []types.InputAttachment) []interface{} { if len(tfList) == 0 { return nil @@ -1090,7 +1195,16 @@ func flattenInputAttachmentsInputSettings(in *types.InputSettings) []interface{} } m := map[string]interface{}{ - "audio_selector": flattenInputAttachmentsInputSettingsAudioSelectors(in.AudioSelectors), + "audio_selector": flattenInputAttachmentsInputSettingsAudioSelectors(in.AudioSelectors), + "caption_selector": flattenInputAttachmentsInputSettingsCaptionSelectors(in.CaptionSelectors), + "deblock_filter": string(in.DeblockFilter), + "denoise_filter": string(in.DenoiseFilter), + "filter_strength": int(in.FilterStrength), + "input_filter": string(in.InputFilter), + "network_input_settings": flattenInputAttachmentsInputSettingsNetworkInputSettings(in.NetworkInputSettings), + "scte35_pid": int(in.Scte35Pid), + "smpte2038_data_preference": string(in.Smpte2038DataPreference), + "source_end_behavior": string(in.SourceEndBehavior), } return []interface{}{m} @@ -1114,6 +1228,54 @@ func flattenInputAttachmentsInputSettingsAudioSelectors(tfList []types.AudioSele return out } +func flattenInputAttachmentsInputSettingsCaptionSelectors(tfList []types.CaptionSelector) []interface{} { + if len(tfList) == 0 { + return nil + } + + var out []interface{} + + for _, v := range tfList { + m := map[string]interface{}{ + "name": aws.ToString(v.Name), + "language_code": aws.ToString(v.LanguageCode), + } + + out = append(out, m) + } + + return out +} + +func flattenInputAttachmentsInputSettingsNetworkInputSettings(in *types.NetworkInputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "hls_input_settings": flattenNetworkInputSettingsHLSInputSettings(in.HlsInputSettings), + "server_validation": string(in.ServerValidation), + } + + return []interface{}{m} +} + +func flattenNetworkInputSettingsHLSInputSettings(in *types.HlsInputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "bandwidth": int(in.Bandwidth), + "buffer_segments": int(in.BufferSegments), + "retries": int(in.Retries), + "retry_interval": int(in.RetryInterval), + "scte35_source": string(in.Scte35Source), + } + + return []interface{}{m} +} + func expandChannelCdiInputSpecification(tfList []interface{}) *types.CdiInputSpecification { if tfList == nil { return nil diff --git a/internal/service/medialive/channel_encoder_settings_schema.go b/internal/service/medialive/channel_encoder_settings_schema.go index ada7af0d4ad..5b50c3d7985 100644 --- a/internal/service/medialive/channel_encoder_settings_schema.go +++ b/internal/service/medialive/channel_encoder_settings_schema.go @@ -246,6 +246,54 @@ func channelEncoderSettingsSchema() *schema.Schema { }, }, }, + "eac3_atmos_settings": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "bitrate": { + Type: schema.TypeFloat, + Optional: true, + Computed: true, + }, + "coding_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateDiagFunc: enum.Validate[types.Eac3AtmosCodingMode](), + }, + "dialnorm": { + Type: schema.TypeFloat, + Optional: true, + Computed: true, + }, + "drc_line": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateDiagFunc: enum.Validate[types.Eac3AtmosDrcLine](), + }, + "drc_rf": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateDiagFunc: enum.Validate[types.Eac3AtmosDrcRf](), + }, + "height_trim": { + Type: schema.TypeFloat, + Optional: true, + Computed: true, + }, + "surround_trim": { + Type: schema.TypeFloat, + Optional: true, + Computed: true, + }, + }, + }, + }, "eac3_settings": { Type: schema.TypeList, Optional: true, @@ -396,6 +444,15 @@ func channelEncoderSettingsSchema() *schema.Schema { }, }, }, + "pass_through_settings": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, // no exported elements in this list + }, + }, "wav_settings": { Type: schema.TypeList, Optional: true, @@ -822,6 +879,12 @@ func channelEncoderSettingsSchema() *schema.Schema { Computed: true, ValidateDiagFunc: enum.Validate[types.HlsId3SegmentTaggingState](), }, + "iframe_only_playlists": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateDiagFunc: enum.Validate[types.IFrameOnlyPlaylistType](), + }, "incomplete_segment_behavior": { Type: schema.TypeString, Optional: true, @@ -851,7 +914,7 @@ func channelEncoderSettingsSchema() *schema.Schema { Computed: true, ValidateDiagFunc: enum.Validate[types.HlsIvSource](), }, - "keep_segment": { + "keep_segments": { Type: schema.TypeInt, Optional: true, Computed: true, @@ -866,6 +929,31 @@ func channelEncoderSettingsSchema() *schema.Schema { Optional: true, Computed: true, }, + "key_provider_settings": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "static_key_settings": { + Type: schema.TypeList, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "static_key_value": { + Type: schema.TypeString, + Required: true, + }, + "key_provider_server": func() *schema.Schema { + return inputLocationSchema() + }(), + }, + }, + }, + }, + }, + }, "manifest_compression": { Type: schema.TypeString, Optional: true, @@ -889,6 +977,12 @@ func channelEncoderSettingsSchema() *schema.Schema { Computed: true, ValidateDiagFunc: enum.Validate[types.HlsMode](), }, + "output_selection": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateDiagFunc: enum.Validate[types.HlsOutputSelection](), + }, "program_date_time": { Type: schema.TypeString, Optional: true, @@ -928,12 +1022,17 @@ func channelEncoderSettingsSchema() *schema.Schema { Computed: true, ValidateDiagFunc: enum.Validate[types.HlsStreamInfResolution](), }, - "time_metadata_id3_frame": { + "timed_metadata_id3_frame": { Type: schema.TypeString, Optional: true, Computed: true, ValidateDiagFunc: enum.Validate[types.HlsTimedMetadataId3Frame](), }, + "timed_metadata_id3_period": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, "timestamp_delta_milliseconds": { Type: schema.TypeInt, Optional: true, @@ -1247,7 +1346,7 @@ func channelEncoderSettingsSchema() *schema.Schema { }, }, }, - "h_264_settings": { + "h264_settings": { Type: schema.TypeList, Optional: true, MaxItems: 1, @@ -1349,6 +1448,11 @@ func channelEncoderSettingsSchema() *schema.Schema { Optional: true, Computed: true, }, + "framerate_numerator": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + }, "gop_b_reference": { Type: schema.TypeString, Optional: true, @@ -1497,7 +1601,7 @@ func channelEncoderSettingsSchema() *schema.Schema { }, }, }, - // TODO h_265_settings + // TODO h265_settings // TODO mgeg2_settings }, }, @@ -1532,7 +1636,24 @@ func channelEncoderSettingsSchema() *schema.Schema { }, }, }, - // TODO avail_blanking + "avail_blanking": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "avail_blanking_image": func() *schema.Schema { + return inputLocationSchema() + }(), + "state": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + }, + }, // TODO avail_configuration // TODO blackout_slate // TODO caption_descriptions @@ -1609,7 +1730,9 @@ func outputSettingsSchema() *schema.Schema { MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "hls_settings": hlsSettingsSchema(), + "hls_settings": func() *schema.Schema { + return hlsSettingsSchema() + }(), "h265_packaging_type": { Type: schema.TypeString, Optional: true, @@ -1767,29 +1890,9 @@ func hlsSettingsSchema() *schema.Schema { Optional: true, Computed: true, }, - "audio_only_image": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "uri": { - Type: schema.TypeString, - Required: true, - }, - "password_param": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "username": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - }, - }, - }, + "audio_only_image": func() *schema.Schema { + return inputLocationSchema() + }(), "audio_track_type": { Type: schema.TypeString, Optional: true, @@ -2259,7 +2362,7 @@ func expandChannelEncoderSettings(tfList []interface{}) *types.EncoderSettings { settings.VideoDescriptions = expandChannelEncoderSettingsVideoDescriptions(v.List()) } if v, ok := m["avail_blanking"].([]interface{}); ok && len(v) > 0 { - settings.AvailBlanking = nil // TODO expandChannelEncoderSettingsAvailBlanking(v) + settings.AvailBlanking = expandChannelEncoderSettingsAvailBlanking(v) } if v, ok := m["avail_configuration"].([]interface{}); ok && len(v) > 0 { settings.AvailConfiguration = nil // TODO expandChannelEncoderSettingsAvailConfiguration(v) @@ -2318,7 +2421,7 @@ func expandChannelEncoderSettingsAudioDescriptions(tfList []interface{}) []types a.AudioWatermarkingSettings = expandAudioWatermarkSettings(v) } if v, ok := m["codec_settings"].([]interface{}); ok && len(v) > 0 { - a.CodecSettings = nil // TODO expandChannelEncoderSettingsAudioDescriptionsCodecSettings(v) + a.CodecSettings = expandChannelEncoderSettingsAudioDescriptionsCodecSettings(v) } if v, ok := m["language_code"].(string); ok && v != "" { a.LanguageCode = aws.String(v) @@ -2327,7 +2430,7 @@ func expandChannelEncoderSettingsAudioDescriptions(tfList []interface{}) []types a.LanguageCodeControl = types.AudioDescriptionLanguageCodeControl(v) } if v, ok := m["remix_settings"].([]interface{}); ok && len(v) > 0 { - a.RemixSettings = nil // TODO expandChannelEncoderSettingsAudioDescriptionsRemixSettings(v) + a.RemixSettings = expandChannelEncoderSettingsAudioDescriptionsRemixSettings(v) } if v, ok := m["stream_name"].(string); ok && v != "" { a.StreamName = aws.String(v) @@ -2389,1045 +2492,2733 @@ func expandAudioDescriptionsAudioNormalizationSettings(tfList []interface{}) *ty return &out } -func expandChannelEncoderSettingsOutputGroupsOutputGroupSettings(tfList []interface{}) *types.OutputGroupSettings { - if tfList == nil { +func expandChannelEncoderSettingsAudioDescriptionsCodecSettings(tfList []interface{}) *types.AudioCodecSettings { + if len(tfList) == 0 { return nil } m := tfList[0].(map[string]interface{}) - var o types.OutputGroupSettings - - if v, ok := m["archive_group_settings"].([]interface{}); ok && len(v) > 0 { - o.ArchiveGroupSettings = expandArchiveGroupSettings(v) + var out types.AudioCodecSettings + if v, ok := m["aac_settings"].([]interface{}); ok && len(v) > 0 { + out.AacSettings = expandAudioDescriptionsCodecSettingsAacSettings(v) } - if v, ok := m["media_package_group_settings"].([]interface{}); ok && len(v) > 0 { - o.MediaPackageGroupSettings = expandMediaPackageGroupSettings(v) + if v, ok := m["ac3_settings"].([]interface{}); ok && len(v) > 0 { + out.Ac3Settings = expandAudioDescriptionsCodecSettingsAc3Settings(v) } - if v, ok := m["multiplex_group_settings"].([]interface{}); ok && len(v) > 0 { - o.MultiplexGroupSettings = &types.MultiplexGroupSettings{} // only unexported fields + if v, ok := m["eac3_atmos_settings"].([]interface{}); ok && len(v) > 0 { + out.Eac3AtmosSettings = expandAudioDescriptionsCodecSettingsEac3AtmosSettings(v) } - if v, ok := m["rtmp_group_settings"].([]interface{}); ok && len(v) > 0 { - o.RtmpGroupSettings = expandRtmpGroupSettings(v) + if v, ok := m["eac3_settings"].([]interface{}); ok && len(v) > 0 { + out.Eac3Settings = expandAudioDescriptionsCodecSettingsEac3Settings(v) } - if v, ok := m["udp_group_settings"].([]interface{}); ok && len(v) > 0 { - o.UdpGroupSettings = expandUdpGroupSettings(v) + if v, ok := m["vp2_settings"].([]interface{}); ok && len(v) > 0 { + out.Mp2Settings = expandAudioDescriptionsCodecSettingsMp2Settings(v) + } + if v, ok := m["pass_through_settings"].([]interface{}); ok && len(v) > 0 { + out.PassThroughSettings = &types.PassThroughSettings{} // no exported fields + } + if v, ok := m["wav_settings"].([]interface{}); ok && len(v) > 0 { + out.WavSettings = expandAudioDescriptionsCodecSettingsWavSettings(v) } - // TODO implement rest of output group settings - return &o + return &out } -func expandDestination(in []interface{}) *types.OutputLocationRef { - if len(in) == 0 { +func expandAudioDescriptionsCodecSettingsAacSettings(tfList []interface{}) *types.AacSettings { + if len(tfList) == 0 { return nil } - m := in[0].(map[string]interface{}) + m := tfList[0].(map[string]interface{}) - var out types.OutputLocationRef - if v, ok := m["destination_ref_id"].(string); ok && v != "" { - out.DestinationRefId = aws.String(v) + var out types.AacSettings + if v, ok := m["bitrate"].(float32); ok { + out.Bitrate = float64(v) + } + if v, ok := m["coding_mode"].(string); ok && v != "" { + out.CodingMode = types.AacCodingMode(v) + } + if v, ok := m["input_type"].(string); ok && v != "" { + out.InputType = types.AacInputType(v) + } + if v, ok := m["profile"].(string); ok && v != "" { + out.Profile = types.AacProfile(v) + } + if v, ok := m["rate_control_mode"].(string); ok && v != "" { + out.RateControlMode = types.AacRateControlMode(v) + } + if v, ok := m["raw_format"].(string); ok && v != "" { + out.RawFormat = types.AacRawFormat(v) + } + if v, ok := m["sample_rate"].(float32); ok { + out.SampleRate = float64(v) + } + if v, ok := m["spec"].(string); ok && v != "" { + out.Spec = types.AacSpec(v) + } + if v, ok := m["vbr_quality"].(string); ok && v != "" { + out.VbrQuality = types.AacVbrQuality(v) } return &out } -func expandMediaPackageGroupSettings(tfList []interface{}) *types.MediaPackageGroupSettings { - if tfList == nil { +func expandAudioDescriptionsCodecSettingsAc3Settings(tfList []interface{}) *types.Ac3Settings { + if len(tfList) == 0 { return nil } m := tfList[0].(map[string]interface{}) - var o types.MediaPackageGroupSettings - - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { - o.Destination = expandDestination(v) + var out types.Ac3Settings + if v, ok := m["bitrate"].(float32); ok { + out.Bitrate = float64(v) + } + if v, ok := m["bitstream_mode"].(string); ok && v != "" { + out.BitstreamMode = types.Ac3BitstreamMode(v) + } + if v, ok := m["coding_mode"].(string); ok && v != "" { + out.CodingMode = types.Ac3CodingMode(v) + } + if v, ok := m["dialnorm"].(int); ok { + out.Dialnorm = int32(v) + } + if v, ok := m["drc_profile"].(string); ok && v != "" { + out.DrcProfile = types.Ac3DrcProfile(v) + } + if v, ok := m["lfe_filter"].(string); ok && v != "" { + out.LfeFilter = types.Ac3LfeFilter(v) + } + if v, ok := m["metadata_control"].(string); ok && v != "" { + out.MetadataControl = types.Ac3MetadataControl(v) } - return &o + return &out } -func expandArchiveGroupSettings(tfList []interface{}) *types.ArchiveGroupSettings { - if tfList == nil { +func expandAudioDescriptionsCodecSettingsEac3AtmosSettings(tfList []interface{}) *types.Eac3AtmosSettings { + if len(tfList) == 0 { return nil } m := tfList[0].(map[string]interface{}) - var o types.ArchiveGroupSettings - - if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { - o.Destination = expandDestination(v) + var out types.Eac3AtmosSettings + if v, ok := m["bitrate"].(float32); ok { + out.Bitrate = float64(v) } - if v, ok := m["archive_cdn_settings"].([]interface{}); ok && len(v) > 0 { - o.ArchiveCdnSettings = expandArchiveCDNSettings(v) + if v, ok := m["coding_mode"].(string); ok && v != "" { + out.CodingMode = types.Eac3AtmosCodingMode(v) } - if v, ok := m["rollover_interval"].(int); ok { - o.RolloverInterval = int32(v) + if v, ok := m["dialnorm"].(int); ok { + out.Dialnorm = int32(v) + } + if v, ok := m["drc_line"].(string); ok && v != "" { + out.DrcLine = types.Eac3AtmosDrcLine(v) + } + if v, ok := m["drc_rf"].(string); ok && v != "" { + out.DrcRf = types.Eac3AtmosDrcRf(v) + } + if v, ok := m["height_trim"].(float32); ok { + out.HeightTrim = float64(v) + } + if v, ok := m["surround_trim"].(float32); ok { + out.SurroundTrim = float64(v) } - return &o + return &out } -func expandArchiveCDNSettings(tfList []interface{}) *types.ArchiveCdnSettings { +func expandAudioDescriptionsCodecSettingsEac3Settings(tfList []interface{}) *types.Eac3Settings { if len(tfList) == 0 { return nil } m := tfList[0].(map[string]interface{}) - var out types.ArchiveCdnSettings - if v, ok := m["archive_s3_settings"].([]interface{}); ok && len(v) > 0 { - out.ArchiveS3Settings = func(in []interface{}) *types.ArchiveS3Settings { - if len(in) == 0 { - return nil - } - - m := in[0].(map[string]interface{}) - - var o types.ArchiveS3Settings - if v, ok := m["canned_acl"].(string); ok && v != "" { - o.CannedAcl = types.S3CannedAcl(v) - } - - return &o - }(v) + var out types.Eac3Settings + if v, ok := m["attenuation_control"].(string); ok && v != "" { + out.AttenuationControl = types.Eac3AttenuationControl(v) + } + if v, ok := m["bitrate"].(float32); ok { + out.Bitrate = float64(v) + } + if v, ok := m["bitstream_mode"].(string); ok && v != "" { + out.BitstreamMode = types.Eac3BitstreamMode(v) + } + if v, ok := m["coding_mode"].(string); ok && v != "" { + out.CodingMode = types.Eac3CodingMode(v) + } + if v, ok := m["dc_filter"].(string); ok && v != "" { + out.DcFilter = types.Eac3DcFilter(v) + } + if v, ok := m["dialnorm"].(int); ok { + out.Dialnorm = int32(v) + } + if v, ok := m["drc_line"].(string); ok && v != "" { + out.DrcLine = types.Eac3DrcLine(v) + } + if v, ok := m["drc_rf"].(string); ok && v != "" { + out.DrcRf = types.Eac3DrcRf(v) + } + if v, ok := m["lfe_control"].(string); ok && v != "" { + out.LfeControl = types.Eac3LfeControl(v) + } + if v, ok := m["lfe_filter"].(string); ok && v != "" { + out.LfeFilter = types.Eac3LfeFilter(v) + } + if v, ok := m["lo_ro_center_mix_level"].(float32); ok { + out.LoRoCenterMixLevel = float64(v) + } + if v, ok := m["lo_ro_surround_mix_level"].(float32); ok { + out.LoRoSurroundMixLevel = float64(v) + } + if v, ok := m["lt_rt_center_mix_level"].(float32); ok { + out.LtRtCenterMixLevel = float64(v) + } + if v, ok := m["lt_rt_surround_mix_level"].(float32); ok { + out.LtRtSurroundMixLevel = float64(v) + } + if v, ok := m["metadata_control"].(string); ok && v != "" { + out.MetadataControl = types.Eac3MetadataControl(v) + } + if v, ok := m["phase_control"].(string); ok && v != "" { + out.PhaseControl = types.Eac3PhaseControl(v) + } + if v, ok := m["stereo_downmix"].(string); ok && v != "" { + out.StereoDownmix = types.Eac3StereoDownmix(v) + } + if v, ok := m["surround_ex_mode"].(string); ok && v != "" { + out.SurroundExMode = types.Eac3SurroundExMode(v) + } + if v, ok := m["surround_mode"].(string); ok && v != "" { + out.SurroundMode = types.Eac3SurroundMode(v) } return &out } -func expandAudioWatermarkSettings(tfList []interface{}) *types.AudioWatermarkSettings { +func expandAudioDescriptionsCodecSettingsMp2Settings(tfList []interface{}) *types.Mp2Settings { if len(tfList) == 0 { return nil } m := tfList[0].(map[string]interface{}) - var o types.AudioWatermarkSettings - if v, ok := m["nielsen_watermark_settings"].([]interface{}); ok && len(v) > 0 { - o.NielsenWatermarksSettings = func(n []interface{}) *types.NielsenWatermarksSettings { - if len(n) == 0 { - return nil - } - - inner := n[0].(map[string]interface{}) - - var ns types.NielsenWatermarksSettings - if v, ok := inner["nielsen_distribution_type"].(string); ok && v != "" { - ns.NielsenDistributionType = types.NielsenWatermarksDistributionTypes(v) - } - if v, ok := inner["nielsen_cbet_settings"].([]interface{}); ok && len(v) > 0 { - ns.NielsenCbetSettings = expandNielsenCbetSettings(v) - } - if v, ok := inner["nielsen_naes_ii_nw_settings"].([]interface{}); ok && len(v) > 0 { - ns.NielsenNaesIiNwSettings = expandNielsenNaseIiNwSettings(v) - } - - return &ns - }(v) + var out types.Mp2Settings + if v, ok := m["bitrate"].(float32); ok { + out.Bitrate = float64(v) + } + if v, ok := m["coding_mode"].(string); ok && v != "" { + out.CodingMode = types.Mp2CodingMode(v) + } + if v, ok := m["sample_rate"].(float32); ok { + out.Bitrate = float64(v) } - return &o + return &out } -func expandRtmpGroupSettings(tfList []interface{}) *types.RtmpGroupSettings { +func expandAudioDescriptionsCodecSettingsWavSettings(tfList []interface{}) *types.WavSettings { if len(tfList) == 0 { return nil } m := tfList[0].(map[string]interface{}) - var out types.RtmpGroupSettings - if v, ok := m["ad_markers"].([]interface{}); ok && len(v) > 0 { - out.AdMarkers = expandAdMarkers(v) + var out types.WavSettings + if v, ok := m["bit_depth"].(float32); ok { + out.BitDepth = float64(v) } - if v, ok := m["authentication_scheme"].(string); ok && v != "" { - out.AuthenticationScheme = types.AuthenticationScheme(v) + if v, ok := m["coding_mode"].(string); ok && v != "" { + out.CodingMode = types.WavCodingMode(v) } - if v, ok := m["cache_full_behavior"].(string); ok && v != "" { - out.CacheFullBehavior = types.RtmpCacheFullBehavior(v) - } - if v, ok := m["cache_length"].(int); ok { - out.CacheLength = int32(v) - } - if v, ok := m["caption_data"].(string); ok && v != "" { - out.CaptionData = types.RtmpCaptionData(v) - } - if v, ok := m["input_loss_action"].(string); ok && v != "" { - out.InputLossAction = types.InputLossActionForRtmpOut(v) - } - if v, ok := m["restart_delay"].(int); ok { - out.RestartDelay = int32(v) + if v, ok := m["sample_rate"].(float32); ok { + out.SampleRate = float64(v) } return &out } -func expandUdpGroupSettings(tfList []interface{}) *types.UdpGroupSettings { +func expandChannelEncoderSettingsAudioDescriptionsRemixSettings(tfList []interface{}) *types.RemixSettings { if len(tfList) == 0 { return nil } m := tfList[0].(map[string]interface{}) - var out types.UdpGroupSettings - if v, ok := m["input_loss_action"].(string); ok && v != "" { - out.InputLossAction = types.InputLossActionForUdpOut(v) + var out types.RemixSettings + if v, ok := m["channel_mappings"].(*schema.Set); ok && v.Len() > 0 { + out.ChannelMappings = expandChannelMappings(v.List()) } - if v, ok := m["timed_metadata_id3_frame"].(string); ok && v != "" { - out.TimedMetadataId3Frame = types.UdpTimedMetadataId3Frame(v) + if v, ok := m["channels_in"].(int); ok { + out.ChannelsIn = int32(v) } - if v, ok := m["timed_metadata_id3_period"].(int); ok { - out.TimedMetadataId3Period = int32(v) + if v, ok := m["channels_out"].(int); ok { + out.ChannelsOut = int32(v) } return &out } -func expandAdMarkers(tfList []interface{}) []types.RtmpAdMarkers { +func expandChannelMappings(tfList []interface{}) []types.AudioChannelMapping { if len(tfList) == 0 { return nil } - var out []types.RtmpAdMarkers - for _, v := range tfList { - out = append(out, types.RtmpAdMarkers(v.(string))) + var out []types.AudioChannelMapping + for _, item := range tfList { + m, ok := item.(map[string]interface{}) + if !ok { + continue + } + + var o types.AudioChannelMapping + if v, ok := m["input_channel_levels"].(*schema.Set); ok && v.Len() > 0 { + o.InputChannelLevels = expandInputChannelLevels(v.List()) + } + if v, ok := m["output_channel"].(int); ok { + o.OutputChannel = int32(v) + } + + out = append(out, o) } return out } -func expandChannelEncoderSettingsOutputGroupsOutputs(tfList []interface{}) []types.Output { - if tfList == nil { +func expandInputChannelLevels(tfList []interface{}) []types.InputChannelLevel { + if len(tfList) == 0 { return nil } - var outputs []types.Output + var out []types.InputChannelLevel for _, item := range tfList { m, ok := item.(map[string]interface{}) if !ok { continue } - var o types.Output - if v, ok := m["output_settings"].([]interface{}); ok && len(v) > 0 { - o.OutputSettings = expandOutputsOutputSettings(v) - } - if v, ok := m["audio_description_names"].(*schema.Set); ok && v.Len() > 0 { - o.AudioDescriptionNames = flex.ExpandStringValueSet(v) + var o types.InputChannelLevel + if v, ok := m["gain"].(int); ok { + o.Gain = int32(v) } - if v, ok := m["caption_description_names"].(*schema.Set); ok && v.Len() > 0 { - o.CaptionDescriptionNames = flex.ExpandStringValueSet(v) - } - if v, ok := m["output_name"].(string); ok && v != "" { - o.OutputName = aws.String(v) - } - if v, ok := m["video_description_name"].(string); ok && v != "" { - o.VideoDescriptionName = aws.String(v) + if v, ok := m["input_channel"].(int); ok { + o.InputChannel = int32(v) } - outputs = append(outputs, o) + + out = append(out, o) } - return outputs + return out } -func expandOutputsOutputSettings(tfList []interface{}) *types.OutputSettings { +func expandChannelEncoderSettingsOutputGroupsOutputGroupSettings(tfList []interface{}) *types.OutputGroupSettings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var os types.OutputSettings - if v, ok := m["archive_output_settings"].([]interface{}); ok && len(v) > 0 { - os.ArchiveOutputSettings = expandOutputsOutputSettingsArchiveOutputSettings(v) + var o types.OutputGroupSettings + + if v, ok := m["archive_group_settings"].([]interface{}); ok && len(v) > 0 { + o.ArchiveGroupSettings = expandArchiveGroupSettings(v) } - if v, ok := m["media_package_output_settings"].([]interface{}); ok && len(v) > 0 { - os.MediaPackageOutputSettings = &types.MediaPackageOutputSettings{} // no exported fields + if v, ok := m["frame_capture_group_settings"].([]interface{}); ok && len(v) > 0 { + o.FrameCaptureGroupSettings = expandFrameCaptureGroupSettings(v) } - if v, ok := m["multiplex_output_settings"].([]interface{}); ok && len(v) > 0 { - os.MultiplexOutputSettings = func(inner []interface{}) *types.MultiplexOutputSettings { - if len(inner) == 0 { - return nil - } - - data := inner[0].(map[string]interface{}) - var mos types.MultiplexOutputSettings - if v, ok := data["destination"].([]interface{}); ok && len(v) > 0 { - mos.Destination = expandDestination(v) - } - return &mos - }(v) + if v, ok := m["hls_group_settings"].([]interface{}); ok && len(v) > 0 { + o.HlsGroupSettings = expandHLSGroupSettings(v) } - - if v, ok := m["rtmp_output_settings"].([]interface{}); ok && len(v) > 0 { - os.RtmpOutputSettings = expandOutputsOutputSettingsRtmpOutputSettings(v) + if v, ok := m["ms_smooth_group_settings"].([]interface{}); ok && len(v) > 0 { + o.MsSmoothGroupSettings = expandMsSmoothGroupSettings(v) } - if v, ok := m["udp_output_settings"].([]interface{}); ok && len(v) > 0 { - os.UdpOutputSettings = expandOutputsOutputSettingsUdpOutputSettings(v) + if v, ok := m["media_package_group_settings"].([]interface{}); ok && len(v) > 0 { + o.MediaPackageGroupSettings = expandMediaPackageGroupSettings(v) + } + if v, ok := m["multiplex_group_settings"].([]interface{}); ok && len(v) > 0 { + o.MultiplexGroupSettings = &types.MultiplexGroupSettings{} // only unexported fields + } + if v, ok := m["rtmp_group_settings"].([]interface{}); ok && len(v) > 0 { + o.RtmpGroupSettings = expandRtmpGroupSettings(v) + } + if v, ok := m["udp_group_settings"].([]interface{}); ok && len(v) > 0 { + o.UdpGroupSettings = expandUdpGroupSettings(v) } - return &os + return &o } -func expandOutputsOutputSettingsArchiveOutputSettings(tfList []interface{}) *types.ArchiveOutputSettings { - if tfList == nil { +func expandDestination(in []interface{}) *types.OutputLocationRef { + if len(in) == 0 { return nil } - m := tfList[0].(map[string]interface{}) + m := in[0].(map[string]interface{}) - var settings types.ArchiveOutputSettings - if v, ok := m["container_settings"].([]interface{}); ok && len(v) > 0 { - settings.ContainerSettings = expandOutputsOutputSettingsArchiveSettingsContainerSettings(v) - } - if v, ok := m["extension"].(string); ok && v != "" { - settings.Extension = aws.String(v) - } - if v, ok := m["name_modifier"].(string); ok && v != "" { - settings.NameModifier = aws.String(v) + var out types.OutputLocationRef + if v, ok := m["destination_ref_id"].(string); ok && v != "" { + out.DestinationRefId = aws.String(v) } - return &settings + + return &out } -func expandOutputsOutputSettingsRtmpOutputSettings(tfList []interface{}) *types.RtmpOutputSettings { +func expandMediaPackageGroupSettings(tfList []interface{}) *types.MediaPackageGroupSettings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var settings types.RtmpOutputSettings + var o types.MediaPackageGroupSettings + if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { - settings.Destination = expandDestination(v) - } - if v, ok := m["certificate_mode"].(string); ok && v != "" { - settings.CertificateMode = types.RtmpOutputCertificateMode(v) - } - if v, ok := m["connection_retry_interval"].(int); ok { - settings.ConnectionRetryInterval = int32(v) - } - if v, ok := m["num_retries"].(int); ok { - settings.NumRetries = int32(v) + o.Destination = expandDestination(v) } - return &settings + return &o } -func expandOutputsOutputSettingsUdpOutputSettings(tfList []interface{}) *types.UdpOutputSettings { +func expandArchiveGroupSettings(tfList []interface{}) *types.ArchiveGroupSettings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var settings types.UdpOutputSettings - if v, ok := m["container_settings"].([]interface{}); ok && len(v) > 0 { - settings.ContainerSettings = expandOutputsOutputSettingsUdpSettingsContainerSettings(v) - } + var o types.ArchiveGroupSettings + if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { - settings.Destination = expandDestination(v) + o.Destination = expandDestination(v) } - if v, ok := m["buffer_msec"].(int); ok { - settings.BufferMsec = int32(v) + if v, ok := m["archive_cdn_settings"].([]interface{}); ok && len(v) > 0 { + o.ArchiveCdnSettings = expandArchiveCDNSettings(v) } - if v, ok := m["fec_output_settings"].([]interface{}); ok && len(v) > 0 { - settings.FecOutputSettings = expandFecOutputSettings(v) + if v, ok := m["rollover_interval"].(int); ok { + o.RolloverInterval = int32(v) } - return &settings + return &o } -func expandOutputsOutputSettingsArchiveSettingsContainerSettings(tfList []interface{}) *types.ArchiveContainerSettings { +func expandFrameCaptureGroupSettings(tfList []interface{}) *types.FrameCaptureGroupSettings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var settings types.ArchiveContainerSettings - if v, ok := m["m2ts_settings"].([]interface{}); ok && len(v) > 0 { - settings.M2tsSettings = expandM2tsSettings(v) + var out types.FrameCaptureGroupSettings + if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + out.Destination = expandDestination(v) } - - if v, ok := m["raw_settings"].([]interface{}); ok && len(v) > 0 { - settings.RawSettings = &types.RawSettings{} + if v, ok := m["frame_capture_cdn_settings"].([]interface{}); ok && len(v) > 0 { + out.FrameCaptureCdnSettings = expandFrameCaptureCDNSettings(v) } - return &settings + return &out } -func expandOutputsOutputSettingsUdpSettingsContainerSettings(tfList []interface{}) *types.UdpContainerSettings { +func expandFrameCaptureCDNSettings(tfList []interface{}) *types.FrameCaptureCdnSettings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var settings types.UdpContainerSettings - if v, ok := m["m2ts_settings"].([]interface{}); ok && len(v) > 0 { - settings.M2tsSettings = expandM2tsSettings(v) + var out types.FrameCaptureCdnSettings + if v, ok := m["frame_capture_s3_settings"].([]interface{}); ok && len(v) > 0 { + out.FrameCaptureS3Settings = expandFrameCaptureS3Settings(v) } - return &settings + return &out } -func expandFecOutputSettings(tfList []interface{}) *types.FecOutputSettings { +func expandFrameCaptureS3Settings(tfList []interface{}) *types.FrameCaptureS3Settings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var settings types.FecOutputSettings - if v, ok := m["column_depth"].(int); ok { - settings.ColumnDepth = int32(v) - } - if v, ok := m["column_depth"].(string); ok && v != "" { - settings.IncludeFec = types.FecOutputIncludeFec(v) - } - if v, ok := m["row_length"].(int); ok { - settings.RowLength = int32(v) + var out types.FrameCaptureS3Settings + if v, ok := m["canned_acl"].(string); ok && v != "" { + out.CannedAcl = types.S3CannedAcl(v) } - return &settings + return &out } -func expandM2tsSettings(tfList []interface{}) *types.M2tsSettings { +func expandHLSGroupSettings(tfList []interface{}) *types.HlsGroupSettings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var s types.M2tsSettings - if v, ok := m["absent_input_audio_behavior"].(string); ok && v != "" { - s.AbsentInputAudioBehavior = types.M2tsAbsentInputAudioBehavior(v) + var out types.HlsGroupSettings + if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + out.Destination = expandDestination(v) } - if v, ok := m["arib"].(string); ok && v != "" { - s.Arib = types.M2tsArib(v) + if v, ok := m["ad_markers"].([]interface{}); ok && len(v) > 0 { + out.AdMarkers = expandHLSAdMarkers(v) } - if v, ok := m["arib_caption_pid"].(string); ok && v != "" { - s.AribCaptionsPid = aws.String(v) + if v, ok := m["base_url_content"].(string); ok && v != "" { + out.BaseUrlContent = aws.String(v) } - if v, ok := m["arib_caption_pid_control"].(string); ok && v != "" { - s.AribCaptionsPidControl = types.M2tsAribCaptionsPidControl(v) + if v, ok := m["base_url_content1"].(string); ok && v != "" { + out.BaseUrlContent1 = aws.String(v) } - if v, ok := m["audio_buffer_model"].(string); ok && v != "" { - s.AudioBufferModel = types.M2tsAudioBufferModel(v) + if v, ok := m["base_url_manifest"].(string); ok && v != "" { + out.BaseUrlManifest = aws.String(v) } - if v, ok := m["audio_frames_per_pes"].(int); ok { - s.AudioFramesPerPes = int32(v) + if v, ok := m["base_url_manifest1"].(string); ok && v != "" { + out.BaseUrlManifest1 = aws.String(v) } - if v, ok := m["audi_pids"].(string); ok && v != "" { - s.AudioPids = aws.String(v) + if v, ok := m["caption_language_mappings"].(*schema.Set); ok && v.Len() > 0 { + out.CaptionLanguageMappings = expandHSLGroupSettingsCaptionLanguageMappings(v.List()) } - if v, ok := m["audio_stream_type"].(string); ok && v != "" { - s.AudioStreamType = types.M2tsAudioStreamType(v) + if v, ok := m["caption_language_setting"].(string); ok && v != "" { + out.CaptionLanguageSetting = types.HlsCaptionLanguageSetting(v) } - if v, ok := m["bitrate"].(int); ok { - s.Bitrate = int32(v) + if v, ok := m["codec_specification"].(string); ok && v != "" { + out.CodecSpecification = types.HlsCodecSpecification(v) } - if v, ok := m["buffer_model"].(string); ok && v != "" { - s.BufferModel = types.M2tsBufferModel(v) + if v, ok := m["constant_iv"].(string); ok && v != "" { + out.ConstantIv = aws.String(v) } - if v, ok := m["cc_descriptor"].(string); ok && v != "" { - s.CcDescriptor = types.M2tsCcDescriptor(v) + if v, ok := m["directory_structure"].(string); ok && v != "" { + out.DirectoryStructure = types.HlsDirectoryStructure(v) } - if v, ok := m["dvb_nit_settings"].([]interface{}); ok && len(v) > 0 { - s.DvbNitSettings = expandM2tsDvbNitSettings(v) + if v, ok := m["discontinuity_tags"].(string); ok && v != "" { + out.DiscontinuityTags = types.HlsDiscontinuityTags(v) } - if v, ok := m["dvb_sdt_settings"].([]interface{}); ok && len(v) > 0 { - s.DvbSdtSettings = expandM2tsDvbSdtSettings(v) + if v, ok := m["encryption_type"].(string); ok && v != "" { + out.EncryptionType = types.HlsEncryptionType(v) } - if v, ok := m["dvb_sub_pids"].(string); ok && v != "" { - s.AudioPids = aws.String(v) + if v, ok := m["hls_cdn_setting"].([]interface{}); ok && len(v) > 0 { + out.HlsCdnSettings = expandHLSCDNSettings(v) } - if v, ok := m["dvb_tdt_settings"].([]interface{}); ok && len(v) > 0 { - s.DvbTdtSettings = func(tfList []interface{}) *types.DvbTdtSettings { - if tfList == nil { - return nil - } - - m := tfList[0].(map[string]interface{}) - - var s types.DvbTdtSettings - if v, ok := m["rep_interval"].(int); ok { - s.RepInterval = int32(v) - } - return &s - }(v) + if v, ok := m["hls_id3_segment_tagging"].(string); ok && v != "" { + out.HlsId3SegmentTagging = types.HlsId3SegmentTaggingState(v) } - if v, ok := m["dvb_teletext_pid"].(string); ok && v != "" { - s.DvbTeletextPid = aws.String(v) + if v, ok := m["iframe_only_playlists"].(string); ok && v != "" { + out.IFrameOnlyPlaylists = types.IFrameOnlyPlaylistType(v) } - if v, ok := m["ebif"].(string); ok && v != "" { - s.Ebif = types.M2tsEbifControl(v) + if v, ok := m["incomplete_segment_behavior"].(string); ok && v != "" { + out.IncompleteSegmentBehavior = types.HlsIncompleteSegmentBehavior(v) } - if v, ok := m["ebp_audio_interval"].(string); ok && v != "" { - s.EbpAudioInterval = types.M2tsAudioInterval(v) + if v, ok := m["index_n_segments"].(int); ok { + out.IndexNSegments = int32(v) } - if v, ok := m["ebp_lookahead_ms"].(int); ok { - s.EbpLookaheadMs = int32(v) + if v, ok := m["input_loss_action"].(string); ok && v != "" { + out.InputLossAction = types.InputLossActionForHlsOut(v) } - if v, ok := m["ebp_placement"].(string); ok && v != "" { - s.EbpPlacement = types.M2tsEbpPlacement(v) + if v, ok := m["iv_in_manifest"].(string); ok && v != "" { + out.IvInManifest = types.HlsIvInManifest(v) } - if v, ok := m["ecm_pid"].(string); ok && v != "" { - s.EcmPid = aws.String(v) + if v, ok := m["iv_source"].(string); ok && v != "" { + out.IvSource = types.HlsIvSource(v) } - if v, ok := m["es_rate_in_pes"].(string); ok && v != "" { - s.EsRateInPes = types.M2tsEsRateInPes(v) + if v, ok := m["keep_segments"].(int); ok { + out.KeepSegments = int32(v) } - if v, ok := m["etv_platform_pid"].(string); ok && v != "" { - s.EtvPlatformPid = aws.String(v) + if v, ok := m["key_format"].(string); ok && v != "" { + out.KeyFormat = aws.String(v) } - if v, ok := m["etv_signal_pid"].(string); ok && v != "" { - s.EtvSignalPid = aws.String(v) + if v, ok := m["key_format_versions"].(string); ok && v != "" { + out.KeyFormatVersions = aws.String(v) } - if v, ok := m["fragment_time"].(float32); ok { - s.FragmentTime = float64(v) + if v, ok := m["key_provider_settings"].([]interface{}); ok && len(v) > 0 { + out.KeyProviderSettings = expandHLSGroupSettingsKeyProviderSettings(v) } - if v, ok := m["klv"].(string); ok && v != "" { - s.Klv = types.M2tsKlv(v) + if v, ok := m["manifest_compression"].(string); ok && v != "" { + out.ManifestCompression = types.HlsManifestCompression(v) } - if v, ok := m["klv_data_pids"].(string); ok && v != "" { - s.KlvDataPids = aws.String(v) + if v, ok := m["manifest_duration_format"].(string); ok && v != "" { + out.ManifestDurationFormat = types.HlsManifestDurationFormat(v) } - if v, ok := m["nielsen_id3_behavior"].(string); ok && v != "" { - s.NielsenId3Behavior = types.M2tsNielsenId3Behavior(v) + if v, ok := m["min_segment_length"].(int); ok { + out.MinSegmentLength = int32(v) } - if v, ok := m["null_packet_bitrate"].(float32); ok { - s.NullPacketBitrate = float64(v) + if v, ok := m["mode"].(string); ok && v != "" { + out.Mode = types.HlsMode(v) } - if v, ok := m["pat_interval"].(int); ok { - s.PatInterval = int32(v) + if v, ok := m["output_selection"].(string); ok && v != "" { + out.OutputSelection = types.HlsOutputSelection(v) } - if v, ok := m["pcr_control"].(string); ok && v != "" { - s.PcrControl = types.M2tsPcrControl(v) + if v, ok := m["program_date_time"].(string); ok && v != "" { + out.ProgramDateTime = types.HlsProgramDateTime(v) } - if v, ok := m["pcr_period"].(int); ok { - s.PcrPeriod = int32(v) + if v, ok := m["program_date_time_clock"].(string); ok && v != "" { + out.ProgramDateTimeClock = types.HlsProgramDateTimeClock(v) } - if v, ok := m["pcr_pid"].(string); ok && v != "" { - s.PcrPid = aws.String(v) + if v, ok := m["program_date_time_period"].(int); ok { + out.ProgramDateTimePeriod = int32(v) } - if v, ok := m["pmt_interval"].(int); ok { - s.PmtInterval = int32(v) + if v, ok := m["redundant_manifest"].(string); ok && v != "" { + out.RedundantManifest = types.HlsRedundantManifest(v) } - if v, ok := m["pmt_pid"].(string); ok && v != "" { - s.PmtPid = aws.String(v) + if v, ok := m["segment_length"].(int); ok { + out.SegmentLength = int32(v) } - if v, ok := m["rate_mode"].(string); ok && v != "" { - s.RateMode = types.M2tsRateMode(v) + if v, ok := m["segments_per_subdirectory"].(int); ok { + out.SegmentsPerSubdirectory = int32(v) } - if v, ok := m["scte27_pids"].(string); ok && v != "" { - s.Scte27Pids = aws.String(v) + if v, ok := m["stream_inf_resolution"].(string); ok && v != "" { + out.StreamInfResolution = types.HlsStreamInfResolution(v) } - if v, ok := m["scte35_control"].(string); ok && v != "" { - s.Scte35Control = types.M2tsScte35Control(v) + if v, ok := m["timed_metadata_id3_frame"].(string); ok && v != "" { + out.TimedMetadataId3Frame = types.HlsTimedMetadataId3Frame(v) } - if v, ok := m["scte35_pid"].(string); ok && v != "" { - s.Scte35Pid = aws.String(v) + if v, ok := m["timed_metadata_id3_period"].(int); ok { + out.TimedMetadataId3Period = int32(v) } - if v, ok := m["segmentation_markers"].(string); ok && v != "" { - s.SegmentationMarkers = types.M2tsSegmentationMarkers(v) + if v, ok := m["timestamp_delta_milliseconds"].(int); ok { + out.TimestampDeltaMilliseconds = int32(v) } - if v, ok := m["segmentation_style"].(string); ok && v != "" { - s.SegmentationStyle = types.M2tsSegmentationStyle(v) + if v, ok := m["ts_file_mode"].(string); ok && v != "" { + out.TsFileMode = types.HlsTsFileMode(v) } - if v, ok := m["segmentation_time"].(float32); ok { - s.SegmentationTime = float64(v) + + return &out +} + +func expandMsSmoothGroupSettings(tfList []interface{}) *types.MsSmoothGroupSettings { + if tfList == nil { + return nil } - if v, ok := m["timed_metadata_behavior"].(string); ok && v != "" { - s.TimedMetadataBehavior = types.M2tsTimedMetadataBehavior(v) + + m := tfList[0].(map[string]interface{}) + + var out types.MsSmoothGroupSettings + if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + out.Destination = expandDestination(v) } - if v, ok := m["timed_metadata_pid"].(string); ok && v != "" { - s.TimedMetadataPid = aws.String(v) + if v, ok := m["acquisition_point_id"].(string); ok && v != "" { + out.AcquisitionPointId = aws.String(v) } - if v, ok := m["transport_stream_id"].(int); ok { - s.TransportStreamId = int32(v) + if v, ok := m["audio_only_timecode_control"].(string); ok && v != "" { + out.AudioOnlyTimecodeControl = types.SmoothGroupAudioOnlyTimecodeControl(v) } - if v, ok := m["video_pid"].(string); ok && v != "" { - s.TimedMetadataPid = aws.String(v) + if v, ok := m["certificate_mode"].(string); ok && v != "" { + out.CertificateMode = types.SmoothGroupCertificateMode(v) + } + if v, ok := m["connection_retry_interval"].(int); ok { + out.ConnectionRetryInterval = int32(v) + } + if v, ok := m["event_id"].(string); ok && v != "" { + out.EventId = aws.String(v) + } + if v, ok := m["event_id_mode"].(string); ok && v != "" { + out.EventIdMode = types.SmoothGroupEventIdMode(v) + } + if v, ok := m["event_stop_behavior"].(string); ok && v != "" { + out.EventStopBehavior = types.SmoothGroupEventStopBehavior(v) + } + if v, ok := m["filecache_duration"].(int); ok { + out.FilecacheDuration = int32(v) + } + if v, ok := m["fragment_length"].(int); ok { + out.FragmentLength = int32(v) + } + if v, ok := m["input_loss_action"].(string); ok && v != "" { + out.InputLossAction = types.InputLossActionForMsSmoothOut(v) + } + if v, ok := m["num_retries"].(int); ok { + out.NumRetries = int32(v) + } + if v, ok := m["restart_delay"].(int); ok { + out.RestartDelay = int32(v) + } + if v, ok := m["segmentation_mode"].(string); ok && v != "" { + out.SegmentationMode = types.SmoothGroupSegmentationMode(v) + } + if v, ok := m["send_delay_ms"].(int); ok { + out.SendDelayMs = int32(v) + } + if v, ok := m["sparse_track_type"].(string); ok && v != "" { + out.SparseTrackType = types.SmoothGroupSparseTrackType(v) + } + if v, ok := m["stream_manifest_behavior"].(string); ok && v != "" { + out.StreamManifestBehavior = types.SmoothGroupStreamManifestBehavior(v) + } + if v, ok := m["timestamp_offset"].(string); ok && v != "" { + out.TimestampOffset = aws.String(v) + } + if v, ok := m["timestamp_offset_mode"].(string); ok && v != "" { + out.TimestampOffsetMode = types.SmoothGroupTimestampOffsetMode(v) } - return &s + return &out } -func expandM2tsDvbNitSettings(tfList []interface{}) *types.DvbNitSettings { +func expandHLSCDNSettings(tfList []interface{}) *types.HlsCdnSettings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var s types.DvbNitSettings - if v, ok := m["network_ids"].(int); ok { - s.NetworkId = int32(v) + var out types.HlsCdnSettings + if v, ok := m["hls_akamai_setting"].([]interface{}); ok && len(v) > 0 { + out.HlsAkamaiSettings = expandHSLAkamaiSettings(v) } - if v, ok := m["network_name"].(string); ok && v != "" { - s.NetworkName = aws.String(v) + if v, ok := m["hls_basic_put_setting"].([]interface{}); ok && len(v) > 0 { + out.HlsBasicPutSettings = expandHSLBasicPutSettings(v) } - if v, ok := m["network_ids"].(int); ok { - s.RepInterval = int32(v) + if v, ok := m["hls_media_store_setting"].([]interface{}); ok && len(v) > 0 { + out.HlsMediaStoreSettings = expandHLSMediaStoreSettings(v) } - return &s + if v, ok := m["hls_s3_setting"].([]interface{}); ok && len(v) > 0 { + out.HlsS3Settings = expandHSLS3Settings(v) + } + if v, ok := m["hls_webdav_setting"].([]interface{}); ok && len(v) > 0 { + out.HlsWebdavSettings = expandHLSWebdavSettings(v) + } + return &out } -func expandM2tsDvbSdtSettings(tfList []interface{}) *types.DvbSdtSettings { +func expandHSLAkamaiSettings(tfList []interface{}) *types.HlsAkamaiSettings { if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var s types.DvbSdtSettings - if v, ok := m["output_sdt"].(string); ok && v != "" { - s.OutputSdt = types.DvbSdtOutputSdt(v) + var out types.HlsAkamaiSettings + if v, ok := m["connection_retry_interval"].(int); ok { + out.ConnectionRetryInterval = int32(v) } - if v, ok := m["rep_interval"].(int); ok { - s.RepInterval = int32(v) + if v, ok := m["filecache_duration"].(int); ok { + out.FilecacheDuration = int32(v) } - if v, ok := m["service_name"].(string); ok && v != "" { - s.ServiceName = aws.String(v) + if v, ok := m["http_transfer_mode"].(string); ok && v != "" { + out.HttpTransferMode = types.HlsAkamaiHttpTransferMode(v) } - if v, ok := m["service_provider_name"].(string); ok && v != "" { - s.ServiceProviderName = aws.String(v) + if v, ok := m["num_retries"].(int); ok { + out.NumRetries = int32(v) + } + if v, ok := m["restart_delay"].(int); ok { + out.RestartDelay = int32(v) + } + if v, ok := m["salt"].(string); ok && v != "" { + out.Salt = aws.String(v) + } + if v, ok := m["token"].(string); ok && v != "" { + out.Token = aws.String(v) } - return &s + return &out } -func expandChannelEncoderSettingsTimecodeConfig(tfList []interface{}) *types.TimecodeConfig { +func expandHSLBasicPutSettings(tfList []interface{}) *types.HlsBasicPutSettings { if tfList == nil { return nil } + m := tfList[0].(map[string]interface{}) - var config types.TimecodeConfig - if v, ok := m["source"].(string); ok && v != "" { - config.Source = types.TimecodeConfigSource(v) + var out types.HlsBasicPutSettings + if v, ok := m["connection_retry_interval"].(int); ok { + out.ConnectionRetryInterval = int32(v) } - if v, ok := m["sync_threshold"].(int32); ok { - config.SyncThreshold = v + if v, ok := m["filecache_duration"].(int); ok { + out.FilecacheDuration = int32(v) + } + if v, ok := m["num_retries"].(int); ok { + out.NumRetries = int32(v) + } + if v, ok := m["restart_delay"].(int); ok { + out.RestartDelay = int32(v) } - return &config + return &out } -func expandChannelEncoderSettingsVideoDescriptions(tfList []interface{}) []types.VideoDescription { +func expandHLSMediaStoreSettings(tfList []interface{}) *types.HlsMediaStoreSettings { if tfList == nil { return nil } - var videoDesc []types.VideoDescription - for _, tfItem := range tfList { - m, ok := tfItem.(map[string]interface{}) - if !ok { - continue - } - - var d types.VideoDescription - if v, ok := m["name"].(string); ok && v != "" { - d.Name = aws.String(v) - } - if v, ok := m["codec_settings"].([]interface{}); ok && len(v) > 0 { - d.CodecSettings = nil // TODO expandChannelEncoderSettingsVideoDescriptionsCodecSettings(v) - } - if v, ok := m["height"].(int); ok { - d.Height = int32(v) - } - if v, ok := m["respond_to_afd"].(string); ok && v != "" { - d.RespondToAfd = types.VideoDescriptionRespondToAfd(v) - } - if v, ok := m["scaling_behavior"].(string); ok && v != "" { - d.ScalingBehavior = types.VideoDescriptionScalingBehavior(v) - } - if v, ok := m["sharpness"].(int); ok { - d.Sharpness = int32(v) - } - if v, ok := m["width"].(int); ok { - d.Width = int32(v) - } + m := tfList[0].(map[string]interface{}) - videoDesc = append(videoDesc, d) + var out types.HlsMediaStoreSettings + if v, ok := m["connection_retry_interval"].(int); ok { + out.ConnectionRetryInterval = int32(v) + } + if v, ok := m["filecache_duration"].(int); ok { + out.FilecacheDuration = int32(v) + } + if v, ok := m["media_store_storage_class"].(string); ok && v != "" { + out.MediaStoreStorageClass = types.HlsMediaStoreStorageClass(v) + } + if v, ok := m["num_retries"].(int); ok { + out.NumRetries = int32(v) + } + if v, ok := m["restart_delay"].(int); ok { + out.RestartDelay = int32(v) } - return videoDesc + return &out } -func expandNielsenCbetSettings(tfList []interface{}) *types.NielsenCBET { - if len(tfList) == 0 { +func expandHSLS3Settings(tfList []interface{}) *types.HlsS3Settings { + if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var out types.NielsenCBET - if v, ok := m["cbet_check_digit_string"].(string); ok && v != "" { - out.CbetCheckDigitString = aws.String(v) - } - if v, ok := m["cbet_stepaside"].(string); ok && v != "" { - out.CbetStepaside = types.NielsenWatermarksCbetStepaside(v) - } - if v, ok := m["csid"].(string); ok && v != "" { - out.Csid = aws.String(v) + var out types.HlsS3Settings + if v, ok := m["canned_acl"].(string); ok && v != "" { + out.CannedAcl = types.S3CannedAcl(v) } return &out } -func expandNielsenNaseIiNwSettings(tfList []interface{}) *types.NielsenNaesIiNw { - if len(tfList) == 0 { +func expandHLSWebdavSettings(tfList []interface{}) *types.HlsWebdavSettings { + if tfList == nil { return nil } m := tfList[0].(map[string]interface{}) - var out types.NielsenNaesIiNw - if v, ok := m["check_digit_string"].(string); ok && v != "" { - out.CheckDigitString = aws.String(v) + var out types.HlsWebdavSettings + if v, ok := m["connection_retry_interval"].(int); ok { + out.ConnectionRetryInterval = int32(v) } - if v, ok := m["sid"].(float32); ok { - out.Sid = float64(v) + if v, ok := m["filecache_duration"].(int); ok { + out.FilecacheDuration = int32(v) + } + if v, ok := m["http_transfer_mode"].(string); ok && v != "" { + out.HttpTransferMode = types.HlsWebdavHttpTransferMode(v) + } + if v, ok := m["num_retries"].(int); ok { + out.NumRetries = int32(v) + } + if v, ok := m["restart_delay"].(int); ok { + out.RestartDelay = int32(v) } - return &out } -func flattenChannelEncoderSettings(apiObject *types.EncoderSettings) []interface{} { - if apiObject == nil { +func expandHSLGroupSettingsCaptionLanguageMappings(tfList []interface{}) []types.CaptionLanguageMapping { + if tfList == nil { return nil } - m := map[string]interface{}{ - "audio_descriptions": flattenAudioDescriptions(apiObject.AudioDescriptions), - "output_groups": flattenOutputGroups(apiObject.OutputGroups), - "timecode_config": flattenTimecodeConfig(apiObject.TimecodeConfig), - "video_descriptions": flattenVideoDescriptions(apiObject.VideoDescriptions), - // TODO avail_blanking - // TODO avail_configuration - // TODO blackout_slate - // TODO caption_descriptions - // TODO feature_activations - // TODO global_configuration - // TODO motion_graphics_configuration - // TODO nielsen_configuration + var out []types.CaptionLanguageMapping + for _, item := range tfList { + m, ok := item.(map[string]interface{}) + if !ok { + continue + } + + var o types.CaptionLanguageMapping + if v, ok := m["caption_channel"].(int); ok { + o.CaptionChannel = int32(v) + } + if v, ok := m["language_code"].(string); ok && v != "" { + o.LanguageCode = aws.String(v) + } + if v, ok := m["language_description"].(string); ok && v != "" { + o.LanguageDescription = aws.String(v) + } + + out = append(out, o) } - return []interface{}{m} + return out } -func flattenAudioDescriptions(od []types.AudioDescription) []interface{} { - if len(od) == 0 { +func expandHLSGroupSettingsKeyProviderSettings(tfList []interface{}) *types.KeyProviderSettings { + if tfList == nil { return nil } - var ml []interface{} - - for _, v := range od { - m := map[string]interface{}{ - "audio_selector_name": aws.ToString(v.AudioSelectorName), - "name": aws.ToString(v.Name), - "audio_normalization_settings": flattenAudioNormalization(v.AudioNormalizationSettings), - "audio_type": v.AudioType, - "audio_type_control": v.AudioTypeControl, - "audio_watermark_settings": flattenAudioWatermarkSettings(v.AudioWatermarkingSettings), - } + m := tfList[0].(map[string]interface{}) - ml = append(ml, m) + var out types.KeyProviderSettings + if v, ok := m["static_key_settings"].([]interface{}); ok && len(v) > 0 { + out.StaticKeySettings = expandKeyProviderSettingsStaticKeySettings(v) } - return ml + return &out } -func flattenOutputGroups(op []types.OutputGroup) []interface{} { - if len(op) == 0 { +func expandKeyProviderSettingsStaticKeySettings(tfList []interface{}) *types.StaticKeySettings { + if tfList == nil { return nil } - var ol []interface{} - - for _, v := range op { - m := map[string]interface{}{ - "output_group_settings": flattenOutputGroupSettings(v.OutputGroupSettings), - "outputs": flattenOutputs(v.Outputs), - "name": aws.ToString(v.Name), - } + m := tfList[0].(map[string]interface{}) - ol = append(ol, m) + var out types.StaticKeySettings + if v, ok := m["static_key_value"].(string); ok && v != "" { + out.StaticKeyValue = aws.String(v) + } + if v, ok := m["key_provider_server"].([]interface{}); ok && len(v) > 0 { + out.KeyProviderServer = expandInputLocation(v) } - return ol + return &out } -func flattenOutputGroupSettings(os *types.OutputGroupSettings) []interface{} { - if os == nil { +func expandInputLocation(tfList []interface{}) *types.InputLocation { + if tfList == nil { return nil } - m := map[string]interface{}{ - "archive_group_settings": flattenOutputGroupSettingsArchiveGroupSettings(os.ArchiveGroupSettings), - "media_package_group_settings": flattenOutputGroupSettingsMediaPackageGroupSettings(os.MediaPackageGroupSettings), - "multiplex_group_settings": func(inner *types.MultiplexGroupSettings) []interface{} { - if inner == nil { - return nil + m := tfList[0].(map[string]interface{}) + + var out types.InputLocation + if v, ok := m["uri"].(string); ok && v != "" { + out.Uri = aws.String(v) + } + if v, ok := m["password_param"].(string); ok && v != "" { + out.PasswordParam = aws.String(v) + } + if v, ok := m["username"].(string); ok && v != "" { + out.Username = aws.String(v) + } + + return &out +} + +func expandArchiveCDNSettings(tfList []interface{}) *types.ArchiveCdnSettings { + if len(tfList) == 0 { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.ArchiveCdnSettings + if v, ok := m["archive_s3_settings"].([]interface{}); ok && len(v) > 0 { + out.ArchiveS3Settings = func(in []interface{}) *types.ArchiveS3Settings { + if len(in) == 0 { + return nil } - return []interface{}{} // no exported attributes - }(os.MultiplexGroupSettings), - "rtmp_group_settings": flattenOutputGroupSettingsRtmpGroupSettings(os.RtmpGroupSettings), - "udp_group_settings": flattenOutputGroupSettingsUdpGroupSettings(os.UdpGroupSettings), + + m := in[0].(map[string]interface{}) + + var o types.ArchiveS3Settings + if v, ok := m["canned_acl"].(string); ok && v != "" { + o.CannedAcl = types.S3CannedAcl(v) + } + + return &o + }(v) } - return []interface{}{m} + return &out } -func flattenOutputs(os []types.Output) []interface{} { - if len(os) == 0 { +func expandAudioWatermarkSettings(tfList []interface{}) *types.AudioWatermarkSettings { + if len(tfList) == 0 { return nil } - var outputs []interface{} + m := tfList[0].(map[string]interface{}) - for _, item := range os { - m := map[string]interface{}{ - "audio_description_names": flex.FlattenStringValueSet(item.AudioDescriptionNames), - "caption_description_names": flex.FlattenStringValueSet(item.CaptionDescriptionNames), - "output_name": aws.ToString(item.OutputName), - "output_settings": flattenOutputsOutputSettings(item.OutputSettings), - "video_description_name": aws.ToString(item.VideoDescriptionName), + var o types.AudioWatermarkSettings + if v, ok := m["nielsen_watermark_settings"].([]interface{}); ok && len(v) > 0 { + o.NielsenWatermarksSettings = func(n []interface{}) *types.NielsenWatermarksSettings { + if len(n) == 0 { + return nil + } + + inner := n[0].(map[string]interface{}) + + var ns types.NielsenWatermarksSettings + if v, ok := inner["nielsen_distribution_type"].(string); ok && v != "" { + ns.NielsenDistributionType = types.NielsenWatermarksDistributionTypes(v) + } + if v, ok := inner["nielsen_cbet_settings"].([]interface{}); ok && len(v) > 0 { + ns.NielsenCbetSettings = expandNielsenCbetSettings(v) + } + if v, ok := inner["nielsen_naes_ii_nw_settings"].([]interface{}); ok && len(v) > 0 { + ns.NielsenNaesIiNwSettings = expandNielsenNaseIiNwSettings(v) + } + + return &ns + }(v) + } + + return &o +} + +func expandRtmpGroupSettings(tfList []interface{}) *types.RtmpGroupSettings { + if len(tfList) == 0 { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.RtmpGroupSettings + if v, ok := m["ad_markers"].([]interface{}); ok && len(v) > 0 { + out.AdMarkers = expandRTMPAdMarkers(v) + } + if v, ok := m["authentication_scheme"].(string); ok && v != "" { + out.AuthenticationScheme = types.AuthenticationScheme(v) + } + if v, ok := m["cache_full_behavior"].(string); ok && v != "" { + out.CacheFullBehavior = types.RtmpCacheFullBehavior(v) + } + if v, ok := m["cache_length"].(int); ok { + out.CacheLength = int32(v) + } + if v, ok := m["caption_data"].(string); ok && v != "" { + out.CaptionData = types.RtmpCaptionData(v) + } + if v, ok := m["input_loss_action"].(string); ok && v != "" { + out.InputLossAction = types.InputLossActionForRtmpOut(v) + } + if v, ok := m["restart_delay"].(int); ok { + out.RestartDelay = int32(v) + } + + return &out +} + +func expandUdpGroupSettings(tfList []interface{}) *types.UdpGroupSettings { + if len(tfList) == 0 { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.UdpGroupSettings + if v, ok := m["input_loss_action"].(string); ok && v != "" { + out.InputLossAction = types.InputLossActionForUdpOut(v) + } + if v, ok := m["timed_metadata_id3_frame"].(string); ok && v != "" { + out.TimedMetadataId3Frame = types.UdpTimedMetadataId3Frame(v) + } + if v, ok := m["timed_metadata_id3_period"].(int); ok { + out.TimedMetadataId3Period = int32(v) + } + + return &out +} + +func expandRTMPAdMarkers(tfList []interface{}) []types.RtmpAdMarkers { + if len(tfList) == 0 { + return nil + } + + var out []types.RtmpAdMarkers + for _, v := range tfList { + out = append(out, types.RtmpAdMarkers(v.(string))) + } + + return out +} + +func expandHLSAdMarkers(tfList []interface{}) []types.HlsAdMarkers { + if len(tfList) == 0 { + return nil + } + + var out []types.HlsAdMarkers + for _, v := range tfList { + out = append(out, types.HlsAdMarkers(v.(string))) + } + + return out +} + +func expandChannelEncoderSettingsOutputGroupsOutputs(tfList []interface{}) []types.Output { + if tfList == nil { + return nil + } + + var outputs []types.Output + for _, item := range tfList { + m, ok := item.(map[string]interface{}) + if !ok { + continue } - outputs = append(outputs, m) + var o types.Output + if v, ok := m["output_settings"].([]interface{}); ok && len(v) > 0 { + o.OutputSettings = expandOutputsOutputSettings(v) + } + if v, ok := m["audio_description_names"].(*schema.Set); ok && v.Len() > 0 { + o.AudioDescriptionNames = flex.ExpandStringValueSet(v) + } + if v, ok := m["caption_description_names"].(*schema.Set); ok && v.Len() > 0 { + o.CaptionDescriptionNames = flex.ExpandStringValueSet(v) + } + if v, ok := m["output_name"].(string); ok && v != "" { + o.OutputName = aws.String(v) + } + if v, ok := m["video_description_name"].(string); ok && v != "" { + o.VideoDescriptionName = aws.String(v) + } + outputs = append(outputs, o) } return outputs } -func flattenOutputsOutputSettings(in *types.OutputSettings) []interface{} { - if in == nil { +func expandOutputsOutputSettings(tfList []interface{}) *types.OutputSettings { + if tfList == nil { return nil } - m := map[string]interface{}{ - "archive_output_settings": flattenOutputsOutputSettingsArchiveOutputSettings(in.ArchiveOutputSettings), - "media_package_output_settings": func(inner *types.MediaPackageOutputSettings) []interface{} { - if inner == nil { - return nil - } - return []interface{}{} // no exported attributes - }(in.MediaPackageOutputSettings), - "multiplex_output_settings": func(inner *types.MultiplexOutputSettings) []interface{} { - if inner == nil { + m := tfList[0].(map[string]interface{}) + + var os types.OutputSettings + if v, ok := m["archive_output_settings"].([]interface{}); ok && len(v) > 0 { + os.ArchiveOutputSettings = expandOutputsOutputSettingsArchiveOutputSettings(v) + } + if v, ok := m["frame_capture_output_settings"].([]interface{}); ok && len(v) > 0 { + os.FrameCaptureOutputSettings = expandOutputsOutSettingsFrameCaptureOutputSettings(v) + } + if v, ok := m["hls_output_settings"].([]interface{}); ok && len(v) > 0 { + os.HlsOutputSettings = expandOutputsOutSettingsHLSOutputSettings(v) + } + if v, ok := m["media_package_output_settings"].([]interface{}); ok && len(v) > 0 { + os.MediaPackageOutputSettings = &types.MediaPackageOutputSettings{} // no exported fields + } + if v, ok := m["ms_smooth_output_settings"].([]interface{}); ok && len(v) > 0 { + os.MsSmoothOutputSettings = expandOutputsOutSettingsMsSmoothOutputSettings(v) + } + if v, ok := m["multiplex_output_settings"].([]interface{}); ok && len(v) > 0 { + os.MultiplexOutputSettings = func(inner []interface{}) *types.MultiplexOutputSettings { + if len(inner) == 0 { return nil } - data := map[string]interface{}{ - "destination": flattenDestination(inner.Destination), + + data := inner[0].(map[string]interface{}) + var mos types.MultiplexOutputSettings + if v, ok := data["destination"].([]interface{}); ok && len(v) > 0 { + mos.Destination = expandDestination(v) } + return &mos + }(v) + } + + if v, ok := m["rtmp_output_settings"].([]interface{}); ok && len(v) > 0 { + os.RtmpOutputSettings = expandOutputsOutputSettingsRtmpOutputSettings(v) + } + if v, ok := m["udp_output_settings"].([]interface{}); ok && len(v) > 0 { + os.UdpOutputSettings = expandOutputsOutputSettingsUdpOutputSettings(v) + } + + return &os +} + +func expandOutputsOutputSettingsArchiveOutputSettings(tfList []interface{}) *types.ArchiveOutputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var settings types.ArchiveOutputSettings + if v, ok := m["container_settings"].([]interface{}); ok && len(v) > 0 { + settings.ContainerSettings = expandOutputsOutputSettingsArchiveSettingsContainerSettings(v) + } + if v, ok := m["extension"].(string); ok && v != "" { + settings.Extension = aws.String(v) + } + if v, ok := m["name_modifier"].(string); ok && v != "" { + settings.NameModifier = aws.String(v) + } + return &settings +} + +func expandOutputsOutSettingsFrameCaptureOutputSettings(tfList []interface{}) *types.FrameCaptureOutputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.FrameCaptureOutputSettings + if v, ok := m["name_modifier"].(string); ok && v != "" { + out.NameModifier = aws.String(v) + } + + return &out +} + +func expandOutputsOutSettingsHLSOutputSettings(tfList []interface{}) *types.HlsOutputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.HlsOutputSettings + if v, ok := m["hls_settings"].([]interface{}); ok && len(v) > 0 { + out.HlsSettings = expandHLSOutputSettingsHLSSettings(v) + } + if v, ok := m["h265_packaging_type"].(string); ok && v != "" { + out.H265PackagingType = types.HlsH265PackagingType(v) + } + if v, ok := m["name_modifier"].(string); ok && v != "" { + out.NameModifier = aws.String(v) + } + if v, ok := m["segment_modifier"].(string); ok && v != "" { + out.SegmentModifier = aws.String(v) + } + + return &out +} + +func expandOutputsOutSettingsMsSmoothOutputSettings(tfList []interface{}) *types.MsSmoothOutputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.MsSmoothOutputSettings + if v, ok := m["h265_packaging_type"].(string); ok && v != "" { + out.H265PackagingType = types.MsSmoothH265PackagingType(v) + } + if v, ok := m["name_modifier"].(string); ok && v != "" { + out.NameModifier = aws.String(v) + } + + return &out +} + +func expandHLSOutputSettingsHLSSettings(tfList []interface{}) *types.HlsSettings { + if len(tfList) == 0 { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.HlsSettings + if v, ok := m["audio_only_hls_settings"].([]interface{}); ok && len(v) > 0 { + out.AudioOnlyHlsSettings = expandHLSSettingsAudioOnlyHLSSettings(v) + } + if v, ok := m["fmp4_hls_settings"].([]interface{}); ok && len(v) > 0 { + out.Fmp4HlsSettings = expandHLSSettingsFmp4HLSSettings(v) + } + if v, ok := m["frame_capture_hls_settings"].([]interface{}); ok && len(v) > 0 { + out.FrameCaptureHlsSettings = &types.FrameCaptureHlsSettings{} // no exported types + } + if v, ok := m["standard_hls_settings"].([]interface{}); ok && len(v) > 0 { + out.StandardHlsSettings = expandHLSSettingsStandardHLSSettings(v) + } + + return &out +} + +func expandHLSSettingsAudioOnlyHLSSettings(tfList []interface{}) *types.AudioOnlyHlsSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.AudioOnlyHlsSettings + if v, ok := m["audio_group_id"].(string); ok && v != "" { + out.AudioGroupId = aws.String(v) + } + if v, ok := m["audio_only_image"].([]interface{}); ok && len(v) > 0 { + out.AudioOnlyImage = expandInputLocation(v) + } + if v, ok := m["audio_track_type"].(string); ok && v != "" { + out.AudioTrackType = types.AudioOnlyHlsTrackType(v) + } + if v, ok := m["segment_type"].(string); ok && v != "" { + out.SegmentType = types.AudioOnlyHlsSegmentType(v) + } + + return &out +} + +func expandHLSSettingsFmp4HLSSettings(tfList []interface{}) *types.Fmp4HlsSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.Fmp4HlsSettings + if v, ok := m["audio_rendition_sets"].(string); ok && v != "" { + out.AudioRenditionSets = aws.String(v) + } + if v, ok := m["segment_type"].(string); ok && v != "" { + out.NielsenId3Behavior = types.Fmp4NielsenId3Behavior(v) + } + if v, ok := m["timed_metadata_behavior"].(string); ok && v != "" { + out.TimedMetadataBehavior = types.Fmp4TimedMetadataBehavior(v) + } + + return &out +} + +func expandHLSSettingsStandardHLSSettings(tfList []interface{}) *types.StandardHlsSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.StandardHlsSettings + if v, ok := m["m3u8_settings"].([]interface{}); ok && len(v) > 0 { + out.M3u8Settings = expandStandardHLSSettingsH3u8Settings(v) + } + if v, ok := m["audio_rendition_sets"].(string); ok && v != "" { + out.AudioRenditionSets = aws.String(v) + } + + return &out +} + +func expandStandardHLSSettingsH3u8Settings(tfList []interface{}) *types.M3u8Settings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.M3u8Settings + if v, ok := m["audio_frames_per_pes"].(int); ok { + out.AudioFramesPerPes = int32(v) + } + if v, ok := m["audio_pids"].(string); ok && v != "" { + out.AudioPids = aws.String(v) + } + if v, ok := m["ecm_pid"].(string); ok && v != "" { + out.EcmPid = aws.String(v) + } + if v, ok := m["nielsen_id3_behavior"].(string); ok && v != "" { + out.NielsenId3Behavior = types.M3u8NielsenId3Behavior(v) + } + if v, ok := m["pat_interval"].(int); ok { + out.PatInterval = int32(v) + } + if v, ok := m["pcr_control"].(string); ok && v != "" { + out.PcrControl = types.M3u8PcrControl(v) + } + if v, ok := m["pcr_period"].(int); ok { + out.PcrPeriod = int32(v) + } + if v, ok := m["pcr_pid"].(string); ok && v != "" { + out.PcrPid = aws.String(v) + } + if v, ok := m["pmt_interval"].(int); ok { + out.PmtInterval = int32(v) + } + if v, ok := m["pmt_pid"].(string); ok && v != "" { + out.PmtPid = aws.String(v) + } + if v, ok := m["program_num"].(int); ok { + out.ProgramNum = int32(v) + } + if v, ok := m["scte35_behavior"].(string); ok && v != "" { + out.Scte35Behavior = types.M3u8Scte35Behavior(v) + } + if v, ok := m["scte35_pid"].(string); ok && v != "" { + out.Scte35Pid = aws.String(v) + } + if v, ok := m["timed_metadata_behavior"].(string); ok && v != "" { + out.TimedMetadataBehavior = types.M3u8TimedMetadataBehavior(v) + } + if v, ok := m["timed_metadata_pid"].(string); ok && v != "" { + out.TimedMetadataPid = aws.String(v) + } + if v, ok := m["transport_stream_id"].(int); ok { + out.TransportStreamId = int32(v) + } + if v, ok := m["video_pid"].(string); ok && v != "" { + out.VideoPid = aws.String(v) + } + + return &out +} + +func expandOutputsOutputSettingsRtmpOutputSettings(tfList []interface{}) *types.RtmpOutputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var settings types.RtmpOutputSettings + if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + settings.Destination = expandDestination(v) + } + if v, ok := m["certificate_mode"].(string); ok && v != "" { + settings.CertificateMode = types.RtmpOutputCertificateMode(v) + } + if v, ok := m["connection_retry_interval"].(int); ok { + settings.ConnectionRetryInterval = int32(v) + } + if v, ok := m["num_retries"].(int); ok { + settings.NumRetries = int32(v) + } + + return &settings +} + +func expandOutputsOutputSettingsUdpOutputSettings(tfList []interface{}) *types.UdpOutputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var settings types.UdpOutputSettings + if v, ok := m["container_settings"].([]interface{}); ok && len(v) > 0 { + settings.ContainerSettings = expandOutputsOutputSettingsUdpSettingsContainerSettings(v) + } + if v, ok := m["destination"].([]interface{}); ok && len(v) > 0 { + settings.Destination = expandDestination(v) + } + if v, ok := m["buffer_msec"].(int); ok { + settings.BufferMsec = int32(v) + } + if v, ok := m["fec_output_settings"].([]interface{}); ok && len(v) > 0 { + settings.FecOutputSettings = expandFecOutputSettings(v) + } + + return &settings +} + +func expandOutputsOutputSettingsArchiveSettingsContainerSettings(tfList []interface{}) *types.ArchiveContainerSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var settings types.ArchiveContainerSettings + if v, ok := m["m2ts_settings"].([]interface{}); ok && len(v) > 0 { + settings.M2tsSettings = expandM2tsSettings(v) + } + + if v, ok := m["raw_settings"].([]interface{}); ok && len(v) > 0 { + settings.RawSettings = &types.RawSettings{} + } + return &settings +} + +func expandOutputsOutputSettingsUdpSettingsContainerSettings(tfList []interface{}) *types.UdpContainerSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var settings types.UdpContainerSettings + if v, ok := m["m2ts_settings"].([]interface{}); ok && len(v) > 0 { + settings.M2tsSettings = expandM2tsSettings(v) + } + + return &settings +} + +func expandFecOutputSettings(tfList []interface{}) *types.FecOutputSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var settings types.FecOutputSettings + if v, ok := m["column_depth"].(int); ok { + settings.ColumnDepth = int32(v) + } + if v, ok := m["column_depth"].(string); ok && v != "" { + settings.IncludeFec = types.FecOutputIncludeFec(v) + } + if v, ok := m["row_length"].(int); ok { + settings.RowLength = int32(v) + } + + return &settings +} + +func expandM2tsSettings(tfList []interface{}) *types.M2tsSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var s types.M2tsSettings + if v, ok := m["absent_input_audio_behavior"].(string); ok && v != "" { + s.AbsentInputAudioBehavior = types.M2tsAbsentInputAudioBehavior(v) + } + if v, ok := m["arib"].(string); ok && v != "" { + s.Arib = types.M2tsArib(v) + } + if v, ok := m["arib_caption_pid"].(string); ok && v != "" { + s.AribCaptionsPid = aws.String(v) + } + if v, ok := m["arib_caption_pid_control"].(string); ok && v != "" { + s.AribCaptionsPidControl = types.M2tsAribCaptionsPidControl(v) + } + if v, ok := m["audio_buffer_model"].(string); ok && v != "" { + s.AudioBufferModel = types.M2tsAudioBufferModel(v) + } + if v, ok := m["audio_frames_per_pes"].(int); ok { + s.AudioFramesPerPes = int32(v) + } + if v, ok := m["audi_pids"].(string); ok && v != "" { + s.AudioPids = aws.String(v) + } + if v, ok := m["audio_stream_type"].(string); ok && v != "" { + s.AudioStreamType = types.M2tsAudioStreamType(v) + } + if v, ok := m["bitrate"].(int); ok { + s.Bitrate = int32(v) + } + if v, ok := m["buffer_model"].(string); ok && v != "" { + s.BufferModel = types.M2tsBufferModel(v) + } + if v, ok := m["cc_descriptor"].(string); ok && v != "" { + s.CcDescriptor = types.M2tsCcDescriptor(v) + } + if v, ok := m["dvb_nit_settings"].([]interface{}); ok && len(v) > 0 { + s.DvbNitSettings = expandM2tsDvbNitSettings(v) + } + if v, ok := m["dvb_sdt_settings"].([]interface{}); ok && len(v) > 0 { + s.DvbSdtSettings = expandM2tsDvbSdtSettings(v) + } + if v, ok := m["dvb_sub_pids"].(string); ok && v != "" { + s.AudioPids = aws.String(v) + } + if v, ok := m["dvb_tdt_settings"].([]interface{}); ok && len(v) > 0 { + s.DvbTdtSettings = func(tfList []interface{}) *types.DvbTdtSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var s types.DvbTdtSettings + if v, ok := m["rep_interval"].(int); ok { + s.RepInterval = int32(v) + } + return &s + }(v) + } + if v, ok := m["dvb_teletext_pid"].(string); ok && v != "" { + s.DvbTeletextPid = aws.String(v) + } + if v, ok := m["ebif"].(string); ok && v != "" { + s.Ebif = types.M2tsEbifControl(v) + } + if v, ok := m["ebp_audio_interval"].(string); ok && v != "" { + s.EbpAudioInterval = types.M2tsAudioInterval(v) + } + if v, ok := m["ebp_lookahead_ms"].(int); ok { + s.EbpLookaheadMs = int32(v) + } + if v, ok := m["ebp_placement"].(string); ok && v != "" { + s.EbpPlacement = types.M2tsEbpPlacement(v) + } + if v, ok := m["ecm_pid"].(string); ok && v != "" { + s.EcmPid = aws.String(v) + } + if v, ok := m["es_rate_in_pes"].(string); ok && v != "" { + s.EsRateInPes = types.M2tsEsRateInPes(v) + } + if v, ok := m["etv_platform_pid"].(string); ok && v != "" { + s.EtvPlatformPid = aws.String(v) + } + if v, ok := m["etv_signal_pid"].(string); ok && v != "" { + s.EtvSignalPid = aws.String(v) + } + if v, ok := m["fragment_time"].(float32); ok { + s.FragmentTime = float64(v) + } + if v, ok := m["klv"].(string); ok && v != "" { + s.Klv = types.M2tsKlv(v) + } + if v, ok := m["klv_data_pids"].(string); ok && v != "" { + s.KlvDataPids = aws.String(v) + } + if v, ok := m["nielsen_id3_behavior"].(string); ok && v != "" { + s.NielsenId3Behavior = types.M2tsNielsenId3Behavior(v) + } + if v, ok := m["null_packet_bitrate"].(float32); ok { + s.NullPacketBitrate = float64(v) + } + if v, ok := m["pat_interval"].(int); ok { + s.PatInterval = int32(v) + } + if v, ok := m["pcr_control"].(string); ok && v != "" { + s.PcrControl = types.M2tsPcrControl(v) + } + if v, ok := m["pcr_period"].(int); ok { + s.PcrPeriod = int32(v) + } + if v, ok := m["pcr_pid"].(string); ok && v != "" { + s.PcrPid = aws.String(v) + } + if v, ok := m["pmt_interval"].(int); ok { + s.PmtInterval = int32(v) + } + if v, ok := m["pmt_pid"].(string); ok && v != "" { + s.PmtPid = aws.String(v) + } + if v, ok := m["rate_mode"].(string); ok && v != "" { + s.RateMode = types.M2tsRateMode(v) + } + if v, ok := m["scte27_pids"].(string); ok && v != "" { + s.Scte27Pids = aws.String(v) + } + if v, ok := m["scte35_control"].(string); ok && v != "" { + s.Scte35Control = types.M2tsScte35Control(v) + } + if v, ok := m["scte35_pid"].(string); ok && v != "" { + s.Scte35Pid = aws.String(v) + } + if v, ok := m["segmentation_markers"].(string); ok && v != "" { + s.SegmentationMarkers = types.M2tsSegmentationMarkers(v) + } + if v, ok := m["segmentation_style"].(string); ok && v != "" { + s.SegmentationStyle = types.M2tsSegmentationStyle(v) + } + if v, ok := m["segmentation_time"].(float32); ok { + s.SegmentationTime = float64(v) + } + if v, ok := m["timed_metadata_behavior"].(string); ok && v != "" { + s.TimedMetadataBehavior = types.M2tsTimedMetadataBehavior(v) + } + if v, ok := m["timed_metadata_pid"].(string); ok && v != "" { + s.TimedMetadataPid = aws.String(v) + } + if v, ok := m["transport_stream_id"].(int); ok { + s.TransportStreamId = int32(v) + } + if v, ok := m["video_pid"].(string); ok && v != "" { + s.TimedMetadataPid = aws.String(v) + } + + return &s +} + +func expandM2tsDvbNitSettings(tfList []interface{}) *types.DvbNitSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var s types.DvbNitSettings + if v, ok := m["network_ids"].(int); ok { + s.NetworkId = int32(v) + } + if v, ok := m["network_name"].(string); ok && v != "" { + s.NetworkName = aws.String(v) + } + if v, ok := m["network_ids"].(int); ok { + s.RepInterval = int32(v) + } + return &s +} + +func expandM2tsDvbSdtSettings(tfList []interface{}) *types.DvbSdtSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var s types.DvbSdtSettings + if v, ok := m["output_sdt"].(string); ok && v != "" { + s.OutputSdt = types.DvbSdtOutputSdt(v) + } + if v, ok := m["rep_interval"].(int); ok { + s.RepInterval = int32(v) + } + if v, ok := m["service_name"].(string); ok && v != "" { + s.ServiceName = aws.String(v) + } + if v, ok := m["service_provider_name"].(string); ok && v != "" { + s.ServiceProviderName = aws.String(v) + } + + return &s +} + +func expandChannelEncoderSettingsTimecodeConfig(tfList []interface{}) *types.TimecodeConfig { + if tfList == nil { + return nil + } + m := tfList[0].(map[string]interface{}) + + var config types.TimecodeConfig + if v, ok := m["source"].(string); ok && v != "" { + config.Source = types.TimecodeConfigSource(v) + } + if v, ok := m["sync_threshold"].(int32); ok { + config.SyncThreshold = v + } + + return &config +} + +func expandChannelEncoderSettingsVideoDescriptions(tfList []interface{}) []types.VideoDescription { + if tfList == nil { + return nil + } + + var videoDesc []types.VideoDescription + for _, tfItem := range tfList { + m, ok := tfItem.(map[string]interface{}) + if !ok { + continue + } + + var d types.VideoDescription + if v, ok := m["name"].(string); ok && v != "" { + d.Name = aws.String(v) + } + if v, ok := m["codec_settings"].([]interface{}); ok && len(v) > 0 { + d.CodecSettings = expandChannelEncoderSettingsVideoDescriptionsCodecSettings(v) + } + if v, ok := m["height"].(int); ok { + d.Height = int32(v) + } + if v, ok := m["respond_to_afd"].(string); ok && v != "" { + d.RespondToAfd = types.VideoDescriptionRespondToAfd(v) + } + if v, ok := m["scaling_behavior"].(string); ok && v != "" { + d.ScalingBehavior = types.VideoDescriptionScalingBehavior(v) + } + if v, ok := m["sharpness"].(int); ok { + d.Sharpness = int32(v) + } + if v, ok := m["width"].(int); ok { + d.Width = int32(v) + } + + videoDesc = append(videoDesc, d) + } + + return videoDesc +} + +func expandChannelEncoderSettingsAvailBlanking(tfList []interface{}) *types.AvailBlanking { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.AvailBlanking + if v, ok := m["avail_blanking_image"].([]interface{}); ok && len(v) > 0 { + out.AvailBlankingImage = expandInputLocation(v) + } + if v, ok := m["state"].(string); ok && v != "" { + out.State = types.AvailBlankingState(v) + } + + return &out +} + +func expandChannelEncoderSettingsVideoDescriptionsCodecSettings(tfList []interface{}) *types.VideoCodecSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.VideoCodecSettings + if v, ok := m["frame_capture_settings"].([]interface{}); ok && len(v) > 0 { + out.FrameCaptureSettings = expandsVideoDescriptionsCodecSettingsFrameCaptureSettings(v) + } + if v, ok := m["h264_settings"].([]interface{}); ok && len(v) > 0 { + out.H264Settings = expandsVideoDescriptionsCodecSettingsH264Settings(v) + } + + return &out +} + +func expandsVideoDescriptionsCodecSettingsFrameCaptureSettings(tfList []interface{}) *types.FrameCaptureSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.FrameCaptureSettings + if v, ok := m["capture_interval"].(int); ok { + out.CaptureInterval = int32(v) + } + if v, ok := m["capture_interval_units"].(string); ok && v != "" { + out.CaptureIntervalUnits = types.FrameCaptureIntervalUnit(v) + } + + return &out +} + +func expandsVideoDescriptionsCodecSettingsH264Settings(tfList []interface{}) *types.H264Settings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.H264Settings + if v, ok := m["adaptive_quantization"].(string); ok && v != "" { + out.AdaptiveQuantization = types.H264AdaptiveQuantization(v) + } + if v, ok := m["afd_signaling"].(string); ok && v != "" { + out.AfdSignaling = types.AfdSignaling(v) + } + if v, ok := m["bitrate"].(int); ok { + out.Bitrate = int32(v) + } + if v, ok := m["buf_fill_pct"].(int); ok { + out.BufFillPct = int32(v) + } + if v, ok := m["buf_size"].(int); ok { + out.BufSize = int32(v) + } + if v, ok := m["color_metadata"].(string); ok && v != "" { + out.ColorMetadata = types.H264ColorMetadata(v) + } + if v, ok := m["entropy_encoding"].(string); ok && v != "" { + out.EntropyEncoding = types.H264EntropyEncoding(v) + } + if v, ok := m["filter_settings"].([]interface{}); ok && len(v) > 0 { + out.FilterSettings = expandH264SettingsFilterSettings(v) + } + if v, ok := m["fixed_afd"].(string); ok && v != "" { + out.FixedAfd = types.FixedAfd(v) + } + if v, ok := m["flicker_aq"].(string); ok && v != "" { + out.FlickerAq = types.H264FlickerAq(v) + } + if v, ok := m["force_field_pictures"].(string); ok && v != "" { + out.ForceFieldPictures = types.H264ForceFieldPictures(v) + } + if v, ok := m["framerate_control"].(string); ok && v != "" { + out.FramerateControl = types.H264FramerateControl(v) + } + if v, ok := m["framerate_denominator"].(int); ok { + out.FramerateDenominator = int32(v) + } + if v, ok := m["framerate_numerator"].(int); ok { + out.FramerateNumerator = int32(v) + } + if v, ok := m["gop_b_reference"].(string); ok && v != "" { + out.GopBReference = types.H264GopBReference(v) + } + if v, ok := m["gop_closed_cadence"].(int); ok { + out.GopClosedCadence = int32(v) + } + if v, ok := m["gop_num_b_frames"].(int); ok { + out.GopNumBFrames = int32(v) + } + if v, ok := m["gop_size"].(float32); ok { + out.GopSize = float64(v) + } + if v, ok := m["gop_size_units"].(string); ok && v != "" { + out.GopSizeUnits = types.H264GopSizeUnits(v) + } + if v, ok := m["level"].(string); ok && v != "" { + out.Level = types.H264Level(v) + } + if v, ok := m["look_ahead_rate_control"].(string); ok && v != "" { + out.LookAheadRateControl = types.H264LookAheadRateControl(v) + } + if v, ok := m["max_bitrate"].(int); ok { + out.MaxBitrate = int32(v) + } + if v, ok := m["min_i_interval"].(int); ok { + out.MinIInterval = int32(v) + } + if v, ok := m["num_ref_frames"].(int); ok { + out.NumRefFrames = int32(v) + } + if v, ok := m["par_control"].(string); ok && v != "" { + out.ParControl = types.H264ParControl(v) + } + if v, ok := m["par_denominator"].(int); ok { + out.ParDenominator = int32(v) + } + if v, ok := m["par_numerator"].(int); ok { + out.ParNumerator = int32(v) + } + if v, ok := m["profile"].(string); ok && v != "" { + out.Profile = types.H264Profile(v) + } + if v, ok := m["quality_level"].(string); ok && v != "" { + out.QualityLevel = types.H264QualityLevel(v) + } + if v, ok := m["qvbr_quality_level"].(int); ok { + out.QvbrQualityLevel = int32(v) + } + if v, ok := m["rate_control_mode"].(string); ok && v != "" { + out.RateControlMode = types.H264RateControlMode(v) + } + if v, ok := m["scan_type"].(string); ok && v != "" { + out.ScanType = types.H264ScanType(v) + } + if v, ok := m["scene_change_detect"].(string); ok && v != "" { + out.SceneChangeDetect = types.H264SceneChangeDetect(v) + } + if v, ok := m["slices"].(int); ok { + out.Slices = int32(v) + } + if v, ok := m["softness"].(int); ok { + out.Softness = int32(v) + } + if v, ok := m["spatial_aq"].(string); ok && v != "" { + out.SpatialAq = types.H264SpatialAq(v) + } + if v, ok := m["subgop_length"].(string); ok && v != "" { + out.SubgopLength = types.H264SubGopLength(v) + } + if v, ok := m["syntax"].(string); ok && v != "" { + out.Syntax = types.H264Syntax(v) + } + if v, ok := m["temporal_aq"].(string); ok && v != "" { + out.TemporalAq = types.H264TemporalAq(v) + } + if v, ok := m["timecode_insertion"].(string); ok && v != "" { + out.TimecodeInsertion = types.H264TimecodeInsertionBehavior(v) + } + + return &out +} + +func expandH264SettingsFilterSettings(tfList []interface{}) *types.H264FilterSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.H264FilterSettings + if v, ok := m["temporal_filter_settings"].([]interface{}); ok && len(v) > 0 { + out.TemporalFilterSettings = expandH264FilterSettingsTemporalFilterSettings(v) + } + + return &out +} + +func expandH264FilterSettingsTemporalFilterSettings(tfList []interface{}) *types.TemporalFilterSettings { + if tfList == nil { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.TemporalFilterSettings + if v, ok := m["post_filter_sharpening"].(string); ok && v != "" { + out.PostFilterSharpening = types.TemporalFilterPostFilterSharpening(v) + } + if v, ok := m["strength"].(string); ok && v != "" { + out.Strength = types.TemporalFilterStrength(v) + } + + return &out +} + +func expandNielsenCbetSettings(tfList []interface{}) *types.NielsenCBET { + if len(tfList) == 0 { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.NielsenCBET + if v, ok := m["cbet_check_digit_string"].(string); ok && v != "" { + out.CbetCheckDigitString = aws.String(v) + } + if v, ok := m["cbet_stepaside"].(string); ok && v != "" { + out.CbetStepaside = types.NielsenWatermarksCbetStepaside(v) + } + if v, ok := m["csid"].(string); ok && v != "" { + out.Csid = aws.String(v) + } + + return &out +} + +func expandNielsenNaseIiNwSettings(tfList []interface{}) *types.NielsenNaesIiNw { + if len(tfList) == 0 { + return nil + } + + m := tfList[0].(map[string]interface{}) + + var out types.NielsenNaesIiNw + if v, ok := m["check_digit_string"].(string); ok && v != "" { + out.CheckDigitString = aws.String(v) + } + if v, ok := m["sid"].(float32); ok { + out.Sid = float64(v) + } + + return &out +} + +func flattenChannelEncoderSettings(apiObject *types.EncoderSettings) []interface{} { + if apiObject == nil { + return nil + } + + m := map[string]interface{}{ + "audio_descriptions": flattenAudioDescriptions(apiObject.AudioDescriptions), + "output_groups": flattenOutputGroups(apiObject.OutputGroups), + "timecode_config": flattenTimecodeConfig(apiObject.TimecodeConfig), + "video_descriptions": flattenVideoDescriptions(apiObject.VideoDescriptions), + "avail_blanking": flattenAvailBlanking(apiObject.AvailBlanking), + // TODO avail_configuration + // TODO blackout_slate + // TODO caption_descriptions + // TODO feature_activations + // TODO global_configuration + // TODO motion_graphics_configuration + // TODO nielsen_configuration + } + + return []interface{}{m} +} + +func flattenAudioDescriptions(od []types.AudioDescription) []interface{} { + if len(od) == 0 { + return nil + } + + var ml []interface{} + + for _, v := range od { + m := map[string]interface{}{ + "audio_selector_name": aws.ToString(v.AudioSelectorName), + "name": aws.ToString(v.Name), + "audio_normalization_settings": flattenAudioNormalization(v.AudioNormalizationSettings), + "audio_type": v.AudioType, + "audio_type_control": v.AudioTypeControl, + "audio_watermark_settings": flattenAudioWatermarkSettings(v.AudioWatermarkingSettings), + "codec_settings": flattenAudioDescriptionsCodecSettings(v.CodecSettings), + "language_code": aws.ToString(v.LanguageCode), + "language_code_control": string(v.LanguageCodeControl), + "remix_settings": flattenAudioDescriptionsRemixSettings(v.RemixSettings), + "stream_name": aws.ToString(v.StreamName), + } + + ml = append(ml, m) + } + + return ml +} + +func flattenOutputGroups(op []types.OutputGroup) []interface{} { + if len(op) == 0 { + return nil + } + + var ol []interface{} + + for _, v := range op { + m := map[string]interface{}{ + "output_group_settings": flattenOutputGroupSettings(v.OutputGroupSettings), + "outputs": flattenOutputs(v.Outputs), + "name": aws.ToString(v.Name), + } + + ol = append(ol, m) + } + + return ol +} + +func flattenOutputGroupSettings(os *types.OutputGroupSettings) []interface{} { + if os == nil { + return nil + } + + m := map[string]interface{}{ + "archive_group_settings": flattenOutputGroupSettingsArchiveGroupSettings(os.ArchiveGroupSettings), + "frame_capture_group_settings": flattenOutputGroupSettingsFrameCaptureGroupSettings(os.FrameCaptureGroupSettings), + "hls_group_settings": flattenOutputGroupSettingsHLSGroupSettings(os.HlsGroupSettings), + "ms_smooth_group_settings": flattenOutputGroupSettingsMsSmoothGroupSettings(os.MsSmoothGroupSettings), + "media_package_group_settings": flattenOutputGroupSettingsMediaPackageGroupSettings(os.MediaPackageGroupSettings), + "multiplex_group_settings": func(inner *types.MultiplexGroupSettings) []interface{} { + if inner == nil { + return nil + } + return []interface{}{} // no exported attributes + }(os.MultiplexGroupSettings), + "rtmp_group_settings": flattenOutputGroupSettingsRtmpGroupSettings(os.RtmpGroupSettings), + "udp_group_settings": flattenOutputGroupSettingsUdpGroupSettings(os.UdpGroupSettings), + } + + return []interface{}{m} +} + +func flattenOutputs(os []types.Output) []interface{} { + if len(os) == 0 { + return nil + } + + var outputs []interface{} + + for _, item := range os { + m := map[string]interface{}{ + "audio_description_names": flex.FlattenStringValueSet(item.AudioDescriptionNames), + "caption_description_names": flex.FlattenStringValueSet(item.CaptionDescriptionNames), + "output_name": aws.ToString(item.OutputName), + "output_settings": flattenOutputsOutputSettings(item.OutputSettings), + "video_description_name": aws.ToString(item.VideoDescriptionName), + } + + outputs = append(outputs, m) + } + + return outputs +} + +func flattenOutputsOutputSettings(in *types.OutputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "archive_output_settings": flattenOutputsOutputSettingsArchiveOutputSettings(in.ArchiveOutputSettings), + "frame_capture_output_settings": flattenOutputsOutputSettingsFrameCaptureOutputSettings(in.FrameCaptureOutputSettings), + "hls_output_settings": flattenOutputsOutputSettingsHLSOutputSettings(in.HlsOutputSettings), + "media_package_output_settings": func(inner *types.MediaPackageOutputSettings) []interface{} { + if inner == nil { + return nil + } + return []interface{}{} // no exported attributes + }(in.MediaPackageOutputSettings), + "ms_smooth_output_settings": flattenOutputsOutputSettingsMsSmoothOutputSettings(in.MsSmoothOutputSettings), + "multiplex_output_settings": func(inner *types.MultiplexOutputSettings) []interface{} { + if inner == nil { + return nil + } + data := map[string]interface{}{ + "destination": flattenDestination(inner.Destination), + } + + return []interface{}{data} + }(in.MultiplexOutputSettings), + "rtmp_output_settings": flattenOutputsOutputSettingsRtmpOutputSettings(in.RtmpOutputSettings), + "udp_output_settings": flattenOutputsOutputSettingsUdpOutputSettings(in.UdpOutputSettings), + } + + return []interface{}{m} +} + +func flattenOutputsOutputSettingsArchiveOutputSettings(in *types.ArchiveOutputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "container_settings": flattenOutputsOutputSettingsArchiveOutputSettingsContainerSettings(in.ContainerSettings), + "extension": aws.ToString(in.Extension), + "name_modifier": aws.ToString(in.NameModifier), + } + + return []interface{}{m} +} + +func flattenOutputsOutputSettingsFrameCaptureOutputSettings(in *types.FrameCaptureOutputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "name_modifier": aws.ToString(in.NameModifier), + } + + return []interface{}{m} +} + +func flattenOutputsOutputSettingsHLSOutputSettings(in *types.HlsOutputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "hls_settings": flattenHLSOutputSettingsHLSSettings(in.HlsSettings), + "h265_packaging_type": string(in.H265PackagingType), + "name_modifier": aws.ToString(in.NameModifier), + "segment_modifier": aws.ToString(in.SegmentModifier), + } + + return []interface{}{m} +} + +func flattenOutputsOutputSettingsMsSmoothOutputSettings(in *types.MsSmoothOutputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "h265_packaging_type": string(in.H265PackagingType), + "name_modifier": aws.ToString(in.NameModifier), + } + + return []interface{}{m} +} + +func flattenHLSOutputSettingsHLSSettings(in *types.HlsSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "audio_only_hls_settings": flattenHLSSettingsAudioOnlyHLSSettings(in.AudioOnlyHlsSettings), + "fmp4_hls_settings": flattenHLSSettingsFmp4HLSSettings(in.Fmp4HlsSettings), + "frame_capture_hls_settings": func(inner *types.FrameCaptureHlsSettings) []interface{} { + if inner == nil { + return nil + } + return []interface{}{} // no exported fields + }(in.FrameCaptureHlsSettings), + "standard_hls_settings": flattenHLSSettingsStandardHLSSettings(in.StandardHlsSettings), + } + + return []interface{}{m} +} + +func flattenHLSSettingsAudioOnlyHLSSettings(in *types.AudioOnlyHlsSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "audio_group_id": aws.ToString(in.AudioGroupId), + "audio_only_image": flattenInputLocation(in.AudioOnlyImage), + "audio_track_type": string(in.AudioTrackType), + "segment_type": string(in.AudioTrackType), + } + + return []interface{}{m} +} + +func flattenHLSSettingsFmp4HLSSettings(in *types.Fmp4HlsSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "audio_rendition_sets": aws.ToString(in.AudioRenditionSets), + "nielsen_id3_behavior": string(in.NielsenId3Behavior), + "timed_metadata_behavior": string(in.TimedMetadataBehavior), + } + + return []interface{}{m} +} + +func flattenHLSSettingsStandardHLSSettings(in *types.StandardHlsSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "m3u8_settings": flattenStandardHLSSettingsM3u8Settings(in.M3u8Settings), + "audio_rendition_sets": aws.ToString(in.AudioRenditionSets), + } + + return []interface{}{m} +} + +func flattenStandardHLSSettingsM3u8Settings(in *types.M3u8Settings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "audio_frames_per_pes": int(in.AudioFramesPerPes), + "audio_pids": aws.ToString(in.AudioPids), + "ecm_pid": aws.ToString(in.EcmPid), + "nielsen_id3_behavior": string(in.NielsenId3Behavior), + "pat_interval": int(in.PatInterval), + "pcr_control": string(in.PcrControl), + "pcr_period": int(in.PcrPeriod), + "pcr_pid": aws.ToString(in.PcrPid), + "pmt_interval": int(in.PmtInterval), + "pmt_pid": aws.ToString(in.PmtPid), + "program_num": int(in.ProgramNum), + "scte35_behavior": string(in.Scte35Behavior), + "scte35_pid": aws.ToString(in.Scte35Pid), + "timed_metadata_behavior": string(in.TimedMetadataBehavior), + "timed_metadata_pid": aws.ToString(in.TimedMetadataPid), + "transport_stream_id": int(in.TransportStreamId), + "video_pid": aws.ToString(in.VideoPid), + } + + return []interface{}{m} +} + +func flattenOutputsOutputSettingsRtmpOutputSettings(in *types.RtmpOutputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "destination": flattenDestination(in.Destination), + "certificate_mode": string(in.CertificateMode), + "connection_retry_interval": int(in.ConnectionRetryInterval), + "num_retries": int(in.NumRetries), + } + + return []interface{}{m} +} + +func flattenOutputsOutputSettingsUdpOutputSettings(in *types.UdpOutputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "container_settings": flattenOutputsOutputSettingsUdpOutputSettingsContainerSettings(in.ContainerSettings), + "destination": flattenDestination(in.Destination), + "buffer_msec": int(in.BufferMsec), + "fec_output_settings": flattenFecOutputSettings(in.FecOutputSettings), + } + + return []interface{}{m} +} + +func flattenOutputsOutputSettingsArchiveOutputSettingsContainerSettings(in *types.ArchiveContainerSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "m2ts_settings": flattenM2tsSettings(in.M2tsSettings), + "raw_settings": []interface{}{}, // attribute has no exported fields + } + + return []interface{}{m} +} + +func flattenOutputsOutputSettingsUdpOutputSettingsContainerSettings(in *types.UdpContainerSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "m2ts_settings": flattenM2tsSettings(in.M2tsSettings), + } + + return []interface{}{m} +} + +func flattenFecOutputSettings(in *types.FecOutputSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "column_depth": int(in.ColumnDepth), + "include_fec": string(in.IncludeFec), + "row_length": int(in.RowLength), + } + + return []interface{}{m} +} + +func flattenM2tsSettings(in *types.M2tsSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "absent_input_audio_behavior": string(in.AbsentInputAudioBehavior), + "arib": string(in.Arib), + "arib_captions_pid": aws.ToString(in.AribCaptionsPid), + "arib_captions_pid_control": string(in.AribCaptionsPidControl), + "audio_buffer_model": string(in.AudioBufferModel), + "audio_frames_per_pes": int(in.AudioFramesPerPes), + "audio_pids": aws.ToString(in.AudioPids), + "audio_stream_type": string(in.AudioStreamType), + "bitrate": int(in.Bitrate), + "buffer_model": string(in.BufferModel), + "cc_descriptor": string(in.CcDescriptor), + "dvb_nit_settings": flattenDvbNitSettings(in.DvbNitSettings), + "dvb_sdt_settings": flattenDvbSdtSettings(in.DvbSdtSettings), + "dvb_sub_pids": aws.ToString(in.DvbSubPids), + "dvb_tdt_settings": flattenDvbTdtSettings(in.DvbTdtSettings), + "dvb_teletext_pid": aws.ToString(in.DvbTeletextPid), + "ebif": string(in.Ebif), + "ebp_audio_interval": string(in.EbpAudioInterval), + "ebp_lookahead_ms": int(in.EbpLookaheadMs), + "ebp_placement": string(in.EbpPlacement), + "ecm_pid": aws.ToString(in.EcmPid), + "es_rate_in_pes": string(in.EsRateInPes), + "etv_platform_pid": aws.ToString(in.EtvPlatformPid), + "etv_signal_pid": aws.ToString(in.EtvSignalPid), + "fragment_time": float32(in.FragmentTime), + "klv": string(in.Klv), + "klv_data_pids": aws.ToString(in.KlvDataPids), + "nielsen_id3_behavior": string(in.NielsenId3Behavior), + "null_packet_bitrate": float32(in.NullPacketBitrate), + "pat_interval": int(in.PatInterval), + "pcr_control": string(in.PcrControl), + "pcr_period": int(in.PcrPeriod), + "pcr_pid": aws.ToString(in.PcrPid), + "pmt_interval": int(in.PmtInterval), + "pmt_pid": aws.ToString(in.PmtPid), + "program_num": int(in.ProgramNum), + "rate_mode": string(in.RateMode), + "scte27_pids": aws.ToString(in.Scte27Pids), + "scte35_control": string(in.Scte35Control), + "scte35_pid": aws.ToString(in.Scte35Pid), + "segmentation_markers": string(in.SegmentationMarkers), + "segmentation_style": string(in.SegmentationStyle), + "segmentation_time": float32(in.SegmentationTime), + "timed_metadata_behavior": string(in.TimedMetadataBehavior), + "timed_metadata_pid": aws.ToString(in.TimedMetadataPid), + "transport_stream_id": int(in.TransportStreamId), + "video_pid": aws.ToString(in.VideoPid), + } + + return []interface{}{m} +} + +func flattenDvbNitSettings(in *types.DvbNitSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "network_id": int(in.NetworkId), + "network_name": aws.ToString(in.NetworkName), + "rep_interval": int(in.RepInterval), + } + + return []interface{}{m} +} + +func flattenDvbSdtSettings(in *types.DvbSdtSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "output_sdt": string(in.OutputSdt), + "rep_interval": int(in.RepInterval), + "service_name": aws.ToString(in.ServiceName), + "service_provider_name": aws.ToString(in.ServiceProviderName), + } + + return []interface{}{m} +} + +func flattenDvbTdtSettings(in *types.DvbTdtSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "rep_interval": int(in.RepInterval), + } + + return []interface{}{m} +} + +func flattenOutputGroupSettingsArchiveGroupSettings(as *types.ArchiveGroupSettings) []interface{} { + if as == nil { + return nil + } + + m := map[string]interface{}{ + "destination": flattenDestination(as.Destination), + "archive_cdn_settings": flattenOutputGroupSettingsArchiveCDNSettings(as.ArchiveCdnSettings), + "rollover_interval": int(as.RolloverInterval), + } + + return []interface{}{m} +} + +func flattenOutputGroupSettingsFrameCaptureGroupSettings(in *types.FrameCaptureGroupSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "destination": flattenDestination(in.Destination), + "frame_capture_cdn_settings": flattenFrameCaptureCDNSettings(in.FrameCaptureCdnSettings), + } + + return []interface{}{m} +} + +func flattenOutputGroupSettingsHLSGroupSettings(in *types.HlsGroupSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "destination": flattenDestination(in.Destination), + "ad_markers": flattenHLSAdMarkers(in.AdMarkers), + "base_url_content": aws.ToString(in.BaseUrlContent), + "base_url_content1": aws.ToString(in.BaseUrlContent1), + "base_url_manifest": aws.ToString(in.BaseUrlManifest), + "base_url_manifest1": aws.ToString(in.BaseUrlManifest1), + "caption_language_mappings": flattenHLSCaptionLanguageMappings(in.CaptionLanguageMappings), + "caption_language_setting": string(in.CaptionLanguageSetting), + "client_cache": string(in.ClientCache), + "codec_specification": string(in.CodecSpecification), + "constant_iv": aws.ToString(in.ConstantIv), + "directory_structure": string(in.DirectoryStructure), + "discontinuity_tags": string(in.DiscontinuityTags), + "encryption_type": string(in.EncryptionType), + "hls_cdn_settings": flattenHLSCDNSettings(in.HlsCdnSettings), + "hls_id3_segment_tagging": string(in.HlsId3SegmentTagging), + "iframe_only_playlists": string(in.IFrameOnlyPlaylists), + "incomplete_segment_behavior": string(in.IncompleteSegmentBehavior), + "index_n_segments": int(in.IndexNSegments), + "input_loss_action": string(in.InputLossAction), + "iv_in_manifest": string(in.IvInManifest), + "iv_source": string(in.IvSource), + "keep_segments": int(in.KeepSegments), + "key_format": aws.ToString(in.KeyFormat), + "key_format_versions": aws.ToString(in.KeyFormatVersions), + "key_provider_settings": flattenHLSKeyProviderSettings(in.KeyProviderSettings), + "manifest_compression": string(in.ManifestCompression), + "manifest_duration_format": string(in.ManifestDurationFormat), + "min_segment_length": int(in.MinSegmentLength), + "mode": string(in.Mode), + "output_selection": string(in.OutputSelection), + "program_date_time": string(in.ProgramDateTime), + "program_date_time_clock": string(in.ProgramDateTimeClock), + "program_date_time_period": int(in.ProgramDateTimePeriod), + "redundant_manifest": string(in.RedundantManifest), + "segment_length": int(in.SegmentLength), + "segments_per_subdirectory": int(in.SegmentsPerSubdirectory), + "stream_inf_resolution": string(in.StreamInfResolution), + "timed_metadata_id3_frame": string(in.TimedMetadataId3Frame), + "timed_metadata_id3_period": int(in.TimedMetadataId3Period), + "timestamp_delta_milliseconds": int(in.TimestampDeltaMilliseconds), + "ts_file_mode": string(in.TsFileMode), + } + + return []interface{}{m} +} + +func flattenOutputGroupSettingsMsSmoothGroupSettings(in *types.MsSmoothGroupSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "destination": flattenDestination(in.Destination), + "acquisition_point_id": aws.ToString(in.AcquisitionPointId), + "audio_only_timecode_control": string(in.AudioOnlyTimecodeControl), + "certificate_mode": string(in.CertificateMode), + "connection_retry_interval": int(in.ConnectionRetryInterval), + "event_id": aws.ToString(in.EventId), + "event_id_mode": string(in.EventIdMode), + "event_stop_behavior": string(in.EventStopBehavior), + "filecache_duration": int(in.FilecacheDuration), + "fragment_length": int(in.FragmentLength), + "input_loss_action": string(in.InputLossAction), + "num_retries": int(in.NumRetries), + "restart_delay": int(in.RestartDelay), + "segmentation_mode": string(in.SegmentationMode), + "send_delay_ms": int(in.SendDelayMs), + "sparse_track_type": string(in.SparseTrackType), + "stream_manifest_behavior": string(in.StreamManifestBehavior), + "timestamp_offset": aws.ToString(in.TimestampOffset), + "timestamp_offset_mode": string(in.TimestampOffsetMode), + } + + return []interface{}{m} +} + +func flattenHLSAdMarkers(in []types.HlsAdMarkers) []interface{} { + if len(in) == 0 { + return nil + } + + var out []interface{} + for _, item := range in { + out = append(out, string(item)) + } + + return out +} - return []interface{}{data} // no exported attributes - }(in.MultiplexOutputSettings), - "rtmp_output_settings": flattenOutputsOutputSettingsRtmpOutputSettings(in.RtmpOutputSettings), - "udp_output_settings": flattenOutputsOutputSettingsUdpOutputSettings(in.UdpOutputSettings), +func flattenHLSCaptionLanguageMappings(in []types.CaptionLanguageMapping) []interface{} { + if len(in) == 0 { + return nil } - return []interface{}{m} + var out []interface{} + for _, item := range in { + m := map[string]interface{}{ + "caption_channel": int(item.CaptionChannel), + "language_code": aws.ToString(item.LanguageCode), + "language_description": aws.ToString(item.LanguageDescription), + } + + out = append(out, m) + } + + return out } -func flattenOutputsOutputSettingsArchiveOutputSettings(in *types.ArchiveOutputSettings) []interface{} { +func flattenHLSCDNSettings(in *types.HlsCdnSettings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "container_settings": flattenOutputsOutputSettingsArchiveOutputSettingsContainerSettings(in.ContainerSettings), - "extension": aws.ToString(in.Extension), - "name_modifier": aws.ToString(in.NameModifier), + "hls_akamai_settings": flattenHLSAkamaiSettings(in.HlsAkamaiSettings), + "hls_basic_put_settings": flattenHLSBasicPutSettings(in.HlsBasicPutSettings), + "hls_media_store_settings": flattenHLSMediaStoreSettings(in.HlsMediaStoreSettings), + "hls_s3_settings": flattenHLSS3Settings(in.HlsS3Settings), + "hls_webdav_settings": flattenHLSWebdavSettings(in.HlsWebdavSettings), } return []interface{}{m} } -func flattenOutputsOutputSettingsRtmpOutputSettings(in *types.RtmpOutputSettings) []interface{} { +func flattenHLSAkamaiSettings(in *types.HlsAkamaiSettings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "destination": flattenDestination(in.Destination), - "certificate_mode": string(in.CertificateMode), "connection_retry_interval": int(in.ConnectionRetryInterval), + "filecache_duration": int(in.FilecacheDuration), + "http_transfer_mode": string(in.HttpTransferMode), "num_retries": int(in.NumRetries), + "restart_delay": int(in.RestartDelay), + "salt": aws.ToString(in.Salt), + "token": aws.ToString(in.Token), } return []interface{}{m} } -func flattenOutputsOutputSettingsUdpOutputSettings(in *types.UdpOutputSettings) []interface{} { +func flattenHLSBasicPutSettings(in *types.HlsBasicPutSettings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "container_settings": flattenOutputsOutputSettingsUdpOutputSettingsContainerSettings(in.ContainerSettings), - "destination": flattenDestination(in.Destination), - "buffer_msec": int(in.BufferMsec), - "fec_output_settings": flattenFecOutputSettings(in.FecOutputSettings), + "connection_retry_interval": int(in.ConnectionRetryInterval), + "filecache_duration": int(in.FilecacheDuration), + "num_retries": int(in.NumRetries), + "restart_delay": int(in.RestartDelay), } return []interface{}{m} } -func flattenOutputsOutputSettingsArchiveOutputSettingsContainerSettings(in *types.ArchiveContainerSettings) []interface{} { +func flattenHLSMediaStoreSettings(in *types.HlsMediaStoreSettings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "m2ts_settings": flattenM2tsSettings(in.M2tsSettings), - "raw_settings": []interface{}{}, // attribute has no exported fields + "connection_retry_interval": int(in.ConnectionRetryInterval), + "filecache_duration": int(in.FilecacheDuration), + "media_store_storage_class": string(in.MediaStoreStorageClass), + "num_retries": int(in.NumRetries), + "restart_delay": int(in.RestartDelay), } return []interface{}{m} } -func flattenOutputsOutputSettingsUdpOutputSettingsContainerSettings(in *types.UdpContainerSettings) []interface{} { +func flattenHLSS3Settings(in *types.HlsS3Settings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "m2ts_settings": flattenM2tsSettings(in.M2tsSettings), + "canned_acl": string(in.CannedAcl), } return []interface{}{m} } -func flattenFecOutputSettings(in *types.FecOutputSettings) []interface{} { +func flattenFrameCaptureCDNSettings(in *types.FrameCaptureCdnSettings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "column_depth": int(in.ColumnDepth), - "include_fec": string(in.IncludeFec), - "row_length": int(in.RowLength), + "frame_capture_s3_settings": flattenFrameCaptureS3Settings(in.FrameCaptureS3Settings), } return []interface{}{m} } -func flattenM2tsSettings(in *types.M2tsSettings) []interface{} { +func flattenHLSWebdavSettings(in *types.HlsWebdavSettings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "absent_input_audio_behavior": string(in.AbsentInputAudioBehavior), - "arib": string(in.Arib), - "arib_captions_pid": aws.ToString(in.AribCaptionsPid), - "arib_captions_pid_control": string(in.AribCaptionsPidControl), - "audio_buffer_model": string(in.AudioBufferModel), - "audio_frames_per_pes": int(in.AudioFramesPerPes), - "audio_pids": aws.ToString(in.AudioPids), - "audio_stream_type": string(in.AudioStreamType), - "bitrate": int(in.Bitrate), - "buffer_model": string(in.BufferModel), - "cc_descriptor": string(in.CcDescriptor), - "dvb_nit_settings": flattenDvbNitSettings(in.DvbNitSettings), - "dvb_sdt_settings": flattenDvbSdtSettings(in.DvbSdtSettings), - "dvb_sub_pids": aws.ToString(in.DvbSubPids), - "dvb_tdt_settings": flattenDvbTdtSettings(in.DvbTdtSettings), - "dvb_teletext_pid": aws.ToString(in.DvbTeletextPid), - "ebif": string(in.Ebif), - "ebp_audio_interval": string(in.EbpAudioInterval), - "ebp_lookahead_ms": int(in.EbpLookaheadMs), - "ebp_placement": string(in.EbpPlacement), - "ecm_pid": aws.ToString(in.EcmPid), - "es_rate_in_pes": string(in.EsRateInPes), - "etv_platform_pid": aws.ToString(in.EtvPlatformPid), - "etv_signal_pid": aws.ToString(in.EtvSignalPid), - "fragment_time": float32(in.FragmentTime), - "klv": string(in.Klv), - "klv_data_pids": aws.ToString(in.KlvDataPids), - "nielsen_id3_behavior": string(in.NielsenId3Behavior), - "null_packet_bitrate": float32(in.NullPacketBitrate), - "pat_interval": int(in.PatInterval), - "pcr_control": string(in.PcrControl), - "pcr_period": int(in.PcrPeriod), - "pcr_pid": aws.ToString(in.PcrPid), - "pmt_interval": int(in.PmtInterval), - "pmt_pid": aws.ToString(in.PmtPid), - "program_num": int(in.ProgramNum), - "rate_mode": string(in.RateMode), - "scte27_pids": aws.ToString(in.Scte27Pids), - "scte35_control": string(in.Scte35Control), - "scte35_pid": aws.ToString(in.Scte35Pid), - "segmentation_markers": string(in.SegmentationMarkers), - "segmentation_style": string(in.SegmentationStyle), - "segmentation_time": float32(in.SegmentationTime), - "timed_metadata_behavior": string(in.TimedMetadataBehavior), - "timed_metadata_pid": aws.ToString(in.TimedMetadataPid), - "transport_stream_id": int(in.TransportStreamId), - "video_pid": aws.ToString(in.VideoPid), + "connection_retry_interval": int(in.ConnectionRetryInterval), + "filecache_duration": int(in.FilecacheDuration), + "http_transfer_mode": string(in.HttpTransferMode), + "num_retries": int(in.NumRetries), + "restart_delay": int(in.RestartDelay), } return []interface{}{m} } -func flattenDvbNitSettings(in *types.DvbNitSettings) []interface{} { +func flattenHLSKeyProviderSettings(in *types.KeyProviderSettings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "network_id": int(in.NetworkId), - "network_name": aws.ToString(in.NetworkName), - "rep_interval": int(in.RepInterval), + "static_key_settings": flattenKeyProviderSettingsStaticKeySettings(in.StaticKeySettings), } return []interface{}{m} } -func flattenDvbSdtSettings(in *types.DvbSdtSettings) []interface{} { +func flattenKeyProviderSettingsStaticKeySettings(in *types.StaticKeySettings) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "output_sdt": string(in.OutputSdt), - "rep_interval": int(in.RepInterval), - "service_name": aws.ToString(in.ServiceName), - "service_provider_name": aws.ToString(in.ServiceProviderName), + "static_key_value": aws.ToString(in.StaticKeyValue), + "key_provider_server": flattenInputLocation(in.KeyProviderServer), } return []interface{}{m} } -func flattenDvbTdtSettings(in *types.DvbTdtSettings) []interface{} { +func flattenInputLocation(in *types.InputLocation) []interface{} { if in == nil { return nil } m := map[string]interface{}{ - "rep_interval": int(in.RepInterval), + "uri": aws.ToString(in.Uri), + "password_param": aws.ToString(in.PasswordParam), + "username": aws.ToString(in.Username), } return []interface{}{m} } -func flattenOutputGroupSettingsArchiveGroupSettings(as *types.ArchiveGroupSettings) []interface{} { - if as == nil { +func flattenFrameCaptureS3Settings(in *types.FrameCaptureS3Settings) []interface{} { + if in == nil { return nil } m := map[string]interface{}{ - "destination": flattenDestination(as.Destination), - "archive_cdn_settings": flattenOutputGroupSettingsArchiveCDNSettings(as.ArchiveCdnSettings), - "rollover_interval": int(as.RolloverInterval), + "canned_acl": string(in.CannedAcl), } return []interface{}{m} @@ -3560,6 +5351,19 @@ func flattenVideoDescriptions(tfList []types.VideoDescription) []interface{} { return out } +func flattenAvailBlanking(in *types.AvailBlanking) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "avail_blanking_image": flattenInputLocation(in.AvailBlankingImage), + "state": string(in.State), + } + + return []interface{}{m} +} + func flattenVideoDescriptionsCodecSettings(in *types.VideoCodecSettings) []interface{} { if in == nil { return nil @@ -3567,6 +5371,7 @@ func flattenVideoDescriptionsCodecSettings(in *types.VideoCodecSettings) []inter m := map[string]interface{}{ "frame_capture_settings": flattenCodecSettingsFrameCaptureSettings(in.FrameCaptureSettings), + "h264_settings": flattenCodecSettingsH264Settings(in.H264Settings), } return []interface{}{m} @@ -3585,6 +5390,80 @@ func flattenCodecSettingsFrameCaptureSettings(in *types.FrameCaptureSettings) [] return []interface{}{m} } +func flattenCodecSettingsH264Settings(in *types.H264Settings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "adaptive_quantization": string(in.AdaptiveQuantization), + "afd_signaling": string(in.AfdSignaling), + "bitrate": int(in.Bitrate), + "buf_size": int(in.BufSize), + "color_metadata": string(in.ColorMetadata), + "entropy_encoding": string(in.EntropyEncoding), + "filter_settings": flattenH264SettingsFilterSettings(in.FilterSettings), + "fixed_afd": string(in.FixedAfd), + "flicker_aq": string(in.FlickerAq), + "force_field_pictures": string(in.ForceFieldPictures), + "framerate_control": string(in.FramerateControl), + "framerate_denominator": int(in.FramerateDenominator), + "framerate_numerator": int(in.FramerateNumerator), + "gop_b_reference": string(in.GopBReference), + "gop_closed_cadence": int(in.GopClosedCadence), + "gop_num_b_frames": int(in.GopNumBFrames), + "gop_size": float32(in.GopSize), + "gop_size_units": string(in.GopSizeUnits), + "level": string(in.Level), + "look_ahead_rate_control": string(in.LookAheadRateControl), + "max_bitrate": int(in.MaxBitrate), + "min_i_interval": int(in.MinIInterval), + "num_ref_frames": int(in.NumRefFrames), + "par_control": string(in.ParControl), + "par_denominator": int(in.ParDenominator), + "par_numerator": int(in.ParNumerator), + "profile": string(in.Profile), + "quality_level": string(in.QualityLevel), + "qvbr_quality_level": int(in.QvbrQualityLevel), + "rate_control_mode": string(in.RateControlMode), + "scan_type": string(in.ScanType), + "scene_change_detect": string(in.SceneChangeDetect), + "slices": int(in.Slices), + "spatial_aq": string(in.SpatialAq), + "subgop_length": string(in.SubgopLength), + "syntax": string(in.Syntax), + "temporal_aq": string(in.TemporalAq), + "timecode_insertion": string(in.TimecodeInsertion), + } + + return []interface{}{m} +} + +func flattenH264SettingsFilterSettings(in *types.H264FilterSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "temporal_filter_settings": flattenFilterSettingsTemporalFilterSettings(in.TemporalFilterSettings), + } + + return []interface{}{m} +} + +func flattenFilterSettingsTemporalFilterSettings(in *types.TemporalFilterSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "post_filter_sharpening": string(in.PostFilterSharpening), + "strength": string(in.Strength), + } + + return []interface{}{m} +} + func flattenAudioNormalization(ns *types.AudioNormalizationSettings) []interface{} { if ns == nil { return nil @@ -3623,6 +5502,192 @@ func flattenAudioWatermarkSettings(ns *types.AudioWatermarkSettings) []interface return []interface{}{m} } +func flattenAudioDescriptionsCodecSettings(in *types.AudioCodecSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "aac_settings": flattenCodecSettingsAacSettings(in.AacSettings), + "ac3_settings": flattenCodecSettingsAc3Settings(in.Ac3Settings), + "eac3_atmos_settings": flattenCodecSettingsEac3AtmosSettings(in.Eac3AtmosSettings), + "eac3_settings": flattenCodecSettingsEac3Settings(in.Eac3Settings), + "mp2_settings": flattenCodecSettingsMp2Settings(in.Mp2Settings), + "wav_settings": flattenCodecSettingsWavSettings(in.WavSettings), + } + + if in.PassThroughSettings != nil { + m["pass_through_settings"] = []interface{}{} // no exported fields + } + + return []interface{}{m} +} + +func flattenCodecSettingsAacSettings(in *types.AacSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "bitrate": float32(in.Bitrate), + "coding_mode": string(in.CodingMode), + "input_type": string(in.InputType), + "profile": string(in.Profile), + "rate_control_mode": string(in.RateControlMode), + "raw_format": string(in.RawFormat), + "sample_rate": float32(in.SampleRate), + "spec": string(in.Spec), + "vbr_quality": string(in.VbrQuality), + } + + return []interface{}{m} +} + +func flattenCodecSettingsAc3Settings(in *types.Ac3Settings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "bitrate": float32(in.Bitrate), + "bitstream_mode": string(in.BitstreamMode), + "coding_mode": string(in.CodingMode), + "dialnorm": int(in.Dialnorm), + "drc_profile": string(in.DrcProfile), + "lfe_filter": string(in.LfeFilter), + "metadata_control": string(in.MetadataControl), + } + + return []interface{}{m} +} + +func flattenCodecSettingsEac3AtmosSettings(in *types.Eac3AtmosSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "bitrate": float32(in.Bitrate), + "coding_mode": string(in.CodingMode), + "dialnorm": int(in.Dialnorm), + "drc_line": string(in.DrcLine), + "drc_rf": string(in.DrcRf), + "height_trim": float32(in.HeightTrim), + "surround_trim": float32(in.SurroundTrim), + } + + return []interface{}{m} +} + +func flattenCodecSettingsEac3Settings(in *types.Eac3Settings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "attenuation_control": string(in.AttenuationControl), + "bitrate": float32(in.Bitrate), + "bitstream_mode": string(in.BitstreamMode), + "coding_mode": string(in.CodingMode), + "dc_filter": string(in.DcFilter), + "dialnorm": int(in.Dialnorm), + "drc_line": string(in.DrcLine), + "drc_rf": string(in.DrcRf), + "lfe_control": string(in.LfeControl), + "lfe_filter": string(in.LfeFilter), + "lo_ro_center_mix_level": float32(in.LoRoCenterMixLevel), + "lo_ro_surround_mix_level": float32(in.LoRoSurroundMixLevel), + "lt_rt_center_mix_level": float32(in.LtRtCenterMixLevel), + "lt_rt_surround_mix_level": float32(in.LtRtSurroundMixLevel), + "metadata_control": string(in.MetadataControl), + "passthrough_control": string(in.PassthroughControl), + "phase_control": string(in.PhaseControl), + "stereo_downmix": string(in.StereoDownmix), + "surround_ex_mode": string(in.SurroundExMode), + "surround_mode": string(in.SurroundMode), + } + + return []interface{}{m} +} + +func flattenCodecSettingsMp2Settings(in *types.Mp2Settings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "bitrate": float32(in.Bitrate), + "coding_mode": string(in.CodingMode), + "sample_rate": float32(in.SampleRate), + } + + return []interface{}{m} +} + +func flattenCodecSettingsWavSettings(in *types.WavSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "bit_depth": float32(in.BitDepth), + "coding_mode": string(in.CodingMode), + "sample_rate": float32(in.SampleRate), + } + + return []interface{}{m} +} + +func flattenAudioDescriptionsRemixSettings(in *types.RemixSettings) []interface{} { + if in == nil { + return nil + } + + m := map[string]interface{}{ + "channel_mappings": flattenChannelMappings(in.ChannelMappings), + "channels_in": int(in.ChannelsIn), + "channels_out": int(in.ChannelsOut), + } + + return []interface{}{m} +} + +func flattenChannelMappings(in []types.AudioChannelMapping) []interface{} { + if len(in) == 0 { + return nil + } + + var out []interface{} + for _, item := range in { + m := map[string]interface{}{ + "input_channel_levels": flattenInputChannelLevels(item.InputChannelLevels), + "output_channel": int(item.OutputChannel), + } + + out = append(out, m) + } + + return out +} + +func flattenInputChannelLevels(in []types.InputChannelLevel) []interface{} { + if len(in) == 0 { + return nil + } + + var out []interface{} + for _, item := range in { + m := map[string]interface{}{ + "gain": int(item.Gain), + "input_channel": int(item.InputChannel), + } + + out = append(out, m) + } + + return out +} + func flattenNielsenCbetSettings(in *types.NielsenCBET) []interface{} { if in == nil { return nil diff --git a/internal/service/medialive/channel_test.go b/internal/service/medialive/channel_test.go index e4d98287af5..63b066768e8 100644 --- a/internal/service/medialive/channel_test.go +++ b/internal/service/medialive/channel_test.go @@ -73,6 +73,57 @@ func TestAccMediaLiveChannel_basic(t *testing.T) { }) } +func TestAccMediaLiveChannel_hls(t *testing.T) { + if testing.Short() { + t.Skip("skipping long-running test in short mode") + } + + var channel medialive.DescribeChannelOutput + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_medialive_channel.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + acctest.PreCheck(t) + acctest.PreCheckPartitionHasService(names.MediaLiveEndpointID, t) + testAccChannelsPreCheck(t) + }, + ErrorCheck: acctest.ErrorCheck(t, names.MediaLiveEndpointID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckChannelDestroy, + Steps: []resource.TestStep{ + { + Config: testAccChannelConfig_hls(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckChannelExists(resourceName, &channel), + resource.TestCheckResourceAttrSet(resourceName, "channel_id"), + resource.TestCheckResourceAttr(resourceName, "channel_class", "STANDARD"), + resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestCheckResourceAttrSet(resourceName, "role_arn"), + resource.TestCheckResourceAttr(resourceName, "input_specification.0.codec", "AVC"), + resource.TestCheckResourceAttr(resourceName, "input_specification.0.input_resolution", "HD"), + resource.TestCheckResourceAttr(resourceName, "input_specification.0.maximum_bitrate", "MAX_20_MBPS"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "input_attachments.*", map[string]string{ + "input_attachment_name": "example-input1", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "destinations.*", map[string]string{ + "id": rName, + }), + resource.TestCheckResourceAttr(resourceName, "encoder_settings.0.timecode_config.0.source", "EMBEDDED"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.audio_descriptions.*", map[string]string{ + "audio_selector_name": rName, + "name": rName, + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "encoder_settings.0.video_descriptions.*", map[string]string{ + "name": "test-video-name", + }), + resource.TestCheckResourceAttr(resourceName, "encoder_settings.0.output_groups.0.outputs.0.output_settings.0.hls_output_settings.0.h265_packaging_type", "HVC1"), + ), + }, + }, + }) +} + func TestAccMediaLiveChannel_update(t *testing.T) { if testing.Short() { t.Skip("skipping long-running test in short mode") @@ -471,6 +522,87 @@ resource "aws_medialive_channel" "test" { `, rName)) } +func testAccChannelConfig_hls(rName string) string { + return acctest.ConfigCompose( + testAccChannelBaseConfig(rName), + testAccChannelBaseS3Config(rName), + testAccChannelBaseMultiplexConfig(rName), + fmt.Sprintf(` +resource "aws_medialive_channel" "test" { + name = %[1]q + channel_class = "STANDARD" + role_arn = aws_iam_role.test.arn + + input_specification { + codec = "AVC" + input_resolution = "HD" + maximum_bitrate = "MAX_20_MBPS" + } + + input_attachments { + input_attachment_name = "example-input1" + input_id = aws_medialive_input.test.id + } + + destinations { + id = %[1]q + + settings { + url = "s3://${aws_s3_bucket.test1.id}/test1" + } + + settings { + url = "s3://${aws_s3_bucket.test2.id}/test2" + } + } + + encoder_settings { + timecode_config { + source = "EMBEDDED" + } + + audio_descriptions { + audio_selector_name = %[1]q + name = %[1]q + } + + video_descriptions { + name = "test-video-name" + } + + output_groups { + output_group_settings { + hls_group_settings { + destination { + destination_ref_id = %[1]q + } + } + } + + outputs { + output_name = "test-output-name" + video_description_name = "test-video-name" + audio_description_names = [%[1]q] + output_settings { + hls_output_settings { + name_modifier = "_1" + h265_packaging_type = "HVC1" + hls_settings { + standard_hls_settings { + m3u8_settings { + audio_frames_per_pes = 4 + } + } + } + } + } + } + } + } +} +`, rName)) +} + func testAccChannelConfig_update(rName, codec, inputResolution string) string { return acctest.ConfigCompose( testAccChannelBaseConfig(rName), diff --git a/internal/service/medialive/schemas.go b/internal/service/medialive/schemas.go index 295e79ae426..eb3d609a1e6 100644 --- a/internal/service/medialive/schemas.go +++ b/internal/service/medialive/schemas.go @@ -1,6 +1,8 @@ package medialive -import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) func destinationSchema() *schema.Schema { return &schema.Schema{ @@ -45,3 +47,29 @@ func restartDelaySchema() *schema.Schema { Optional: true, } } + +func inputLocationSchema() *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "uri": { + Type: schema.TypeString, + Required: true, + }, + "password_param": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "username": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + }, + } +} diff --git a/website/docs/r/medialive_channel.html.markdown b/website/docs/r/medialive_channel.html.markdown index 11fd522832b..778916ed584 100644 --- a/website/docs/r/medialive_channel.html.markdown +++ b/website/docs/r/medialive_channel.html.markdown @@ -127,6 +127,7 @@ The following arguments are optional: * `output_groups` - (Required) Output groups for the channel. See [Output Groups](#output-groups) for more details. * `timecode_config` - (Required) Contains settings used to acquire and adjust timecode information from inputs. See [Timecode Config](#timecode-config) for more details. * `video_descriptions` - (Required) Video Descriptions. See [Video Descriptions](#video-descriptions) for more details. +* `avail_blanking` - (Optional) Settings for ad avail blanking. See [Avail Blanking](#avail-blanking) for more details. ### Input Attachments @@ -137,11 +138,38 @@ The following arguments are optional: ### Input Settings * `audio_selectors` - (Optional) Used to select the audio stream to decode for inputs that have multiple. See [Audio Selectors](#audio-selectors) for more details. +* `caption_selectors` - (Optional) Used to select the caption input to use for inputs that have multiple available. See [Caption Selectors](#caption-selectors) for more details. +* `deblock_filter` - (Optional) Enable or disable the deblock filter when filtering. +* `denoise_filter` - (Optional) Enable or disable the denoise filter when filtering. +* `filter_strength` - (Optional) Adjusts the magnitude of filtering from 1 (minimal) to 5 (strongest). +* `input_filter` - (Optional) Turns on the filter for the input. +* `network_input_settings` - (Optional) Input settings. See [Network Input Settings](#network-input-settings) for more details. +* `scte35_pid` - (Optional) PID from which to read SCTE-35 messages. +* `smpte2038_data_preference` - (Optional) Specifies whether to extract applicable ancillary data from a SMPTE-2038 source in the input. +* `source_end_behavior` - (Optional) Loop input if it is a file. ### Audio Selectors * `name` - (Required) The name of the audio selector. +### Caption Selectors + +* `name` - (Optional) The name of the caption selector. +* `language_code` - (Optional) When specified this field indicates the three letter language code of the caption track to extract from the source. + +### Network Input Settings + +* `hls_input_settings` - (Optional) Specifies HLS input settings when the uri is for a HLS manifest. See [HLS Input Settings](#hls-input-settings) for more details. +* `server_validation` - (Optional) Check HTTPS server certificates. + +### HLS Input Settings + +* `bandwidth` - (Optional) The bitrate is specified in bits per second, as in an HLS manifest. +* `buffer_segments` - (Optional) Buffer segments. +* `retries` - (Optional) The number of consecutive times that attempts to read a manifest or segment must fail before the input is considered unavailable. +* `retry_interval` - (Optional) The number of seconds between retries when an attempt to read a manifest or segment fails. +* `scte35_source_type` - (Optional) Identifies the source for the SCTE-35 messages that MediaLive will ingest. + ### Maintenance * `maintenance_day` - (Optional) The day of the week to use for maintenance. @@ -171,6 +199,7 @@ The following arguments are optional: * `audio_type` - (Optional) Applies only if audioTypeControl is useConfigured. The values for audioType are defined in ISO-IEC 13818-1. * `audio_type_control` - (Optional) Determined how audio type is determined. * `audio_watermark_settings` - (Optional) Settings to configure one or more solutions that insert audio watermarks in the audio encode. See [Audio Watermark Settings](#audio-watermark-settings) for more details. +* `codec_settings` - (Optional) Audio codec settings. See [Audio Codec Settings](#audio-codec-settings) for more details. ### Audio Normalization Settings @@ -182,6 +211,53 @@ The following arguments are optional: * `nielsen_watermark_settings` - (Optional) Settings to configure Nielsen Watermarks in the audio encode. See [Nielsen Watermark Settings](#nielsen-watermark-settings) for more details. +### Audio Codec Settings + +* `aac_settings` - (Optional) Aac Settings. See [AAC Settings](#aac-settings) for more details. +* `ac3_settings` - (Optional) Ac3 Settings. See [AC3 Settings](#ac3-settings) for more details. +* `eac3_atmos_settings` - (Optional) - Eac3 Atmos Settings. See [EAC3 Atmos Settings](#eac3-atmos-settings) +* `eac3_settings` - (Optional) - Eac3 Settings. See [EAC3 Settings](#eac3-settings) + +### AAC Settings + +* `bitrate` - (Optional) Average bitrate in bits/second. +* `coding_mode` - (Optional) Mono, Stereo, or 5.1 channel layout. +* `input_type` - (Optional) Set to "broadcasterMixedAd" when input contains pre-mixed main audio + AD (narration) as a stereo pair. +* `profile` - (Optional) AAC profile. +* `rate_control_mode` - (Optional) The rate control mode. +* `raw_format` - (Optional) Sets LATM/LOAS AAC output for raw containers. +* `sample_rate` - (Optional) Sample rate in Hz. +* `spec` - (Optional) Use MPEG-2 AAC audio instead of MPEG-4 AAC audio for raw or MPEG-2 Transport Stream containers. +* `vbr_quality` - (Optional) VBR Quality Level - Only used if rateControlMode is VBR. + +### AC3 Settings + +* `bitrate` - (Optional) Average bitrate in bits/second. +* `bitstream_mode` - (Optional) Specifies the bitstream mode (bsmod) for the emitted AC-3 stream. +* `coding_mode` - (Optional) Dolby Digital coding mode. +* `dialnorm` - (Optional) Sets the dialnorm of the output. +* `drc_profile` - (Optional) If set to filmStandard, adds dynamic range compression signaling to the output bitstream as defined in the Dolby Digital specification. +* `lfe_filter` - (Optional) When set to enabled, applies a 120Hz lowpass filter to the LFE channel prior to encoding. +* `metadata_control` - (Optional) Metadata control. + +### EAC3 Atmos Settings + +* `bitrate` - (Optional) Average bitrate in bits/second. +* `coding_mode` - (Optional) Dolby Digital Plus with dolby Atmos coding mode. +* `dialnorm` - (Optional) Sets the dialnorm for the output. +* `drc_line` - (Optional) Sets the Dolby dynamic range compression profile. +* `drc_line` - (Optional) Sets the Dolby dynamic range compression profile. +* `drc_rf` - (Optional) Sets the profile for heavy Dolby dynamic range compression. +* `height_trim` - (Optional) Height dimensional trim. +* `surround_trim` - (Optional) Surround dimensional trim. + +### EAC3 Settings + +* `attenuation_control` - (Optional) Sets the attenuation control. +* `bitrate` - (Optional) Average bitrate in bits/second. +* `bitstream_mode` - (Optional) Specifies the bitstream mode (bsmod) for the emitted AC-3 stream. +* `coding_mode` - (Optional) Dolby Digital Plus coding mode. + ### Nielsen Watermark Settings * `nielsen_cbet_settings` - (Optional) Used to insert watermarks of type Nielsen CBET. See [Nielsen CBET Settings](#nielsen-cbet-settings) for more details. @@ -228,12 +304,87 @@ The following arguments are optional: ### Video Descriptions +* `name` - (Required) The name of the video description. +* `codec_settings` - (Optional) The video codec settings. See [Video Codec Settings](#video-codec-settings) for more details. * `height` - Output video height in pixels. * `respond_to_afd` - (Optional) Indicate how to respond to the AFD values that might be in the input video. * `scaling_behavior` - (Optional) Behavior on how to scale. * `sharpness` - (Optional) Changes the strength of the anti-alias filter used for scaling. * `width` - (Optional) Output video width in pixels. +### Video Codec Settings + +* `frame_capture_settings` - (Optional) Frame capture settings. See [Frame Capture Settings](#frame-capture-settings) for more details. +* `h264_settings` - (Optional) H264 settings. See [H264 Settings](#h264-settings) for more details. + +### Frame Capture Settings + +* `capture_interval` - (Optional) The frequency at which to capture frames for inclusion in the output. +* `capture_interval_units` - (Optional) Unit for the frame capture interval. + +### H264 Settings + +* `adaptive_quantization` - (Optional) Enables or disables adaptive quantization. +* `afd_signaling` - (Optional) Indicates that AFD values will be written into the output stream. +* `bitrate` - (Optional) Average bitrate in bits/second. +* `buf_fil_pct` - (Optional) Percentage of the buffer that should initially be filled. +* `buf_size` - (Optional) Size of buffer in bits. +* `color_metadata` - (Optional) Includes color space metadata in the output. +* `entropy_encoding` - (Optional) Entropy encoding mode. +* `filter_settings` - (Optional) Filters to apply to an encode. See [H264 Filter Settings](#h264-filter-settings) for more details. +* `fixed_afd` - (Optional) Four bit AFD value to write on all frames of video in the output stream. +* `flicer_aq` - (Optional) Makes adjustments within each frame to reduce flicker on the I-frames. +* `force_field_pictures` - (Optional) Controls whether coding is performed on a field basis or on a frame basis. +* `framerate_control` - (Optional) Indicates how the output video frame rate is specified. +* `framerate_denominator` - (Optional) Framerate denominator. +* `framerate_numerator` - (Optional) Framerate numerator. +* `gop_b_reference` - (Optional) GOP-B reference. +* `gop_closed_cadence` - (Optional) Frequency of closed GOPs. +* `gop_num_b_frames` - (Optional) Number of B-frames between reference frames. +* `gop_size` - (Optional) GOP size in units of either frames of seconds per `gop_size_units`. +* `gop_size_units` - (Optional) Indicates if the `gop_size` is specified in frames or seconds. +* `level` - (Optional) H264 level. +* `look_ahead_rate_control` - (Optional) Amount of lookahead. +* `max_bitrate` - (Optional) Set the maximum bitrate in order to accommodate expected spikes in the complexity of the video. +* `min_interval` - (Optional) Min interval. +* `num_ref_frames` - (Optional) Number of reference frames to use. +* `par_control` - (Optional) Indicates how the output pixel aspect ratio is specified. +* `par_denominator` - (Optional) Pixel Aspect Ratio denominator. +* `par_numerator` - (Optional) Pixel Aspect Ratio numerator. +* `profile` - (Optional) H264 profile. +* `quality_level` - (Optional) Quality level. +* `qvbr_quality_level` - (Optional) Controls the target quality for the video encode. +* `rate_control_mode` - (Optional) Rate control mode. +* `scan_type` - (Optional) Sets the scan type of the output. +* `scene_change_detect` - (Optional) Scene change detection. +* `slices` - (Optional) Number of slices per picture. +* `softness` - (Optional) Softness. +* `spatial_aq` - (Optional) Makes adjustments within each frame based on spatial variation of content complexity. +* `subgop_length` - (Optional) Subgop length. +* `syntax` - (Optional) Produces a bitstream compliant with SMPTE RP-2027. +* `temporal_aq` - (Optional) Makes adjustments within each frame based on temporal variation of content complexity. +* `timecode_insertion` - (Optional) Determines how timecodes should be inserted into the video elementary stream. + +### H264 Filter Settings + +* `temporal_filter_settings` - (Optional) Temporal filter settings. See [Temporal Filter Settings](#temporal-filter-settings) + +### Temporal Filter Settings + +* `post_filter_sharpening` - (Optional) Post filter sharpening. +* `strength` - (Optional) Filter strength. + +### Avail Blanking + +* `avail_blanking_image` - (Optional) Blanking image to be used. See [Avail Blanking Image](#avail-blanking-image) for more details. +* `state` - (Optional) When set to enabled, causes video, audio and captions to be blanked when insertion metadata is added. + +### Avail Blanking Image + +* `uri` - (Required) Path to a file accessible to the live stream. +* `password_param` - (Optional) Key used to extract the password from EC2 Parameter store. +* `username` - (Optional). Username to be used. + ### Archive Group Settings * `destination` - (Required) A director and base filename where archive files should be written. See [Destination](#destination) for more details.