/
helpers_labels.go
559 lines (527 loc) · 22.3 KB
/
helpers_labels.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
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
/*
Copyright © 2021-2023 Hannes Hayashi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package provider
import (
"context"
"fmt"
"github.com/hanneshayashi/gsm/gsmdrivelabels"
"github.com/hanneshayashi/gsm/gsmhelpers"
dsschema "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/diag"
rsschema "github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/types"
"google.golang.org/api/drivelabels/v2"
)
type gdriveLabelFieldPropertieseModel struct {
DisplayName types.String `tfsdk:"display_name"`
InsertBeforeField types.String `tfsdk:"insert_before_field"`
Required types.Bool `tfsdk:"required"`
}
func (disablePolicyModel *gdriveLabelLifeCycleDisabledPolicyModel) populate(disablePolicy *drivelabels.GoogleAppsDriveLabelsV2LifecycleDisabledPolicy) {
if disablePolicy != nil {
disablePolicyModel.HideInSearch = types.BoolValue(disablePolicy.HideInSearch)
disablePolicyModel.ShowInApply = types.BoolValue(disablePolicy.ShowInApply)
}
}
func (lifeCycleModel *gdriveLabelLifeCycleModel) populate(lifecycle *drivelabels.GoogleAppsDriveLabelsV2Lifecycle) {
if lifecycle != nil {
var state string
if lifecycle.State == "PUBLISHED" && lifecycle.HasUnpublishedChanges {
state = "PUBLISHED_WITH_PENDING_CHANGES"
} else {
state = lifecycle.State
}
lifeCycleModel.State = types.StringValue(state)
if lifeCycleModel.DisabledPolicy != nil {
lifeCycleModel.DisabledPolicy.populate(lifecycle.DisabledPolicy)
}
}
}
func (lifeCycleModel *gdriveLabelLifeCycleDSModel) populate(lifecycle *drivelabels.GoogleAppsDriveLabelsV2Lifecycle) {
if lifecycle != nil {
lifeCycleModel.State = types.StringValue(lifecycle.State)
lifeCycleModel.HasUnpublishedChanges = types.BoolValue(lifecycle.HasUnpublishedChanges)
if lifeCycleModel.DisabledPolicy != nil {
lifeCycleModel.DisabledPolicy.populate(lifecycle.DisabledPolicy)
}
}
}
func (lifecycleModel *gdriveLabelLifeCycleDSModel) toLifecycle() (lifecycle *drivelabels.GoogleAppsDriveLabelsV2Lifecycle) {
lifecycle = &drivelabels.GoogleAppsDriveLabelsV2Lifecycle{
State: lifecycleModel.State.ValueString(),
HasUnpublishedChanges: lifecycleModel.HasUnpublishedChanges.ValueBool(),
}
if lifecycleModel.DisabledPolicy != nil {
lifecycle.DisabledPolicy = &drivelabels.GoogleAppsDriveLabelsV2LifecycleDisabledPolicy{
HideInSearch: lifecycleModel.DisabledPolicy.HideInSearch.ValueBool(),
ShowInApply: lifecycleModel.DisabledPolicy.ShowInApply.ValueBool(),
}
if !lifecycle.DisabledPolicy.HideInSearch {
lifecycle.DisabledPolicy.ForceSendFields = append(lifecycle.DisabledPolicy.ForceSendFields, "HideInSearch")
}
if !lifecycle.DisabledPolicy.ShowInApply {
lifecycle.DisabledPolicy.ForceSendFields = append(lifecycle.DisabledPolicy.ForceSendFields, "ShowInApply")
}
}
return
}
func (lifecycleModel *gdriveLabelLifeCycleModel) toLifecycle() (lifecycle *drivelabels.GoogleAppsDriveLabelsV2Lifecycle) {
lifecycle = &drivelabels.GoogleAppsDriveLabelsV2Lifecycle{
State: lifecycleModel.State.ValueString(),
}
if lifecycleModel.DisabledPolicy != nil {
lifecycle.DisabledPolicy = &drivelabels.GoogleAppsDriveLabelsV2LifecycleDisabledPolicy{
HideInSearch: lifecycleModel.DisabledPolicy.HideInSearch.ValueBool(),
ShowInApply: lifecycleModel.DisabledPolicy.ShowInApply.ValueBool(),
}
if !lifecycle.DisabledPolicy.HideInSearch {
lifecycle.DisabledPolicy.ForceSendFields = append(lifecycle.DisabledPolicy.ForceSendFields, "HideInSearch")
}
if !lifecycle.DisabledPolicy.ShowInApply {
lifecycle.DisabledPolicy.ForceSendFields = append(lifecycle.DisabledPolicy.ForceSendFields, "ShowInApply")
}
}
return
}
type labelInterface interface {
getLanguageCode() string
getUseAdminAccess() bool
}
func (labelModel *gdriveLabelResourceModel) getLanguageCode() string {
return labelModel.LanguageCode.ValueString()
}
func (LabelModel *gdriveLabelResourceModel) getUseAdminAccess() bool {
return LabelModel.UseAdminAccess.ValueBool()
}
func (labelModel *gdriveLabelResourceModel) populate(ctx context.Context) (diags diag.Diagnostics) {
l, err := gsmdrivelabels.GetLabel(gsmhelpers.EnsurePrefix(labelModel.Id.ValueString(), "labels/"), labelModel.LanguageCode.ValueString(), "LABEL_VIEW_FULL", "*", labelModel.UseAdminAccess.ValueBool())
if err != nil {
diags.AddError("Client Error", fmt.Sprintf("Unable to get label, got error: %s", err))
return
}
labelModel.LabelId = types.StringValue(l.Id)
labelModel.Name = types.StringValue(l.Name)
labelModel.LabelType = types.StringValue(l.LabelType)
labelModel.Properties = &gdriveLabelResourcePropertiesModel{}
labelModel.Properties.populate(l.Properties)
if labelModel.LifeCycle != nil {
labelModel.LifeCycle.populate(l.Lifecycle)
}
return
}
func dateFieldDS() dsschema.SingleNestedAttribute {
return dsschema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]dsschema.Attribute{
"day": dsschema.Int64Attribute{
Computed: true,
MarkdownDescription: `Day of a month.`,
},
"month": dsschema.Int64Attribute{
Computed: true,
MarkdownDescription: "Month of a year.",
},
"year": dsschema.Int64Attribute{
Computed: true,
MarkdownDescription: "Year of the date.",
},
},
MarkdownDescription: "Min/Max valid value (year, month, day).",
}
}
func lifeCycleRS() rsschema.SingleNestedBlock {
return rsschema.SingleNestedBlock{
MarkdownDescription: `The lifecycle state of an object, such as label, field, or choice.
The lifecycle enforces the following transitions:
* UNPUBLISHED_DRAFT (starting state)
* UNPUBLISHED_DRAFT -> PUBLISHED
* UNPUBLISHED_DRAFT -> (Deleted)
* PUBLISHED -> DISABLED
* DISABLED -> PUBLISHED
* DISABLED -> (Deleted)`,
Attributes: map[string]rsschema.Attribute{
"state": rsschema.StringAttribute{
MarkdownDescription: "The state of the object associated with this lifecycle.",
Optional: true,
},
},
Blocks: map[string]rsschema.Block{
"disabled_policy": rsschema.SingleNestedBlock{
MarkdownDescription: "The policy that governs how to show a disabled label, field, or selection choice.",
Attributes: map[string]rsschema.Attribute{
"hide_in_search": rsschema.BoolAttribute{
MarkdownDescription: `Whether to hide this disabled object in the search menu for Drive items.
When false, the object is generally shown in the UI as disabled but it appears in the search results when searching for Drive items.
When true, the object is generally hidden in the UI when searching for Drive items.`,
Optional: true,
Computed: true,
Default: booldefault.StaticBool(false),
},
"show_in_apply": rsschema.BoolAttribute{
MarkdownDescription: `Whether to show this disabled object in the apply menu on Drive items.
When true, the object is generally shown in the UI as disabled and is unselectable.
When false, the object is generally hidden in the UI.`,
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
},
},
},
},
}
}
func lifecycleDS() dsschema.SingleNestedAttribute {
return dsschema.SingleNestedAttribute{
MarkdownDescription: `The lifecycle state of an object, such as label, field, or choice.`,
Computed: true,
Attributes: map[string]dsschema.Attribute{
"state": dsschema.StringAttribute{
MarkdownDescription: "The state of the object associated with this lifecycle.",
Computed: true,
},
"has_unpublished_changes": dsschema.BoolAttribute{
MarkdownDescription: "Whether the object associated with this lifecycle has unpublished changes.",
Computed: true,
},
"disabled_policy": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "The policy that governs how to show a disabled label, field, or selection choice.",
Attributes: map[string]dsschema.Attribute{
"hide_in_search": dsschema.BoolAttribute{
MarkdownDescription: `Whether to hide this disabled object in the search menu for Drive items.
When false, the object is generally shown in the UI as disabled but it appears in the search results when searching for Drive items.
When true, the object is generally hidden in the UI when searching for Drive items.`,
Computed: true,
},
"show_in_apply": dsschema.BoolAttribute{
MarkdownDescription: `Whether to show this disabled object in the apply menu on Drive items.
When true, the object is generally shown in the UI as disabled and is unselectable.
When false, the object is generally hidden in the UI.`,
Computed: true,
},
},
},
},
}
}
func listOptions() dsschema.SingleNestedAttribute {
return dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "List options",
Attributes: map[string]dsschema.Attribute{
"max_entries": dsschema.Int64Attribute{
MarkdownDescription: "Maximum number of entries permitted.",
Computed: true,
},
},
}
}
func fieldsDS() dsschema.ListNestedAttribute {
return dsschema.ListNestedAttribute{
MarkdownDescription: "The fields of this label.",
Computed: true,
NestedObject: dsschema.NestedAttributeObject{
Attributes: map[string]dsschema.Attribute{
"id": dsId(),
"field_id": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: `The key of a field, unique within a label or library.
Use this when referencing a field somewhere.`,
},
"query_key": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: `The key to use when constructing Drive search queries to find labels based on values defined for this field on labels.
For example, "{queryKey} > 2001-01-01".`,
},
"value_type": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: `The type of the field.
Use this when setting the values for a field.`,
},
"life_cycle": lifecycleDS(),
"date_options": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "A set of restrictions that apply to this shared drive or items inside this shared drive.",
Attributes: map[string]dsschema.Attribute{
"date_format": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: "ICU date format.",
},
"date_format_type": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: "Localized date formatting option. Field values are rendered in this format according to their locale.",
},
"max_value": dateFieldDS(),
"min_value": dateFieldDS(),
},
},
"selection_options": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "Options for the selection field type.",
Attributes: map[string]dsschema.Attribute{
"list_options": listOptions(),
"choices": dsschema.ListNestedAttribute{
Computed: true,
NestedObject: dsschema.NestedAttributeObject{
Attributes: map[string]dsschema.Attribute{
"id": dsId(),
"choice_id": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: `The unique value of the choice.
Use this when referencing / setting a choice.`,
},
"life_cycle": lifecycleDS(),
"properties": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "Basic properties of the choice.",
Attributes: map[string]dsschema.Attribute{
"display_name": dsschema.StringAttribute{
MarkdownDescription: "The display text to show in the UI identifying this choice.",
Required: true,
}, "badge_config": dsschema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]dsschema.Attribute{
"priority_override": dsschema.Int64Attribute{
MarkdownDescription: `Override the default global priority of this badge.
When set to 0, the default priority heuristic is used.`,
Computed: true,
},
"color": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: `The color of the badge.
When not specified, no badge is rendered.
The background, foreground, and solo (light and dark mode) colors set here are changed in the Drive UI into the closest recommended supported color.
*After setting this property, the plan will likely show a difference, because the API automatically modifies the values.
It is recommended to change the Terraform configuration to match the values set by the API.`,
Attributes: map[string]dsschema.Attribute{
"alpha": dsschema.Float64Attribute{
MarkdownDescription: `The alpha value for the badge color as a float (number between 1 and 0 - e.g. "0.5")`,
Computed: true,
},
"blue": dsschema.Float64Attribute{
MarkdownDescription: `The blue value for the badge color as a float (number between 1 and 0 - e.g. "0.5")`,
Computed: true,
},
"green": dsschema.Float64Attribute{
MarkdownDescription: `The green value for the badge color as a float (number between 1 and 0 - e.g. "0.5")`,
Computed: true,
},
"red": dsschema.Float64Attribute{
MarkdownDescription: `The red value for the badge color as a float (number between 1 and 0 - e.g. "0.5")`,
Computed: true,
},
},
},
},
},
},
},
},
},
},
},
},
"integer_options": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "Options for the Integer field type.",
Attributes: map[string]dsschema.Attribute{
"max_value": dsschema.Int64Attribute{
Computed: true,
MarkdownDescription: "The maximum valid value for the integer field.",
},
"min_value": dsschema.Int64Attribute{
Computed: true,
MarkdownDescription: "The minimum valid value for the integer field.",
},
},
},
"text_options": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "Options for the Text field type.",
Attributes: map[string]dsschema.Attribute{
"min_length": dsschema.Int64Attribute{
Computed: true,
MarkdownDescription: "The minimum valid length of values for the text field.",
},
"max_length": dsschema.Int64Attribute{
Computed: true,
MarkdownDescription: "The maximum valid length of values for the text field.",
},
},
},
"user_options": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "Options for the user field type.",
Attributes: map[string]dsschema.Attribute{
"list_options": listOptions(),
},
},
"properties": dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "The basic properties of the field.",
Attributes: map[string]dsschema.Attribute{
"display_name": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: "The display text to show in the UI identifying this field.",
},
"required": dsschema.BoolAttribute{
Computed: true,
MarkdownDescription: "Whether the field should be marked as required.",
},
},
},
},
},
}
}
func fieldsToModel(fields []*drivelabels.GoogleAppsDriveLabelsV2Field) (model []*gdriveLabelDataSourceFieldsModel) {
for i := range fields {
field := &gdriveLabelDataSourceFieldsModel{
Id: types.StringValue(fields[i].Id),
FieldId: types.StringValue(fields[i].Id),
QueryKey: types.StringValue(fields[i].QueryKey),
LifeCycle: &gdriveLabelLifeCycleDSModel{},
}
if fields[i].Properties != nil {
field.Properties = &gdriveLabelDataSourceFieldPropertieseModel{
DisplayName: types.StringValue(fields[i].Properties.DisplayName),
Required: types.BoolValue(fields[i].Properties.Required),
}
}
field.LifeCycle.populate(fields[i].Lifecycle)
if fields[i].TextOptions != nil {
field.ValueType = types.StringValue("text")
field.TextOptions = &gdriveLabelTextOptionsModel{
MinLength: types.Int64Value(fields[i].TextOptions.MinLength),
MaxLength: types.Int64Value(fields[i].TextOptions.MaxLength),
}
} else if fields[i].IntegerOptions != nil {
field.ValueType = types.StringValue("integer")
field.IntegerOptions = &gdriveLabelIntegerOptionsModel{
MinValue: types.Int64Value(fields[i].IntegerOptions.MinValue),
MaxValue: types.Int64Value(fields[i].IntegerOptions.MaxValue),
}
} else if fields[i].UserOptions != nil {
field.ValueType = types.StringValue("user")
field.UserOptions = &gdriveLabelUserOptionseModel{}
if fields[i].UserOptions.ListOptions != nil {
field.UserOptions.ListOptions = &gdriveLabelListOptionsModel{
MaxEntries: types.Int64Value(fields[i].UserOptions.ListOptions.MaxEntries),
}
}
} else if fields[i].SelectionOptions != nil {
field.ValueType = types.StringValue("selection")
field.SelectionOptions = &gdriveLabelSelectionOptionsModel{}
if fields[i].SelectionOptions.ListOptions != nil {
field.SelectionOptions.ListOptions = &gdriveLabelListOptionsModel{
MaxEntries: types.Int64Value(fields[i].SelectionOptions.ListOptions.MaxEntries),
}
}
field.SelectionOptions.Choices = make([]*gdriveLabelChoiceModel, len(fields[i].SelectionOptions.Choices))
for j := range fields[i].SelectionOptions.Choices {
field.SelectionOptions.Choices[j] = &gdriveLabelChoiceModel{
Id: types.StringValue(fields[i].SelectionOptions.Choices[j].Id),
ChoiceId: types.StringValue(fields[i].SelectionOptions.Choices[j].Id),
LifeCycle: &gdriveLabelLifeCycleDSModel{},
}
if fields[i].SelectionOptions.Choices[j].Properties != nil {
field.SelectionOptions.Choices[j].Properties = &gdriveLabelChoicePropertiesModel{
DisplayName: types.StringValue(fields[i].SelectionOptions.Choices[j].Properties.DisplayName),
}
if fields[i].SelectionOptions.Choices[j].Properties.BadgeConfig != nil {
field.SelectionOptions.Choices[j].Properties.BadgeConfig = &gdriveLabelChoiceBadgeConfigModel{}
field.SelectionOptions.Choices[j].Properties.BadgeConfig.populate(fields[i].SelectionOptions.Choices[j].Properties.BadgeConfig)
}
}
field.SelectionOptions.Choices[j].LifeCycle.populate(fields[i].SelectionOptions.Choices[j].Lifecycle)
}
} else if fields[i].DateOptions != nil {
field.ValueType = types.StringValue("dateString")
field.DateOptions = &gdriveLabelDateOptionsModel{
DateFormat: types.StringValue(fields[i].DateOptions.DateFormat),
DateFormatType: types.StringValue(fields[i].DateOptions.DateFormatType),
}
if fields[i].DateOptions.MinValue != nil {
field.DateOptions.MinValue = &gdriveLabelDateFieldModel{
Day: types.Int64Value(fields[i].DateOptions.MinValue.Day),
Month: types.Int64Value(fields[i].DateOptions.MinValue.Month),
Year: types.Int64Value(fields[i].DateOptions.MinValue.Year),
}
}
if fields[i].DateOptions.MaxValue != nil {
field.DateOptions.MaxValue = &gdriveLabelDateFieldModel{
Day: types.Int64Value(fields[i].DateOptions.MaxValue.Day),
Month: types.Int64Value(fields[i].DateOptions.MaxValue.Month),
Year: types.Int64Value(fields[i].DateOptions.MaxValue.Year),
}
}
}
model = append(model, field)
}
return model
}
func (propertiesModel *gdriveLabelFieldPropertieseModel) toProperties() *drivelabels.GoogleAppsDriveLabelsV2FieldProperties {
properties := &drivelabels.GoogleAppsDriveLabelsV2FieldProperties{
DisplayName: propertiesModel.DisplayName.ValueString(),
InsertBeforeField: propertiesModel.InsertBeforeField.ValueString(),
Required: propertiesModel.Required.ValueBool(),
}
if properties.DisplayName == "" {
properties.ForceSendFields = append(properties.ForceSendFields, "DisplayName")
}
if properties.InsertBeforeField == "" {
properties.ForceSendFields = append(properties.ForceSendFields, "InsertBeforeField")
}
if !properties.Required {
properties.ForceSendFields = append(properties.ForceSendFields, "Required")
}
return properties
}
func (plan *gdriveLabelDateFieldResourceModel) toUpateRequest(state *gdriveLabelDateFieldResourceModel) (request *drivelabels.GoogleAppsDriveLabelsV2DeltaUpdateLabelRequestRequest) {
if !plan.DateOptions.DateFormatType.Equal(state.DateOptions.DateFormatType) {
request = &drivelabels.GoogleAppsDriveLabelsV2DeltaUpdateLabelRequestRequest{
UpdateFieldType: &drivelabels.GoogleAppsDriveLabelsV2DeltaUpdateLabelRequestUpdateFieldTypeRequest{
Id: plan.FieldId.ValueString(),
DateOptions: &drivelabels.GoogleAppsDriveLabelsV2FieldDateOptions{
DateFormatType: plan.DateOptions.DateFormatType.ValueString(),
},
},
}
}
return
}
func newUpdateLabelRequest(plan labelInterface) *drivelabels.GoogleAppsDriveLabelsV2DeltaUpdateLabelRequest {
return &drivelabels.GoogleAppsDriveLabelsV2DeltaUpdateLabelRequest{
LanguageCode: plan.getLanguageCode(),
UseAdminAccess: plan.getUseAdminAccess(),
View: "LABEL_VIEW_FULL",
}
}
func labelPropertiesDS() dsschema.SingleNestedAttribute {
return dsschema.SingleNestedAttribute{
Computed: true,
MarkdownDescription: "Basic properties of the label.",
Attributes: map[string]dsschema.Attribute{
"title": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: "Title of the label.",
},
"description": dsschema.StringAttribute{
Computed: true,
MarkdownDescription: "The description of the label.",
},
},
}
}