(cli *cli)
| 152 | } |
| 153 | |
| 154 | func updateLogStreamsSplunkCmd(cli *cli) *cobra.Command { |
| 155 | var inputs struct { |
| 156 | id string |
| 157 | name string |
| 158 | splunkDomain string |
| 159 | splunkToken string |
| 160 | splunkPort string |
| 161 | splunkVerifyTLS bool |
| 162 | piiConfig string |
| 163 | filters string |
| 164 | } |
| 165 | |
| 166 | cmd := &cobra.Command{ |
| 167 | Use: "splunk", |
| 168 | Args: cobra.MaximumNArgs(1), |
| 169 | Short: "Update an existing Splunk log stream", |
| 170 | Long: "Monitor real-time logs and display log analytics.\n\n" + |
| 171 | "To update interactively, use `auth0 logs streams create splunk` with no arguments.\n\n" + |
| 172 | "To update non-interactively, supply the log stream name and other information through the flags.", |
| 173 | Example: ` auth0 log streams update splunk |
| 174 | auth0 log streams update splunk <log-stream-id> --name <name> |
| 175 | auth0 log streams update splunk <log-stream-id> --name <name> --domain <domain> |
| 176 | auth0 log streams update splunk <log-stream-id> --name <name> --domain <domain> --token <token> |
| 177 | auth0 log streams update splunk <log-stream-id> --name <name> --domain <domain> --token <token> --pii-config '{"log_fields": ["first_name", "last_name"], "method": "mask", "algorithm": "xxhash"}' |
| 178 | auth0 log streams update splunk <log-stream-id> --name <name> --domain <domain> --token <token> --filters '[{"type":"category","name":"user.fail"},{"type":"category","name":"scim.event"}]' |
| 179 | auth0 log streams update splunk <log-stream-id> --name <name> --domain <domain> --token <token> --port <port> |
| 180 | auth0 log streams update splunk <log-stream-id> --name <name> --domain <domain> --token <token> --port <port> --secure=false |
| 181 | auth0 log streams update splunk <log-stream-id> -n <name> -d <domain> -t <token> -p <port> -s -c null |
| 182 | auth0 log streams update splunk <log-stream-id> -n mylogstream -d "demo.splunk.com" -t "12a34ab5-c6d7-8901-23ef-456b7c89d0c1" -p "8088" -s=false --json |
| 183 | auth0 log streams update splunk <log-stream-id> -n mylogstream -d "demo.splunk.com" -t "12a34ab5-c6d7-8901-23ef-456b7c89d0c1" -p "8088" -s=false --json-compact`, |
| 184 | RunE: func(cmd *cobra.Command, args []string) error { |
| 185 | if len(args) == 0 { |
| 186 | err := logStreamID.Pick(cmd, &inputs.id, cli.logStreamPickerOptionsByType(logStreamTypeSplunk)) |
| 187 | if err != nil { |
| 188 | return err |
| 189 | } |
| 190 | } else { |
| 191 | inputs.id = args[0] |
| 192 | } |
| 193 | |
| 194 | var oldLogStream *management.LogStream |
| 195 | if err := ansi.Waiting(func() (err error) { |
| 196 | oldLogStream, err = cli.api.LogStream.Read(cmd.Context(), inputs.id) |
| 197 | return err |
| 198 | }); err != nil { |
| 199 | return fmt.Errorf("failed to read log stream with ID %q: %w", inputs.id, err) |
| 200 | } |
| 201 | |
| 202 | if oldLogStream.GetType() != string(logStreamTypeSplunk) { |
| 203 | return errInvalidLogStreamType(inputs.id, oldLogStream.GetType(), string(logStreamTypeSplunk)) |
| 204 | } |
| 205 | |
| 206 | if err := logStreamName.AskU(cmd, &inputs.name, oldLogStream.Name); err != nil { |
| 207 | return err |
| 208 | } |
| 209 | |
| 210 | existingConfig, _ := json.Marshal(oldLogStream.GetPIIConfig()) |
| 211 | if err := logStreamPIIConfig.AskU(cmd, &inputs.piiConfig, auth0.String(string(existingConfig))); err != nil { |
no test coverage detected