/
datalake.go
36 lines (30 loc) · 1.64 KB
/
datalake.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
//go:generate mockgen -destination=./mocks/datalake.go -package=mocks . DataLakeStorageAccountsClient,DataLakeAnalyticsAccountsClient
package services
import (
"context"
"github.com/Azure/azure-sdk-for-go/profiles/latest/datalake/analytics/mgmt/account"
storeAccount "github.com/Azure/azure-sdk-for-go/profiles/latest/datalake/store/mgmt/account"
"github.com/Azure/go-autorest/autorest"
)
type DataLakeClient struct {
DataLakeStorageAccounts DataLakeStorageAccountsClient
DataLakeAnalyticsAccounts DataLakeAnalyticsAccountsClient
}
type DataLakeStorageAccountsClient interface {
List(ctx context.Context, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result storeAccount.DataLakeStoreAccountListResultPage, err error)
Get(ctx context.Context, resourceGroupName string, accountName string) (result storeAccount.DataLakeStoreAccount, err error)
}
type DataLakeAnalyticsAccountsClient interface {
List(ctx context.Context, filter string, top *int32, skip *int32, selectParameter string, orderby string, count *bool) (result account.DataLakeAnalyticsAccountListResultPage, err error)
Get(ctx context.Context, resourceGroupName string, accountName string) (result account.DataLakeAnalyticsAccount, err error)
}
func NewDataLakeClient(subscriptionId string, auth autorest.Authorizer) DataLakeClient {
storeAccounts := storeAccount.NewAccountsClient(subscriptionId)
storeAccounts.Authorizer = auth
analyticsAccounts := account.NewAccountsClient(subscriptionId)
analyticsAccounts.Authorizer = auth
return DataLakeClient{
DataLakeStorageAccounts: storeAccounts,
DataLakeAnalyticsAccounts: analyticsAccounts,
}
}