-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK2: Replace SDK to new one in util/cluster (#3884)
* add subnets.List * remove deprecated nsg & subnets client from util/cluster * add routetable client * remove deprecated route tables client from util/cluster * add virtual network peerings client * remove deprecated virtual network peerings from util/cluster * remove the rest usage of mgmt network sdk * remove unused sdk wrappers
- Loading branch information
Showing
13 changed files
with
217 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package armnetwork | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the Apache License 2.0. | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" | ||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" | ||
|
||
"github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/azcore" | ||
) | ||
|
||
// RouteTablesClient is a minimal interface for azure RouteTablesClient | ||
type RouteTablesClient interface { | ||
Get(ctx context.Context, resourceGroupName string, routeTableName string, options *armnetwork.RouteTablesClientGetOptions) (result armnetwork.RouteTablesClientGetResponse, err error) | ||
RouteTablesClientAddons | ||
} | ||
|
||
type routeTablesClient struct { | ||
*armnetwork.RouteTablesClient | ||
} | ||
|
||
// NewRouteTablesClient creates a new RouteTablesClient | ||
func NewRouteTablesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (RouteTablesClient, error) { | ||
clientFactory, err := armnetwork.NewClientFactory(subscriptionID, credential, options) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &routeTablesClient{clientFactory.NewRouteTablesClient()}, err | ||
} |
24 changes: 24 additions & 0 deletions
24
pkg/util/azureclient/azuresdk/armnetwork/routetable_addons.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package armnetwork | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the Apache License 2.0. | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" | ||
) | ||
|
||
// RouteTablesClientAddons contains addons for RouteTablesClient | ||
type RouteTablesClientAddons interface { | ||
DeleteAndWait(ctx context.Context, resourceGroupName string, routeTableName string, options *armnetwork.RouteTablesClientBeginDeleteOptions) error | ||
} | ||
|
||
func (c *routeTablesClient) DeleteAndWait(ctx context.Context, resourceGroupName string, routeTableName string, options *armnetwork.RouteTablesClientBeginDeleteOptions) error { | ||
poller, err := c.RouteTablesClient.BeginDelete(ctx, resourceGroupName, routeTableName, options) | ||
if err != nil { | ||
return err | ||
} | ||
_, err = poller.PollUntilDone(ctx, nil) | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
pkg/util/azureclient/azuresdk/armnetwork/virtualnetworkpeerings.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package armnetwork | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the Apache License 2.0. | ||
|
||
import ( | ||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" | ||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" | ||
|
||
"github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/azcore" | ||
) | ||
|
||
type VirtualNetworkPeeringsClient interface { | ||
VirtualNetworkPeeringsAddons | ||
} | ||
|
||
type virtualNetworkPeeringsClient struct { | ||
*armnetwork.VirtualNetworkPeeringsClient | ||
} | ||
|
||
// NewVirtualNetworkPeeringsClient creates a new VirtualNetworkPeeringsClient | ||
func NewVirtualNetworkPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (VirtualNetworkPeeringsClient, error) { | ||
clientFactory, err := armnetwork.NewClientFactory(subscriptionID, credential, options) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &virtualNetworkPeeringsClient{clientFactory.NewVirtualNetworkPeeringsClient()}, err | ||
} |
33 changes: 33 additions & 0 deletions
33
pkg/util/azureclient/azuresdk/armnetwork/virtualnetworkpeerings_addons.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package armnetwork | ||
|
||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the Apache License 2.0. | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" | ||
) | ||
|
||
type VirtualNetworkPeeringsAddons interface { | ||
CreateOrUpdateAndWait(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters armnetwork.VirtualNetworkPeering, options *armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions) (err error) | ||
DeleteAndWait(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, options *armnetwork.VirtualNetworkPeeringsClientBeginDeleteOptions) (err error) | ||
} | ||
|
||
func (c *virtualNetworkPeeringsClient) CreateOrUpdateAndWait(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters armnetwork.VirtualNetworkPeering, options *armnetwork.VirtualNetworkPeeringsClientBeginCreateOrUpdateOptions) (err error) { | ||
poller, err := c.VirtualNetworkPeeringsClient.BeginCreateOrUpdate(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options) | ||
if err != nil { | ||
return err | ||
} | ||
_, err = poller.PollUntilDone(ctx, nil) | ||
return err | ||
} | ||
|
||
func (c *virtualNetworkPeeringsClient) DeleteAndWait(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, options *armnetwork.VirtualNetworkPeeringsClientBeginDeleteOptions) (err error) { | ||
poller, err := c.VirtualNetworkPeeringsClient.BeginDelete(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) | ||
if err != nil { | ||
return err | ||
} | ||
_, err = poller.PollUntilDone(ctx, nil) | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
50 changes: 0 additions & 50 deletions
50
pkg/util/azureclient/mgmt/network/securitygroups_addons.go
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
pkg/util/azureclient/mgmt/network/virtualnetworkpeerings.go
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
pkg/util/azureclient/mgmt/network/virtualnetworkpeerings_addons.go
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.