-
Notifications
You must be signed in to change notification settings - Fork 46
/
client.go
109 lines (94 loc) · 4.85 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
package v2022_12_01
// 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/dataprotection/2022-12-01/azurebackupjob"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/azurebackupjobs"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/backupinstances"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/backuppolicies"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/backupvaults"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/deletedbackupinstances"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/dppfeaturesupport"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/findrestorabletimeranges"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/recoverypoint"
"github.com/hashicorp/go-azure-sdk/resource-manager/dataprotection/2022-12-01/resourceguards"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments"
)
type Client struct {
AzureBackupJob *azurebackupjob.AzureBackupJobClient
AzureBackupJobs *azurebackupjobs.AzureBackupJobsClient
BackupInstances *backupinstances.BackupInstancesClient
BackupPolicies *backuppolicies.BackupPoliciesClient
BackupVaults *backupvaults.BackupVaultsClient
DeletedBackupInstances *deletedbackupinstances.DeletedBackupInstancesClient
DppFeatureSupport *dppfeaturesupport.DppFeatureSupportClient
FindRestorableTimeRanges *findrestorabletimeranges.FindRestorableTimeRangesClient
RecoveryPoint *recoverypoint.RecoveryPointClient
ResourceGuards *resourceguards.ResourceGuardsClient
}
func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) {
azureBackupJobClient, err := azurebackupjob.NewAzureBackupJobClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building AzureBackupJob client: %+v", err)
}
configureFunc(azureBackupJobClient.Client)
azureBackupJobsClient, err := azurebackupjobs.NewAzureBackupJobsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building AzureBackupJobs client: %+v", err)
}
configureFunc(azureBackupJobsClient.Client)
backupInstancesClient, err := backupinstances.NewBackupInstancesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building BackupInstances client: %+v", err)
}
configureFunc(backupInstancesClient.Client)
backupPoliciesClient, err := backuppolicies.NewBackupPoliciesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building BackupPolicies client: %+v", err)
}
configureFunc(backupPoliciesClient.Client)
backupVaultsClient, err := backupvaults.NewBackupVaultsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building BackupVaults client: %+v", err)
}
configureFunc(backupVaultsClient.Client)
deletedBackupInstancesClient, err := deletedbackupinstances.NewDeletedBackupInstancesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building DeletedBackupInstances client: %+v", err)
}
configureFunc(deletedBackupInstancesClient.Client)
dppFeatureSupportClient, err := dppfeaturesupport.NewDppFeatureSupportClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building DppFeatureSupport client: %+v", err)
}
configureFunc(dppFeatureSupportClient.Client)
findRestorableTimeRangesClient, err := findrestorabletimeranges.NewFindRestorableTimeRangesClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building FindRestorableTimeRanges client: %+v", err)
}
configureFunc(findRestorableTimeRangesClient.Client)
recoveryPointClient, err := recoverypoint.NewRecoveryPointClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building RecoveryPoint client: %+v", err)
}
configureFunc(recoveryPointClient.Client)
resourceGuardsClient, err := resourceguards.NewResourceGuardsClientWithBaseURI(sdkApi)
if err != nil {
return nil, fmt.Errorf("building ResourceGuards client: %+v", err)
}
configureFunc(resourceGuardsClient.Client)
return &Client{
AzureBackupJob: azureBackupJobClient,
AzureBackupJobs: azureBackupJobsClient,
BackupInstances: backupInstancesClient,
BackupPolicies: backupPoliciesClient,
BackupVaults: backupVaultsClient,
DeletedBackupInstances: deletedBackupInstancesClient,
DppFeatureSupport: dppFeatureSupportClient,
FindRestorableTimeRanges: findRestorableTimeRangesClient,
RecoveryPoint: recoveryPointClient,
ResourceGuards: resourceGuardsClient,
}, nil
}