forked from databricks/databricks-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
impl.go
executable file
·92 lines (76 loc) · 4.01 KB
/
impl.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
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package billing
import (
"context"
"fmt"
"net/http"
"github.com/xuxiaoshuo/databricks-sdk-go/client"
)
// unexported type that holds implementations of just BillableUsage API methods
type billableUsageImpl struct {
client *client.DatabricksClient
}
func (a *billableUsageImpl) Download(ctx context.Context, request DownloadRequest) error {
path := fmt.Sprintf("/api/2.0/accounts/%v/usage/download", a.client.ConfiguredAccountID())
err := a.client.Do(ctx, http.MethodGet, path, request, nil)
return err
}
// unexported type that holds implementations of just Budgets API methods
type budgetsImpl struct {
client *client.DatabricksClient
}
func (a *budgetsImpl) Create(ctx context.Context, request WrappedBudget) (*WrappedBudgetWithStatus, error) {
var wrappedBudgetWithStatus WrappedBudgetWithStatus
path := fmt.Sprintf("/api/2.0/accounts/%v/budget", a.client.ConfiguredAccountID())
err := a.client.Do(ctx, http.MethodPost, path, request, &wrappedBudgetWithStatus)
return &wrappedBudgetWithStatus, err
}
func (a *budgetsImpl) Delete(ctx context.Context, request DeleteBudgetRequest) error {
path := fmt.Sprintf("/api/2.0/accounts/%v/budget/%v", a.client.ConfiguredAccountID(), request.BudgetId)
err := a.client.Do(ctx, http.MethodDelete, path, request, nil)
return err
}
func (a *budgetsImpl) Get(ctx context.Context, request GetBudgetRequest) (*WrappedBudgetWithStatus, error) {
var wrappedBudgetWithStatus WrappedBudgetWithStatus
path := fmt.Sprintf("/api/2.0/accounts/%v/budget/%v", a.client.ConfiguredAccountID(), request.BudgetId)
err := a.client.Do(ctx, http.MethodGet, path, request, &wrappedBudgetWithStatus)
return &wrappedBudgetWithStatus, err
}
func (a *budgetsImpl) List(ctx context.Context) (*BudgetList, error) {
var budgetList BudgetList
path := fmt.Sprintf("/api/2.0/accounts/%v/budget", a.client.ConfiguredAccountID())
err := a.client.Do(ctx, http.MethodGet, path, nil, &budgetList)
return &budgetList, err
}
func (a *budgetsImpl) Update(ctx context.Context, request WrappedBudget) error {
path := fmt.Sprintf("/api/2.0/accounts/%v/budget/%v", a.client.ConfiguredAccountID(), request.BudgetId)
err := a.client.Do(ctx, http.MethodPatch, path, request, nil)
return err
}
// unexported type that holds implementations of just LogDelivery API methods
type logDeliveryImpl struct {
client *client.DatabricksClient
}
func (a *logDeliveryImpl) Create(ctx context.Context, request WrappedCreateLogDeliveryConfiguration) (*WrappedLogDeliveryConfiguration, error) {
var wrappedLogDeliveryConfiguration WrappedLogDeliveryConfiguration
path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery", a.client.ConfiguredAccountID())
err := a.client.Do(ctx, http.MethodPost, path, request, &wrappedLogDeliveryConfiguration)
return &wrappedLogDeliveryConfiguration, err
}
func (a *logDeliveryImpl) Get(ctx context.Context, request GetLogDeliveryRequest) (*WrappedLogDeliveryConfiguration, error) {
var wrappedLogDeliveryConfiguration WrappedLogDeliveryConfiguration
path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery/%v", a.client.ConfiguredAccountID(), request.LogDeliveryConfigurationId)
err := a.client.Do(ctx, http.MethodGet, path, request, &wrappedLogDeliveryConfiguration)
return &wrappedLogDeliveryConfiguration, err
}
func (a *logDeliveryImpl) List(ctx context.Context, request ListLogDeliveryRequest) (*WrappedLogDeliveryConfigurations, error) {
var wrappedLogDeliveryConfigurations WrappedLogDeliveryConfigurations
path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery", a.client.ConfiguredAccountID())
err := a.client.Do(ctx, http.MethodGet, path, request, &wrappedLogDeliveryConfigurations)
return &wrappedLogDeliveryConfigurations, err
}
func (a *logDeliveryImpl) PatchStatus(ctx context.Context, request UpdateLogDeliveryConfigurationStatusRequest) error {
path := fmt.Sprintf("/api/2.0/accounts/%v/log-delivery/%v", a.client.ConfiguredAccountID(), request.LogDeliveryConfigurationId)
err := a.client.Do(ctx, http.MethodPatch, path, request, nil)
return err
}