/
deployments.go
44 lines (34 loc) · 1.69 KB
/
deployments.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
41
42
43
44
package resources
//go:generate mockgen -destination=../../../util/mocks/mock_azureclient/mock_$GOPACKAGE/$GOPACKAGE.go github.com/openshift/openshift-azure/pkg/util/azureclient/$GOPACKAGE DeploymentOperationsClient,DeploymentsClient,GroupsClient
//go:generate gofmt -s -l -w ../../../util/mocks/mock_azureclient/mock_$GOPACKAGE/$GOPACKAGE.go
//go:generate goimports -local=github.com/openshift/openshift-azure -e -w ../../../util/mocks/mock_azureclient/mock_$GOPACKAGE/$GOPACKAGE.go
import (
"context"
"time"
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources"
"github.com/Azure/go-autorest/autorest"
"github.com/sirupsen/logrus"
"github.com/openshift/openshift-azure/pkg/util/azureclient"
)
// DeploymentsClient is a minimal interface for azure DeploymentsClient
type DeploymentsClient interface {
CreateOrUpdate(ctx context.Context, resourceGroupName string, deploymentName string, parameters resources.Deployment) (result resources.DeploymentsCreateOrUpdateFuture, err error)
azureclient.Client
DeploymentsClientAddons
}
type deploymentsClient struct {
resources.DeploymentsClient
}
var _ DeploymentsClient = &deploymentsClient{}
// NewDeploymentsClient creates a new DeploymentsClient
func NewDeploymentsClient(ctx context.Context, log *logrus.Entry, subscriptionID string, authorizer autorest.Authorizer) DeploymentsClient {
client := resources.NewDeploymentsClient(subscriptionID)
azureclient.SetupClient(ctx, log, "resources.DeploymentsClient", &client.Client, authorizer)
client.PollingDuration = 30 * time.Minute
return &deploymentsClient{
DeploymentsClient: client,
}
}
func (c *deploymentsClient) Client() autorest.Client {
return c.DeploymentsClient.Client
}