/
setting_selector.go
93 lines (76 loc) · 2.73 KB
/
setting_selector.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
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
package azappconfig
import (
"time"
"github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig/internal/generated"
)
// SettingFilter to select configuration setting entities.
type SettingFilter struct {
// Key filter that will be used to select a set of configuration setting entities.
KeyFilter *string
// Label filter that will be used to select a set of configuration setting entities.
LabelFilter *string
}
// SettingSelector is a set of options that allows selecting a filtered set of configuration setting entities
// from the configuration store, and optionally allows indicating which fields of each setting to retrieve.
type SettingSelector struct {
// Key filter that will be used to select a set of configuration setting entities.
KeyFilter *string
// Label filter that will be used to select a set of configuration setting entities.
LabelFilter *string
// Indicates the point in time in the revision history of the selected configuration setting entities to retrieve.
// If set, all properties of the configuration setting entities in the returned group will be exactly what they were at this time.
AcceptDateTime *time.Time
// The fields of the configuration setting to retrieve for each setting in the retrieved group.
Fields []SettingFields
}
// AllSettingFields returns a collection of all setting fields to use in SettingSelector.
func AllSettingFields() []SettingFields {
return []SettingFields{
SettingFieldsKey,
SettingFieldsLabel,
SettingFieldsValue,
SettingFieldsContentType,
SettingFieldsETag,
SettingFieldsLastModified,
SettingFieldsIsReadOnly,
SettingFieldsTags,
}
}
func (sc SettingSelector) toGeneratedGetRevisions() *generated.AzureAppConfigurationClientGetRevisionsOptions {
var dt *string
if sc.AcceptDateTime != nil {
str := sc.AcceptDateTime.Format(timeFormat)
dt = &str
}
sf := make([]SettingFields, len(sc.Fields))
for i := range sc.Fields {
sf[i] = SettingFields(sc.Fields[i])
}
return &generated.AzureAppConfigurationClientGetRevisionsOptions{
After: dt,
Key: sc.KeyFilter,
Label: sc.LabelFilter,
Select: sf,
}
}
func (sc SettingSelector) toGeneratedGetKeyValues() *generated.AzureAppConfigurationClientGetKeyValuesOptions {
var dt *string
if sc.AcceptDateTime != nil {
str := sc.AcceptDateTime.Format(timeFormat)
dt = &str
}
sf := make([]SettingFields, len(sc.Fields))
for i := range sc.Fields {
sf[i] = SettingFields(sc.Fields[i])
}
return &generated.AzureAppConfigurationClientGetKeyValuesOptions{
After: dt,
Key: sc.KeyFilter,
Label: sc.LabelFilter,
Select: sf,
}
}