Repository navigation
Conversation
4d194f4 to
8af9e54
Compare
|
This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it. |
| Short: "Updates a TelemetryRouter instance", | ||
| Long: "Updates a TelemetryRouter instance.", | ||
| Args: args.SingleArg(argInstanceID, utils.ValidateUUID), | ||
| Example: examples.Build( | ||
| examples.NewExample( | ||
| `Update the display name of the TelemetryRouter instance with ID "xxx"`, | ||
| "$ stackit beta telemetryrouter instance update xxx --display-name new-name"), | ||
| examples.NewExample( | ||
| `Update the description of the TelemetryRouter instance with ID "xxx"`, | ||
| "$ stackit beta telemetryrouter instance update xxx --description new-description"), | ||
| examples.NewExample( | ||
| `Replace the filter attributes of the TelemetryRouter instance with ID "xxx" so it only routes telemetry data for HTTP GET or HEAD requests, matched at the resource level`, | ||
| `$ stackit beta telemetryrouter instance update xxx --filter-attribute "key=http.method;level=resource;matcher==;values=GET,HEAD"`), | ||
| examples.NewExample( | ||
| `Replace the filter attributes of the TelemetryRouter instance with ID "xxx" with many filter attributes sourced from a JSON file (recommended over repeating --filter-attribute for more than a handful of attributes); `+ | ||
| `use "stackit beta telemetryrouter instance generate-filter --instance-id xxx" to generate a starting point from the instance's current filter`, | ||
| `$ stackit beta telemetryrouter instance update xxx --filter @./filter.json`), |
There was a problem hiding this comment.
I didn't tested it yet, but the endpoint behind this command is a PUT endpoint. If it's also implement to behave like a PUT, it means that everything that isn't set by the user during the update, will be removed. This relates not only to the filter / filter-attribute but also display name and description.
I think this should be mentioned here, to make aware of the different behavior.
There was a problem hiding this comment.
Or it could be even discussed, if we want to have here the update command. Because this behave different like our existing update commands
There was a problem hiding this comment.
Tested it today and the PUT endpoint behaves partial as patch and put. The name remains unchanged if it's not set during the update. But the description and filter are removed if they are not part of the update
|
|
||
| func NewCmd(params *types.CmdParams) *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: fmt.Sprintf("update %s", destinationIdArg), |
There was a problem hiding this comment.
This update command has also a mixed behavior. If description is unset during the update it will be removed, but the name and config remain unchanged if they are not set within the update.
I assume the behavior of the API is in general, that for fields that are not required during creation, it behaves like a PUT, but for fields that are required during creation, it behaves like a PATCH during the update.
There was a problem hiding this comment.
same applies for the access-token update command
06b8a20 to
786f253
Compare
STACKITCLI-382 Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
786f253 to
3cc7194
Compare
Merging this branch changes the coverage (1 decrease, 20 increase)
Coverage detailsCompared to commit 538e0ac (run #39250588989)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files:
|
| type inputModel struct { | ||
| *globalflags.GlobalFlagModel | ||
| InstanceId string | ||
| Payload *telemetryrouter.CreateDestinationPayload |
There was a problem hiding this comment.
I would suggest to not set the payload as pointer, because it's required and it safe potentially nil pointer
| Payload *telemetryrouter.CreateDestinationPayload | |
| Payload telemetryrouter.CreateDestinationPayload |
STACKITCLI-382
Description
Checklist
make fmtmake generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)