-
Notifications
You must be signed in to change notification settings - Fork 301
/
error_flags.pb.go
63 lines (59 loc) · 3.46 KB
/
error_flags.pb.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
// Code generated by protoc-gen-go-flags. DO NOT EDIT.
// versions:
// - protoc-gen-go-flags v1.2.0
// - protoc v4.23.4
// source: ttn/lorawan/v3/error.proto
package ttnpb
import (
flagsplugin "github.com/TheThingsIndustries/protoc-gen-go-flags/flagsplugin"
pflag "github.com/spf13/pflag"
)
// AddSelectFlagsForErrorDetails adds flags to select fields in ErrorDetails.
func AddSelectFlagsForErrorDetails(flags *pflag.FlagSet, prefix string, hidden bool) {
flags.AddFlag(flagsplugin.NewBoolFlag(flagsplugin.Prefix("namespace", prefix), flagsplugin.SelectDesc(flagsplugin.Prefix("namespace", prefix), false), flagsplugin.WithHidden(hidden)))
flags.AddFlag(flagsplugin.NewBoolFlag(flagsplugin.Prefix("name", prefix), flagsplugin.SelectDesc(flagsplugin.Prefix("name", prefix), false), flagsplugin.WithHidden(hidden)))
flags.AddFlag(flagsplugin.NewBoolFlag(flagsplugin.Prefix("message-format", prefix), flagsplugin.SelectDesc(flagsplugin.Prefix("message-format", prefix), false), flagsplugin.WithHidden(hidden)))
flags.AddFlag(flagsplugin.NewBoolFlag(flagsplugin.Prefix("attributes", prefix), flagsplugin.SelectDesc(flagsplugin.Prefix("attributes", prefix), false), flagsplugin.WithHidden(hidden)))
flags.AddFlag(flagsplugin.NewBoolFlag(flagsplugin.Prefix("correlation-id", prefix), flagsplugin.SelectDesc(flagsplugin.Prefix("correlation-id", prefix), false), flagsplugin.WithHidden(hidden)))
flags.AddFlag(flagsplugin.NewBoolFlag(flagsplugin.Prefix("code", prefix), flagsplugin.SelectDesc(flagsplugin.Prefix("code", prefix), false), flagsplugin.WithHidden(hidden)))
flags.AddFlag(flagsplugin.NewBoolFlag(flagsplugin.Prefix("details", prefix), flagsplugin.SelectDesc(flagsplugin.Prefix("details", prefix), false), flagsplugin.WithHidden(hidden)))
}
// SelectFromFlags outputs the fieldmask paths forErrorDetails message from select flags.
func PathsFromSelectFlagsForErrorDetails(flags *pflag.FlagSet, prefix string) (paths []string, err error) {
if val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix("namespace", prefix)); err != nil {
return nil, err
} else if selected && val {
paths = append(paths, flagsplugin.Prefix("namespace", prefix))
}
if val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix("name", prefix)); err != nil {
return nil, err
} else if selected && val {
paths = append(paths, flagsplugin.Prefix("name", prefix))
}
if val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix("message_format", prefix)); err != nil {
return nil, err
} else if selected && val {
paths = append(paths, flagsplugin.Prefix("message_format", prefix))
}
if val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix("attributes", prefix)); err != nil {
return nil, err
} else if selected && val {
paths = append(paths, flagsplugin.Prefix("attributes", prefix))
}
if val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix("correlation_id", prefix)); err != nil {
return nil, err
} else if selected && val {
paths = append(paths, flagsplugin.Prefix("correlation_id", prefix))
}
if val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix("code", prefix)); err != nil {
return nil, err
} else if selected && val {
paths = append(paths, flagsplugin.Prefix("code", prefix))
}
if val, selected, err := flagsplugin.GetBool(flags, flagsplugin.Prefix("details", prefix)); err != nil {
return nil, err
} else if selected && val {
paths = append(paths, flagsplugin.Prefix("details", prefix))
}
return paths, nil
}