-
Notifications
You must be signed in to change notification settings - Fork 165
/
resourcegroups.go
40 lines (31 loc) · 1.42 KB
/
resourcegroups.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package features
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"context"
"time"
mgmtfeatures "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-07-01/features"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/ARO-RP/pkg/util/azureclient"
)
// ResourceGroupsClient is a minimal interface for azure ResourceGroupsClient
type ResourceGroupsClient interface {
Get(ctx context.Context, resourceGroupName string) (result mgmtfeatures.ResourceGroup, err error)
CreateOrUpdate(ctx context.Context, resourceGroupName string, parameters mgmtfeatures.ResourceGroup) (result mgmtfeatures.ResourceGroup, err error)
Delete(ctx context.Context, resourceGroupName string) (result mgmtfeatures.ResourceGroupsDeleteFuture, err error)
ResourceGroupsClientAddons
}
type resourceGroupsClient struct {
mgmtfeatures.ResourceGroupsClient
}
var _ ResourceGroupsClient = &resourceGroupsClient{}
// NewResourceGroupsClient creates a new ResourceGroupsClient
func NewResourceGroupsClient(environment *azureclient.AROEnvironment, subscriptionID string, authorizer autorest.Authorizer) ResourceGroupsClient {
client := mgmtfeatures.NewResourceGroupsClientWithBaseURI(environment.ResourceManagerEndpoint, subscriptionID)
client.Authorizer = authorizer
client.PollingDelay = 10 * time.Second
client.PollingDuration = time.Hour
return &resourceGroupsClient{
ResourceGroupsClient: client,
}
}