Skip to content

Commit

Permalink
Merge pull request #35738 from hashicorp/f-medialive_hslgroupsettings
Browse files Browse the repository at this point in the history
r/medialive_channel: add `client_cache` to HLS group settings
  • Loading branch information
johnsonaj authored Feb 9, 2024
2 parents da9ea00 + d3c3e47 commit 0a329df
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .changelog/35738.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_medialive_channel: Added `client_cache` to `hls_group_settings`.
```
28 changes: 16 additions & 12 deletions internal/service/medialive/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/hashicorp/terraform-provider-aws/internal/conns"
"github.com/hashicorp/terraform-provider-aws/internal/create"
"github.com/hashicorp/terraform-provider-aws/internal/enum"
"github.com/hashicorp/terraform-provider-aws/internal/errs"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
Expand Down Expand Up @@ -958,6 +959,10 @@ func resourceChannelDelete(ctx context.Context, d *schema.ResourceData, meta int

channel, err := FindChannelByID(ctx, conn, d.Id())

if tfresource.NotFound(err) {
return diags
}

if err != nil {
return create.AppendDiagError(diags, names.MediaLive, create.ErrActionDeleting, ResNameChannel, d.Id(), err)
}
Expand All @@ -972,12 +977,11 @@ func resourceChannelDelete(ctx context.Context, d *schema.ResourceData, meta int
ChannelId: aws.String(d.Id()),
})

if err != nil {
var nfe *types.NotFoundException
if errors.As(err, &nfe) {
return diags
}
if errs.IsA[*types.NotFoundException](err) {
return diags
}

if err != nil {
return create.AppendDiagError(diags, names.MediaLive, create.ErrActionDeleting, ResNameChannel, d.Id(), err)
}

Expand Down Expand Up @@ -1128,15 +1132,15 @@ func FindChannelByID(ctx context.Context, conn *medialive.Client, id string) (*m
ChannelId: aws.String(id),
}
out, err := conn.DescribeChannel(ctx, in)
if err != nil {
var nfe *types.NotFoundException
if errors.As(err, &nfe) {
return nil, &retry.NotFoundError{
LastError: err,
LastRequest: in,
}

if errs.IsA[*types.NotFoundException](err) {
return nil, &retry.NotFoundError{
LastError: err,
LastRequest: in,
}
}

if err != nil {
return nil, err
}

Expand Down
3 changes: 3 additions & 0 deletions internal/service/medialive/channel_encoder_settings_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -3697,6 +3697,9 @@ func expandHLSGroupSettings(tfList []interface{}) *types.HlsGroupSettings {
if v, ok := m["caption_language_setting"].(string); ok && v != "" {
out.CaptionLanguageSetting = types.HlsCaptionLanguageSetting(v)
}
if v, ok := m["client_cache"].(string); ok && v != "" {
out.ClientCache = types.HlsClientCache(v)
}
if v, ok := m["codec_specification"].(string); ok && v != "" {
out.CodecSpecification = types.HlsCodecSpecification(v)
}
Expand Down
2 changes: 2 additions & 0 deletions internal/service/medialive/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ func TestAccMediaLiveChannel_hls(t *testing.T) {
"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"),
resource.TestCheckResourceAttr(resourceName, "encoder_settings.0.output_groups.0.output_group_settings.0.hls_group_settings.0.client_cache", "ENABLED"),
),
},
},
Expand Down Expand Up @@ -1774,6 +1775,7 @@ resource "aws_medialive_channel" "test" {
destination {
destination_ref_id = %[1]q
}
client_cache = "ENABLED"
}
}
Expand Down

0 comments on commit 0a329df

Please sign in to comment.