-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
client.go
45 lines (37 loc) · 1.67 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
37
38
39
40
41
42
43
44
45
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package client
import (
"fmt"
"github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-10-01/datastore"
"github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-10-01/machinelearningcomputes"
"github.com/hashicorp/go-azure-sdk/resource-manager/machinelearningservices/2023-10-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)
type Client struct {
Datastore *datastore.DatastoreClient
MachineLearningComputes *machinelearningcomputes.MachineLearningComputesClient
Workspaces *workspaces.WorkspacesClient
}
func NewClient(o *common.ClientOptions) (*Client, error) {
datastoreClient, err := datastore.NewDatastoreClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Datastore client: %+v", err)
}
o.Configure(datastoreClient.Client, o.Authorizers.ResourceManager)
workspacesClient, err := workspaces.NewWorkspacesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building Workspaces client: %+v", err)
}
o.Configure(workspacesClient.Client, o.Authorizers.ResourceManager)
computesClient, err := machinelearningcomputes.NewMachineLearningComputesClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building MachineLearningComputes client: %+v", err)
}
o.Configure(computesClient.Client, o.Authorizers.ResourceManager)
return &Client{
MachineLearningComputes: computesClient,
Datastore: datastoreClient,
Workspaces: workspacesClient,
}, nil
}