Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media: refactoring to use API Version 2022-08-01 for StreamingEndpoints #20457

Merged
merged 4 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/google/go-cmp v0.5.9
github.com/google/uuid v1.1.2
github.com/hashicorp/go-azure-helpers v0.51.0
github.com/hashicorp/go-azure-sdk v0.20230213.1235936
github.com/hashicorp/go-azure-sdk v0.20230214.1122756
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/go-version v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv
github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg=
github.com/hashicorp/go-azure-helpers v0.51.0 h1:8KSDGkGnWH6zOT60R3KUqsi0fk1vA7AMunaOUJZMM6k=
github.com/hashicorp/go-azure-helpers v0.51.0/go.mod h1:lsykLR4KjTUO7MiRmNWiTiX8QQtw3ILjyOvT0f5h3rw=
github.com/hashicorp/go-azure-sdk v0.20230213.1235936 h1:JEqzFbmnkTZZrIIs5ZxIi4gY6oMF43zbo8+315qmbPs=
github.com/hashicorp/go-azure-sdk v0.20230213.1235936/go.mod h1:aHinadEuBi04I1i+yvpPMZUxvxRxl5JgBOwlzIIxozU=
github.com/hashicorp/go-azure-sdk v0.20230214.1122756 h1:5cRwmNR2QwATfmnsWe8HQJcxbm8tyyjuE2MK2YTzk8Q=
github.com/hashicorp/go-azure-sdk v0.20230214.1122756/go.mod h1:aHinadEuBi04I1i+yvpPMZUxvxRxl5JgBOwlzIIxozU=
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
Expand Down
7 changes: 0 additions & 7 deletions internal/services/media/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@ package client

import (
"github.com/Azure/go-autorest/autorest"
mediaV20200501 "github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01"
mediaV20211101 "github.com/hashicorp/go-azure-sdk/resource-manager/media/2021-11-01"
mediaV20220801 "github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)

type Client struct {
V20200501Client *mediaV20200501.Client
V20211101Client *mediaV20211101.Client
V20220801Client *mediaV20220801.Client
}

func NewClient(o *common.ClientOptions) *Client {
V20200501Client := mediaV20200501.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) {
c.Authorizer = o.ResourceManagerAuthorizer
})

V20211101Client := mediaV20211101.NewClientWithBaseURI(o.ResourceManagerEndpoint, func(c *autorest.Client) {
c.Authorizer = o.ResourceManagerAuthorizer
})
Expand All @@ -28,7 +22,6 @@ func NewClient(o *common.ClientOptions) *Client {
})

return &Client{
V20200501Client: &V20200501Client,
V20211101Client: &V20211101Client,
V20220801Client: &V20220801Client,
}
Expand Down
10 changes: 5 additions & 5 deletions internal/services/media/media_streaming_endpoint_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints"
"github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/media/migration"
Expand Down Expand Up @@ -219,7 +219,7 @@ func resourceMediaStreamingEndpoint() *pluginsdk.Resource {

func resourceMediaStreamingEndpointCreate(d *pluginsdk.ResourceData, meta interface{}) error {
subscriptionId := meta.(*clients.Client).Account.SubscriptionId
client := meta.(*clients.Client).Media.V20200501Client.StreamingEndpoints
client := meta.(*clients.Client).Media.V20220801Client.StreamingEndpoints
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down Expand Up @@ -294,7 +294,7 @@ func resourceMediaStreamingEndpointCreate(d *pluginsdk.ResourceData, meta interf
}

func resourceMediaStreamingEndpointUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Media.V20200501Client.StreamingEndpoints
client := meta.(*clients.Client).Media.V20220801Client.StreamingEndpoints
ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down Expand Up @@ -367,7 +367,7 @@ func resourceMediaStreamingEndpointUpdate(d *pluginsdk.ResourceData, meta interf
}

func resourceMediaStreamingEndpointRead(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Media.V20200501Client.StreamingEndpoints
client := meta.(*clients.Client).Media.V20220801Client.StreamingEndpoints
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down Expand Up @@ -429,7 +429,7 @@ func resourceMediaStreamingEndpointRead(d *pluginsdk.ResourceData, meta interfac
}

func resourceMediaStreamingEndpointDelete(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).Media.V20200501Client.StreamingEndpoints
client := meta.(*clients.Client).Media.V20220801Client.StreamingEndpoints
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d)
defer cancel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/hashicorp/go-azure-sdk/resource-manager/media/2020-05-01/streamingendpoints"
"github.com/hashicorp/go-azure-sdk/resource-manager/media/2022-08-01/streamingendpoints"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
Expand Down Expand Up @@ -97,7 +97,7 @@ func (r MediaStreamingEndpointResource) Start(ctx context.Context, client *clien
return err
}

if err := client.Media.V20200501Client.StreamingEndpoints.StartThenPoll(ctx, *id); err != nil {
if err := client.Media.V20220801Client.StreamingEndpoints.StartThenPoll(ctx, *id); err != nil {
return fmt.Errorf("starting %s: %+v", id, err)
}

Expand All @@ -110,7 +110,7 @@ func (MediaStreamingEndpointResource) Exists(ctx context.Context, clients *clien
return nil, err
}

resp, err := clients.Media.V20200501Client.StreamingEndpoints.Get(ctx, *id)
resp, err := clients.Media.V20220801Client.StreamingEndpoints.Get(ctx, *id)
if err != nil {
return nil, fmt.Errorf("retrieving %s: %v", id.String(), err)
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

This file was deleted.

This file was deleted.

Loading