-
Notifications
You must be signed in to change notification settings - Fork 46
/
client.go
127 lines (110 loc) · 5.16 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package v2021_09_03_preview
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See NOTICE.txt in the project root for license information.
import (
"fmt"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/application"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/applicationgroup"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/desktop"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/hostpool"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/msiximage"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/msixpackage"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/privatelink"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/scalingplan"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/sessionhost"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/startmenuitem"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/usersession"
"github.com/hashicorp/go-azure-sdk/resource-manager/desktopvirtualization/2021-09-03-preview/workspace"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)
type Client struct {
Application *application.ApplicationClient
ApplicationGroup *applicationgroup.ApplicationGroupClient
Desktop *desktop.DesktopClient
HostPool *hostpool.HostPoolClient
MSIXPackage *msixpackage.MSIXPackageClient
MsixImage *msiximage.MsixImageClient
PrivateLink *privatelink.PrivateLinkClient
ScalingPlan *scalingplan.ScalingPlanClient
SessionHost *sessionhost.SessionHostClient
StartMenuItem *startmenuitem.StartMenuItemClient
UserSession *usersession.UserSessionClient
Workspace *workspace.WorkspaceClient
}
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
applicationClient, err := application.NewApplicationClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Application client: %+v", err)
}
configureFunc(applicationClient.Client)
applicationGroupClient, err := applicationgroup.NewApplicationGroupClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ApplicationGroup client: %+v", err)
}
configureFunc(applicationGroupClient.Client)
desktopClient, err := desktop.NewDesktopClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Desktop client: %+v", err)
}
configureFunc(desktopClient.Client)
hostPoolClient, err := hostpool.NewHostPoolClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building HostPool client: %+v", err)
}
configureFunc(hostPoolClient.Client)
mSIXPackageClient, err := msixpackage.NewMSIXPackageClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building MSIXPackage client: %+v", err)
}
configureFunc(mSIXPackageClient.Client)
msixImageClient, err := msiximage.NewMsixImageClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building MsixImage client: %+v", err)
}
configureFunc(msixImageClient.Client)
privateLinkClient, err := privatelink.NewPrivateLinkClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building PrivateLink client: %+v", err)
}
configureFunc(privateLinkClient.Client)
scalingPlanClient, err := scalingplan.NewScalingPlanClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ScalingPlan client: %+v", err)
}
configureFunc(scalingPlanClient.Client)
sessionHostClient, err := sessionhost.NewSessionHostClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building SessionHost client: %+v", err)
}
configureFunc(sessionHostClient.Client)
startMenuItemClient, err := startmenuitem.NewStartMenuItemClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building StartMenuItem client: %+v", err)
}
configureFunc(startMenuItemClient.Client)
userSessionClient, err := usersession.NewUserSessionClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building UserSession client: %+v", err)
}
configureFunc(userSessionClient.Client)
workspaceClient, err := workspace.NewWorkspaceClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building Workspace client: %+v", err)
}
configureFunc(workspaceClient.Client)
return &Client{
Application: applicationClient,
ApplicationGroup: applicationGroupClient,
Desktop: desktopClient,
HostPool: hostPoolClient,
MSIXPackage: mSIXPackageClient,
MsixImage: msixImageClient,
PrivateLink: privateLinkClient,
ScalingPlan: scalingPlanClient,
SessionHost: sessionHostClient,
StartMenuItem: startMenuItemClient,
UserSession: userSessionClient,
Workspace: workspaceClient,
}, nil
}