MCPcopy Create free account
hub / github.com/auth0/auth0-cli / updateLogStreamsSumoLogicCmd

Function updateLogStreamsSumoLogicCmd

internal/cli/log_streams_sumo.go:108–218  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

106}
107
108func updateLogStreamsSumoLogicCmd(cli *cli) *cobra.Command {
109 var inputs struct {
110 id string
111 name string
112 sumoLogicSource string
113 piiConfig string
114 filters string
115 }
116
117 cmd := &cobra.Command{
118 Use: "sumo",
119 Args: cobra.MaximumNArgs(1),
120 Short: "Update an existing Sumo Logic log stream",
121 Long: "Visualize logs and detect threats faster with security insights.\n\n" +
122 "To update interactively, use `auth0 logs streams create sumo` with no arguments.\n\n" +
123 "To update non-interactively, supply the log stream name and other information through the flags.",
124 Example: ` auth0 logs streams update sumo
125 auth0 logs streams update sumo <log-stream-id> --name <name>
126 auth0 logs streams update sumo <log-stream-id> --name <name> --source <source>
127 auth0 logs streams update sumo <log-stream-id> --name <name> --source <source> --filters '[{"type":"category","name":"user.fail"},{"type":"category","name":"scim.event"}]'
128 auth0 logs streams update sumo <log-stream-id> --name <name> --source <source> --pii-config '{"log_fields": ["first_name", "last_name"], "method": "mask", "algorithm": "xxhash"}'
129 auth0 logs streams update sumo <log-stream-id> -n <name> -s <source> -c null
130 auth0 logs streams update sumo <log-stream-id> -n "mylogstream" -s "demo.sumo.com" --json
131 auth0 logs streams update sumo <log-stream-id> -n "mylogstream" -s "demo.sumo.com" --json-compact`,
132 RunE: func(cmd *cobra.Command, args []string) error {
133 if len(args) == 0 {
134 err := logStreamID.Pick(cmd, &inputs.id, cli.logStreamPickerOptionsByType(logStreamTypeSumo))
135 if err != nil {
136 return err
137 }
138 } else {
139 inputs.id = args[0]
140 }
141
142 var oldLogStream *management.LogStream
143 if err := ansi.Waiting(func() (err error) {
144 oldLogStream, err = cli.api.LogStream.Read(cmd.Context(), inputs.id)
145 return err
146 }); err != nil {
147 return fmt.Errorf("failed to read log stream with id %q: %w", inputs.id, err)
148 }
149
150 if oldLogStream.GetType() != string(logStreamTypeSumo) {
151 return errInvalidLogStreamType(inputs.id, oldLogStream.GetType(), string(logStreamTypeSumo))
152 }
153
154 if err := logStreamName.AskU(cmd, &inputs.name, oldLogStream.Name); err != nil {
155 return err
156 }
157
158 existingConfig, _ := json.Marshal(oldLogStream.GetPIIConfig())
159 if err := logStreamPIIConfig.AskU(cmd, &inputs.piiConfig, auth0.String(string(existingConfig))); err != nil {
160 return err
161 }
162
163 existingFilters, _ := json.Marshal(oldLogStream.GetFilters())
164 if err := logStreamFilters.AskU(cmd, &inputs.filters, auth0.String(string(existingFilters))); err != nil {
165 return err

Callers 1

updateLogStreamCmdFunction · 0.85

Calls 10

WaitingFunction · 0.92
errInvalidLogStreamTypeFunction · 0.85
ErrorfMethod · 0.80
AskUMethod · 0.80
LogStreamUpdateMethod · 0.80
RegisterStringUMethod · 0.80
ReadMethod · 0.65
UpdateMethod · 0.65
PickMethod · 0.45

Tested by

no test coverage detected