-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
client.go
36 lines (29 loc) · 1.03 KB
/
client.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
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package client
import (
"fmt"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/devices"
"github.com/hashicorp/go-azure-sdk/resource-manager/databoxedge/2022-03-01/orders"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)
type Client struct {
DeviceClient *devices.DevicesClient
OrdersClient *orders.OrdersClient
}
func NewClient(o *common.ClientOptions) (*Client, error) {
deviceClient, err := devices.NewDevicesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Devices client: %+v", err)
}
o.Configure(deviceClient.Client, o.Authorizers.ResourceManager)
ordersClient, err := orders.NewOrdersClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Orders client: %+v", err)
}
o.Configure(ordersClient.Client, o.Authorizers.ResourceManager)
return &Client{
DeviceClient: deviceClient,
OrdersClient: ordersClient,
}, nil
}