-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
client.go
36 lines (29 loc) · 1.28 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/managedservices/2022-10-01/registrationassignments"
"github.com/hashicorp/go-azure-sdk/resource-manager/managedservices/2022-10-01/registrationdefinitions"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
)
type Client struct {
AssignmentsClient *registrationassignments.RegistrationAssignmentsClient
DefinitionsClient *registrationdefinitions.RegistrationDefinitionsClient
}
func NewClient(o *common.ClientOptions) (*Client, error) {
assignmentsClient, err := registrationassignments.NewRegistrationAssignmentsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building RegistrationAssignments Client: %+v", err)
}
o.Configure(assignmentsClient.Client, o.Authorizers.ResourceManager)
definitionsClient, err := registrationdefinitions.NewRegistrationDefinitionsClientWithBaseURI(o.Environment.ResourceManager)
if err != nil {
return nil, fmt.Errorf("building RegistrationDefinitions Client: %+v", err)
}
o.Configure(definitionsClient.Client, o.Authorizers.ResourceManager)
return &Client{
AssignmentsClient: assignmentsClient,
DefinitionsClient: definitionsClient,
}, nil
}