-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathaibi-dashboard-embedding-access-policy.go
More file actions
237 lines (178 loc) · 7.04 KB
/
Copy pathaibi-dashboard-embedding-access-policy.go
File metadata and controls
237 lines (178 loc) · 7.04 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
// Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
package aibi_dashboard_embedding_access_policy
import (
"fmt"
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/libs/cmdctx"
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/cli/libs/flags"
"github.com/databricks/databricks-sdk-go/service/settings"
"github.com/spf13/cobra"
)
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var cmdOverrides []func(*cobra.Command)
func New() *cobra.Command {
cmd := &cobra.Command{
Use: "aibi-dashboard-embedding-access-policy",
Short: `*Public Preview* Controls whether AI/BI published dashboard embedding is enabled, conditionally enabled, or disabled at the workspace level.`,
Long: `This command is in Public Preview and may change without notice.
Controls whether AI/BI published dashboard embedding is enabled, conditionally
enabled, or disabled at the workspace level. By default, this setting is
conditionally enabled (ALLOW_APPROVED_DOMAINS).`,
RunE: root.ReportUnknownSubcommand,
}
cmd.Annotations = make(map[string]string)
cmd.Annotations["launch_stage"] = "PUBLIC_PREVIEW"
cmd.Annotations["launch_stage_display"] = "Public Preview"
// Add methods
cmd.AddCommand(newDelete())
cmd.AddCommand(newGet())
cmd.AddCommand(newUpdate())
// Apply optional overrides to this command.
for _, fn := range cmdOverrides {
fn(cmd)
}
return cmd
}
// start delete command
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var deleteOverrides []func(
*cobra.Command,
*settings.DeleteAibiDashboardEmbeddingAccessPolicySettingRequest,
)
func newDelete() *cobra.Command {
cmd := &cobra.Command{}
var deleteReq settings.DeleteAibiDashboardEmbeddingAccessPolicySettingRequest
cmd.Flags().StringVar(&deleteReq.Etag, "etag", deleteReq.Etag, `etag used for versioning.`)
cmd.Use = "delete"
cmd.Short = `*Public Preview* Delete the AI/BI dashboard embedding access policy.`
cmd.Long = `This command is in Public Preview and may change without notice.
Delete the AI/BI dashboard embedding access policy.
Delete the AI/BI dashboard embedding access policy, reverting back to the
default.`
cmd.Annotations = make(map[string]string)
cmd.Annotations["launch_stage"] = "PUBLIC_PREVIEW"
cmd.Annotations["launch_stage_display"] = "Public Preview"
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.ExactArgs(0)
return check(cmd, args)
}
cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := cmdctx.WorkspaceClient(ctx)
response, err := w.Settings.AibiDashboardEmbeddingAccessPolicy().Delete(ctx, deleteReq)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
}
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range deleteOverrides {
fn(cmd, &deleteReq)
}
return cmd
}
// start get command
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var getOverrides []func(
*cobra.Command,
*settings.GetAibiDashboardEmbeddingAccessPolicySettingRequest,
)
func newGet() *cobra.Command {
cmd := &cobra.Command{}
var getReq settings.GetAibiDashboardEmbeddingAccessPolicySettingRequest
cmd.Flags().StringVar(&getReq.Etag, "etag", getReq.Etag, `etag used for versioning.`)
cmd.Use = "get"
cmd.Short = `*Public Preview* Retrieve the AI/BI dashboard embedding access policy.`
cmd.Long = `This command is in Public Preview and may change without notice.
Retrieve the AI/BI dashboard embedding access policy.
Retrieves the AI/BI dashboard embedding access policy. The default setting is
ALLOW_APPROVED_DOMAINS, permitting AI/BI dashboards to be embedded on approved
domains.`
cmd.Annotations = make(map[string]string)
cmd.Annotations["launch_stage"] = "PUBLIC_PREVIEW"
cmd.Annotations["launch_stage_display"] = "Public Preview"
cmd.Args = func(cmd *cobra.Command, args []string) error {
check := root.ExactArgs(0)
return check(cmd, args)
}
cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := cmdctx.WorkspaceClient(ctx)
response, err := w.Settings.AibiDashboardEmbeddingAccessPolicy().Get(ctx, getReq)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
}
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range getOverrides {
fn(cmd, &getReq)
}
return cmd
}
// start update command
// Slice with functions to override default command behavior.
// Functions can be added from the `init()` function in manually curated files in this directory.
var updateOverrides []func(
*cobra.Command,
*settings.UpdateAibiDashboardEmbeddingAccessPolicySettingRequest,
)
func newUpdate() *cobra.Command {
cmd := &cobra.Command{}
var updateReq settings.UpdateAibiDashboardEmbeddingAccessPolicySettingRequest
var updateJson flags.JsonFlag
cmd.Flags().Var(&updateJson, "json", `either inline JSON string or @path/to/file.json with request body`)
cmd.Use = "update"
cmd.Short = `*Public Preview* Update the AI/BI dashboard embedding access policy.`
cmd.Long = `This command is in Public Preview and may change without notice.
Update the AI/BI dashboard embedding access policy.
Updates the AI/BI dashboard embedding access policy at the workspace level.`
cmd.Annotations = make(map[string]string)
cmd.Annotations["launch_stage"] = "PUBLIC_PREVIEW"
cmd.Annotations["launch_stage_display"] = "Public Preview"
cmd.PreRunE = root.MustWorkspaceClient
cmd.RunE = func(cmd *cobra.Command, args []string) (err error) {
ctx := cmd.Context()
w := cmdctx.WorkspaceClient(ctx)
if cmd.Flags().Changed("json") {
diags := updateJson.Unmarshal(&updateReq)
if diags.HasError() {
return diags.Error()
}
if len(diags) > 0 {
err := cmdio.RenderDiagnostics(ctx, diags)
if err != nil {
return err
}
}
} else {
return fmt.Errorf("please provide command input in JSON format by specifying the --json flag")
}
response, err := w.Settings.AibiDashboardEmbeddingAccessPolicy().Update(ctx, updateReq)
if err != nil {
return err
}
return cmdio.Render(ctx, response)
}
// Disable completions since they are not applicable.
// Can be overridden by manual implementation in `override.go`.
cmd.ValidArgsFunction = cobra.NoFileCompletions
// Apply optional overrides to this command.
for _, fn := range updateOverrides {
fn(cmd, &updateReq)
}
return cmd
}
// end service AibiDashboardEmbeddingAccessPolicy