Skip to content

Commit

Permalink
Merge pull request #20457 from hashicorp/refactor/media-remove-swagge…
Browse files Browse the repository at this point in the history
…r-workaround

media: refactoring to use API Version 2022-08-01 for `StreamingEndpoints`
  • Loading branch information
tombuildsstuff authored Feb 14, 2023
2 parents 51b143b + 739928e commit 60dc3d5
Show file tree
Hide file tree
Showing 336 changed files with 8 additions and 20,643 deletions.
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

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 60dc3d5

Please sign in to comment.