-
Notifications
You must be signed in to change notification settings - Fork 165
/
operations.go
48 lines (39 loc) · 1.43 KB
/
operations.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
45
46
47
48
package redhatopenshift
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"crypto/tls"
"net/http"
"github.com/Azure/go-autorest/autorest"
mgmtredhatopenshift20210901preview "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2021-09-01-preview/redhatopenshift"
"github.com/Azure/ARO-RP/pkg/env"
"github.com/Azure/ARO-RP/pkg/util/azureclient"
)
// OperationsClient is a minimal interface for azure OperationsClient
type OperationsClient interface {
OperationsClientAddons
}
type operationsClient struct {
mgmtredhatopenshift20210901preview.OperationsClient
}
var _ OperationsClient = &operationsClient{}
// NewOperationsClient creates a new OperationsClient
func NewOperationsClient(environment *azureclient.AROEnvironment, subscriptionID string, authorizer autorest.Authorizer) OperationsClient {
var client mgmtredhatopenshift20210901preview.OperationsClient
if env.IsLocalDevelopmentMode() {
client = mgmtredhatopenshift20210901preview.NewOperationsClientWithBaseURI("https://localhost:8443", subscriptionID)
client.Sender = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}
} else {
client = mgmtredhatopenshift20210901preview.NewOperationsClientWithBaseURI(environment.ResourceManagerEndpoint, subscriptionID)
client.Authorizer = authorizer
}
return &operationsClient{
OperationsClient: client,
}
}