diff --git a/cmd/agent_setup.go b/cmd/agent_setup.go index a32e9faca..720c27096 100644 --- a/cmd/agent_setup.go +++ b/cmd/agent_setup.go @@ -47,7 +47,7 @@ import ( nodeHost "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" logProv "github.com/osapi-io/osapi/internal/provider/node/log" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ntpProv "github.com/osapi-io/osapi/internal/provider/node/ntp" powerProv "github.com/osapi-io/osapi/internal/provider/node/power" processProv "github.com/osapi-io/osapi/internal/provider/node/process" @@ -55,7 +55,7 @@ import ( sysctlProv "github.com/osapi-io/osapi/internal/provider/node/sysctl" timezoneProv "github.com/osapi-io/osapi/internal/provider/node/timezone" userProv "github.com/osapi-io/osapi/internal/provider/node/user" - cronProv "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + cronProv "github.com/osapi-io/osapi/internal/provider/schedule/cron" "github.com/osapi-io/osapi/internal/telemetry/process" "github.com/osapi-io/osapi/pkg/sdk/platform" ) @@ -114,14 +114,14 @@ func setupAgent( diskProvider = disk.NewLinuxProvider() } - var memProvider mem.Provider + var memoryProvider memory.Provider switch plat { case "debian": - memProvider = mem.NewDebianProvider() + memoryProvider = memory.NewDebianProvider() case "darwin": - memProvider = mem.NewDarwinProvider() + memoryProvider = memory.NewDarwinProvider() default: - memProvider = mem.NewLinuxProvider() + memoryProvider = memory.NewLinuxProvider() } var loadProvider load.Provider @@ -235,7 +235,7 @@ func setupAgent( agent.NewNodeProcessor( hostProvider, diskProvider, - memProvider, + memoryProvider, loadProvider, sysctlProvider, ntpProvider, @@ -251,7 +251,7 @@ func setupAgent( ), hostProvider, diskProvider, - memProvider, + memoryProvider, loadProvider, sysctlProvider, ntpProvider, @@ -313,7 +313,7 @@ func setupAgent( streamName, hostProvider, diskProvider, - memProvider, + memoryProvider, loadProvider, netinfoProvider, process.New(), diff --git a/cmd/client_node_schedule_cron_create.go b/cmd/client_node_schedule_create.go similarity index 80% rename from cmd/client_node_schedule_cron_create.go rename to cmd/client_node_schedule_create.go index 948f11cd0..9e6db1809 100644 --- a/cmd/client_node_schedule_cron_create.go +++ b/cmd/client_node_schedule_create.go @@ -29,8 +29,8 @@ import ( "github.com/osapi-io/osapi/pkg/sdk/client" ) -// clientNodeScheduleCronCreateCmd represents the cron create command. -var clientNodeScheduleCronCreateCmd = &cobra.Command{ +// clientNodeScheduleCreateCmd represents the cron create command. +var clientNodeScheduleCreateCmd = &cobra.Command{ Use: "create", Short: "Create a cron entry", Run: func(cmd *cobra.Command, _ []string) { @@ -43,7 +43,7 @@ var clientNodeScheduleCronCreateCmd = &cobra.Command{ user, _ := cmd.Flags().GetString("user") contentType, _ := cmd.Flags().GetString("content-type") - resp, err := sdkClient.Cron.Create(ctx, host, client.CronCreateOpts{ + resp, err := sdkClient.Schedule.Create(ctx, host, client.ScheduleCreateOpts{ Name: name, Object: object, Schedule: schedule, @@ -89,21 +89,21 @@ var clientNodeScheduleCronCreateCmd = &cobra.Command{ } func init() { - clientNodeScheduleCronCmd.AddCommand(clientNodeScheduleCronCreateCmd) + clientNodeScheduleCmd.AddCommand(clientNodeScheduleCreateCmd) - clientNodeScheduleCronCreateCmd.PersistentFlags(). + clientNodeScheduleCreateCmd.PersistentFlags(). String("name", "", "Name for the cron drop-in entry (required)") - clientNodeScheduleCronCreateCmd.PersistentFlags(). + clientNodeScheduleCreateCmd.PersistentFlags(). String("object", "", "Name of the uploaded file in the object store (required)") - clientNodeScheduleCronCreateCmd.PersistentFlags(). + clientNodeScheduleCreateCmd.PersistentFlags(). String("schedule", "", "Cron schedule expression, e.g. \"*/5 * * * *\"") - clientNodeScheduleCronCreateCmd.PersistentFlags(). + clientNodeScheduleCreateCmd.PersistentFlags(). String("interval", "", "Periodic interval: hourly, daily, weekly, monthly") - clientNodeScheduleCronCreateCmd.PersistentFlags(). + clientNodeScheduleCreateCmd.PersistentFlags(). String("user", "", "User to run the command as (default root)") - clientNodeScheduleCronCreateCmd.PersistentFlags(). + clientNodeScheduleCreateCmd.PersistentFlags(). String("content-type", "", "Content type: raw or template") - _ = clientNodeScheduleCronCreateCmd.MarkPersistentFlagRequired("name") - _ = clientNodeScheduleCronCreateCmd.MarkPersistentFlagRequired("object") + _ = clientNodeScheduleCreateCmd.MarkPersistentFlagRequired("name") + _ = clientNodeScheduleCreateCmd.MarkPersistentFlagRequired("object") } diff --git a/cmd/client_node_schedule_cron.go b/cmd/client_node_schedule_cron.go deleted file mode 100644 index 70f868f4c..000000000 --- a/cmd/client_node_schedule_cron.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2026 John Dewey - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - -package cmd - -import ( - "github.com/spf13/cobra" -) - -// clientNodeScheduleCronCmd represents the clientNodeScheduleCron command. -var clientNodeScheduleCronCmd = &cobra.Command{ - Use: "cron", - Short: "The cron subcommand", -} - -func init() { - clientNodeScheduleCmd.AddCommand(clientNodeScheduleCronCmd) -} diff --git a/cmd/client_node_schedule_cron_delete.go b/cmd/client_node_schedule_delete.go similarity index 85% rename from cmd/client_node_schedule_cron_delete.go rename to cmd/client_node_schedule_delete.go index df45be871..428a0c9e8 100644 --- a/cmd/client_node_schedule_cron_delete.go +++ b/cmd/client_node_schedule_delete.go @@ -28,8 +28,8 @@ import ( "github.com/osapi-io/osapi/internal/cli" ) -// clientNodeScheduleCronDeleteCmd represents the cron delete command. -var clientNodeScheduleCronDeleteCmd = &cobra.Command{ +// clientNodeScheduleDeleteCmd represents the cron delete command. +var clientNodeScheduleDeleteCmd = &cobra.Command{ Use: "delete", Short: "Delete a cron entry", Run: func(cmd *cobra.Command, _ []string) { @@ -37,7 +37,7 @@ var clientNodeScheduleCronDeleteCmd = &cobra.Command{ host, _ := cmd.Flags().GetString("target") name, _ := cmd.Flags().GetString("name") - resp, err := sdkClient.Cron.Delete(ctx, host, name) + resp, err := sdkClient.Schedule.Delete(ctx, host, name) if err != nil { cli.HandleError(err, logger) return @@ -76,10 +76,10 @@ var clientNodeScheduleCronDeleteCmd = &cobra.Command{ } func init() { - clientNodeScheduleCronCmd.AddCommand(clientNodeScheduleCronDeleteCmd) + clientNodeScheduleCmd.AddCommand(clientNodeScheduleDeleteCmd) - clientNodeScheduleCronDeleteCmd.PersistentFlags(). + clientNodeScheduleDeleteCmd.PersistentFlags(). String("name", "", "Name of the cron entry to delete (required)") - _ = clientNodeScheduleCronDeleteCmd.MarkPersistentFlagRequired("name") + _ = clientNodeScheduleDeleteCmd.MarkPersistentFlagRequired("name") } diff --git a/cmd/client_node_schedule_cron_get.go b/cmd/client_node_schedule_get.go similarity index 86% rename from cmd/client_node_schedule_cron_get.go rename to cmd/client_node_schedule_get.go index 19d9878c3..f0a250614 100644 --- a/cmd/client_node_schedule_cron_get.go +++ b/cmd/client_node_schedule_get.go @@ -28,8 +28,8 @@ import ( "github.com/osapi-io/osapi/internal/cli" ) -// clientNodeScheduleCronGetCmd represents the cron get command. -var clientNodeScheduleCronGetCmd = &cobra.Command{ +// clientNodeScheduleGetCmd represents the cron get command. +var clientNodeScheduleGetCmd = &cobra.Command{ Use: "get", Short: "Get a cron entry by name", Run: func(cmd *cobra.Command, _ []string) { @@ -37,7 +37,7 @@ var clientNodeScheduleCronGetCmd = &cobra.Command{ host, _ := cmd.Flags().GetString("target") name, _ := cmd.Flags().GetString("name") - resp, err := sdkClient.Cron.Get(ctx, host, name) + resp, err := sdkClient.Schedule.Get(ctx, host, name) if err != nil { cli.HandleError(err, logger) return @@ -76,10 +76,10 @@ var clientNodeScheduleCronGetCmd = &cobra.Command{ } func init() { - clientNodeScheduleCronCmd.AddCommand(clientNodeScheduleCronGetCmd) + clientNodeScheduleCmd.AddCommand(clientNodeScheduleGetCmd) - clientNodeScheduleCronGetCmd.PersistentFlags(). + clientNodeScheduleGetCmd.PersistentFlags(). String("name", "", "Name of the cron entry (required)") - _ = clientNodeScheduleCronGetCmd.MarkPersistentFlagRequired("name") + _ = clientNodeScheduleGetCmd.MarkPersistentFlagRequired("name") } diff --git a/cmd/client_node_schedule_cron_list.go b/cmd/client_node_schedule_list.go similarity index 90% rename from cmd/client_node_schedule_cron_list.go rename to cmd/client_node_schedule_list.go index 956f051c3..25c6d6ce4 100644 --- a/cmd/client_node_schedule_cron_list.go +++ b/cmd/client_node_schedule_list.go @@ -28,15 +28,15 @@ import ( "github.com/osapi-io/osapi/internal/cli" ) -// clientNodeScheduleCronListCmd represents the cron list command. -var clientNodeScheduleCronListCmd = &cobra.Command{ +// clientNodeScheduleListCmd represents the cron list command. +var clientNodeScheduleListCmd = &cobra.Command{ Use: "list", Short: "List all cron entries", Run: func(cmd *cobra.Command, _ []string) { ctx := cmd.Context() host, _ := cmd.Flags().GetString("target") - resp, err := sdkClient.Cron.List(ctx, host) + resp, err := sdkClient.Schedule.List(ctx, host) if err != nil { cli.HandleError(err, logger) return @@ -79,5 +79,5 @@ var clientNodeScheduleCronListCmd = &cobra.Command{ } func init() { - clientNodeScheduleCronCmd.AddCommand(clientNodeScheduleCronListCmd) + clientNodeScheduleCmd.AddCommand(clientNodeScheduleListCmd) } diff --git a/cmd/client_node_schedule_cron_update.go b/cmd/client_node_schedule_update.go similarity index 80% rename from cmd/client_node_schedule_cron_update.go rename to cmd/client_node_schedule_update.go index 7128f0111..3eb0ab7cd 100644 --- a/cmd/client_node_schedule_cron_update.go +++ b/cmd/client_node_schedule_update.go @@ -29,8 +29,8 @@ import ( "github.com/osapi-io/osapi/pkg/sdk/client" ) -// clientNodeScheduleCronUpdateCmd represents the cron update command. -var clientNodeScheduleCronUpdateCmd = &cobra.Command{ +// clientNodeScheduleUpdateCmd represents the cron update command. +var clientNodeScheduleUpdateCmd = &cobra.Command{ Use: "update", Short: "Update a cron entry", Run: func(cmd *cobra.Command, _ []string) { @@ -42,7 +42,7 @@ var clientNodeScheduleCronUpdateCmd = &cobra.Command{ user, _ := cmd.Flags().GetString("user") contentType, _ := cmd.Flags().GetString("content-type") - resp, err := sdkClient.Cron.Update(ctx, host, name, client.CronUpdateOpts{ + resp, err := sdkClient.Schedule.Update(ctx, host, name, client.ScheduleUpdateOpts{ Object: object, Schedule: schedule, User: user, @@ -86,19 +86,19 @@ var clientNodeScheduleCronUpdateCmd = &cobra.Command{ } func init() { - clientNodeScheduleCronCmd.AddCommand(clientNodeScheduleCronUpdateCmd) + clientNodeScheduleCmd.AddCommand(clientNodeScheduleUpdateCmd) - clientNodeScheduleCronUpdateCmd.PersistentFlags(). + clientNodeScheduleUpdateCmd.PersistentFlags(). String("name", "", "Name of the cron entry to update (required)") - clientNodeScheduleCronUpdateCmd.PersistentFlags(). + clientNodeScheduleUpdateCmd.PersistentFlags(). String("object", "", "New object to deploy") - clientNodeScheduleCronUpdateCmd.PersistentFlags(). + clientNodeScheduleUpdateCmd.PersistentFlags(). String("schedule", "", "New cron schedule expression") - clientNodeScheduleCronUpdateCmd.PersistentFlags(). + clientNodeScheduleUpdateCmd.PersistentFlags(). String("user", "", "New user to run the command as") - clientNodeScheduleCronUpdateCmd.PersistentFlags(). + clientNodeScheduleUpdateCmd.PersistentFlags(). String("content-type", "", "Content type: raw or template") - _ = clientNodeScheduleCronUpdateCmd.MarkPersistentFlagRequired("name") - clientNodeScheduleCronUpdateCmd.MarkFlagsOneRequired("object", "schedule", "user") + _ = clientNodeScheduleUpdateCmd.MarkPersistentFlagRequired("name") + clientNodeScheduleUpdateCmd.MarkFlagsOneRequired("object", "schedule", "user") } diff --git a/cmd/controller_setup.go b/cmd/controller_setup.go index a6a003199..e532859bc 100644 --- a/cmd/controller_setup.go +++ b/cmd/controller_setup.go @@ -52,7 +52,7 @@ import ( nodeAPI "github.com/osapi-io/osapi/internal/controller/api/node" certificateAPI "github.com/osapi-io/osapi/internal/controller/api/node/certificate" commandAPI "github.com/osapi-io/osapi/internal/controller/api/node/command" - dockerAPI "github.com/osapi-io/osapi/internal/controller/api/node/docker" + dockerAPI "github.com/osapi-io/osapi/internal/controller/api/node/container" nodeFileAPI "github.com/osapi-io/osapi/internal/controller/api/node/file" hostnameAPI "github.com/osapi-io/osapi/internal/controller/api/node/hostname" logAPI "github.com/osapi-io/osapi/internal/controller/api/node/log" diff --git a/docs/docs/gen/api/delete-node-schedule-cron.StatusCodes.json b/docs/docs/gen/api/delete-node-schedule-cron.StatusCodes.json deleted file mode 100644 index 4ba6458da..000000000 --- a/docs/docs/gen/api/delete-node-schedule-cron.StatusCodes.json +++ /dev/null @@ -1 +0,0 @@ -{"responses":{"200":{"description":"Cron entry deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"Result of a cron create, update, or delete operation for one host.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that processed this operation."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Cron entry name."},"changed":{"type":"boolean","description":"Whether the operation modified system state."},"error":{"type":"string","description":"Error message if the agent failed."}},"required":["hostname","status"],"title":"CronMutationResult"}}},"required":["results"],"title":"CronDeleteResponse"}}}},"400":{"description":"Bad request - validation error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"404":{"description":"Cron entry not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error deleting cron entry.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/delete-node-schedule-cron.api.mdx b/docs/docs/gen/api/delete-node-schedule-cron.api.mdx deleted file mode 100644 index 3dc396252..000000000 --- a/docs/docs/gen/api/delete-node-schedule-cron.api.mdx +++ /dev/null @@ -1,70 +0,0 @@ ---- -id: delete-node-schedule-cron -title: "Delete a cron entry" -description: "Delete a cron drop-in entry from the target node." -sidebar_label: "Delete a cron entry" -hide_title: true -hide_table_of_contents: true -api: eJztWG2PGjcQ/iuW1Q+J6gUu5dIGqR9Ic1GvSqoovShSrxSZ9cD62LW349nLEbT/vRp74TigbZomUiPdJxbW8/Y8M8OM19JAyNHWZL2TI/kMSiAQWuTonTDo68w6AY5wJeboK0EFCNK4ABLOG+j95qSSpBdBji7lL3kBpilh+lI7vYAKHE3Hr86nrGzqa0DNZoKcKLn9dm62Zn/2BjYqfkDPmgPkDVpaydHlWj4FjYDjhgo2xkpH79ASyEk7UbLWqCsgwBAPO12BHMnCB4qPSloOsNZUSCUR/mgsgpEjwgbUHgoXKUC9AEdio0EJhAB4DUagb8i6hbjWZQPiwVS7lRJTXZYPlfAoSj2DUgQoISeP4sESVqN49GGC6ybzurZZ7g0swGVwQ6izhOFaXuvSGk3s+8ZJVVn3/YmKb6YJfNkqGfICKs0ytKr5fCC0biGVrKx7AW7BOJ20rdqC8a+BYBY69lm2J142gUTuHWnrhHflSuiyLrRrKkCbi7zQqHPmQInGGcCQe4SghHZGFKu6ABf+CwYfHjbnAxEgR/H7pc7ej7NfB9mTaTb5+ivZcr4ghNq7ANHio8GAP/4yehMT1PSkkhw9OOLjuq5Lm8c07l8FllkfuudnV5CTVLJGTnqyyeKVn02tORbG3GOlSY5k01gjD3KzAHHlZ+L8mWgCGEFe1OhzCEFQYYNgwCAQewo3uqpL1n16OoDvhoNBBo+ezLLhiRlm+tuTx9lw+Pjx6elwOBgMBowtQmhKCjteaUS94pwhqMKxqO569zoqEH6+aSE5giZQoqlN/PTYYSm2HUDMPQrvIFZa7wCobQUfgequ8R+7k2ye+1SqXyo0bSBivBikre1ezCjS1IRj+sE1Ffcav2RetC2BCQlLW9fxiWwFviFuaIcsJbUbZ+6GG71I8bZKflh4+8XIknmh3QJ202jmfQnaHUi/LYAKwD1fKm/s3IIRYRUIquhz0gyIHv/ZqTM+JioIQS9A2F3gE1492ba7beZytyV3yE8YSYqZykG+bCh6l5JJtvsKNlm6J5b+RF53Zc1irZLDY4X9VJtNnYhMdN2G4YhBf8Ii/0AQx2Ln+yZhomzKXp/nDWJqP7dF/Tziyw0AgdDC9SblIn8GSNvyaFbvGTfG8qMuRScj9Mw3dOvEUbOmATbtgN55XIquElJSerObztYRLACPdrIUJAvcMXI6GDB5G3Zjkh0Qe3JI7BunGyo82vdgRCbGr87FElZimzz3xH4JxH5zSOxzjzNrDDiRiXMXmvnc5pabTA1Y2RDiWHnP7pfA7vBvBy3nScx94z7lqHVP52ej8/TY32uaCeKYx1tSvmX3ntP/P6etkhVQ4XktT5O6VGlZHMm+rm2f1/7+ejPEtf3Qbex95rm/jj/GzR2v0y4+uV3jebuvEoG7y/w2oIKolt2KF4fZeEiq7uH5ZjP66e1FHCutm/so3oUzjoPn7e0DTwBSSXYkIXPSG/TiplP7QJWOKdctx3evPmK+7gO7vs3ej70pSXES3FC/LrV17EuDJetOIF9KXVupJMtIJUe703KHNFdRuh4ZxTcTFWdqll2vZzrAGyzbln/+owFcJQquNVo9Y5Qu19LYwM9Gjua6DPtr/26YD153s9ND8ZlvRY5Cs9lCHXMRT8uRlEouYbV7ucN3HB8V0+e74PiIcFIok1bJArQBjFSlV+M8h5p2hA56J19pbAv32dmLs4szqaS+W1979RQNHPVpvU4nLvwSXNtuXST+zj627Z95jALq -sidebar_class_name: "delete api-method" -info_path: gen/api/agent-management-api -custom_edit_url: null ---- - -import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; -import ParamsDetails from "@theme/ParamsDetails"; -import RequestSchema from "@theme/RequestSchema"; -import StatusCodes from "@theme/StatusCodes"; -import OperationTabs from "@theme/OperationTabs"; -import TabItem from "@theme/TabItem"; -import Heading from "@theme/Heading"; -import Translate from "@docusaurus/Translate"; - - - - - - - - - - -Delete a cron drop-in entry from the target node. - - - - Request - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/docs/gen/api/delete-node-schedule-cron.ParamsDetails.json b/docs/docs/gen/api/delete-node-schedule.ParamsDetails.json similarity index 56% rename from docs/docs/gen/api/delete-node-schedule-cron.ParamsDetails.json rename to docs/docs/gen/api/delete-node-schedule.ParamsDetails.json index 748479206..1bf06c373 100644 --- a/docs/docs/gen/api/delete-node-schedule-cron.ParamsDetails.json +++ b/docs/docs/gen/api/delete-node-schedule.ParamsDetails.json @@ -1 +1 @@ -{"parameters":[{"name":"hostname","in":"path","required":true,"description":"Target agent hostname, reserved routing value (_any, _all), or label selector (key:value).\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1,valid_target"},"schema":{"type":"string","minLength":1}},{"name":"name","in":"path","required":true,"description":"Cron entry name. Must contain only alphanumeric characters, underscores, and hyphens.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1"},"schema":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9_-]+$"}}]} \ No newline at end of file +{"parameters":[{"name":"hostname","in":"path","required":true,"description":"Target agent hostname, reserved routing value (_any, _all), or label selector (key:value).\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1,valid_target"},"schema":{"type":"string","minLength":1}},{"name":"name","in":"path","required":true,"description":"Scheduled entry name. Must contain only alphanumeric characters, underscores, and hyphens.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1"},"schema":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9_-]+$"}}]} \ No newline at end of file diff --git a/docs/docs/gen/api/delete-node-schedule-cron.RequestSchema.json b/docs/docs/gen/api/delete-node-schedule.RequestSchema.json similarity index 100% rename from docs/docs/gen/api/delete-node-schedule-cron.RequestSchema.json rename to docs/docs/gen/api/delete-node-schedule.RequestSchema.json diff --git a/docs/docs/gen/api/delete-node-schedule.StatusCodes.json b/docs/docs/gen/api/delete-node-schedule.StatusCodes.json new file mode 100644 index 000000000..c0776d0fc --- /dev/null +++ b/docs/docs/gen/api/delete-node-schedule.StatusCodes.json @@ -0,0 +1 @@ +{"responses":{"200":{"description":"Scheduled entry deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"Result of a cron create, update, or delete operation for one host.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that processed this operation."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Scheduled entry name."},"changed":{"type":"boolean","description":"Whether the operation modified system state."},"error":{"type":"string","description":"Error message if the agent failed."}},"required":["hostname","status"],"title":"ScheduleMutationResult"}}},"required":["results"],"title":"ScheduleDeleteResponse"}}}},"400":{"description":"Bad request - validation error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"404":{"description":"Scheduled entry not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error deleting scheduled entry.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/delete-node-schedule.api.mdx b/docs/docs/gen/api/delete-node-schedule.api.mdx new file mode 100644 index 000000000..44cf8e819 --- /dev/null +++ b/docs/docs/gen/api/delete-node-schedule.api.mdx @@ -0,0 +1,70 @@ +--- +id: delete-node-schedule +title: "Delete a scheduled entry" +description: "Delete a scheduled entry from the target node." +sidebar_label: "Delete a scheduled entry" +hide_title: true +hide_table_of_contents: true +api: eJztWG1v2zYQ/ivEYR9ajLKdzulWA/vgoimWoRmKNkWBZZ5Bi2eLiUSq5CmNa+i/D0dajmN7a9e1wArkkyWb9/bcc+c7rkBjyL2pyTgLI3iGJRIKJUJeoG5K1AIt+aWYe1cJKlCQ8gskYZ3G3h8WJJBaBBhdwOu1xPRMWbXACi1Nxy9Pp52mqavRK7YTYCJh83aqN3Z/cxo7NSAhYN54Q0sYXazgKSqPftxQwcY6paP33hDCpJ1IqJVXFRL6EAWsqhBGULhA8VGC4QhrRQVI8PiuMR41jMg3KHdgOE9BqgVaEp0GKTwG9NeohXcNGbsQ16psUDyYKruUYqrK8qEUzotSzbAUAUvMyXnx4AqXo3j0YYLsJnOqNlnuNC7QZnhDXmUJxxVcq9JoRex756SsjP35SMZfpikB0MoIQqVYhpY1nw/kjV2AhMrYF2gXjNVR28oNGP8aiNc7NGAFPXHWBBK5s6SMFc6WS6HKulC2qdCbXOSF8irnREjRWI0+5M5jkEJZLYplXaAN/wWIT4+dSUGEnkP580JlH8bZ74PsyTSbfP8dtEwaj6F2NmC0+Ggw4I9/hkBHquoeSGAI0BLLqLouTR4J3b8MLLja99HNLjEnkFB7pj+ZZPbSzaZGH4pl7nylCEbQNEbDHksLFJduJk6fiSagFuRE7V2OIQgqTBCMGgZiT/FGVXXJuo+PB/jTcDDI8NGTWTY80sNM/Xj0OBsOHz8+Ph4OB4PBgAH2GJqSwpZXynu1ZPYQVuFQVHe9exUVCDcXSuTeWZF7VIRSNLWOn86vsRSbXiDmzgtnMdZcbw+oTS0fgOqu8V/WJ9k8d61UyVQo6iBivBikje1epBUpasIh/WibijuPu+K8KFMiJyRcmbqOT2QqdA1xa9vPUlLbOXM33OhFireV8GnhHSxLFs8LZRe4zaWZcyUqu6fibYFUoN9xqHLazA1qEZaBsIqOJ83ovfMf9+yEj4kKQ1ALFGYb/QRaD9p2u+tcbHfoNfwThpMiXbtIzxqKHiZWQburpKPrAdH03/JqXegs2koYHir1p0p3RSMyse4/DEsM/gtW/CeCORZb7x17omyissvzxvvUi24r/HnEmbuBR/IGrzv+xTxqJGXKgxTfMa614UdVirWMUDPX0K0TB83qBtm0RXrv/JVYl0Uip9Pb3DaWcIH+YFtLQbLAHSPHgwEnr8twJNteYo/2E/vGqoYK580H1CIT45en4gqXYkOg+8R+C4n9YT+xz52fGa3Rikyc2tDM5yY33Gxq9JUJIU6b99n9FrI7/PjoZR2JuWvslxy+7nP61XJ6fOg/Ng0IcfDjDWpnz7xP7P8/sa2ECqlwvLenAR5k2iZH0Fe16fPdQH/VjXVtv8txfxXf42bvr9OePrld87naq5S77WV/E0tBVMN684uTbTwEcv3wvNuVfn17HmdMY+cuiq8jGccp9PZ2gscAkMCOJFCOeoNe3H1qF6hSkW3rxfnv7kV2gV3dsvez7lJSpIQ31K9LZSx70/iSFSeEL0DVBiSwDEgYbQ/Ptzcno/jVRMbZmoVWq5kK+MaXbctfv2vQLxP618obNWOALlagTeBnDaO5KsPubcB2cA9erWenh+IrX5YcxKRbSS1nIJ6GEYCEK1xu3/nw1cdnxfSV7z0+I6YUz6SVUKDS6GO+0k/jPMeatoT22ibfdGxq9tnJi5PzE5Cg7tbXTj1FAwd9Wq3SiXN3hbZtNy4Sv7OPbfsX5VkQBg== +sidebar_class_name: "delete api-method" +info_path: gen/api/agent-management-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; +import Translate from "@docusaurus/Translate"; + + + + + + + + + + +Delete a scheduled entry from the target node. + + + + Request + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule-cron-by-name.ParamsDetails.json b/docs/docs/gen/api/get-node-schedule-by-name.ParamsDetails.json similarity index 56% rename from docs/docs/gen/api/get-node-schedule-cron-by-name.ParamsDetails.json rename to docs/docs/gen/api/get-node-schedule-by-name.ParamsDetails.json index 748479206..1bf06c373 100644 --- a/docs/docs/gen/api/get-node-schedule-cron-by-name.ParamsDetails.json +++ b/docs/docs/gen/api/get-node-schedule-by-name.ParamsDetails.json @@ -1 +1 @@ -{"parameters":[{"name":"hostname","in":"path","required":true,"description":"Target agent hostname, reserved routing value (_any, _all), or label selector (key:value).\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1,valid_target"},"schema":{"type":"string","minLength":1}},{"name":"name","in":"path","required":true,"description":"Cron entry name. Must contain only alphanumeric characters, underscores, and hyphens.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1"},"schema":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9_-]+$"}}]} \ No newline at end of file +{"parameters":[{"name":"hostname","in":"path","required":true,"description":"Target agent hostname, reserved routing value (_any, _all), or label selector (key:value).\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1,valid_target"},"schema":{"type":"string","minLength":1}},{"name":"name","in":"path","required":true,"description":"Scheduled entry name. Must contain only alphanumeric characters, underscores, and hyphens.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1"},"schema":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9_-]+$"}}]} \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule-cron-by-name.RequestSchema.json b/docs/docs/gen/api/get-node-schedule-by-name.RequestSchema.json similarity index 100% rename from docs/docs/gen/api/get-node-schedule-cron-by-name.RequestSchema.json rename to docs/docs/gen/api/get-node-schedule-by-name.RequestSchema.json diff --git a/docs/docs/gen/api/get-node-schedule-by-name.StatusCodes.json b/docs/docs/gen/api/get-node-schedule-by-name.StatusCodes.json new file mode 100644 index 000000000..163fa6306 --- /dev/null +++ b/docs/docs/gen/api/get-node-schedule-by-name.StatusCodes.json @@ -0,0 +1 @@ +{"responses":{"200":{"description":"Scheduled entry detail.","content":{"application/json":{"schema":{"type":"object","description":"Collection response for a single scheduled entry get operation.","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"A scheduled entry.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that reported this entry."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Scheduled entry name."},"object":{"type":"string","description":"Object store name for the deployed content."},"schedule":{"type":"string","description":"Cron schedule expression. Present for /etc/cron.d/ entries.\n"},"interval":{"type":"string","description":"Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries.\n","enum":["hourly","daily","weekly","monthly"]},"source":{"type":"string","description":"Where the entry lives: \"cron.d\", \"hourly\", \"daily\", \"weekly\", or \"monthly\".\n"},"user":{"type":"string","description":"User the scheduled entry runs as."},"error":{"type":"string","description":"Error message if the agent failed to retrieve this entry."}},"required":["hostname","status"],"title":"ScheduleEntry"}}},"required":["results"],"title":"ScheduleGetResponse"}}}},"400":{"description":"Bad request - validation error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"404":{"description":"Scheduled entry not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error retrieving scheduled entry.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule-by-name.api.mdx b/docs/docs/gen/api/get-node-schedule-by-name.api.mdx new file mode 100644 index 000000000..b39d44ce1 --- /dev/null +++ b/docs/docs/gen/api/get-node-schedule-by-name.api.mdx @@ -0,0 +1,70 @@ +--- +id: get-node-schedule-by-name +title: "Get a scheduled entry" +description: "Get a specific scheduled entry by name on the target node." +sidebar_label: "Get a scheduled entry" +hide_title: true +hide_table_of_contents: true +api: eJztWG1v2zYQ/isHYh8SjH5J53SrgX1wu7bLsHZBm6LAEs+gxbPFWCJVknKjGvrvw5GS47ctWYsCK5BPkmze2/PcHclbMYkusarwymg2ZC/RgwBXYKJmKgGXpCjLDCWg9raCaQVa5AhGg08RvLBz9KCNxO6VZpx5MXdseMneNnKTV0KLOeao/WR0fjZp9U1MgVaQTcfGnK2/zmT04bWR2Op4Wr0WOTLOHCalVb5iw8sVe4rCoh2VPiV7rd6hRSHZuB5zVggrcvRoXVhPbrMhS43zOqpTFG8hfMo4s/ihVBYlG3pbIt8B5SKGKeaoPbQaOFh0aJcowZrSKz2HpchKhKOJ0BWHiciyYw7GQiammIHDDBNvLBwtsBqGpccRtJuOEYXqJEbiHHUHb7wVnYjkii1FpqTw5HvrJM+V/vmEh38mkQJW84BBLkjGVwWtd94qPWec5Ur/jnpOUJ3UNV+D8Z+BeLuTDqSgC69K5yEx2gulweisApEVqdBljlYlkKTCioSI4FBqidYlxqLjILSEtCpS1O5LgLh/7JQU3qOlUP66FJ1Po86f/c6TSWf8/XespqSx6AqjHQaLj/p9evw7BBK9UFmXcUYIoPYkIooiU0nI6N61I7nVvotmeo2JZ7sYPzMZJYoyGlpvYGYsVaXS8wz3apJSc11A5Ehh6dOrGMW1mU6UPATNzNhceDZkZanknh8XKcK1mcLZL1A6lOANFNYk6Bz4VDkgEtB5Mog3Ii8y0n162sefBv1+Bx89mXYGJ3LQET+ePO4MBo8fn54OBv1+v098WXRl5t2GV8JaUVEyeszd3SiNdmHYD3xd6gdC31b2a7MSzCy0tVjoPhUeLBbGegqfYm4sUcJ54Ut3SDXqMqeWZBYEsVAZErZuoYoivHmVoyk9tb19wKPa1o81qyEBggcUVHDgfpEdLFgSb2C9U8EfYR04byzG1h9dQZBYZKZCCU3ed9s6JHt3K35mjV5zCHhTWHSOEhjOqa9qHwz10Ce9xBrdlb0QgsLQK2rqWh7tUmR3mzpHq4xUCbQicJSa0mYVBykUPT4iLuiZG+3TrDr+JydWrYZ6y5tb0qNe8oAUM86iZupDUTUbE0qmtMk9MHqfosUAdmQvU0t0Q7hiEZErxuGqMRnfg9X4Gg3Tu7Fw1Zq/Yg16pUN7twPvHEayd3uOLbUD4QLnaK25h67ntAxydE7MEdRmpcUqoQ5jkUBd4na51Zv70uXmHt6U4ZjKyocO1Gb8c5Jl9a5s23gOSLxE/6ZpuCRXczY4tAE8FbLtfdCBZleiGg04fNFGsN2/7onrCDa+284RZGMHM0lSWotyu1G/2Ic8YhkojZvawfa2Y1xKRa8iazZCB2JqSn/rxEGzskQyrdF/NHYBTUsMpmnz37BLBTdHe3B3ikGSwJaR036fyGvpDXm3R+zJPrHvtCh9aqz6hBI6MDo/gwVWsM6eB2K/BWJ/2Cf2hbFTJSVq6MCZduVsphJFfadAm6uw67gHdr8Jdgd3H8i1oV271PKhFX8LnJ4e2mPjWaGBg27WBw77D9T+v6mtOcvRp4YmOjSh4HHEMGQ9UagejYx6q/YkV/dagnur8B2mPXYZhzfj29EPFXseidscAK0DSb0vWDMOoO9pWMR48/KivfH+9v4iHCuVnpkg3oQxCufR26EVnQIYZ+RIROSk2++GG2xhnM9FSLVmmtKMzrYzdRfS1W3efvGsLYbs8cb3ikyoeK634UIUob5kolCMM5JhnA03D87tRY2zYfhpzMO5moRWq6lw+M5mdU0/fyjRVpGGpbBKTAmpyxWTytG7ZMOZyNzurGgz0KM3zRnqGL7yKO0gJu2EQRMbYTUbMsbZAqvNiSANxj4rpq88FfuMmGI8dNVMUUi66V2umr9GSYKF3xDaa540B1tX7svnF4wzsV1lO1UVtB90aLWKKy7MAnVdr/3z9E0O1vXfM0LQXg== +sidebar_class_name: "get api-method" +info_path: gen/api/agent-management-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; +import Translate from "@docusaurus/Translate"; + + + + + + + + + + +Get a specific scheduled entry by name on the target node. + + + + Request + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule-cron-by-name.StatusCodes.json b/docs/docs/gen/api/get-node-schedule-cron-by-name.StatusCodes.json deleted file mode 100644 index 8ec5ff3fc..000000000 --- a/docs/docs/gen/api/get-node-schedule-cron-by-name.StatusCodes.json +++ /dev/null @@ -1 +0,0 @@ -{"responses":{"200":{"description":"Cron entry detail.","content":{"application/json":{"schema":{"type":"object","description":"Collection response for a single cron entry get operation.","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"A cron drop-in entry.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that reported this entry."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Cron entry name."},"object":{"type":"string","description":"Object store name for the deployed content."},"schedule":{"type":"string","description":"Cron schedule expression. Present for /etc/cron.d/ entries.\n"},"interval":{"type":"string","description":"Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries.\n","enum":["hourly","daily","weekly","monthly"]},"source":{"type":"string","description":"Where the entry lives: \"cron.d\", \"hourly\", \"daily\", \"weekly\", or \"monthly\".\n"},"user":{"type":"string","description":"User the cron entry runs as."},"error":{"type":"string","description":"Error message if the agent failed to retrieve this entry."}},"required":["hostname","status"],"title":"CronEntry"}}},"required":["results"],"title":"CronGetResponse"}}}},"400":{"description":"Bad request - validation error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"404":{"description":"Cron entry not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error retrieving cron entry.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule-cron-by-name.api.mdx b/docs/docs/gen/api/get-node-schedule-cron-by-name.api.mdx deleted file mode 100644 index 1396c6e0f..000000000 --- a/docs/docs/gen/api/get-node-schedule-cron-by-name.api.mdx +++ /dev/null @@ -1,70 +0,0 @@ ---- -id: get-node-schedule-cron-by-name -title: "Get a cron entry" -description: "Get a specific cron drop-in entry by name on the target node." -sidebar_label: "Get a cron entry" -hide_title: true -hide_table_of_contents: true -api: eJztWG1v2zYQ/isHYh8SjIqdzulWA/vgbm2XYe2CLkWBJZ5Bi2eLsUSqJOVGNfTfhyMlx7HdJWtXYAXyyZLFe3vu7iF5KybRpVaVXhnNhuwFehDgSkzVTKWQWqNBWlMmSgNqb2uY1qBFgWA0+AzBCztHD9pIPLrUjDMv5o4NL9gfaYayynHyUmgxxwK1n4zOTiekcmJKtIJMOjbmbP12KqMLr4zETv4na/TT+pUokHHmMK2s8jUbXqzYUxQW7ajyGdkjvUOLQrJxM+asFFYU6NG6sJZcZkOWGed1VKUo3FL4jHFm8V2lLEo29LZCvoXJeQxRzFF76DRwsOjQLlGCNZVXeg5LkVcIBxOhaw4TkeeHHIyFXEwxB4c5pt5YOFhgPQxLDyNg14kRpUpSI3GOOsFrb0USUVyxpciVFJ5875zkhdI/HvPwZRLhZw1nLs2wECTj65LWO2+VnjPOCqV/Qz0nmI6bhq/B+NdAUCraKiDZI3hZOQ+p0V4oDUbnNYi8zISuCrRUPZmwIqUccKi0ROtSY9FxEFpCVpcZavc5GNw/bKoH79FSFH9diOTDKPmznzyZJONvv2EN1YtFVxrtMFh81O/Tz0ejl+iFyo8YZxQ8ak+rRVnmKg113LtyJLLa9c5MrzD1bAdZk1N5KKOhcwRmxlIrKj3PMTZiNE61uO4Y8qG09OpV9P3KTCdK7gNkZmwhPBuyqlJyx4XzDOHKTOH0Z6gcSvAGSmtSdA58phwQ9Og8GcRrUZQ56T456eMPg34/wUdPpsngWA4S8f3x42QwePz45GQw6Pf7fcqSRVfl3m14JawVNVWfx8LdDdBoDxXtxr5u7z3R39b3S7sSzCzQWGxunwkPFktjPSFAYbeWqNK88JXbpxp1VRAFmQWhLFSOBK9bqLIMT14VaCpPVLeLeVTb+bFObEh/8ICCCg7cL7LtJiXJFtQ7ZX8P68B5YzGyfPQCQWKZmxoltAV/1PUeUfQ9neqWA16XFp2j8oUzolHtg6Ee+rRHeT6SvRCCwsAPDZGUR7sU+d2mztAqI1UKnQgcZKayec1BCkU/7xEX9FsY7bO8PvyYE6tOQ3PLm5t8R73kASlmnEXNxD1RNRsTSqay6T0wepuhxQB2zF6uluiGcMkiIpeMw2VrMj4Hq/ExGqZnY+GyM3/JWvQqh/ZuB944jMneIBtbaQfChXSjteYeap7RMijQOTFHUJv9FXuDqMUi4bnE203WbO5AF5u7ddt8Y2omH6iHSuoZybFmW65jm63VL9C/bsmVZBrOBvt4/qmQHdlBAu3mQx0Z4v8s0r/NVvfEcwQb7x1PBNnIVyZNK2tR3mbm57tQRwxDKuMGtpfMtoxLqehR5O2m50BMTeVvnNhrVlZIpjX698YuoCXAYJr2+A271GNztHu3oxgkCdwyctLvU/K61IZ620ns8W5i32hR+cxY9QElJDA6O4UF1rCunIfEfg2J/W43sc+NnSopUUMCp9pVs5lKFfFNibZQYaNxD9n9KrI7+Mdztza0R1daPrDw15DOk33bazwetHDQtfnmtPGQ1f9/VhvOCvSZoUkNTR54HB0MWU+UqkdjoN6qO7c1ve7IHw7UvVX4M4xx7DJOZsY3Mx0a+BQxe5uTnXU0mfclay/89D4NixhvH553t9tf356Hk6TSMxPE21hG4Qh6M42iAwDjjByJsBwf9Y/CbbU0zhci1Fs7KoljsZtK3YZ0dVO3/8UILQbs8dr3ylyoeIa34fIT0b5golSMM5JhnA03T8rdpYyHiwN9DV/GPJynSXa1mgqHb2zeNPT3uwptHXOxFFaJKcF1sWJSOXqWbDgTudueBm2GfPC6PUMdwhcelu2FphspaMpLWM2GjHG2wHpz5kejr0+K6cvNvT4hnBgKXSwzFJLudRer9tMoTbH0G0I7DEqTrnX7vnh2zjgTt7tsq6uC9r0OrVZxxblZoG6atX+e3snBpvkbDPLAHg== -sidebar_class_name: "get api-method" -info_path: gen/api/agent-management-api -custom_edit_url: null ---- - -import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; -import ParamsDetails from "@theme/ParamsDetails"; -import RequestSchema from "@theme/RequestSchema"; -import StatusCodes from "@theme/StatusCodes"; -import OperationTabs from "@theme/OperationTabs"; -import TabItem from "@theme/TabItem"; -import Heading from "@theme/Heading"; -import Translate from "@docusaurus/Translate"; - - - - - - - - - - -Get a specific cron drop-in entry by name on the target node. - - - - Request - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule-cron.StatusCodes.json b/docs/docs/gen/api/get-node-schedule-cron.StatusCodes.json deleted file mode 100644 index 85edfd12f..000000000 --- a/docs/docs/gen/api/get-node-schedule-cron.StatusCodes.json +++ /dev/null @@ -1 +0,0 @@ -{"responses":{"200":{"description":"List of cron entries.","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"A cron drop-in entry.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that reported this entry."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Cron entry name."},"object":{"type":"string","description":"Object store name for the deployed content."},"schedule":{"type":"string","description":"Cron schedule expression. Present for /etc/cron.d/ entries.\n"},"interval":{"type":"string","description":"Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries.\n","enum":["hourly","daily","weekly","monthly"]},"source":{"type":"string","description":"Where the entry lives: \"cron.d\", \"hourly\", \"daily\", \"weekly\", or \"monthly\".\n"},"user":{"type":"string","description":"User the cron entry runs as."},"error":{"type":"string","description":"Error message if the agent failed to retrieve this entry."}},"required":["hostname","status"],"title":"CronEntry"}}},"required":["results"],"title":"CronCollectionResponse"}}}},"400":{"description":"Bad request - validation error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error listing cron entries.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule-cron.api.mdx b/docs/docs/gen/api/get-node-schedule-cron.api.mdx deleted file mode 100644 index 1d17268cd..000000000 --- a/docs/docs/gen/api/get-node-schedule-cron.api.mdx +++ /dev/null @@ -1,70 +0,0 @@ ---- -id: get-node-schedule-cron -title: "List all cron entries" -description: "List all cron drop-in entries on the target node." -sidebar_label: "List all cron entries" -hide_title: true -hide_table_of_contents: true -api: eJztWN1v2zYQ/1eIe0oA+SOd020C9uB2bZeh3YIuRR/iwKDFs8VYItUj5cYz9L8PR0qOv4YGw/pQoE+iLN4Hf7+74503oNBlpCuvrYEU3mrnhSwKkZE1QpGtetoINJ40OmGN8DkKL2mBXhirsD8xkICXCwfpLfyV5ajqAqfvpJELLNH46fj6asrKprZCkmzGwV0C27crBSm8Qf+HVdjJvyTLah1mNWm/hvR2Ay9QEtK49jlbYo0poVRw19wlUEmSJXokF/YaWSKkkFvnwzIBzYerpM8hAcJPtSZUkHqqMTlA4CYeTi7QeNFpSAShQ1qhEmRrr81CrGRRozibSrNOxFQWxXkiLIlCzrAQDgvMvCVxtsR1GraeR6geelZWupdZhQs0PXzwJHsRvw2sZKGV9Ox752RSavPLRRK+TCPw0CTgshxLyTJ+XfF+50mbBSRQavMWzYJhumgYG0JXWeMwWHg2HPLjBOl2Hjlvue5DApk1Ho1nAVlVhc4CYYN7x1KbYx/s7B4zDwlUxPR6HW3e29lUq1O+zi2V0kMKda0VHDGRo7i3M3H1q6gdKuGtqMhm6JzwuXaCIULn2VN8kGVVsO7LyyH+NBoOe/js51lvdKFGPfnjxfPeaPT8+eXlaDQcDocMIKGrC+92vJJEcs2h4rF0p0617934OEXW/aOzb0PwxOn39f3W7mQiOMliAPpcekFYWfKMAB+7tcRB4KWv3SnVaOqS08QuGWWpC2R43VJXVVh5XaKtPSfiMeZRbefHNlHF3FL0gA8VHHjayV52YbUWLBAkW1C/KPtn2Cect4RBuvUChcKqsGtUoo3SfpcWXECe6FS3XeBDReictqYvrjnVjQ+GBuizAfPcV4NtZkwMm9LGI61k8WVT10jaKp2JTkSc5bamYp0IJTU/PiMu+Vla4/Niff5vTmw6Dc2eN498R73sASuGBKJmLgtRNdwxSram7AkYfcyRMIAd2Sv0Cl0qJhARmUAiJq3JuA5W4zIa5rUlMenMT6BFr3ZIX3bgg8NIdvYYQlQbJ6QLdCORfYKaV7xNlOicXKDQu/kVc4NLCyHjucL9JGt2r4vb3RulTb47TiYfSg+H1CuWg+ZQrqs2B7tf2oLvCW3N+7ZIs2iTwOhUmX4hVVfzRE+0dwUnZoDhfyzYT4R1LHbeu3IRZGPZsllWE6HaL9CvjxGPUAZGFXqpi5M17cC4UpqXshCtjJAzW/tHJ06aVTWyaYP+s6WlaOtgMM1X8o5dTrUF0slbKR6SBfaMXA6HTF7HcAi7I2Ivjon9YGTtc0v6b1SiJ8bXV2KJa7ENoO/EfgvE/nBM7GtLM60UGtETV8bV87nONJedCqnU4b5x39n9Bti9PFWP47VSaBfmga/UPH8n9SuR2iRQos8tj588VCVxPExhICs94Nl2sOmu+2bQdYqhDwujKa3itHn3OKfy+FpG2nan1e0xcu8raGc3fp+FTZC0i9fdNPT7x5vQeWgzt0G8PcQ4tCyPszXfFJAAOxLxuOgP+2G6qazzpQyB1s7C+4N9G6eHgG4eo/a//hMQT+rxwQ+qQurY7FHokiO+tyArDQmwDCSQ7rZUXfeehA6TuyX+yjKbzUw6/EBF0/DPn2qkdQR/JUnLGeNzuwGlHa8VpHNZuMPZfvd4Z+/b2/VcfOWJ/yQk3cxpuDcPuyEFSGCJ690/Lhpu13OUirvl2037eZxlWPkdwaMCw3P/NrrfvLqBBOR+LB7EXtB+0qnNJu64sUs0TbP10fM7O9g0/wB421RV -sidebar_class_name: "get api-method" -info_path: gen/api/agent-management-api -custom_edit_url: null ---- - -import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; -import ParamsDetails from "@theme/ParamsDetails"; -import RequestSchema from "@theme/RequestSchema"; -import StatusCodes from "@theme/StatusCodes"; -import OperationTabs from "@theme/OperationTabs"; -import TabItem from "@theme/TabItem"; -import Heading from "@theme/Heading"; -import Translate from "@docusaurus/Translate"; - - - - - - - - - - -List all cron drop-in entries on the target node. - - - - Request - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule-cron.ParamsDetails.json b/docs/docs/gen/api/get-node-schedule.ParamsDetails.json similarity index 100% rename from docs/docs/gen/api/get-node-schedule-cron.ParamsDetails.json rename to docs/docs/gen/api/get-node-schedule.ParamsDetails.json diff --git a/docs/docs/gen/api/get-node-schedule-cron.RequestSchema.json b/docs/docs/gen/api/get-node-schedule.RequestSchema.json similarity index 100% rename from docs/docs/gen/api/get-node-schedule-cron.RequestSchema.json rename to docs/docs/gen/api/get-node-schedule.RequestSchema.json diff --git a/docs/docs/gen/api/get-node-schedule.StatusCodes.json b/docs/docs/gen/api/get-node-schedule.StatusCodes.json new file mode 100644 index 000000000..383dc2590 --- /dev/null +++ b/docs/docs/gen/api/get-node-schedule.StatusCodes.json @@ -0,0 +1 @@ +{"responses":{"200":{"description":"List of scheduled entries.","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"A scheduled entry.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that reported this entry."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Scheduled entry name."},"object":{"type":"string","description":"Object store name for the deployed content."},"schedule":{"type":"string","description":"Cron schedule expression. Present for /etc/cron.d/ entries.\n"},"interval":{"type":"string","description":"Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries.\n","enum":["hourly","daily","weekly","monthly"]},"source":{"type":"string","description":"Where the entry lives: \"cron.d\", \"hourly\", \"daily\", \"weekly\", or \"monthly\".\n"},"user":{"type":"string","description":"User the scheduled entry runs as."},"error":{"type":"string","description":"Error message if the agent failed to retrieve this entry."}},"required":["hostname","status"],"title":"ScheduleEntry"}}},"required":["results"],"title":"ScheduleCollectionResponse"}}}},"400":{"description":"Bad request - validation error.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error listing scheduled entries.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/get-node-schedule.api.mdx b/docs/docs/gen/api/get-node-schedule.api.mdx new file mode 100644 index 000000000..fd7cf454a --- /dev/null +++ b/docs/docs/gen/api/get-node-schedule.api.mdx @@ -0,0 +1,70 @@ +--- +id: get-node-schedule +title: "List all scheduled entries" +description: "List all scheduled entries on the target node." +sidebar_label: "List all scheduled entries" +hide_title: true +hide_table_of_contents: true +api: eJztWEtvGzcQ/ivEnGyAejiV01ZAD06apC6S1kgc5GAbArUca2ntkpshV7Eq7H8vhtyV9QpsFM0hQE7LlTiv75sZcnYFGn1GpgrGWRjDW+ODUEUhfJajrgvUAm0gg144K0KOIiiaYRDWaexfW5AQ1MzD+Ao+tBKTd8qqGZZow+Ts4nzSaZq4CkmxHQ83EtZv5xrG8AbDX05jpwMkeMxqMmEJ46sVvEBFSGd1yNlSp3FMqDTcNDcSKkWqxIDk436rSoQx5M6HuJRgOLpKhRwkEH6uDaGGcaAa5Q4ElylANUMbRKdBCkKPtEAtyNXB2JlYqKJGcTRRdinFRBXFsRSORKGmWAiPBWbBkTia43Ictx4nuO57TlWmlzmNM7Q9vA+kegnDFSxUYbQK7HvnpCyN/e1Exn8mCXxoZMSgVCwTlhXv94GMnYGE0ti3aGcM1UnD2BD6ylmP0cKz4ZAfB1h3t/uk90FC5mxAG1hKVVVhssja4M6z6GrfETe9wyyAhIqY42CS4Ts3nRh9yOFbR6UKMIa6Nhr26MhR3LmpOP9d1B61CE5U5DL0XoTceME4oQ/sKd6rsipY9+npEH8ZDYc9fPbrtDc60aOe+vnkeW80ev789HQ0Gg6HQ0aR0NdF8BteKSK15HwJWPpDUW17d7aD2bK/F/g6CQ+Evq3sj3YnU8GlllIw5CoIwspR4PA55tYSp0FQofaHVKOtSy4WN2eIlSmQsfVzU1VxFUyJrg5civuAJ7WdH+tSFbeOkgccVHTgaZF92AZJsFQUb2F9VMHfcZ/wwRFG6dYVFBqrwi1RizZP+111xD7yqOKX5OyaQ4H3FaH3xtm+uOCKtyEaGmDIBhk529eDdW1cWzZlbEBaqOJxUxdIxmmTiU5EHOWupmIphVaGH18Q5/wsnQ15sTz+mhOrTkOz5c0D6Ukve8CKQULSzN0hqYYbRsnVlD0Bo085EkawE3uFWaAfi2tIiFyDFNetybSOVtMyGea1I3Hdmb+GFr3aIz3uwEePieydYhNUWy+Uj5wjkXuCrle8TZTovZqhMJuVlqqEOwwhg7rA7XJrNo+Oq83TpS3DGy6rEDtQl/GvWBaaXdmu8RyQeOkKPjuMs+/bxs3ijYTRodb9QumuBYqeaM8PLtUIx//Yv58I75nYeO8aSJRNjcxlWU2Eertfv95HPkEamdUYlCkOdrkd41obXqpCtDJCTV0dHpw4aFbXyKYthi+O5qLtjNE0H9MbdrnuZkgHD6kUJAtsGTkdDpm8juWYfnvEnuwT+9GqOuSOzD+oRU+cXZyLOS7FOol+EPs9EPvTPrGvHU2N1mhFT5xbX9/emsxw+6mQShMPH/+D3e+A3dND/TgdL4XxcUb4lhfqH8x+I2YbCSWG3PFcytOWTHPjGAaqMgMefAer7uxvBn5zZKVFmkBvHuZXPtbLxNjmFLuOIA+hgnae4/dp3ASyXbzuhqM/P13GG4ixty6Kt/6fxavLw8zNJwVIYEcSFCf9YT8OO5XzoVQxx9r5+OvT/i6gq4es/U/fCFKsAe/DoCqUSXc/ipfmBO4VqMqABJYBCePNy1WH8I2Mdy7evFpNlcePVDQN//y5Rlom3BeKjJoyNFcr0MbzWsP4VhV+d9TfDOrofXuwHotv/AHgIBbd9Gn5jh53wxhAwhyXm98xGr6256g035qvVu3fZ1mGVdgQ3Gsr/BlgndNvXl2CBLWdhjtpF7UfdGq1Sjsu3Rxt06x9DPzODjbNv9I+XJk= +sidebar_class_name: "get api-method" +info_path: gen/api/agent-management-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; +import Translate from "@docusaurus/Translate"; + + + + + + + + + + +List all scheduled entries on the target node. + + + + Request + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/gen/api/post-node-schedule-cron.RequestSchema.json b/docs/docs/gen/api/post-node-schedule-cron.RequestSchema.json deleted file mode 100644 index 0a34c61ce..000000000 --- a/docs/docs/gen/api/post-node-schedule-cron.RequestSchema.json +++ /dev/null @@ -1 +0,0 @@ -{"title":"Body","body":{"description":"Cron entry creation parameters.","required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","object"],"properties":{"name":{"type":"string","description":"Name for the cron drop-in entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1,max=64"}},"object":{"type":"string","description":"Name of the uploaded file in the object store to deploy as the cron entry content.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1"}},"schedule":{"type":"string","description":"Cron schedule expression (e.g., \"*/5 * * * *\"). Mutually exclusive with interval — provide exactly one.\n","x-oapi-codegen-extra-tags":{"validate":"required_without=Interval,excluded_with=Interval,omitempty,cron_schedule"}},"interval":{"type":"string","description":"Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one.\n","enum":["hourly","daily","weekly","monthly"],"x-oapi-codegen-extra-tags":{"validate":"required_without=Schedule,excluded_with=Schedule,omitempty,oneof=hourly daily weekly monthly"}},"user":{"type":"string","description":"User to run the command as. Only applies when using schedule (cron.d entries include a user field).\n"},"content_type":{"type":"string","description":"Content type: \"raw\" or \"template\". When \"template\", the file content is rendered through Go text/template with agent facts and user-supplied vars.\n","enum":["raw","template"],"x-oapi-codegen-extra-tags":{"validate":"omitempty,oneof=raw template"}},"vars":{"type":"object","additionalProperties":true,"description":"Template variables. Only used when content_type is \"template\".\n"}},"title":"CronCreateRequest"}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/post-node-schedule-cron.StatusCodes.json b/docs/docs/gen/api/post-node-schedule-cron.StatusCodes.json deleted file mode 100644 index 4a72727e0..000000000 --- a/docs/docs/gen/api/post-node-schedule-cron.StatusCodes.json +++ /dev/null @@ -1 +0,0 @@ -{"responses":{"200":{"description":"Cron entry created.","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"Result of a cron create, update, or delete operation for one host.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that processed this operation."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Cron entry name."},"changed":{"type":"boolean","description":"Whether the operation modified system state."},"error":{"type":"string","description":"Error message if the agent failed."}},"required":["hostname","status"],"title":"CronMutationResult"}}},"required":["results"],"title":"CronCreateResponse"}}}},"400":{"description":"Invalid request payload.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error creating cron entry.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/post-node-schedule-cron.api.mdx b/docs/docs/gen/api/post-node-schedule-cron.api.mdx deleted file mode 100644 index aa364fa49..000000000 --- a/docs/docs/gen/api/post-node-schedule-cron.api.mdx +++ /dev/null @@ -1,70 +0,0 @@ ---- -id: post-node-schedule-cron -title: "Create a cron entry" -description: "Create a new cron drop-in entry on the target node." -sidebar_label: "Create a cron entry" -hide_title: true -hide_table_of_contents: true -api: eJztWNtuI7kR/ZUCn+xF6+KNPUkEzIN3s5M42Nk1Zj2YB9sQqGZJzTGb7OVFckdoIB+RL8yXBEV2q1uXrCezCZAFBgYsqZssVp1TN9aWCXS5lZWXRrMZ+9Yi9wgcNG4gt0aDsKYaSQ2ova3BaPAFgud2hR60ETh+0Cxjnq8cm92zn/ICRVA4f8s1X2GJ2s+vb2/mJGpuKrScDnLsMWO7XzeCzditcf4HI7AT8K01JNdhHqz0NZvdb9k3yC3a6+ALOopEzjZWemSPzWPGKm55iR6ti4s1L5HNWGGcj18zJsnAivuCZcziz0FaFGzmbcDsAIW7ZB5fofbQScjAokO7RgHWBC/1CtZcBYSzOdd1BnOu1HkGxoLiC1TgUGHujYWzJ6xncel5Aut5ZHglR7kRuEI9wmdv+SghuGVrrqTgnnTvlMxKqV9fZPHNPEHPmoy5vMCS0x5fV7TeeSv1imWslPp71CvC6aIhbEgSOv+NETWtP+TcdPTmRL80GnowxyfQyo32qD2J4lWlZB43TT46krc9VswsPmLu9wTds5aV9h0RaMklvMSIQ+Lv2LZ93X/gJcLS2OiVx/46hvcOBXAX3y+lQiC5ELRACxP0+YQ2jcWEeOt/b6X2aNdcNZNfRVnJn1+/umRNs7Pz0ywyy6hwqJThAkXSXKbYS4LAeWMRvAGBlTJ1Z2M+IDOx9GsMiJq7NiRf1j16Urcc8Lmy6By50xmOV+MMHthXkyv4Kv09sPMxvA0+cKVqwOdcBSfXCBvpC+jwh3/+/R9QWbOWggTy3CtKQvh5Rs1Jtgn+9U0rPovHivZN/9iU0mNZ+TqLiWuHAMHRqfYyHLdopREy7605K0ywqs5AcEkfG8Qn+iyN9oWqz8dwq3iOicokimg/7Zj/FrwdA78IHupQUhwmlUh50ollLClFaSRpRbH52Uh3+fwA6d3jHmmj0SxfJ20SPi08HToR/eDQvoz8e4eWYsOGFDO5KUuuKRGM4UetaohpCx1sCtQQHCXzHWpnKSXEKKI1UkfNgQMdDkuJSsRM3uwy4Typ82J8pNVAq2bwwCzfPDDKPA+MQFDc4wMbwwdSavgo69NXeyBIBxYpi6EAX1gTVgX82YDHZz/pNiZvSFVsyXPvgDAgI0YuRAAErLl1+/5g+YYKeivjPyH/kEvLN7CTQ+TRYafKAhdCEkRc3Q5qwMnK3Jm25lbyhcKO0EB5PrI5pIRg2sOWWGsy5qWnfBYTVmp53qUKyZqG3lt0ldEuVaKvp9OXiyYKKpSfXRj3a99Hs5hLccqflsaW3LMZC0GKI/+6KxA+mgXc/Cnh4Q2Ff46OEkr0mGgkaYrPvKwiBldXU/zD5XQ6wq//uBhdXojLEf/9xavR5eWrV1dXl5fT6XTKEiZB+SF/3FpOeYJYP8nrvnbvogCqbTyVqQRcBqES8dNYEKjQI+x6w1jbjcbYhY2PgNp1dy+G3l/alV1pTVHhC+47iGIgSdefPY5Nluc+uFPyu3gxT8QLlwqJEPckqyp+87JEE2Jnc8xSEtsps29u1CLZ22Sf2AcN3JE2xJ15wfUKh260MEYh10e7PxToC7QHupRGyCXlCFc7j2XUOUlGa80nZOHvaBmU6BxfIcgh8AmvMUvB1jeFg3a9Rf5xP1rfBh+1S87EmkMBnZc+ng7yFNZtlF+eCuwbHTNaFytQ8ZqasP9idH8ietcw+N15Styb3NbkebA25Z0+mt9EYGPtQypf687XInECPZfqpDsfHL7LyNDuAb4wwfdKnDxWhNiSavQbY5+gDYHkjUYM/Zj6mBXakyksGUkb9g65mk6HuTt61xGjF8eMvtc8+MJY+TcUMILr2xt4whp2XvOF2N8Csb87JvaNsQspBGoYwY12YbmUuaTsUqEtZbx5uC/s/gbYvTqViFP1SBMJvRpcbL+k4v9/TpuMlegLQ6O9yriIPE3eZmzCKzmhweFk2xX7ZtLdveIlN4797DoN8h77GSDdGcvE23ASuLOj8L5i7VgsdjtxEcvaL2+61vmvH+5i30HO8q4fjH3XGbebHe4I6WY3/ZN+JtI/6wcD/Z06XVf7Nfv3xfau1V6L0nBhaaJJLbLXsVvqh6lUvWgHWpdIuhhPx7E9J5RLrgfq72a5fegccrztA+nzR7/JlHjzrBSX8V4cbJyPJM7vGa8kyxjtYRmbDZu8DscsznOpbaO3tGe7XXCH761qGnr8c0BbJ4fo7n5xziuko++CzZZcucML49DAs3dtxT+H//GA9yQk3aVJ15FyFegXy9gT1sM5dfPYZKxALshx7rft63ZyMLojIf32o9zXZN2O6zzHyv/i2sdBkN7++NMdhUo7IS5jimj9k/5HVU2VpvezbXq2ZYrrVeArWptkkhPz/bg8iMNo1Ukwttu04s48oW6aHTaefhMwTfMvS7ShiA== -sidebar_class_name: "post api-method" -info_path: gen/api/agent-management-api -custom_edit_url: null ---- - -import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; -import ParamsDetails from "@theme/ParamsDetails"; -import RequestSchema from "@theme/RequestSchema"; -import StatusCodes from "@theme/StatusCodes"; -import OperationTabs from "@theme/OperationTabs"; -import TabItem from "@theme/TabItem"; -import Heading from "@theme/Heading"; -import Translate from "@docusaurus/Translate"; - - - - - - - - - - -Create a new cron drop-in entry on the target node. - - - - Request - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/docs/gen/api/post-node-schedule-cron.ParamsDetails.json b/docs/docs/gen/api/post-node-schedule.ParamsDetails.json similarity index 100% rename from docs/docs/gen/api/post-node-schedule-cron.ParamsDetails.json rename to docs/docs/gen/api/post-node-schedule.ParamsDetails.json diff --git a/docs/docs/gen/api/post-node-schedule.RequestSchema.json b/docs/docs/gen/api/post-node-schedule.RequestSchema.json new file mode 100644 index 000000000..382959e3e --- /dev/null +++ b/docs/docs/gen/api/post-node-schedule.RequestSchema.json @@ -0,0 +1 @@ +{"title":"Body","body":{"description":"Scheduled entry creation parameters.","required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","object"],"properties":{"name":{"type":"string","description":"Name for the scheduled entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1,max=64"}},"object":{"type":"string","description":"Name of the uploaded file in the object store to deploy as the scheduled entry content.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1"}},"schedule":{"type":"string","description":"Cron schedule expression (e.g., \"*/5 * * * *\"). Mutually exclusive with interval — provide exactly one.\n","x-oapi-codegen-extra-tags":{"validate":"required_without=Interval,excluded_with=Interval,omitempty,cron_schedule"}},"interval":{"type":"string","description":"Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one.\n","enum":["hourly","daily","weekly","monthly"],"x-oapi-codegen-extra-tags":{"validate":"required_without=Schedule,excluded_with=Schedule,omitempty,oneof=hourly daily weekly monthly"}},"user":{"type":"string","description":"User to run the command as. Only applies when using schedule (cron.d entries include a user field).\n"},"content_type":{"type":"string","description":"Content type: \"raw\" or \"template\". When \"template\", the file content is rendered through Go text/template with agent facts and user-supplied vars.\n","enum":["raw","template"],"x-oapi-codegen-extra-tags":{"validate":"omitempty,oneof=raw template"}},"vars":{"type":"object","additionalProperties":true,"description":"Template variables. Only used when content_type is \"template\".\n"}},"title":"ScheduleCreateRequest"}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/post-node-schedule.StatusCodes.json b/docs/docs/gen/api/post-node-schedule.StatusCodes.json new file mode 100644 index 000000000..9e3c23739 --- /dev/null +++ b/docs/docs/gen/api/post-node-schedule.StatusCodes.json @@ -0,0 +1 @@ +{"responses":{"200":{"description":"Scheduled entry created.","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"Result of a cron create, update, or delete operation for one host.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that processed this operation."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Scheduled entry name."},"changed":{"type":"boolean","description":"Whether the operation modified system state."},"error":{"type":"string","description":"Error message if the agent failed."}},"required":["hostname","status"],"title":"ScheduleMutationResult"}}},"required":["results"],"title":"ScheduleCreateResponse"}}}},"400":{"description":"Invalid request payload.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error creating scheduled entry.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/post-node-schedule.api.mdx b/docs/docs/gen/api/post-node-schedule.api.mdx new file mode 100644 index 000000000..7c3ed473e --- /dev/null +++ b/docs/docs/gen/api/post-node-schedule.api.mdx @@ -0,0 +1,70 @@ +--- +id: post-node-schedule +title: "Create a scheduled entry" +description: "Create a new scheduled entry on the target node." +sidebar_label: "Create a scheduled entry" +hide_title: true +hide_table_of_contents: true +api: eJztWNtuI8cR/ZVCP0nG8CKH2iQE9kF2vIkCry3sarEPkkA0p4ucXs10j/tCakIM4I/wF+ZLguqeGy+xlHUCxMBCgMgZdldXnVO3rh0TaFMjSye1YnP2rUHuEDgo3IJNMxQ+RwGonKlAK3AZguNmjQ6UFji+Vyxhjq8tm9+x9836xVuu+BoLVG5xdXO9aOUsdImG00mWPSSse7oWbM5utHU/aIGtEJYwi6k30lVsfrdj3yA3aK68y+ioVuR8a6RD9lA/JKzkhhfo0NiwQfEC2Zxl2rrwNWGSLCy5y1jCDP7kpUHB5s54TA5guI0m8jUqB62EBAxaNBsUYLR3Uq1hw3OPcLbgqkpgwfP8PAFtIOdLzMFijqnTBs4esZqHpecRsKeR5qUcpVrgGtUIn5zho4jijm14LgV3pHurZFJI9foiCb8sIvysTgIIBac9rippvXVGqjVLWCHV96jWhNVFTdiQJLTuGy0qWr9v7fsDnlNyAqkV9IiOT0CWauVQOZLHyzKXadg0+WRJ6O5YO738hKnbE3THGmqa34hFQ37hJAYwIonHBu4b8AMvEFbaBPc88NoxfLAogNvw40rmCCQUvBJoYIIunaRGq7GYEHP9804qh2bD83rym0gr+NPrVzNW152RLzNHr4LCvsw1Fyii5jJGYBQE1mmD4DQILHNdtTYehm3D02+xIqjfyn3egG+NVp0agE+lQWvJoc5wvB4ncM++mlzCV/Hvnp2P4a13nud5BfiU5t7KDcJWugxaEuCfP/8CpdEbKUggT11O+Qg/z6gFydbevb5uxCfhWNH80r/WhXRYlK5KyCe6RBbgaFV7Ho4bNFILmfbWnGXam7xKQHBJH1vER/ostHJZXp2P4SbnKbZ8kiji/rR3/lvwOgZ+FTxUvqBIjCqR8qQTS1hUirJJ1Iqi87ORbnPMAdLd6x5prVCvXkdtIj4NPC06AX1v0TyP/AeLhgLE+Bg4qS4KrigbjOFHlVcQEhda2GaowFvK6R1qZzEvhCiiNVIFzYEDHQ4ribkICb3ucuEiqvNsfMTVQKvmcM8M394zSj/3jEDIucN7NoaPpNTwVdLnsOZAkBYMUipDAS4z2q8z+KsGh09u0m6M3hCL2YqnzgJhQEaMrA8ACNhwY/f9wfAt1fZGxn9C/iGXhm+hk0Pk0WGnCgMXQhJEPL8ZVIGTBbo1bcON5MscW0I9JfvA5pASgmkPW2KtTpiTjvJZVwFj+/MuFktW17TGoC21srEefT2dvrB+oqCa+dk1cr8MftLLhRSnHGulTcEdmzPvpThytNsM4ZNewvVfIjBOUx5I0VJmCa4TLCVN8YkXZQDj8nKKf5pNpyP8+s/L0exCzEb8jxevRrPZq1eXl7PZdDqdsgiMz92QSG4Mp4RB9J8keF+7d0EAVToOFGsNcAn4UoRPbUBgjg6h6xVDmdcKQ1c2PgKq6/aejcG/NSvbQhvDw2XctRCFiJK2P3scmi7Hnben5LeBox+JFy5zJELsoyzL8M3JArUPTc4xS1Fsq8y+uUGLaG+dvLAlOvRJ2hW2pxlXaxz60lLrHLk6EvExQ5ehOVCo0EKuKGPYyjosguJRMhqjX5CTv6NlUKC1fI0gh+hH0MYshl3fJA56+Ab+h+PYfetd0DB6FasPhbTuemJrG/Yx0Ju4n50K9WsV8lwbOFDyivqz/2KovxDFKxg8t24T9kYf1mnqjYlJqA/tNwHgUBGRitqmdbxAoEDHZX7Stw8O7/I0NHuAL7V3vRInjxU+dKsK3VabR2jiIXqlFkOnpu5mjeZkPotG0oa9Qy6n02FGD152xOjFMaMfFPcu00b+AwWM4OrmGh6xgs5zvhD7eyD2D8fEvtFmKYVABSO4VtavVjKVlGVKNIUM9xH7hd3fAbuXpxJxrCJxUjFo2ttL/xdi/++JrRNWoMs0Df9KbQPyNJubswkv5YTGi5NdW/nriR3OBc0mTvke+iEh1fIiUjYcFXYmZM6VrJmZha4nLGJJ8+VN20f//eNt6D/IT971U7PvWru6wWLHRTvW6d/0k5L+XT8u6G/a8RLbr9m/RTY3sOayFEcOKx1MakC9Cl1TP22l6kU70NjIz8V4Og69OgFccDVQv5v0HoTOIce7PpA+czocjQk30jLnMtyXvQlzk0j4HeOlZAmjPSxh82G71yL5kIQukBbvdktu8YPJ65pe/+TRVNEX2stgmP8Kaem7YPMVz+3hDXJo1tm7ptifw/948HsSi/bypKrAdu7piSXsEavh/Lp+qBOWIRfkM3e75udmlDC6JSH99qOMVyftjqs0xdL96tqHQWje/Pj+lqKkmRwXITE0rkn/g6q6jFP9+S6+27Gcq7Xna1obZZL/8v2QPAjBYNVJMHa7uOJWP6Kq6w4bR88ETF3/C4xfrWY= +sidebar_class_name: "post api-method" +info_path: gen/api/agent-management-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; +import Translate from "@docusaurus/Translate"; + + + + + + + + + + +Create a new scheduled entry on the target node. + + + + Request + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/gen/api/put-node-schedule-cron.RequestSchema.json b/docs/docs/gen/api/put-node-schedule-cron.RequestSchema.json deleted file mode 100644 index 7c0e72e79..000000000 --- a/docs/docs/gen/api/put-node-schedule-cron.RequestSchema.json +++ /dev/null @@ -1 +0,0 @@ -{"title":"Body","body":{"description":"Cron entry update parameters.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","description":"New object to deploy (redeploy with updated content).\n","x-oapi-codegen-extra-tags":{"validate":"omitempty,min=1"}},"schedule":{"type":"string","description":"Cron schedule expression (e.g., \"*/5 * * * *\").\n","x-oapi-codegen-extra-tags":{"validate":"omitempty,cron_schedule"}},"user":{"type":"string","description":"User to run the command as."},"content_type":{"type":"string","description":"Content type: \"raw\" or \"template\".\n","enum":["raw","template"],"x-oapi-codegen-extra-tags":{"validate":"omitempty,oneof=raw template"}},"vars":{"type":"object","additionalProperties":true,"description":"Template variables.\n"}},"title":"CronUpdateRequest"}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/put-node-schedule-cron.StatusCodes.json b/docs/docs/gen/api/put-node-schedule-cron.StatusCodes.json deleted file mode 100644 index 168807e89..000000000 --- a/docs/docs/gen/api/put-node-schedule-cron.StatusCodes.json +++ /dev/null @@ -1 +0,0 @@ -{"responses":{"200":{"description":"Cron entry updated.","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"Result of a cron create, update, or delete operation for one host.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that processed this operation."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Cron entry name."},"changed":{"type":"boolean","description":"Whether the operation modified system state."},"error":{"type":"string","description":"Error message if the agent failed."}},"required":["hostname","status"],"title":"CronMutationResult"}}},"required":["results"],"title":"CronUpdateResponse"}}}},"400":{"description":"Invalid request payload.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"404":{"description":"Cron entry not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error updating cron entry.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/put-node-schedule-cron.api.mdx b/docs/docs/gen/api/put-node-schedule-cron.api.mdx deleted file mode 100644 index ca8628689..000000000 --- a/docs/docs/gen/api/put-node-schedule-cron.api.mdx +++ /dev/null @@ -1,70 +0,0 @@ ---- -id: put-node-schedule-cron -title: "Update a cron entry" -description: "Update an existing cron drop-in entry on the target node." -sidebar_label: "Update a cron entry" -hide_title: true -hide_table_of_contents: true -api: eJztWG1vIzUQ/iuWxYcebF4K6QGR+FBeThRxqDpaIdGGaLKeZH3dtRd73HaJ9r+jsXeTtAlc7wCJk06VquyuPZ55nnnG9qylQp87XZO2Rk7lZa2AUIAReK89abMSubNGKGfrgTYCDblGWCOoQEHgVkjCWIXDayMzSbDycnolf84LVKHE+UswsMIKDc1Pz8/mbGpua3TAy3k5y+Tm6UzJqTwP9JNV2M//xlk26zEPTlMjp1dr+TWCQ3caqOCV2OL0zmlCOWtnmazBQYWEzsfBBiqUU1lYT/FnJjVHWQMVMpMOfw/aoZJTcgGzR1BcpOhghYZEbyETDj26W1TC2RDxuYUyoDiag2kyMYeyfJYJ60QJCyyFxxJzsk4c3WAzjUOfJazuBxZqPcitwhWaAd6Tg0ECcC1vodRMhJxunMwqbb46zuKXeUJetpn0eYEV8Bxqah7vyWmzkpmstPkRzYpxOm7bbAPGWwPBLHTE89yheBk8idwaAm2ENWUjoKwLMKFCp3ORF+AgZw4yEYxC53Pr0GcCjBJFUxdo/D/B4Olhcz4QoeMofruCwR+ng1/Hgy/ng9knH8mW84Uto6evrWrY2F8GHpIutuk1PAAbQ4KG2BDUdanzmNij156trfd9tovXmJPMZO1YBqQxBt69PhDbQ/d+wjuRxgqyQmFd2kYcOex+3WkqOr+V6Fx7y9yzlSasamp64DvkWZtv9i/C1w8XeF879F5bI45wuBpm4lp+PDoRH6e/a/nOvsWqsnGLfQwe3Zv9u/ToGDkXUjnLbVVxioIfcop1kM2TkTcGm0YLHjUV19LB3bXkOnAt2c0SCK9lihBNqLh2Objjmtl95WL49rFbg3b5lYM7sbHDANyC84cSDZTS7DCU5zspd7D6debELTgNixKjZNk2aWL2I71pu3iVRCTblr879LU1PuXyp+PxE3SlWE3/knpe28Vcq0OELa2rgORUhqDVHoEXBYrXdiHOvhXBo+LEqJ3N0XtBhfaiqxTsKd5DVUcMTk7G+MVkPB7gp18uBpNjNRnA58fPB5PJ8+cnJ5PJeDwey4RJKGmXEnAOGi7DhNVBqh569yoaEHYpIG3IuUMgzDoA446jsERCsdlRxdI6YQ3GzWu4B9RmU3xjbn/fjeTlWShpS6QCqIeI8WKQNmtHBXkCCv6Q/V4C9oZ5AV0iE+JvdF3HX6QrtIFYE/ssJbO9Mw/DjV6keNtMPi28x/tbFH8BZoW7abSwtkQwe7N/KZAKLiQPfKms0kuNSvjGE1bR52QZnbNPKE7f8TBRofewQqF3gU94DWUSW78FXe2ecjrkZw/V+jJQ9C4lk2wfG+izdHZY5EnWnconh4R9ZmKR6rUiamhKC/+mup+I3qnYee4zJc5NaWvzPDiX6s5WzS8isHFLQHIab/tci8QpJNDlwXR+tPimyIpujoCFDbR14uCyKiAvbZDurLsRnQS6rUjt5rE2hCt0B0tYCpInPFjkZDzerd0xu/YYPd5n9NJAoMI6/QcqMRCn52fiBhuxyZoPxL4PxH62T+wL6xZaKTRiIM6MD8ulzjVXlxpdpeM5zX9g971gd/K3JyxjSSxtMB+q8HtB58mhfTUdBuJRb9ORiex+4PT/z2mbyQqpsNzfqkMEnrsuUzmCWo+4eTZa90e3dtTfY0dM8mgdX8YWmLtNTa3Zth/GbbIqsbfbFdtEUxDVsuuVxCNsHCSz7seL/j70wy8X8TDJKfNq2xD5rg9x25LYErNtA2zfpWv39vnhDbq773ZXU15Pm6WN7nbYncbj7bZnyMcNnoHOJxqOh+NhvE/V1lMFMb+7rlbfuNwRx2MW11up/NM+ZwqI8J5GdQnasE/BlbxGIvdKQq1lJnmOzOR092zeI5fF7iV/jV9mWTzB89z1egEeL13Ztvz694CuSdT3t/HY3VTa828lp0so/eMr/G64R6+6A9sz8R+3NQ9C0995TRMToAz8JDN5g81ud5ablO8U03/XoXyHcFIoszaTBYJiRVytu09dk2hwwQa2U/fKNgORZpzmOdb0t2NnO/Xl/PKC5d11M6tY3Drd8f/opa1T8326Tu/WsgSzCrDisckkixMe1pJHtSMGdRCH9TqNuLA3aNp2AwvxM+PStn8C3RJ+qA== -sidebar_class_name: "put api-method" -info_path: gen/api/agent-management-api -custom_edit_url: null ---- - -import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; -import ParamsDetails from "@theme/ParamsDetails"; -import RequestSchema from "@theme/RequestSchema"; -import StatusCodes from "@theme/StatusCodes"; -import OperationTabs from "@theme/OperationTabs"; -import TabItem from "@theme/TabItem"; -import Heading from "@theme/Heading"; -import Translate from "@docusaurus/Translate"; - - - - - - - - - - -Update an existing cron drop-in entry on the target node. - - - - Request - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/docs/gen/api/put-node-schedule-cron.ParamsDetails.json b/docs/docs/gen/api/put-node-schedule.ParamsDetails.json similarity index 56% rename from docs/docs/gen/api/put-node-schedule-cron.ParamsDetails.json rename to docs/docs/gen/api/put-node-schedule.ParamsDetails.json index 748479206..1bf06c373 100644 --- a/docs/docs/gen/api/put-node-schedule-cron.ParamsDetails.json +++ b/docs/docs/gen/api/put-node-schedule.ParamsDetails.json @@ -1 +1 @@ -{"parameters":[{"name":"hostname","in":"path","required":true,"description":"Target agent hostname, reserved routing value (_any, _all), or label selector (key:value).\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1,valid_target"},"schema":{"type":"string","minLength":1}},{"name":"name","in":"path","required":true,"description":"Cron entry name. Must contain only alphanumeric characters, underscores, and hyphens.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1"},"schema":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9_-]+$"}}]} \ No newline at end of file +{"parameters":[{"name":"hostname","in":"path","required":true,"description":"Target agent hostname, reserved routing value (_any, _all), or label selector (key:value).\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1,valid_target"},"schema":{"type":"string","minLength":1}},{"name":"name","in":"path","required":true,"description":"Scheduled entry name. Must contain only alphanumeric characters, underscores, and hyphens.\n","x-oapi-codegen-extra-tags":{"validate":"required,min=1"},"schema":{"type":"string","minLength":1,"pattern":"^[a-zA-Z0-9_-]+$"}}]} \ No newline at end of file diff --git a/docs/docs/gen/api/put-node-schedule.RequestSchema.json b/docs/docs/gen/api/put-node-schedule.RequestSchema.json new file mode 100644 index 000000000..ac464053c --- /dev/null +++ b/docs/docs/gen/api/put-node-schedule.RequestSchema.json @@ -0,0 +1 @@ +{"title":"Body","body":{"description":"Scheduled entry update parameters.","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","description":"New object to deploy (redeploy with updated content).\n","x-oapi-codegen-extra-tags":{"validate":"omitempty,min=1"}},"schedule":{"type":"string","description":"Cron schedule expression (e.g., \"*/5 * * * *\").\n","x-oapi-codegen-extra-tags":{"validate":"omitempty,cron_schedule"}},"user":{"type":"string","description":"User to run the command as."},"content_type":{"type":"string","description":"Content type: \"raw\" or \"template\".\n","enum":["raw","template"],"x-oapi-codegen-extra-tags":{"validate":"omitempty,oneof=raw template"}},"vars":{"type":"object","additionalProperties":true,"description":"Template variables.\n"}},"title":"ScheduleUpdateRequest"}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/put-node-schedule.StatusCodes.json b/docs/docs/gen/api/put-node-schedule.StatusCodes.json new file mode 100644 index 000000000..359aa26cd --- /dev/null +++ b/docs/docs/gen/api/put-node-schedule.StatusCodes.json @@ -0,0 +1 @@ +{"responses":{"200":{"description":"Scheduled entry updated.","content":{"application/json":{"schema":{"type":"object","properties":{"job_id":{"type":"string","format":"uuid","description":"The job ID used to process this request.","example":"550e8400-e29b-41d4-a716-446655440000"},"results":{"type":"array","items":{"type":"object","description":"Result of a cron create, update, or delete operation for one host.","properties":{"hostname":{"type":"string","description":"Hostname of the agent that processed this operation."},"status":{"type":"string","enum":["ok","failed","skipped","timeout"],"description":"The status of the operation for this host."},"name":{"type":"string","description":"Scheduled entry name."},"changed":{"type":"boolean","description":"Whether the operation modified system state."},"error":{"type":"string","description":"Error message if the agent failed."}},"required":["hostname","status"],"title":"ScheduleMutationResult"}}},"required":["results"],"title":"ScheduleUpdateResponse"}}}},"400":{"description":"Invalid request payload.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"401":{"description":"Unauthorized - API key required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"404":{"description":"Scheduled entry not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}},"500":{"description":"Error updating scheduled entry.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"A description of the error that occurred.","example":"Failed to retrieve status."},"details":{"type":"string","description":"Additional details about the error.","example":"Failed due to network timeout."},"code":{"type":"integer","description":"The error code.","example":500}},"title":"ErrorResponse"}}}}}} \ No newline at end of file diff --git a/docs/docs/gen/api/put-node-schedule.api.mdx b/docs/docs/gen/api/put-node-schedule.api.mdx new file mode 100644 index 000000000..f6f5210a5 --- /dev/null +++ b/docs/docs/gen/api/put-node-schedule.api.mdx @@ -0,0 +1,70 @@ +--- +id: put-node-schedule +title: "Update a scheduled entry" +description: "Update an existing scheduled entry on the target node." +sidebar_label: "Update a scheduled entry" +hide_title: true +hide_table_of_contents: true +api: eJztWGFv4zYS/SsEcR+yPdlxWmfvaqAf0rsumsNtEWwTFLjENcbi2OJGIlVymEQ19N8PQ0q2EwtNdtsCXWARIJBkcjjz3rwhORup0OdO16StkTN5VSsgFGAEPmhP2qyFzwtUoUQl0JBrhDWCChQEbo0kjFU4vjEykwRrL2fX8sdu/OItGFhjhYYWZxfni97OwtbogNfzcp7J7du5kjN5EegHq7C3ITPpMQ9OUyNn1xv5LYJDdxao4JV6i7N7pwnlvJ1nsgYHFRI6HycYqFDOZGE9xcdMag6zBipkJh3+ErRDJWfkAmZPsLhMEcIaDYneQiYcenR3qISzIQJ0B2VAcbQA02RiAWX5KhPWiRKWWAqPJeZknTi6xWYWh75KeD2MLNR6lFuFazQjfCAHowTiRt5BqZkJOds6mVXafHOSxV8WCX3ZZhGECngONTWP9+S0WctMVtr8F82asTpp22wLxgcD8eOTDGADY/E2eBK5NQTaCGvKRkBZF2BChU7nIi/AQc5EZCIYhc7n1qHPBBgliqYu0PjfA8TLY+ekIELHofx8DaNfz0b/m4y+Xozmf/+bbDlp2DJ6+taqho39dvQhSWSXaOMBABkXNMTWoK5LnccUP37v2eTm0HG7fI85yUzWjgVBGmP03eeBAB/7+APeizRWkBUK69I24shh93Svqej8VqJz7QOz0FaasKqp6dHv4I8qfda/fzlrtoVE4EPt0HttjTjC8XqciRv5xfGp+CL93ciP9i131mwLTfQxeHTP+3fl0TFyLqTiltuq4jwFP+Y86yBbJCPPBptGCx41EzfSwf2N5IpwI9nNEghvZIoQTai4kjm45wra/cpl8cNjtwbt6hsH92JrhwG4A+eHEg2U0uwwlBd7KTdYBztz4g6chmWJUbdsmzQx+1uJpN3jXVKTbFse49DX1viUz19OJi8VmGJZ/UEyem+XC62GmFtZVwHJmQxBqwMmLwsU7+1SnP9bBI+KM6R2NkfvBRXai65usKf4AFUdwTg9neA/p5PJCL/8ejmanqjpCP5x8no0nb5+fXo6nU4mk4lMwISS9rkB56DhykxYDXL22Lt30YCwKwGCE1/kDoEw6wCMm5DCEgnFdpMVK+uENRj3s/EBUNt98tkk/74bycuzYtIuSQVQDxHjxSBt145S8gQU/JD9Xgv2lnkBXSIT4m91Xccn0hXaQCyOQ5aS2d6Zx+FGL1K8bSZfFt7glhdLQQFmjfu5tLS2RDAHJn4qkAouK48cqqzSK41K+MYTVtHxZBmdsy8oVd/xMFGh97BGoffRT6CNZZJdvyFd759+Ovjnh9p9Gyh6mLJKtk+N9Ok6MLWXfRJ6p/vpkNTPTSxdvXBEDU1p4Y+U+gtRPBN7733axLkph22eB+dSEdpJ+00EOG4USE7jXZ94kUCFBLoczO0ni29Lr+jmCFjaQDsnBpdVAXlpg3Rv3a3o9NBtUGo/qbUhXKMbrGcpSJ7waJHTyWS/oscsO2D05JDRKwOBCuv0r6jESJxdnItbbMQ2cz4T+ykQ+9UhsW+sW2ql0IiRODc+rFY611xlanSVjqc3/5ndT4Ld6fNnLmNJrGwwn0vxJ8Hp6dDmmk4G8fA30Lf5TOxfn9g2kxVSYbkTVocIPPdnZvIYan3MrbbjTX+Ya497go838T32ytxd6nzNd40zlnqViNtvn20DKYhq2fVS4nk2DpJZ9/CmvyH956fLeLLkbHm3a5h810e361bsONl1CHbf0o189/74ct1dhbtbK6+nzcpGdzvYzuJZd9dc5DMHz0DnEwMn48k43rBq66mCmNpd66tvbz4Vx1MWNzup/K6WaAqJ8IGO6xK0Ya+CK3mBxOy1hFrLTPIcmcnZ/lF91wOdxU/zLJ7kedJmswSPV65sW/78S0DXJNb7O3rsfirt+VnJ2QpK//Rivx/k0bvuwPZK/Mltz0FM+guwaSL3ZeA3mclbbPa7t9zE/KiY/uQO5kfElOKZt5ksEBQr4nrT/dT1j0aXbGA39aBiMxppxlmeY02/OXa+V1ouri5Z3l23s4p1rdMd/49e2jp16Geb9G0jSzDrAGsem0yyOOFxLXlSO2JQgzhsNmnEpb1F07ZbWIjfGZe2/T9gzo9e +sidebar_class_name: "put api-method" +info_path: gen/api/agent-management-api +custom_edit_url: null +--- + +import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; +import ParamsDetails from "@theme/ParamsDetails"; +import RequestSchema from "@theme/RequestSchema"; +import StatusCodes from "@theme/StatusCodes"; +import OperationTabs from "@theme/OperationTabs"; +import TabItem from "@theme/TabItem"; +import Heading from "@theme/Heading"; +import Translate from "@docusaurus/Translate"; + + + + + + + + + + +Update an existing scheduled entry on the target node. + + + + Request + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/gen/api/schedule-management-api-cron-operations.tag.mdx b/docs/docs/gen/api/schedule-management-api-schedule-operations.tag.mdx similarity index 60% rename from docs/docs/gen/api/schedule-management-api-cron-operations.tag.mdx rename to docs/docs/gen/api/schedule-management-api-schedule-operations.tag.mdx index e38b90d6d..1d1a53c19 100644 --- a/docs/docs/gen/api/schedule-management-api-cron-operations.tag.mdx +++ b/docs/docs/gen/api/schedule-management-api-schedule-operations.tag.mdx @@ -1,13 +1,13 @@ --- -id: schedule-management-api-cron-operations -title: "Node/Schedule/Cron" -description: "Node/Schedule/Cron" +id: schedule-management-api-schedule-operations +title: "Node/Schedule" +description: "Node/Schedule" custom_edit_url: null --- -Cron drop-in file management on a target node. +Scheduled task management on a target node. diff --git a/docs/docs/gen/api/sidebar.ts b/docs/docs/gen/api/sidebar.ts index 67aad07c5..6e46eeb99 100644 --- a/docs/docs/gen/api/sidebar.ts +++ b/docs/docs/gen/api/sidebar.ts @@ -750,40 +750,40 @@ const sidebar: SidebarsConfig = { }, { type: "category", - label: "Node/Schedule/Cron", + label: "Node/Schedule", link: { type: "doc", - id: "gen/api/schedule-management-api-cron-operations", + id: "gen/api/schedule-management-api-schedule-operations", }, items: [ { type: "doc", - id: "gen/api/get-node-schedule-cron", - label: "List all cron entries", + id: "gen/api/get-node-schedule", + label: "List all scheduled entries", className: "api-method get", }, { type: "doc", - id: "gen/api/post-node-schedule-cron", - label: "Create a cron entry", + id: "gen/api/post-node-schedule", + label: "Create a scheduled entry", className: "api-method post", }, { type: "doc", - id: "gen/api/get-node-schedule-cron-by-name", - label: "Get a cron entry", + id: "gen/api/get-node-schedule-by-name", + label: "Get a scheduled entry", className: "api-method get", }, { type: "doc", - id: "gen/api/put-node-schedule-cron", - label: "Update a cron entry", + id: "gen/api/put-node-schedule", + label: "Update a scheduled entry", className: "api-method put", }, { type: "doc", - id: "gen/api/delete-node-schedule-cron", - label: "Delete a cron entry", + id: "gen/api/delete-node-schedule", + label: "Delete a scheduled entry", className: "api-method delete", }, ], diff --git a/examples/sdk/client/cron.go b/examples/sdk/client/schedule.go similarity index 89% rename from examples/sdk/client/cron.go rename to examples/sdk/client/schedule.go index 3b8b91373..3189a8ae8 100644 --- a/examples/sdk/client/cron.go +++ b/examples/sdk/client/schedule.go @@ -78,9 +78,9 @@ func main() { fmt.Println("Uploaded: logrotate-script") // Create a cron entry referencing the uploaded object. - // Returns Collection[CronMutationResult] with per-host results. + // Returns Collection[ScheduleMutationResult] with per-host results. fmt.Println("\n=== Creating cron entry ===") - createResp, err := c.Cron.Create(ctx, target, client.CronCreateOpts{ + createResp, err := c.Schedule.Create(ctx, target, client.ScheduleCreateOpts{ Name: "backup-daily", Schedule: "0 2 * * *", Object: "backup-script", @@ -95,7 +95,7 @@ func main() { // Create a periodic entry (interval-based) referencing an uploaded object. fmt.Println("\n=== Creating periodic cron entry ===") - periodicResp, err := c.Cron.Create(ctx, target, client.CronCreateOpts{ + periodicResp, err := c.Schedule.Create(ctx, target, client.ScheduleCreateOpts{ Name: "logrotate", Interval: "daily", Object: "logrotate-script", @@ -108,9 +108,9 @@ func main() { } // List all cron entries. - // Returns Collection[CronEntryResult] with per-host entries. + // Returns Collection[ScheduleEntryResult] with per-host entries. fmt.Println("\n=== Listing cron entries ===") - listResp, err := c.Cron.List(ctx, target) + listResp, err := c.Schedule.List(ctx, target) if err != nil { log.Fatalf("list failed: %v", err) } @@ -124,9 +124,9 @@ func main() { } // Get a specific entry. - // Returns Collection[CronEntryResult] — one result per host. + // Returns Collection[ScheduleEntryResult] — one result per host. fmt.Println("\n=== Getting cron entry ===") - getResp, err := c.Cron.Get(ctx, target, "backup-daily") + getResp, err := c.Schedule.Get(ctx, target, "backup-daily") if err != nil { log.Fatalf("get failed: %v", err) } @@ -149,7 +149,7 @@ func main() { fmt.Println("Uploaded: backup-script-v2") fmt.Println("\n=== Updating cron entry ===") - updateResp, err := c.Cron.Update(ctx, target, "backup-daily", client.CronUpdateOpts{ + updateResp, err := c.Schedule.Update(ctx, target, "backup-daily", client.ScheduleUpdateOpts{ Schedule: "0 3 * * *", Object: "backup-script-v2", }) @@ -163,7 +163,7 @@ func main() { // Delete the entry. The cron file is removed from disk; file-state KV // tracking is preserved so the undeploy is recorded. fmt.Println("\n=== Deleting cron entry ===") - deleteResp, err := c.Cron.Delete(ctx, target, "backup-daily") + deleteResp, err := c.Schedule.Delete(ctx, target, "backup-daily") if err != nil { log.Fatalf("delete failed: %v", err) } @@ -173,7 +173,7 @@ func main() { // Clean up the periodic entry. fmt.Println("\n=== Cleaning up periodic entry ===") - cleanupResp, err := c.Cron.Delete(ctx, target, "logrotate") + cleanupResp, err := c.Schedule.Delete(ctx, target, "logrotate") if err != nil { log.Fatalf("cleanup failed: %v", err) } diff --git a/internal/agent/agent.go b/internal/agent/agent.go index 18aa96f2c..5af7c4993 100644 --- a/internal/agent/agent.go +++ b/internal/agent/agent.go @@ -39,7 +39,7 @@ import ( "github.com/osapi-io/osapi/internal/provider/node/disk" nodeHost "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" "github.com/osapi-io/osapi/internal/telemetry/process" ) @@ -52,7 +52,7 @@ func New( streamName string, hostProvider nodeHost.Provider, diskProvider disk.Provider, - memProvider mem.Provider, + memoryProvider memory.Provider, loadProvider load.Provider, netinfoProvider netinfo.Provider, processProvider process.Provider, @@ -70,7 +70,7 @@ func New( streamName: streamName, hostProvider: hostProvider, diskProvider: diskProvider, - memProvider: memProvider, + memoryProvider: memoryProvider, loadProvider: loadProvider, netinfoProvider: netinfoProvider, processProvider: processProvider, diff --git a/internal/agent/agent_public_test.go b/internal/agent/agent_public_test.go index 4b7bc0d5f..c41ce980b 100644 --- a/internal/agent/agent_public_test.go +++ b/internal/agent/agent_public_test.go @@ -50,7 +50,7 @@ import ( diskMocks "github.com/osapi-io/osapi/internal/provider/node/disk/mocks" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" "github.com/osapi-io/osapi/internal/telemetry/metrics" processMocks "github.com/osapi-io/osapi/internal/telemetry/process/mocks" ) @@ -132,7 +132,7 @@ func (s *AgentPublicTestSuite) buildAgent() *agent.Agent { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), @@ -239,7 +239,7 @@ func (s *AgentPublicTestSuite) TestStart() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), @@ -285,7 +285,7 @@ func (s *AgentPublicTestSuite) TestStart() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), @@ -327,7 +327,7 @@ func (s *AgentPublicTestSuite) TestStart() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), @@ -389,7 +389,7 @@ func (s *AgentPublicTestSuite) TestStart() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), diff --git a/internal/agent/condition.go b/internal/agent/condition.go index 4fe6361a6..8a34b0da9 100644 --- a/internal/agent/condition.go +++ b/internal/agent/condition.go @@ -27,7 +27,7 @@ import ( "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/provider/node/disk" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) // findPrevCondition returns the previous condition of the given type, @@ -60,7 +60,7 @@ func transitionTime( } func evaluateMemoryPressure( - stats *mem.Result, + stats *memory.Result, threshold int, prev []job.Condition, ) job.Condition { diff --git a/internal/agent/condition_public_test.go b/internal/agent/condition_public_test.go index f930b13bc..c2288b56a 100644 --- a/internal/agent/condition_public_test.go +++ b/internal/agent/condition_public_test.go @@ -30,7 +30,7 @@ import ( "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/provider/node/disk" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) type ConditionPublicTestSuite struct { @@ -191,14 +191,14 @@ func (s *ConditionPublicTestSuite) TestTransitionTime() { func (s *ConditionPublicTestSuite) TestEvaluateMemoryPressure() { tests := []struct { name string - stats *mem.Result + stats *memory.Result threshold int prev []job.Condition validateFunc func(job.Condition) }{ { name: "when usage above threshold returns true with reason", - stats: &mem.Result{ + stats: &memory.Result{ Total: 8 * 1024 * 1024 * 1024, // 8 GB Available: 1 * 1024 * 1024 * 1024, // 1 GB available = 87.5% used }, @@ -214,7 +214,7 @@ func (s *ConditionPublicTestSuite) TestEvaluateMemoryPressure() { }, { name: "when usage below threshold returns false", - stats: &mem.Result{ + stats: &memory.Result{ Total: 8 * 1024 * 1024 * 1024, // 8 GB Available: 6 * 1024 * 1024 * 1024, // 6 GB available = 25% used }, @@ -239,7 +239,7 @@ func (s *ConditionPublicTestSuite) TestEvaluateMemoryPressure() { }, { name: "when total is zero returns false", - stats: &mem.Result{ + stats: &memory.Result{ Total: 0, Available: 0, }, @@ -253,7 +253,7 @@ func (s *ConditionPublicTestSuite) TestEvaluateMemoryPressure() { }, { name: "when usage exactly at threshold returns false", - stats: &mem.Result{ + stats: &memory.Result{ Total: 100, Available: 20, // 80% used, threshold is 80 (> not >=) }, @@ -511,7 +511,7 @@ func (s *ConditionPublicTestSuite) TestLastTransitionTimeTracking() { name: "when status flips from false to true transition time updates", evalFunc: func(prev []job.Condition) job.Condition { return agent.ExportEvaluateMemoryPressure( - &mem.Result{ + &memory.Result{ Total: 100, Available: 10, // 90% used }, @@ -536,7 +536,7 @@ func (s *ConditionPublicTestSuite) TestLastTransitionTimeTracking() { name: "when status stays true transition time is preserved", evalFunc: func(prev []job.Condition) job.Condition { return agent.ExportEvaluateMemoryPressure( - &mem.Result{ + &memory.Result{ Total: 100, Available: 10, // 90% used }, @@ -560,7 +560,7 @@ func (s *ConditionPublicTestSuite) TestLastTransitionTimeTracking() { name: "when status flips from true to false transition time updates", evalFunc: func(prev []job.Condition) job.Condition { return agent.ExportEvaluateMemoryPressure( - &mem.Result{ + &memory.Result{ Total: 100, Available: 80, // 20% used }, @@ -585,7 +585,7 @@ func (s *ConditionPublicTestSuite) TestLastTransitionTimeTracking() { name: "when status stays false transition time is preserved", evalFunc: func(prev []job.Condition) job.Condition { return agent.ExportEvaluateMemoryPressure( - &mem.Result{ + &memory.Result{ Total: 100, Available: 80, // 20% used }, diff --git a/internal/agent/consumer_public_test.go b/internal/agent/consumer_public_test.go index 13a966d93..fd11dccce 100644 --- a/internal/agent/consumer_public_test.go +++ b/internal/agent/consumer_public_test.go @@ -41,7 +41,7 @@ import ( diskMocks "github.com/osapi-io/osapi/internal/provider/node/disk/mocks" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" processMocks "github.com/osapi-io/osapi/internal/telemetry/process/mocks" ) @@ -83,7 +83,7 @@ func (s *ConsumerPublicTestSuite) SetupTest() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), diff --git a/internal/agent/drain_public_test.go b/internal/agent/drain_public_test.go index 805193a51..9d0950ebf 100644 --- a/internal/agent/drain_public_test.go +++ b/internal/agent/drain_public_test.go @@ -38,7 +38,7 @@ import ( diskMocks "github.com/osapi-io/osapi/internal/provider/node/disk/mocks" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" processMocks "github.com/osapi-io/osapi/internal/telemetry/process/mocks" ) @@ -70,7 +70,7 @@ func (s *DrainPublicTestSuite) SetupTest() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), diff --git a/internal/agent/export_test.go b/internal/agent/export_test.go index 3eb1588b2..d92d9918b 100644 --- a/internal/agent/export_test.go +++ b/internal/agent/export_test.go @@ -44,7 +44,7 @@ import ( diskProv "github.com/osapi-io/osapi/internal/provider/node/disk" nodeHost "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - memProv "github.com/osapi-io/osapi/internal/provider/node/mem" + memProv "github.com/osapi-io/osapi/internal/provider/node/memory" "github.com/osapi-io/osapi/internal/provider/node/ntp" "github.com/osapi-io/osapi/internal/provider/node/power" "github.com/osapi-io/osapi/internal/provider/node/sysctl" @@ -470,7 +470,7 @@ func SetAgentAppConfig( a.registry.processors["node"] = NewNodeProcessor( a.hostProvider, a.diskProvider, - a.memProvider, + a.memoryProvider, a.loadProvider, sysctl.Provider(nil), ntp.Provider(nil), @@ -508,7 +508,7 @@ func SetAgentHostProvider( a.registry.processors["node"] = NewNodeProcessor( p, a.diskProvider, - a.memProvider, + a.memoryProvider, a.loadProvider, sysctl.Provider(nil), ntp.Provider(nil), @@ -559,7 +559,7 @@ func ExportGetDiskProvider( func ExportGetMemProvider( a *Agent, ) memProv.Provider { - return a.memProvider + return a.memoryProvider } // ExportGetLoadProvider returns the load provider from the registry for testing. diff --git a/internal/agent/facts_public_test.go b/internal/agent/facts_public_test.go index 67beb3bac..29e68ac2f 100644 --- a/internal/agent/facts_public_test.go +++ b/internal/agent/facts_public_test.go @@ -42,7 +42,7 @@ import ( diskMocks "github.com/osapi-io/osapi/internal/provider/node/disk/mocks" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" processMocks "github.com/osapi-io/osapi/internal/telemetry/process/mocks" ) @@ -76,7 +76,7 @@ func (s *FactsPublicTestSuite) SetupTest() { streamName: "test-stream", hostProvider: s.mockHostProvider, diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), diff --git a/internal/agent/handler_public_test.go b/internal/agent/handler_public_test.go index 848f9d0d9..5d952fa4a 100644 --- a/internal/agent/handler_public_test.go +++ b/internal/agent/handler_public_test.go @@ -56,7 +56,7 @@ import ( diskMocks "github.com/osapi-io/osapi/internal/provider/node/disk/mocks" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" "github.com/osapi-io/osapi/internal/telemetry/metrics" processMocks "github.com/osapi-io/osapi/internal/telemetry/process/mocks" ) @@ -128,7 +128,7 @@ func (s *HandlerPublicTestSuite) SetupTest() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMock, pingProvider: pingMock, diff --git a/internal/agent/heartbeat.go b/internal/agent/heartbeat.go index 9053e5f79..874f4090c 100644 --- a/internal/agent/heartbeat.go +++ b/internal/agent/heartbeat.go @@ -29,7 +29,7 @@ import ( "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/provider/node/disk" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" "github.com/osapi-io/osapi/internal/telemetry/process" ) @@ -145,8 +145,8 @@ func (a *Agent) writeRegistration( reg.LoadAverages = avg } - var memStats *mem.Result - if stats, err := a.memProvider.GetStats(); err == nil { + var memStats *memory.Result + if stats, err := a.memoryProvider.GetStats(); err == nil { memStats = stats reg.MemoryStats = stats } diff --git a/internal/agent/heartbeat_public_test.go b/internal/agent/heartbeat_public_test.go index c81d14c15..b5ea320d4 100644 --- a/internal/agent/heartbeat_public_test.go +++ b/internal/agent/heartbeat_public_test.go @@ -48,7 +48,7 @@ import ( diskMocks "github.com/osapi-io/osapi/internal/provider/node/disk/mocks" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" processMocks "github.com/osapi-io/osapi/internal/telemetry/process/mocks" ) @@ -156,7 +156,7 @@ func (s *HeartbeatPublicTestSuite) TestStartWithHeartbeat() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), @@ -195,7 +195,7 @@ func (s *HeartbeatPublicTestSuite) TestStartWithHeartbeat() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), @@ -255,7 +255,7 @@ func (s *HeartbeatLowLevelPublicTestSuite) SetupTest() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), @@ -559,7 +559,7 @@ func (s *HeartbeatLowLevelPublicTestSuite) TestStartHeartbeatHostnameChange() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(ctrl), diskProvider: diskMocks.NewDefaultMockProvider(ctrl), - memProvider: memMocks.NewDefaultMockProvider(ctrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(ctrl), loadProvider: loadMocks.NewDefaultMockProvider(ctrl), dnsProvider: dnsMocks.NewDefaultMockProvider(ctrl), pingProvider: pingMocks.NewDefaultMockProvider(ctrl), diff --git a/internal/agent/lifecycle_public_test.go b/internal/agent/lifecycle_public_test.go index f326ad0ed..63d14147a 100644 --- a/internal/agent/lifecycle_public_test.go +++ b/internal/agent/lifecycle_public_test.go @@ -39,7 +39,7 @@ import ( diskMocks "github.com/osapi-io/osapi/internal/provider/node/disk/mocks" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" processMocks "github.com/osapi-io/osapi/internal/telemetry/process/mocks" ) @@ -67,7 +67,7 @@ func (s *LifecyclePublicTestSuite) SetupTest() { streamName: "test-stream", hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewDefaultMockProvider(s.mockCtrl), pingProvider: pingMocks.NewDefaultMockProvider(s.mockCtrl), diff --git a/internal/agent/node_status_public_test.go b/internal/agent/node_status_public_test.go index 20b541c9c..d266ef9c8 100644 --- a/internal/agent/node_status_public_test.go +++ b/internal/agent/node_status_public_test.go @@ -41,7 +41,7 @@ import ( hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" logMocks "github.com/osapi-io/osapi/internal/provider/node/log/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" ntpMocks "github.com/osapi-io/osapi/internal/provider/node/ntp/mocks" powerMocks "github.com/osapi-io/osapi/internal/provider/node/power/mocks" processMocks "github.com/osapi-io/osapi/internal/provider/node/process/mocks" @@ -68,11 +68,11 @@ func (s *NodeStatusPublicTestSuite) SetupTest() { // processorWith builds a node processor whose host, disk, memory and load reads // behave as the test describes. func (s *NodeStatusPublicTestSuite) processorWith( - setup func(*hostMocks.MockProvider, *diskMocks.MockProvider, *memMocks.MockProvider, *loadMocks.MockProvider), + setup func(*hostMocks.MockProvider, *diskMocks.MockProvider, *memoryMocks.MockProvider, *loadMocks.MockProvider), ) agent.ProcessorFunc { hostMock := hostMocks.NewMockProvider(s.mockCtrl) diskMock := diskMocks.NewMockProvider(s.mockCtrl) - memMock := memMocks.NewMockProvider(s.mockCtrl) + memMock := memoryMocks.NewMockProvider(s.mockCtrl) loadMock := loadMocks.NewMockProvider(s.mockCtrl) setup(hostMock, diskMock, memMock, loadMock) @@ -106,7 +106,7 @@ func (s *NodeStatusPublicTestSuite) TestGetNodeStatus() { tests := []struct { name string - setup func(*hostMocks.MockProvider, *diskMocks.MockProvider, *memMocks.MockProvider, *loadMocks.MockProvider) + setup func(*hostMocks.MockProvider, *diskMocks.MockProvider, *memoryMocks.MockProvider, *loadMocks.MockProvider) validateFunc func(map[string]any, error) }{ { @@ -114,7 +114,7 @@ func (s *NodeStatusPublicTestSuite) TestGetNodeStatus() { setup: func( h *hostMocks.MockProvider, d *diskMocks.MockProvider, - m *memMocks.MockProvider, + m *memoryMocks.MockProvider, l *loadMocks.MockProvider, ) { h.EXPECT().GetHostname().Return("web-01", nil) @@ -135,7 +135,7 @@ func (s *NodeStatusPublicTestSuite) TestGetNodeStatus() { setup: func( h *hostMocks.MockProvider, d *diskMocks.MockProvider, - m *memMocks.MockProvider, + m *memoryMocks.MockProvider, l *loadMocks.MockProvider, ) { h.EXPECT().GetHostname().Return("web-01", nil) @@ -165,7 +165,7 @@ func (s *NodeStatusPublicTestSuite) TestGetNodeStatus() { setup: func( h *hostMocks.MockProvider, d *diskMocks.MockProvider, - m *memMocks.MockProvider, + m *memoryMocks.MockProvider, l *loadMocks.MockProvider, ) { h.EXPECT().GetHostname().Return("", errors.New("no hostname")) diff --git a/internal/agent/processor.go b/internal/agent/processor.go index 4273fe07b..84c2eb363 100644 --- a/internal/agent/processor.go +++ b/internal/agent/processor.go @@ -34,7 +34,7 @@ import ( nodeHost "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" logProv "github.com/osapi-io/osapi/internal/provider/node/log" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" "github.com/osapi-io/osapi/internal/provider/node/ntp" "github.com/osapi-io/osapi/internal/provider/node/power" processProv "github.com/osapi-io/osapi/internal/provider/node/process" @@ -62,7 +62,7 @@ func (a *Agent) processJobOperation( func NewNodeProcessor( hostProvider nodeHost.Provider, diskProvider disk.Provider, - memProvider mem.Provider, + memoryProvider memory.Provider, loadProvider load.Provider, sysctlProvider sysctl.Provider, ntpProvider ntp.Provider, @@ -87,7 +87,7 @@ func NewNodeProcessor( } return getNodeHostname(hostProvider, appConfig, logger) case "status": - return getNodeStatus(hostProvider, diskProvider, memProvider, loadProvider, logger) + return getNodeStatus(hostProvider, diskProvider, memoryProvider, loadProvider, logger) case "uptime": return getNodeUptime(hostProvider, logger) case "os", "osinfo": @@ -95,7 +95,7 @@ func NewNodeProcessor( case "disk": return getNodeDisk(diskProvider, logger) case "memory", "mem": - return getNodeMemory(memProvider, logger) + return getNodeMemory(memoryProvider, logger) case "load": return getNodeLoad(loadProvider, logger) case "sysctl": @@ -184,7 +184,7 @@ func setNodeHostname( func getNodeStatus( hostProvider nodeHost.Provider, diskProvider disk.Provider, - memProvider mem.Provider, + memoryProvider memory.Provider, loadProvider load.Provider, logger *slog.Logger, ) (json.RawMessage, error) { @@ -219,7 +219,7 @@ func getNodeStatus( diskUsage, err := diskProvider.GetLocalUsageStats() record("disk_usage", err) - memInfo, err := memProvider.GetStats() + memInfo, err := memoryProvider.GetStats() record("memory_stats", err) loadAvg, err := loadProvider.GetAverageStats() @@ -300,12 +300,12 @@ func getNodeDisk( // getNodeMemory retrieves memory statistics. func getNodeMemory( - memProvider mem.Provider, + memoryProvider memory.Provider, logger *slog.Logger, ) (json.RawMessage, error) { - logger.Debug("executing mem.GetStats") + logger.Debug("executing memory.GetStats") - memInfo, err := memProvider.GetStats() + memInfo, err := memoryProvider.GetStats() if err != nil { return nil, err } diff --git a/internal/agent/processor_docker.go b/internal/agent/processor_container.go similarity index 100% rename from internal/agent/processor_docker.go rename to internal/agent/processor_container.go diff --git a/internal/agent/processor_docker_public_test.go b/internal/agent/processor_container_public_test.go similarity index 100% rename from internal/agent/processor_docker_public_test.go rename to internal/agent/processor_container_public_test.go diff --git a/internal/agent/processor_public_test.go b/internal/agent/processor_public_test.go index 9d48fa3bf..548458b20 100644 --- a/internal/agent/processor_public_test.go +++ b/internal/agent/processor_public_test.go @@ -48,7 +48,7 @@ import ( nodeHost "github.com/osapi-io/osapi/internal/provider/node/host" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" processMocks "github.com/osapi-io/osapi/internal/telemetry/process/mocks" ) @@ -87,7 +87,7 @@ func (s *ProcessorPublicTestSuite) SetupTest() { Return(nil, fmt.Errorf("host: %w", provider.ErrUnsupported)). AnyTimes() diskMock := diskMocks.NewDefaultMockProvider(s.mockCtrl) - memMock := memMocks.NewDefaultMockProvider(s.mockCtrl) + memMock := memoryMocks.NewDefaultMockProvider(s.mockCtrl) loadMock := loadMocks.NewDefaultMockProvider(s.mockCtrl) // Use plain DNS mock to avoid hardcoded interface expectations @@ -128,7 +128,7 @@ func (s *ProcessorPublicTestSuite) SetupTest() { streamName: "test-stream", hostProvider: hostMock, diskProvider: diskMock, - memProvider: memMock, + memoryProvider: memMock, loadProvider: loadMock, dnsProvider: dnsMock, pingProvider: pingMock, @@ -836,7 +836,7 @@ func (s *ProcessorPublicTestSuite) TestSystemOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMock, diskProvider: diskMocks.NewPlainMockProvider(s.mockCtrl), - memProvider: memMocks.NewPlainMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewPlainMockProvider(s.mockCtrl), loadProvider: loadMocks.NewPlainMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewPlainMockProvider(s.mockCtrl), pingProvider: pingMocks.NewPlainMockProvider(s.mockCtrl), @@ -864,7 +864,7 @@ func (s *ProcessorPublicTestSuite) TestSystemOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMock, diskProvider: diskMocks.NewPlainMockProvider(s.mockCtrl), - memProvider: memMocks.NewPlainMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewPlainMockProvider(s.mockCtrl), loadProvider: loadMocks.NewPlainMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewPlainMockProvider(s.mockCtrl), pingProvider: pingMocks.NewPlainMockProvider(s.mockCtrl), @@ -890,7 +890,7 @@ func (s *ProcessorPublicTestSuite) TestSystemOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMock, diskProvider: diskMocks.NewPlainMockProvider(s.mockCtrl), - memProvider: memMocks.NewPlainMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewPlainMockProvider(s.mockCtrl), loadProvider: loadMocks.NewPlainMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewPlainMockProvider(s.mockCtrl), pingProvider: pingMocks.NewPlainMockProvider(s.mockCtrl), @@ -916,7 +916,7 @@ func (s *ProcessorPublicTestSuite) TestSystemOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMocks.NewPlainMockProvider(s.mockCtrl), diskProvider: diskMock, - memProvider: memMocks.NewPlainMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewPlainMockProvider(s.mockCtrl), loadProvider: loadMocks.NewPlainMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewPlainMockProvider(s.mockCtrl), pingProvider: pingMocks.NewPlainMockProvider(s.mockCtrl), @@ -934,7 +934,7 @@ func (s *ProcessorPublicTestSuite) TestSystemOperationErrors() { name: "memory provider error", operation: "memory.get", createAgent: func() *agent.Agent { - memMock := memMocks.NewPlainMockProvider(s.mockCtrl) + memMock := memoryMocks.NewPlainMockProvider(s.mockCtrl) memMock.EXPECT().GetStats().Return(nil, errors.New("memory unavailable")) return newTestAgent(newTestAgentParams{ appFs: memfs.New(), @@ -942,7 +942,7 @@ func (s *ProcessorPublicTestSuite) TestSystemOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMocks.NewPlainMockProvider(s.mockCtrl), diskProvider: diskMocks.NewPlainMockProvider(s.mockCtrl), - memProvider: memMock, + memoryProvider: memMock, loadProvider: loadMocks.NewPlainMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewPlainMockProvider(s.mockCtrl), pingProvider: pingMocks.NewPlainMockProvider(s.mockCtrl), @@ -968,7 +968,7 @@ func (s *ProcessorPublicTestSuite) TestSystemOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMocks.NewPlainMockProvider(s.mockCtrl), diskProvider: diskMocks.NewPlainMockProvider(s.mockCtrl), - memProvider: memMocks.NewPlainMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewPlainMockProvider(s.mockCtrl), loadProvider: loadMock, dnsProvider: dnsMocks.NewPlainMockProvider(s.mockCtrl), pingProvider: pingMocks.NewPlainMockProvider(s.mockCtrl), @@ -1024,7 +1024,7 @@ func (s *ProcessorPublicTestSuite) TestNetworkOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMocks.NewPlainMockProvider(s.mockCtrl), diskProvider: diskMocks.NewPlainMockProvider(s.mockCtrl), - memProvider: memMocks.NewPlainMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewPlainMockProvider(s.mockCtrl), loadProvider: loadMocks.NewPlainMockProvider(s.mockCtrl), dnsProvider: dnsMock, pingProvider: pingMocks.NewPlainMockProvider(s.mockCtrl), @@ -1054,7 +1054,7 @@ func (s *ProcessorPublicTestSuite) TestNetworkOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMocks.NewPlainMockProvider(s.mockCtrl), diskProvider: diskMocks.NewPlainMockProvider(s.mockCtrl), - memProvider: memMocks.NewPlainMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewPlainMockProvider(s.mockCtrl), loadProvider: loadMocks.NewPlainMockProvider(s.mockCtrl), dnsProvider: dnsMock, pingProvider: pingMocks.NewPlainMockProvider(s.mockCtrl), @@ -1082,7 +1082,7 @@ func (s *ProcessorPublicTestSuite) TestNetworkOperationErrors() { jobClient: s.mockJobClient, hostProvider: hostMocks.NewPlainMockProvider(s.mockCtrl), diskProvider: diskMocks.NewPlainMockProvider(s.mockCtrl), - memProvider: memMocks.NewPlainMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewPlainMockProvider(s.mockCtrl), loadProvider: loadMocks.NewPlainMockProvider(s.mockCtrl), dnsProvider: dnsMocks.NewPlainMockProvider(s.mockCtrl), pingProvider: pingMock, diff --git a/internal/agent/processor_schedule.go b/internal/agent/processor_schedule.go index 6a403008b..0dd251bc1 100644 --- a/internal/agent/processor_schedule.go +++ b/internal/agent/processor_schedule.go @@ -28,7 +28,7 @@ import ( "strings" "github.com/osapi-io/osapi/internal/job" - "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + "github.com/osapi-io/osapi/internal/provider/schedule/cron" ) // NewScheduleProcessor returns a ProcessorFunc that handles schedule-related operations. @@ -62,7 +62,7 @@ func processCronOperation( // Extract sub-operation: "cron.list" -> "list" parts := strings.Split(jobRequest.Operation, ".") if len(parts) < 2 { - return nil, fmt.Errorf("invalid cron operation: %s", jobRequest.Operation) + return nil, fmt.Errorf("invalid schedule operation: %s", jobRequest.Operation) } subOp := parts[1] diff --git a/internal/agent/processor_schedule_public_test.go b/internal/agent/processor_schedule_public_test.go index 261914cc3..939e11a6a 100644 --- a/internal/agent/processor_schedule_public_test.go +++ b/internal/agent/processor_schedule_public_test.go @@ -36,9 +36,9 @@ import ( diskMocks "github.com/osapi-io/osapi/internal/provider/node/disk/mocks" hostMocks "github.com/osapi-io/osapi/internal/provider/node/host/mocks" loadMocks "github.com/osapi-io/osapi/internal/provider/node/load/mocks" - memMocks "github.com/osapi-io/osapi/internal/provider/node/mem/mocks" - "github.com/osapi-io/osapi/internal/provider/scheduled/cron" - cronMocks "github.com/osapi-io/osapi/internal/provider/scheduled/cron/mocks" + memoryMocks "github.com/osapi-io/osapi/internal/provider/node/memory/mocks" + "github.com/osapi-io/osapi/internal/provider/schedule/cron" + cronMocks "github.com/osapi-io/osapi/internal/provider/schedule/cron/mocks" ) type ProcessorSchedulePublicTestSuite struct { @@ -141,7 +141,7 @@ func (s *ProcessorSchedulePublicTestSuite) TestProcessCronOperation() { validateFunc func(json.RawMessage, error) }{ { - name: "invalid cron operation missing sub-operation", + name: "invalid schedule operation missing sub-operation", jobRequest: job.Request{ Type: job.TypeQuery, Category: "schedule", @@ -153,7 +153,7 @@ func (s *ProcessorSchedulePublicTestSuite) TestProcessCronOperation() { }, validateFunc: func(result json.RawMessage, err error) { s.Error(err) - s.Contains(err.Error(), "invalid cron operation: cron") + s.Contains(err.Error(), "invalid schedule operation: cron") s.Nil(result) }, }, @@ -555,12 +555,12 @@ func (s *ProcessorSchedulePublicTestSuite) TestProcessJobOperationScheduleCatego for _, tt := range tests { s.Run(tt.name, func() { a := newTestAgent(newTestAgentParams{ - jobClient: s.mockJobClient, - hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), - diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), - memProvider: memMocks.NewDefaultMockProvider(s.mockCtrl), - loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), - cronProvider: tt.setupMock(), + jobClient: s.mockJobClient, + hostProvider: hostMocks.NewDefaultMockProvider(s.mockCtrl), + diskProvider: diskMocks.NewDefaultMockProvider(s.mockCtrl), + memoryProvider: memoryMocks.NewDefaultMockProvider(s.mockCtrl), + loadProvider: loadMocks.NewDefaultMockProvider(s.mockCtrl), + cronProvider: tt.setupMock(), }) tt.validateFunc(agent.ExportProcessJobOperation(a, tt.jobRequest)) diff --git a/internal/agent/test_agent_public_test.go b/internal/agent/test_agent_public_test.go index 98720c50b..428e0a9e1 100644 --- a/internal/agent/test_agent_public_test.go +++ b/internal/agent/test_agent_public_test.go @@ -39,12 +39,12 @@ import ( "github.com/osapi-io/osapi/internal/provider/node/disk" nodeHost "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ntpProv "github.com/osapi-io/osapi/internal/provider/node/ntp" powerProv "github.com/osapi-io/osapi/internal/provider/node/power" sysctlProv "github.com/osapi-io/osapi/internal/provider/node/sysctl" timezoneProv "github.com/osapi-io/osapi/internal/provider/node/timezone" - cronProv "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + cronProv "github.com/osapi-io/osapi/internal/provider/schedule/cron" "github.com/osapi-io/osapi/internal/telemetry/process" ) @@ -58,7 +58,7 @@ type newTestAgentParams struct { streamName string hostProvider nodeHost.Provider diskProvider disk.Provider - memProvider mem.Provider + memoryProvider memory.Provider loadProvider load.Provider dnsProvider dns.Provider pingProvider ping.Provider @@ -101,7 +101,7 @@ func newTestAgent( agent.NewNodeProcessor( p.hostProvider, p.diskProvider, - p.memProvider, + p.memoryProvider, p.loadProvider, p.sysctlProvider, p.ntpProvider, @@ -115,7 +115,7 @@ func newTestAgent( p.appConfig, logger, ), - p.hostProvider, p.diskProvider, p.memProvider, p.loadProvider, + p.hostProvider, p.diskProvider, p.memoryProvider, p.loadProvider, ) registry.Register( @@ -156,7 +156,7 @@ func newTestAgent( streamName, p.hostProvider, p.diskProvider, - p.memProvider, + p.memoryProvider, p.loadProvider, p.netinfoProvider, p.processProvider, diff --git a/internal/agent/types.go b/internal/agent/types.go index fb731e6e9..bcae6fdca 100644 --- a/internal/agent/types.go +++ b/internal/agent/types.go @@ -41,7 +41,7 @@ import ( "github.com/osapi-io/osapi/internal/provider/node/disk" "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" "github.com/osapi-io/osapi/internal/telemetry/process" ) @@ -69,7 +69,7 @@ type Agent struct { // system info independently of job processing. hostProvider host.Provider diskProvider disk.Provider - memProvider mem.Provider + memoryProvider memory.Provider loadProvider load.Provider netinfoProvider netinfo.Provider diff --git a/internal/controller/api/agent/agent_get_public_test.go b/internal/controller/api/agent/agent_get_public_test.go index ca3e53d7d..0fbac1195 100644 --- a/internal/controller/api/agent/agent_get_public_test.go +++ b/internal/controller/api/agent/agent_get_public_test.go @@ -43,7 +43,7 @@ import ( jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) type AgentGetPublicTestSuite struct { @@ -108,7 +108,7 @@ func (s *AgentGetPublicTestSuite) TestGetAgentDetails() { OSInfo: &host.Result{Distribution: "Ubuntu", Version: "24.04"}, Uptime: 5 * time.Hour, LoadAverages: &load.Result{Load1: 0.5, Load5: 0.3, Load15: 0.2}, - MemoryStats: &mem.Result{Total: 8388608, Free: 4194304, Cached: 2097152}, + MemoryStats: &memory.Result{Total: 8388608, Free: 4194304, Cached: 2097152}, }, validateFunc: func(resp gen.GetAgentDetailsResponseObject) { r, ok := resp.(gen.GetAgentDetails200JSONResponse) @@ -193,7 +193,11 @@ func (s *AgentGetPublicTestSuite) TestGetAgentDetailsHTTP() { OSInfo: &host.Result{Distribution: "Ubuntu", Version: "24.04"}, Uptime: 5 * time.Hour, LoadAverages: &load.Result{Load1: 0.5, Load5: 0.3, Load15: 0.2}, - MemoryStats: &mem.Result{Total: 8388608, Free: 4194304, Cached: 2097152}, + MemoryStats: &memory.Result{ + Total: 8388608, + Free: 4194304, + Cached: 2097152, + }, }, nil) return mock }, diff --git a/internal/controller/api/agent/agent_list_public_test.go b/internal/controller/api/agent/agent_list_public_test.go index 841e6d3cc..82f0b8736 100644 --- a/internal/controller/api/agent/agent_list_public_test.go +++ b/internal/controller/api/agent/agent_list_public_test.go @@ -44,7 +44,7 @@ import ( jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) type AgentListPublicTestSuite struct { @@ -91,7 +91,7 @@ func (s *AgentListPublicTestSuite) TestListAgents() { OSInfo: &host.Result{Distribution: "Ubuntu", Version: "24.04"}, Uptime: 5 * time.Hour, LoadAverages: &load.Result{Load1: 0.5, Load5: 0.3, Load15: 0.2}, - MemoryStats: &mem.Result{Total: 8388608, Free: 4194304, Cached: 2097152}, + MemoryStats: &memory.Result{Total: 8388608, Free: 4194304, Cached: 2097152}, }, {Hostname: "server2"}, }, diff --git a/internal/controller/api/gen/api.yaml b/internal/controller/api/gen/api.yaml index 91cfc7305..d5eddc26c 100644 --- a/internal/controller/api/gen/api.yaml +++ b/internal/controller/api/gen/api.yaml @@ -78,9 +78,9 @@ tags: - name: Process_Management_API_process_operations x-displayName: Node/Process description: Process management operations on a target node. - - name: Schedule_Management_API_cron_operations - x-displayName: Node/Schedule/Cron - description: Cron drop-in file management on a target node. + - name: Schedule_Management_API_schedule_operations + x-displayName: Node/Schedule + description: Scheduled task management on a target node. - name: Service_Management_API_service_operations x-displayName: Node/Service description: Systemd service management on a target node. @@ -4310,27 +4310,27 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - /api/node/{hostname}/schedule/cron: + /api/node/{hostname}/schedule: servers: [] get: - summary: List all cron entries + summary: List all scheduled entries description: | - List all cron drop-in entries on the target node. + List all scheduled entries on the target node. tags: - - Schedule_Management_API_cron_operations - operationId: GetNodeScheduleCron + - Schedule_Management_API_schedule_operations + operationId: GetNodeSchedule security: - BearerAuth: - - cron:read + - schedule:read parameters: - $ref: '#/components/parameters/Hostname' responses: '200': - description: List of cron entries. + description: List of scheduled entries. content: application/json: schema: - $ref: '#/components/schemas/CronCollectionResponse' + $ref: '#/components/schemas/ScheduleCollectionResponse' '400': description: Bad request - validation error. content: @@ -4350,37 +4350,37 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error listing cron entries. + description: Error listing scheduled entries. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' post: - summary: Create a cron entry + summary: Create a scheduled entry description: | - Create a new cron drop-in entry on the target node. + Create a new scheduled entry on the target node. tags: - - Schedule_Management_API_cron_operations - operationId: PostNodeScheduleCron + - Schedule_Management_API_schedule_operations + operationId: PostNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' requestBody: - description: Cron entry creation parameters. + description: Scheduled entry creation parameters. required: true content: application/json: schema: - $ref: '#/components/schemas/CronCreateRequest' + $ref: '#/components/schemas/ScheduleCreateRequest' responses: '200': - description: Cron entry created. + description: Scheduled entry created. content: application/json: schema: - $ref: '#/components/schemas/CronCreateResponse' + $ref: '#/components/schemas/ScheduleCreateResponse' '400': description: Invalid request payload. content: @@ -4400,33 +4400,33 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error creating cron entry. + description: Error creating scheduled entry. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - /api/node/{hostname}/schedule/cron/{name}: + /api/node/{hostname}/schedule/{name}: servers: [] get: - summary: Get a cron entry + summary: Get a scheduled entry description: | - Get a specific cron drop-in entry by name on the target node. + Get a specific scheduled entry by name on the target node. tags: - - Schedule_Management_API_cron_operations - operationId: GetNodeScheduleCronByName + - Schedule_Management_API_schedule_operations + operationId: GetNodeScheduleByName security: - BearerAuth: - - cron:read + - schedule:read parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' responses: '200': - description: Cron entry detail. + description: Scheduled entry detail. content: application/json: schema: - $ref: '#/components/schemas/CronGetResponse' + $ref: '#/components/schemas/ScheduleGetResponse' '400': description: Bad request - validation error. content: @@ -4446,44 +4446,44 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error retrieving cron entry. + description: Error retrieving scheduled entry. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' put: - summary: Update a cron entry + summary: Update a scheduled entry description: | - Update an existing cron drop-in entry on the target node. + Update an existing scheduled entry on the target node. tags: - - Schedule_Management_API_cron_operations - operationId: PutNodeScheduleCron + - Schedule_Management_API_schedule_operations + operationId: PutNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' requestBody: - description: Cron entry update parameters. + description: Scheduled entry update parameters. required: true content: application/json: schema: - $ref: '#/components/schemas/CronUpdateRequest' + $ref: '#/components/schemas/ScheduleUpdateRequest' responses: '200': - description: Cron entry updated. + description: Scheduled entry updated. content: application/json: schema: - $ref: '#/components/schemas/CronUpdateResponse' + $ref: '#/components/schemas/ScheduleUpdateResponse' '400': description: Invalid request payload. content: @@ -4503,37 +4503,37 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error updating cron entry. + description: Error updating scheduled entry. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' delete: - summary: Delete a cron entry + summary: Delete a scheduled entry description: | - Delete a cron drop-in entry from the target node. + Delete a scheduled entry from the target node. tags: - - Schedule_Management_API_cron_operations - operationId: DeleteNodeScheduleCron + - Schedule_Management_API_schedule_operations + operationId: DeleteNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' responses: '200': - description: Cron entry deleted. + description: Scheduled entry deleted. content: application/json: schema: - $ref: '#/components/schemas/CronDeleteResponse' + $ref: '#/components/schemas/ScheduleDeleteResponse' '400': description: Bad request - validation error. content: @@ -4553,13 +4553,13 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error deleting cron entry. + description: Error deleting scheduled entry. content: application/json: schema: @@ -9748,7 +9748,7 @@ components: $ref: '#/components/schemas/ProcessSignalResult' required: - results - CronCreateRequest: + ScheduleCreateRequest: type: object required: - name @@ -9757,15 +9757,15 @@ components: name: type: string description: > - Name for the cron drop-in entry. Used as the file name under + Name for the scheduled entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. x-oapi-codegen-extra-tags: validate: required,min=1,max=64 object: type: string description: > - Name of the uploaded file in the object store to deploy as the cron - entry content. + Name of the uploaded file in the object store to deploy as the + scheduled entry content. x-oapi-codegen-extra-tags: validate: required,min=1 schedule: @@ -9812,7 +9812,7 @@ components: additionalProperties: true description: | Template variables. Only used when content_type is "template". - CronUpdateRequest: + ScheduleUpdateRequest: type: object properties: object: @@ -9844,9 +9844,9 @@ components: additionalProperties: true description: | Template variables. - CronEntry: + ScheduleEntry: type: object - description: A cron drop-in entry. + description: A scheduled entry. properties: hostname: type: string @@ -9861,7 +9861,7 @@ components: description: The status of the operation for this host. name: type: string - description: Cron entry name. + description: Scheduled entry name. object: type: string description: Object store name for the deployed content. @@ -9886,14 +9886,14 @@ components: "monthly". user: type: string - description: User the cron entry runs as. + description: User the scheduled entry runs as. error: type: string description: Error message if the agent failed to retrieve this entry. required: - hostname - status - CronCollectionResponse: + ScheduleCollectionResponse: type: object properties: job_id: @@ -9904,12 +9904,12 @@ components: results: type: array items: - $ref: '#/components/schemas/CronEntry' + $ref: '#/components/schemas/ScheduleEntry' required: - results - CronGetResponse: + ScheduleGetResponse: type: object - description: Collection response for a single cron entry get operation. + description: Collection response for a single scheduled entry get operation. properties: job_id: type: string @@ -9919,10 +9919,10 @@ components: results: type: array items: - $ref: '#/components/schemas/CronEntry' + $ref: '#/components/schemas/ScheduleEntry' required: - results - CronMutationResult: + ScheduleMutationResult: type: object description: Result of a cron create, update, or delete operation for one host. properties: @@ -9939,7 +9939,7 @@ components: description: The status of the operation for this host. name: type: string - description: Cron entry name. + description: Scheduled entry name. changed: type: boolean description: Whether the operation modified system state. @@ -9949,7 +9949,7 @@ components: required: - hostname - status - CronCreateResponse: + ScheduleCreateResponse: type: object properties: job_id: @@ -9960,10 +9960,10 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results - CronUpdateResponse: + ScheduleUpdateResponse: type: object properties: job_id: @@ -9974,10 +9974,10 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results - CronDeleteResponse: + ScheduleDeleteResponse: type: object properties: job_id: @@ -9988,7 +9988,7 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results ServiceCreateRequest: @@ -10952,13 +10952,13 @@ components: schema: type: integer minimum: 1 - CronName: + ScheduleName: name: name in: path required: true description: > - Cron entry name. Must contain only alphanumeric characters, underscores, - and hyphens. + Scheduled entry name. Must contain only alphanumeric characters, + underscores, and hyphens. x-oapi-codegen-extra-tags: validate: required,min=1 schema: @@ -11095,7 +11095,7 @@ x-tagGroups: - Process_Management_API_process_operations - name: Schedule Management API tags: - - Schedule_Management_API_cron_operations + - Schedule_Management_API_schedule_operations - name: Service Management API tags: - Service_Management_API_service_operations diff --git a/internal/controller/api/node/docker/container.go b/internal/controller/api/node/container/container.go similarity index 95% rename from internal/controller/api/node/docker/container.go rename to internal/controller/api/node/container/container.go index e95ab65cb..d44c87b99 100644 --- a/internal/controller/api/node/docker/container.go +++ b/internal/controller/api/node/container/container.go @@ -24,7 +24,7 @@ package container import ( "log/slog" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job/client" ) diff --git a/internal/controller/api/node/docker/convert.go b/internal/controller/api/node/container/convert.go similarity index 100% rename from internal/controller/api/node/docker/convert.go rename to internal/controller/api/node/container/convert.go diff --git a/internal/controller/api/node/docker/convert_public_test.go b/internal/controller/api/node/container/convert_public_test.go similarity index 99% rename from internal/controller/api/node/docker/convert_public_test.go rename to internal/controller/api/node/container/convert_public_test.go index ff3b297fc..484ed3977 100644 --- a/internal/controller/api/node/docker/convert_public_test.go +++ b/internal/controller/api/node/container/convert_public_test.go @@ -25,7 +25,7 @@ import ( "github.com/stretchr/testify/suite" - container "github.com/osapi-io/osapi/internal/controller/api/node/docker" + container "github.com/osapi-io/osapi/internal/controller/api/node/container" "github.com/osapi-io/osapi/internal/job" ) diff --git a/internal/controller/api/node/docker/container_create.go b/internal/controller/api/node/container/docker_create.go similarity index 98% rename from internal/controller/api/node/docker/container_create.go rename to internal/controller/api/node/container/docker_create.go index 8ea095d5b..c77a7aca6 100644 --- a/internal/controller/api/node/docker/container_create.go +++ b/internal/controller/api/node/container/docker_create.go @@ -27,7 +27,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_create_public_test.go b/internal/controller/api/node/container/docker_create_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_create_public_test.go rename to internal/controller/api/node/container/docker_create_public_test.go index ad73ce1e6..e93c5d518 100644 --- a/internal/controller/api/node/docker/container_create_public_test.go +++ b/internal/controller/api/node/container/docker_create_public_test.go @@ -40,8 +40,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/container_exec.go b/internal/controller/api/node/container/docker_exec.go similarity index 98% rename from internal/controller/api/node/docker/container_exec.go rename to internal/controller/api/node/container/docker_exec.go index 715eeb7ba..c84c25840 100644 --- a/internal/controller/api/node/docker/container_exec.go +++ b/internal/controller/api/node/container/docker_exec.go @@ -27,7 +27,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_exec_public_test.go b/internal/controller/api/node/container/docker_exec_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_exec_public_test.go rename to internal/controller/api/node/container/docker_exec_public_test.go index f8c3432c1..93f7c8c9b 100644 --- a/internal/controller/api/node/docker/container_exec_public_test.go +++ b/internal/controller/api/node/container/docker_exec_public_test.go @@ -40,8 +40,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/container_image_remove.go b/internal/controller/api/node/container/docker_image_remove.go similarity index 98% rename from internal/controller/api/node/docker/container_image_remove.go rename to internal/controller/api/node/container/docker_image_remove.go index 9df5cd6ee..0ff16c136 100644 --- a/internal/controller/api/node/docker/container_image_remove.go +++ b/internal/controller/api/node/container/docker_image_remove.go @@ -26,7 +26,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_image_remove_public_test.go b/internal/controller/api/node/container/docker_image_remove_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_image_remove_public_test.go rename to internal/controller/api/node/container/docker_image_remove_public_test.go index f9dfcd396..fa856827d 100644 --- a/internal/controller/api/node/docker/container_image_remove_public_test.go +++ b/internal/controller/api/node/container/docker_image_remove_public_test.go @@ -38,8 +38,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/container_inspect.go b/internal/controller/api/node/container/docker_inspect.go similarity index 98% rename from internal/controller/api/node/docker/container_inspect.go rename to internal/controller/api/node/container/docker_inspect.go index a9c083831..5cc562289 100644 --- a/internal/controller/api/node/docker/container_inspect.go +++ b/internal/controller/api/node/container/docker_inspect.go @@ -27,7 +27,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_inspect_public_test.go b/internal/controller/api/node/container/docker_inspect_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_inspect_public_test.go rename to internal/controller/api/node/container/docker_inspect_public_test.go index e2ba8a323..eab335942 100644 --- a/internal/controller/api/node/docker/container_inspect_public_test.go +++ b/internal/controller/api/node/container/docker_inspect_public_test.go @@ -37,8 +37,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/container_list.go b/internal/controller/api/node/container/docker_list.go similarity index 98% rename from internal/controller/api/node/docker/container_list.go rename to internal/controller/api/node/container/docker_list.go index 1ffa1438d..bea882e79 100644 --- a/internal/controller/api/node/docker/container_list.go +++ b/internal/controller/api/node/container/docker_list.go @@ -27,7 +27,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_list_public_test.go b/internal/controller/api/node/container/docker_list_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_list_public_test.go rename to internal/controller/api/node/container/docker_list_public_test.go index bbc09631a..cd5968481 100644 --- a/internal/controller/api/node/docker/container_list_public_test.go +++ b/internal/controller/api/node/container/docker_list_public_test.go @@ -39,8 +39,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/container_pull.go b/internal/controller/api/node/container/docker_pull.go similarity index 98% rename from internal/controller/api/node/docker/container_pull.go rename to internal/controller/api/node/container/docker_pull.go index e2a1ed629..d6b32945f 100644 --- a/internal/controller/api/node/docker/container_pull.go +++ b/internal/controller/api/node/container/docker_pull.go @@ -27,7 +27,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_pull_public_test.go b/internal/controller/api/node/container/docker_pull_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_pull_public_test.go rename to internal/controller/api/node/container/docker_pull_public_test.go index 848871b40..f00795acd 100644 --- a/internal/controller/api/node/docker/container_pull_public_test.go +++ b/internal/controller/api/node/container/docker_pull_public_test.go @@ -40,8 +40,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/container_remove.go b/internal/controller/api/node/container/docker_remove.go similarity index 98% rename from internal/controller/api/node/docker/container_remove.go rename to internal/controller/api/node/container/docker_remove.go index 2eca55edb..7f188313d 100644 --- a/internal/controller/api/node/docker/container_remove.go +++ b/internal/controller/api/node/container/docker_remove.go @@ -26,7 +26,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_remove_public_test.go b/internal/controller/api/node/container/docker_remove_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_remove_public_test.go rename to internal/controller/api/node/container/docker_remove_public_test.go index 6c8f7d6a8..fc5886de5 100644 --- a/internal/controller/api/node/docker/container_remove_public_test.go +++ b/internal/controller/api/node/container/docker_remove_public_test.go @@ -38,8 +38,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/container_start.go b/internal/controller/api/node/container/docker_start.go similarity index 98% rename from internal/controller/api/node/docker/container_start.go rename to internal/controller/api/node/container/docker_start.go index 847412a05..917633a63 100644 --- a/internal/controller/api/node/docker/container_start.go +++ b/internal/controller/api/node/container/docker_start.go @@ -26,7 +26,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_start_public_test.go b/internal/controller/api/node/container/docker_start_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_start_public_test.go rename to internal/controller/api/node/container/docker_start_public_test.go index 25a68cfc6..c83ae2cec 100644 --- a/internal/controller/api/node/docker/container_start_public_test.go +++ b/internal/controller/api/node/container/docker_start_public_test.go @@ -38,8 +38,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/container_stop.go b/internal/controller/api/node/container/docker_stop.go similarity index 98% rename from internal/controller/api/node/docker/container_stop.go rename to internal/controller/api/node/container/docker_stop.go index c208724bb..ddb848d80 100644 --- a/internal/controller/api/node/docker/container_stop.go +++ b/internal/controller/api/node/container/docker_stop.go @@ -26,7 +26,7 @@ import ( "github.com/google/uuid" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/validation" ) diff --git a/internal/controller/api/node/docker/container_stop_public_test.go b/internal/controller/api/node/container/docker_stop_public_test.go similarity index 99% rename from internal/controller/api/node/docker/container_stop_public_test.go rename to internal/controller/api/node/container/docker_stop_public_test.go index c6740a5fc..cd0401dbc 100644 --- a/internal/controller/api/node/docker/container_stop_public_test.go +++ b/internal/controller/api/node/container/docker_stop_public_test.go @@ -39,8 +39,8 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/config" "github.com/osapi-io/osapi/internal/controller/api" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" - "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" + "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/validation" diff --git a/internal/controller/api/node/docker/export_test.go b/internal/controller/api/node/container/export_test.go similarity index 100% rename from internal/controller/api/node/docker/export_test.go rename to internal/controller/api/node/container/export_test.go diff --git a/internal/controller/api/node/docker/gen/api.yaml b/internal/controller/api/node/container/gen/api.yaml similarity index 100% rename from internal/controller/api/node/docker/gen/api.yaml rename to internal/controller/api/node/container/gen/api.yaml diff --git a/internal/controller/api/node/docker/gen/cfg.yaml b/internal/controller/api/node/container/gen/cfg.yaml similarity index 100% rename from internal/controller/api/node/docker/gen/cfg.yaml rename to internal/controller/api/node/container/gen/cfg.yaml diff --git a/internal/controller/api/node/docker/gen/docker.gen.go b/internal/controller/api/node/container/gen/docker.gen.go similarity index 100% rename from internal/controller/api/node/docker/gen/docker.gen.go rename to internal/controller/api/node/container/gen/docker.gen.go diff --git a/internal/controller/api/node/docker/gen/generate.go b/internal/controller/api/node/container/gen/generate.go similarity index 100% rename from internal/controller/api/node/docker/gen/generate.go rename to internal/controller/api/node/container/gen/generate.go diff --git a/internal/controller/api/node/docker/handler.go b/internal/controller/api/node/container/handler.go similarity index 96% rename from internal/controller/api/node/docker/handler.go rename to internal/controller/api/node/container/handler.go index 0494996d6..feb038f3f 100644 --- a/internal/controller/api/node/docker/handler.go +++ b/internal/controller/api/node/container/handler.go @@ -27,7 +27,7 @@ import ( "github.com/osapi-io/osapi/internal/authtoken" "github.com/osapi-io/osapi/internal/controller/api" - gen "github.com/osapi-io/osapi/internal/controller/api/node/docker/gen" + gen "github.com/osapi-io/osapi/internal/controller/api/node/container/gen" "github.com/osapi-io/osapi/internal/job/client" ) diff --git a/internal/controller/api/node/docker/handler_public_test.go b/internal/controller/api/node/container/handler_public_test.go similarity index 99% rename from internal/controller/api/node/docker/handler_public_test.go rename to internal/controller/api/node/container/handler_public_test.go index d61b79fc8..e0e923704 100644 --- a/internal/controller/api/node/docker/handler_public_test.go +++ b/internal/controller/api/node/container/handler_public_test.go @@ -30,7 +30,7 @@ import ( "github.com/stretchr/testify/suite" "go.uber.org/mock/gomock" - apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/docker" + apicontainer "github.com/osapi-io/osapi/internal/controller/api/node/container" "github.com/osapi-io/osapi/internal/job/mocks" ) diff --git a/internal/controller/api/node/docker/types.go b/internal/controller/api/node/container/types.go similarity index 100% rename from internal/controller/api/node/docker/types.go rename to internal/controller/api/node/container/types.go diff --git a/internal/controller/api/node/docker/validate.go b/internal/controller/api/node/container/validate.go similarity index 100% rename from internal/controller/api/node/docker/validate.go rename to internal/controller/api/node/container/validate.go diff --git a/internal/controller/api/node/node_memory_get.go b/internal/controller/api/node/node_memory_get.go index 384e36178..7edd8d838 100644 --- a/internal/controller/api/node/node_memory_get.go +++ b/internal/controller/api/node/node_memory_get.go @@ -29,7 +29,7 @@ import ( "github.com/osapi-io/osapi/internal/controller/api/node/gen" "github.com/osapi-io/osapi/internal/job" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) // GetNodeMemory get the node memory stats API endpoint. @@ -82,7 +82,7 @@ func (s *Node) GetNodeMemory( }, nil } - var memStats mem.Result + var memStats memory.Result if rawResp.Data != nil { _ = json.Unmarshal(rawResp.Data, &memStats) } @@ -136,7 +136,7 @@ func (s *Node) getNodeMemoryBroadcast( item.Error = &e default: item.Status = gen.MemoryResultItemStatusOk - var memStats mem.Result + var memStats memory.Result if resp.Data != nil { _ = json.Unmarshal(resp.Data, &memStats) } @@ -154,10 +154,10 @@ func (s *Node) getNodeMemoryBroadcast( }, nil } -// buildMemoryResultItem converts mem.Result to a MemoryResultItem. +// buildMemoryResultItem converts memory.Result to a MemoryResultItem. func buildMemoryResultItem( hostname string, - memStats *mem.Result, + memStats *memory.Result, ) *gen.MemoryResultItem { changed := false item := &gen.MemoryResultItem{ diff --git a/internal/controller/api/node/node_memory_get_public_test.go b/internal/controller/api/node/node_memory_get_public_test.go index f9e58b45c..4d5c14723 100644 --- a/internal/controller/api/node/node_memory_get_public_test.go +++ b/internal/controller/api/node/node_memory_get_public_test.go @@ -41,7 +41,7 @@ import ( "github.com/osapi-io/osapi/internal/controller/api/node/gen" "github.com/osapi-io/osapi/internal/job" jobmocks "github.com/osapi-io/osapi/internal/job/mocks" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" "github.com/osapi-io/osapi/internal/validation" ) @@ -89,7 +89,7 @@ func (s *NodeMemoryGetPublicTestSuite) TestGetNodeMemory() { name: "success", request: gen.GetNodeMemoryRequestObject{Hostname: "_any"}, setupMock: func() { - memResult := mem.Result{ + memResult := memory.Result{ Total: 8192, Free: 4096, Cached: 2048, @@ -160,8 +160,8 @@ func (s *NodeMemoryGetPublicTestSuite) TestGetNodeMemory() { name: "broadcast all success", request: gen.GetNodeMemoryRequestObject{Hostname: "_all"}, setupMock: func() { - mem1 := mem.Result{Total: 8192, Free: 4096, Cached: 2048} - mem2 := mem.Result{Total: 16384, Free: 8192, Cached: 4096} + mem1 := memory.Result{Total: 8192, Free: 4096, Cached: 2048} + mem2 := memory.Result{Total: 16384, Free: 8192, Cached: 4096} data1, _ := json.Marshal(mem1) data2, _ := json.Marshal(mem2) s.mockJobClient.EXPECT(). @@ -185,7 +185,7 @@ func (s *NodeMemoryGetPublicTestSuite) TestGetNodeMemory() { name: "broadcast all with errors", request: gen.GetNodeMemoryRequestObject{Hostname: "_all"}, setupMock: func() { - mem1 := mem.Result{Total: 8192, Free: 4096, Cached: 2048} + mem1 := memory.Result{Total: 8192, Free: 4096, Cached: 2048} data1, _ := json.Marshal(mem1) s.mockJobClient.EXPECT(). QueryBroadcast(gomock.Any(), "_all", "node", job.OperationNodeMemoryGet, gomock.Any()). @@ -323,7 +323,7 @@ func (s *NodeMemoryGetPublicTestSuite) TestGetNodeMemoryValidationHTTP() { path: "/api/node/server1/memory", setupJobMock: func() *jobmocks.MockJobClient { mock := jobmocks.NewMockJobClient(s.mockCtrl) - memResult := mem.Result{Total: 8192, Free: 4096, Cached: 2048} + memResult := memory.Result{Total: 8192, Free: 4096, Cached: 2048} data, _ := json.Marshal(memResult) mock.EXPECT(). Query(gomock.Any(), "server1", "node", job.OperationNodeMemoryGet, gomock.Any()). @@ -446,7 +446,7 @@ func (s *NodeMemoryGetPublicTestSuite) TestGetNodeMemoryRBACHTTP() { }, setupJobMock: func() *jobmocks.MockJobClient { mock := jobmocks.NewMockJobClient(s.mockCtrl) - memResult := mem.Result{Total: 8192, Free: 4096, Cached: 2048} + memResult := memory.Result{Total: 8192, Free: 4096, Cached: 2048} data, _ := json.Marshal(memResult) mock.EXPECT(). Query(gomock.Any(), "server1", "node", job.OperationNodeMemoryGet, gomock.Any()). diff --git a/internal/controller/api/node/node_status_get_public_test.go b/internal/controller/api/node/node_status_get_public_test.go index 83da77199..4873c68b8 100644 --- a/internal/controller/api/node/node_status_get_public_test.go +++ b/internal/controller/api/node/node_status_get_public_test.go @@ -46,7 +46,7 @@ import ( "github.com/osapi-io/osapi/internal/provider/node/disk" "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" "github.com/osapi-io/osapi/internal/validation" ) @@ -401,7 +401,7 @@ func (s *NodeStatusGetPublicTestSuite) TestGetNodeStatusValidationHTTP() { Load5: 0.5, Load15: 0.2, }, - MemoryStats: &mem.Result{ + MemoryStats: &memory.Result{ Total: 8388608, Free: 4194304, Cached: 2097152, @@ -601,7 +601,7 @@ func (s *NodeStatusGetPublicTestSuite) TestGetNodeStatusRBACHTTP() { Load5: 0.5, Load15: 0.2, }, - MemoryStats: &mem.Result{ + MemoryStats: &memory.Result{ Total: 8388608, Free: 4194304, Cached: 2097152, diff --git a/internal/controller/api/node/schedule/cron_create.go b/internal/controller/api/node/schedule/create.go similarity index 72% rename from internal/controller/api/node/schedule/cron_create.go rename to internal/controller/api/node/schedule/create.go index f8e0cd00a..15215ae89 100644 --- a/internal/controller/api/node/schedule/cron_create.go +++ b/internal/controller/api/node/schedule/create.go @@ -29,21 +29,21 @@ import ( "github.com/osapi-io/osapi/internal/controller/api/node/schedule/gen" "github.com/osapi-io/osapi/internal/job" - cronProv "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + cronProv "github.com/osapi-io/osapi/internal/provider/schedule/cron" "github.com/osapi-io/osapi/internal/validation" ) -// PostNodeScheduleCron creates a cron entry on a target node. -func (s *Schedule) PostNodeScheduleCron( +// PostNodeSchedule creates a cron entry on a target node. +func (s *Schedule) PostNodeSchedule( ctx context.Context, - request gen.PostNodeScheduleCronRequestObject, -) (gen.PostNodeScheduleCronResponseObject, error) { + request gen.PostNodeScheduleRequestObject, +) (gen.PostNodeScheduleResponseObject, error) { if errMsg, ok := validateHostname(request.Hostname); !ok { - return gen.PostNodeScheduleCron400JSONResponse{Error: &errMsg}, nil + return gen.PostNodeSchedule400JSONResponse{Error: &errMsg}, nil } if errMsg, ok := validation.Struct(request.Body); !ok { - return gen.PostNodeScheduleCron400JSONResponse{Error: &errMsg}, nil + return gen.PostNodeSchedule400JSONResponse{Error: &errMsg}, nil } entry := cronProv.Entry{ @@ -77,7 +77,7 @@ func (s *Schedule) PostNodeScheduleCron( ) if job.IsBroadcastTarget(hostname) { - return s.postNodeScheduleCronCreateBroadcast(ctx, hostname, entry) + return s.postNodeScheduleCreateBroadcast(ctx, hostname, entry) } jobID, resp, err := s.JobClient.Modify( @@ -89,18 +89,18 @@ func (s *Schedule) PostNodeScheduleCron( ) if err != nil { errMsg := err.Error() - return gen.PostNodeScheduleCron500JSONResponse{Error: &errMsg}, nil + return gen.PostNodeSchedule500JSONResponse{Error: &errMsg}, nil } if resp.Status == job.StatusSkipped { jobUUID := uuid.MustParse(jobID) e := resp.Error - return gen.PostNodeScheduleCron200JSONResponse{ + return gen.PostNodeSchedule200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronMutationResult{ + Results: []gen.ScheduleMutationResult{ { Hostname: resp.Hostname, - Status: gen.CronMutationResultStatusSkipped, + Status: gen.ScheduleMutationResultStatusSkipped, Error: &e, }, }, @@ -117,12 +117,12 @@ func (s *Schedule) PostNodeScheduleCron( name := result.Name agentHostname := resp.Hostname - return gen.PostNodeScheduleCron200JSONResponse{ + return gen.PostNodeSchedule200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronMutationResult{ + Results: []gen.ScheduleMutationResult{ { Hostname: agentHostname, - Status: gen.CronMutationResultStatusOk, + Status: gen.ScheduleMutationResultStatusOk, Name: &name, Changed: changed, }, @@ -130,12 +130,12 @@ func (s *Schedule) PostNodeScheduleCron( }, nil } -// postNodeScheduleCronCreateBroadcast handles broadcast targets for cron create. -func (s *Schedule) postNodeScheduleCronCreateBroadcast( +// postNodeScheduleCreateBroadcast handles broadcast targets for cron create. +func (s *Schedule) postNodeScheduleCreateBroadcast( ctx context.Context, target string, entry cronProv.Entry, -) (gen.PostNodeScheduleCronResponseObject, error) { +) (gen.PostNodeScheduleResponseObject, error) { jobID, responses, err := s.JobClient.ModifyBroadcast( ctx, target, @@ -145,29 +145,29 @@ func (s *Schedule) postNodeScheduleCronCreateBroadcast( ) if err != nil { errMsg := err.Error() - return gen.PostNodeScheduleCron500JSONResponse{Error: &errMsg}, nil + return gen.PostNodeSchedule500JSONResponse{Error: &errMsg}, nil } - var apiResponses []gen.CronMutationResult + var apiResponses []gen.ScheduleMutationResult for host, resp := range responses { - item := gen.CronMutationResult{ + item := gen.ScheduleMutationResult{ Hostname: host, } switch resp.Status { case job.StatusFailed: - item.Status = gen.CronMutationResultStatusFailed + item.Status = gen.ScheduleMutationResultStatusFailed e := resp.Error item.Error = &e case job.StatusSkipped: - item.Status = gen.CronMutationResultStatusSkipped + item.Status = gen.ScheduleMutationResultStatusSkipped e := resp.Error item.Error = &e case job.StatusTimeout: - item.Status = gen.CronMutationResultStatusTimeout + item.Status = gen.ScheduleMutationResultStatusTimeout e := resp.Error item.Error = &e default: - item.Status = gen.CronMutationResultStatusOk + item.Status = gen.ScheduleMutationResultStatusOk var result cronProv.CreateResult if resp.Data != nil { _ = json.Unmarshal(resp.Data, &result) @@ -181,7 +181,7 @@ func (s *Schedule) postNodeScheduleCronCreateBroadcast( jobUUID := uuid.MustParse(jobID) - return gen.PostNodeScheduleCron200JSONResponse{ + return gen.PostNodeSchedule200JSONResponse{ JobId: &jobUUID, Results: apiResponses, }, nil diff --git a/internal/controller/api/node/schedule/cron_create_public_test.go b/internal/controller/api/node/schedule/create_public_test.go similarity index 78% rename from internal/controller/api/node/schedule/cron_create_public_test.go rename to internal/controller/api/node/schedule/create_public_test.go index 90bacc90c..97b9cbedf 100644 --- a/internal/controller/api/node/schedule/cron_create_public_test.go +++ b/internal/controller/api/node/schedule/create_public_test.go @@ -47,7 +47,7 @@ import ( "github.com/osapi-io/osapi/internal/validation" ) -type CronCreatePublicTestSuite struct { +type ScheduleCreatePublicTestSuite struct { suite.Suite mockCtrl *gomock.Controller @@ -58,7 +58,7 @@ type CronCreatePublicTestSuite struct { logger *slog.Logger } -func (s *CronCreatePublicTestSuite) SetupSuite() { +func (s *ScheduleCreatePublicTestSuite) SetupSuite() { validation.RegisterTargetValidator(func(_ context.Context) ([]validation.AgentTarget, error) { return []validation.AgentTarget{ {Hostname: "server1", Labels: map[string]string{"group": "web"}}, @@ -67,7 +67,7 @@ func (s *CronCreatePublicTestSuite) SetupSuite() { }) } -func (s *CronCreatePublicTestSuite) SetupTest() { +func (s *ScheduleCreatePublicTestSuite) SetupTest() { s.mockCtrl = gomock.NewController(s.T()) s.mockJobClient = jobmocks.NewMockJobClient(s.mockCtrl) s.handler = apischedule.New(slog.Default(), s.mockJobClient) @@ -76,27 +76,27 @@ func (s *CronCreatePublicTestSuite) SetupTest() { s.logger = slog.New(slog.NewTextHandler(os.Stdout, nil)) } -func (s *CronCreatePublicTestSuite) TearDownTest() { +func (s *ScheduleCreatePublicTestSuite) TearDownTest() { s.mockCtrl.Finish() } -func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { +func (s *ScheduleCreatePublicTestSuite) TestPostNodeSchedule() { tests := []struct { name string - request gen.PostNodeScheduleCronRequestObject + request gen.PostNodeScheduleRequestObject setupMock func() - validateFunc func(resp gen.PostNodeScheduleCronResponseObject) + validateFunc func(resp gen.PostNodeScheduleResponseObject) }{ { name: "success", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "backup-script", User: ptr.To("root"), - ContentType: (*gen.CronCreateRequestContentType)(ptr.To("template")), + ContentType: (*gen.ScheduleCreateRequestContentType)(ptr.To("template")), Vars: &map[string]interface{}{"region": "us-east"}, }, }, @@ -120,8 +120,8 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -133,9 +133,9 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "success with nil user", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "/usr/bin/backup.sh", @@ -161,8 +161,8 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -171,11 +171,11 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "success with interval instead of schedule", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "daily-backup", - Interval: ptr.To(gen.CronCreateRequestIntervalDaily), + Interval: ptr.To(gen.ScheduleCreateRequestIntervalDaily), Object: "/usr/bin/backup.sh", }, }, @@ -199,8 +199,8 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -209,9 +209,9 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "success with nil response data", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "/usr/bin/backup.sh", @@ -237,8 +237,8 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -247,9 +247,9 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "broadcast success", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "_all", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "backup-script", @@ -279,8 +279,8 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -288,9 +288,9 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "broadcast with errors", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "_all", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "backup-script", @@ -319,8 +319,8 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -328,9 +328,9 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "broadcast with skipped host", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "_all", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "backup-script", @@ -353,21 +353,21 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) - s.Equal(gen.CronMutationResultStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "broadcast with a host that never answered", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "_all", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "backup-script", @@ -390,21 +390,21 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) - s.Equal(gen.CronMutationResultStatusTimeout, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusTimeout, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "timeout: agent did not respond") }, }, { name: "broadcast error collecting responses", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "_all", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "backup-script", @@ -421,24 +421,24 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - _, ok := resp.(gen.PostNodeScheduleCron500JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + _, ok := resp.(gen.PostNodeSchedule500JSONResponse) s.True(ok) }, }, { name: "validation error empty hostname", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "/usr/bin/backup.sh", }, }, setupMock: func() {}, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "required") @@ -446,33 +446,33 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "body validation error empty name", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "", Schedule: ptr.To("0 2 * * *"), Object: "/usr/bin/backup.sh", }, }, setupMock: func() {}, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) }, }, { name: "validation error neither schedule nor interval", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Object: "/usr/bin/backup.sh", }, }, setupMock: func() {}, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "Schedule") @@ -480,35 +480,35 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "validation error both schedule and interval", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), - Interval: ptr.To(gen.CronCreateRequestIntervalDaily), + Interval: ptr.To(gen.ScheduleCreateRequestIntervalDaily), Object: "/usr/bin/backup.sh", }, }, setupMock: func() {}, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) }, }, { name: "validation error invalid cron schedule expression", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("not-a-cron"), Object: "/usr/bin/backup.sh", }, }, setupMock: func() {}, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "cron_schedule") @@ -516,26 +516,26 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { }, { name: "body validation error empty command", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "", }, }, setupMock: func() {}, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) }, }, { name: "when job skipped", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "/usr/bin/backup.sh", @@ -560,22 +560,22 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PostNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + r, ok := resp.(gen.PostNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) s.Equal("server1", r.Results[0].Hostname) - s.Equal(gen.CronMutationResultStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "job client error", - request: gen.PostNodeScheduleCronRequestObject{ + request: gen.PostNodeScheduleRequestObject{ Hostname: "server1", - Body: &gen.PostNodeScheduleCronJSONRequestBody{ + Body: &gen.PostNodeScheduleJSONRequestBody{ Name: "backup", Schedule: ptr.To("0 2 * * *"), Object: "/usr/bin/backup.sh", @@ -592,8 +592,8 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.PostNodeScheduleCronResponseObject) { - _, ok := resp.(gen.PostNodeScheduleCron500JSONResponse) + validateFunc: func(resp gen.PostNodeScheduleResponseObject) { + _, ok := resp.(gen.PostNodeSchedule500JSONResponse) s.True(ok) }, }, @@ -603,14 +603,14 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCron() { s.Run(tt.name, func() { tt.setupMock() - resp, err := s.handler.PostNodeScheduleCron(s.ctx, tt.request) + resp, err := s.handler.PostNodeSchedule(s.ctx, tt.request) s.NoError(err) tt.validateFunc(resp) }) } } -func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronValidationHTTP() { +func (s *ScheduleCreatePublicTestSuite) TestPostNodeScheduleValidationHTTP() { tests := []struct { name string path string @@ -620,7 +620,7 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronValidationHTTP() { }{ { name: "when valid request", - path: "/api/node/server1/schedule/cron", + path: "/api/node/server1/schedule", body: `{"name":"backup","schedule":"0 2 * * *","object":"backup-script"}`, setupJobMock: func() *jobmocks.MockJobClient { mock := jobmocks.NewMockJobClient(s.mockCtrl) @@ -646,7 +646,7 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronValidationHTTP() { }, { name: "when missing name", - path: "/api/node/server1/schedule/cron", + path: "/api/node/server1/schedule", body: `{"schedule":"0 2 * * *","object":"backup-script"}`, setupJobMock: func() *jobmocks.MockJobClient { return jobmocks.NewMockJobClient(s.mockCtrl) @@ -660,7 +660,7 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronValidationHTTP() { }, { name: "when target agent not found", - path: "/api/node/nonexistent/schedule/cron", + path: "/api/node/nonexistent/schedule", body: `{"name":"backup","schedule":"0 2 * * *","object":"backup-script"}`, setupJobMock: func() *jobmocks.MockJobClient { return jobmocks.NewMockJobClient(s.mockCtrl) @@ -700,7 +700,7 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronValidationHTTP() { const rbacCronCreateTestSigningKey = "test-signing-key-for-rbac-cron-create" -func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronRBACHTTP() { +func (s *ScheduleCreatePublicTestSuite) TestPostNodeScheduleRBACHTTP() { tokenManager := authtoken.New(s.logger) tests := []struct { @@ -729,7 +729,7 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronRBACHTTP() { rbacCronCreateTestSigningKey, []string{"read"}, "test-user", - []string{"cron:read"}, + []string{"schedule:read"}, ) s.Require().NoError(err) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) @@ -803,7 +803,7 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronRBACHTTP() { req := httptest.NewRequest( http.MethodPost, - "/api/node/server1/schedule/cron", + "/api/node/server1/schedule", strings.NewReader( `{"name":"backup","schedule":"0 2 * * *","object":"backup-script"}`, ), @@ -819,8 +819,8 @@ func (s *CronCreatePublicTestSuite) TestPostNodeScheduleCronRBACHTTP() { } } -func TestCronCreatePublicTestSuite( +func TestScheduleCreatePublicTestSuite( t *testing.T, ) { - suite.Run(t, new(CronCreatePublicTestSuite)) + suite.Run(t, new(ScheduleCreatePublicTestSuite)) } diff --git a/internal/controller/api/node/schedule/cron_delete.go b/internal/controller/api/node/schedule/delete.go similarity index 70% rename from internal/controller/api/node/schedule/cron_delete.go rename to internal/controller/api/node/schedule/delete.go index f46dbe68c..5672a0908 100644 --- a/internal/controller/api/node/schedule/cron_delete.go +++ b/internal/controller/api/node/schedule/delete.go @@ -29,18 +29,18 @@ import ( "github.com/osapi-io/osapi/internal/controller/api/node/schedule/gen" "github.com/osapi-io/osapi/internal/job" - cronProv "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + cronProv "github.com/osapi-io/osapi/internal/provider/schedule/cron" "github.com/osapi-io/osapi/internal/controller/api/apierr" ) -// DeleteNodeScheduleCron deletes a cron entry on a target node. -func (s *Schedule) DeleteNodeScheduleCron( +// DeleteNodeSchedule deletes a cron entry on a target node. +func (s *Schedule) DeleteNodeSchedule( ctx context.Context, - request gen.DeleteNodeScheduleCronRequestObject, -) (gen.DeleteNodeScheduleCronResponseObject, error) { + request gen.DeleteNodeScheduleRequestObject, +) (gen.DeleteNodeScheduleResponseObject, error) { if errMsg, ok := validateHostname(request.Hostname); !ok { - return gen.DeleteNodeScheduleCron400JSONResponse{Error: &errMsg}, nil + return gen.DeleteNodeSchedule400JSONResponse{Error: &errMsg}, nil } hostname := request.Hostname @@ -54,7 +54,7 @@ func (s *Schedule) DeleteNodeScheduleCron( ) if job.IsBroadcastTarget(hostname) { - return s.deleteNodeScheduleCronBroadcast(ctx, hostname, name) + return s.deleteNodeScheduleBroadcast(ctx, hostname, name) } jobID, resp, err := s.JobClient.Modify( @@ -67,20 +67,20 @@ func (s *Schedule) DeleteNodeScheduleCron( if err != nil { errMsg := err.Error() if apierr.IsMissing(err) { - return gen.DeleteNodeScheduleCron404JSONResponse{Error: &errMsg}, nil + return gen.DeleteNodeSchedule404JSONResponse{Error: &errMsg}, nil } - return gen.DeleteNodeScheduleCron500JSONResponse{Error: &errMsg}, nil + return gen.DeleteNodeSchedule500JSONResponse{Error: &errMsg}, nil } if resp.Status == job.StatusSkipped { jobUUID := uuid.MustParse(jobID) e := resp.Error - return gen.DeleteNodeScheduleCron200JSONResponse{ + return gen.DeleteNodeSchedule200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronMutationResult{ + Results: []gen.ScheduleMutationResult{ { Hostname: resp.Hostname, - Status: gen.CronMutationResultStatusSkipped, + Status: gen.ScheduleMutationResultStatusSkipped, Error: &e, }, }, @@ -97,12 +97,12 @@ func (s *Schedule) DeleteNodeScheduleCron( resultName := result.Name agentHostname := resp.Hostname - return gen.DeleteNodeScheduleCron200JSONResponse{ + return gen.DeleteNodeSchedule200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronMutationResult{ + Results: []gen.ScheduleMutationResult{ { Hostname: agentHostname, - Status: gen.CronMutationResultStatusOk, + Status: gen.ScheduleMutationResultStatusOk, Name: &resultName, Changed: changed, }, @@ -110,12 +110,12 @@ func (s *Schedule) DeleteNodeScheduleCron( }, nil } -// deleteNodeScheduleCronBroadcast handles broadcast targets for cron delete. -func (s *Schedule) deleteNodeScheduleCronBroadcast( +// deleteNodeScheduleBroadcast handles broadcast targets for cron delete. +func (s *Schedule) deleteNodeScheduleBroadcast( ctx context.Context, target string, name string, -) (gen.DeleteNodeScheduleCronResponseObject, error) { +) (gen.DeleteNodeScheduleResponseObject, error) { jobID, responses, err := s.JobClient.ModifyBroadcast( ctx, target, @@ -125,29 +125,29 @@ func (s *Schedule) deleteNodeScheduleCronBroadcast( ) if err != nil { errMsg := err.Error() - return gen.DeleteNodeScheduleCron500JSONResponse{Error: &errMsg}, nil + return gen.DeleteNodeSchedule500JSONResponse{Error: &errMsg}, nil } - var apiResponses []gen.CronMutationResult + var apiResponses []gen.ScheduleMutationResult for host, resp := range responses { - item := gen.CronMutationResult{ + item := gen.ScheduleMutationResult{ Hostname: host, } switch resp.Status { case job.StatusFailed: - item.Status = gen.CronMutationResultStatusFailed + item.Status = gen.ScheduleMutationResultStatusFailed e := resp.Error item.Error = &e case job.StatusSkipped: - item.Status = gen.CronMutationResultStatusSkipped + item.Status = gen.ScheduleMutationResultStatusSkipped e := resp.Error item.Error = &e case job.StatusTimeout: - item.Status = gen.CronMutationResultStatusTimeout + item.Status = gen.ScheduleMutationResultStatusTimeout e := resp.Error item.Error = &e default: - item.Status = gen.CronMutationResultStatusOk + item.Status = gen.ScheduleMutationResultStatusOk var result cronProv.DeleteResult if resp.Data != nil { _ = json.Unmarshal(resp.Data, &result) @@ -161,7 +161,7 @@ func (s *Schedule) deleteNodeScheduleCronBroadcast( jobUUID := uuid.MustParse(jobID) - return gen.DeleteNodeScheduleCron200JSONResponse{ + return gen.DeleteNodeSchedule200JSONResponse{ JobId: &jobUUID, Results: apiResponses, }, nil diff --git a/internal/controller/api/node/schedule/cron_delete_public_test.go b/internal/controller/api/node/schedule/delete_public_test.go similarity index 81% rename from internal/controller/api/node/schedule/cron_delete_public_test.go rename to internal/controller/api/node/schedule/delete_public_test.go index 54b757325..ae33a724e 100644 --- a/internal/controller/api/node/schedule/cron_delete_public_test.go +++ b/internal/controller/api/node/schedule/delete_public_test.go @@ -46,7 +46,7 @@ import ( "github.com/osapi-io/osapi/internal/validation" ) -type CronDeletePublicTestSuite struct { +type ScheduleDeletePublicTestSuite struct { suite.Suite mockCtrl *gomock.Controller @@ -57,7 +57,7 @@ type CronDeletePublicTestSuite struct { logger *slog.Logger } -func (s *CronDeletePublicTestSuite) SetupSuite() { +func (s *ScheduleDeletePublicTestSuite) SetupSuite() { validation.RegisterTargetValidator(func(_ context.Context) ([]validation.AgentTarget, error) { return []validation.AgentTarget{ {Hostname: "server1", Labels: map[string]string{"group": "web"}}, @@ -66,7 +66,7 @@ func (s *CronDeletePublicTestSuite) SetupSuite() { }) } -func (s *CronDeletePublicTestSuite) SetupTest() { +func (s *ScheduleDeletePublicTestSuite) SetupTest() { s.mockCtrl = gomock.NewController(s.T()) s.mockJobClient = jobmocks.NewMockJobClient(s.mockCtrl) s.handler = apischedule.New(slog.Default(), s.mockJobClient) @@ -75,20 +75,20 @@ func (s *CronDeletePublicTestSuite) SetupTest() { s.logger = slog.New(slog.NewTextHandler(os.Stdout, nil)) } -func (s *CronDeletePublicTestSuite) TearDownTest() { +func (s *ScheduleDeletePublicTestSuite) TearDownTest() { s.mockCtrl.Finish() } -func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { +func (s *ScheduleDeletePublicTestSuite) TestDeleteNodeSchedule() { tests := []struct { name string - request gen.DeleteNodeScheduleCronRequestObject + request gen.DeleteNodeScheduleRequestObject setupMock func() - validateFunc func(resp gen.DeleteNodeScheduleCronResponseObject) + validateFunc func(resp gen.DeleteNodeScheduleResponseObject) }{ { name: "success", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", }, @@ -112,8 +112,8 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -125,7 +125,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, { name: "success with nil response data", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", }, @@ -149,8 +149,8 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -160,7 +160,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, { name: "broadcast success", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", }, @@ -188,8 +188,8 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -197,7 +197,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, { name: "broadcast with errors", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", }, @@ -225,8 +225,8 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -234,7 +234,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, { name: "broadcast with skipped host", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", }, @@ -255,19 +255,19 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) - s.Equal(gen.CronMutationResultStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "broadcast with a host that never answered", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", }, @@ -288,19 +288,19 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) - s.Equal(gen.CronMutationResultStatusTimeout, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusTimeout, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "timeout: agent did not respond") }, }, { name: "broadcast error collecting responses", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", }, @@ -315,20 +315,20 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - _, ok := resp.(gen.DeleteNodeScheduleCron500JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + _, ok := resp.(gen.DeleteNodeSchedule500JSONResponse) s.True(ok) }, }, { name: "validation error empty hostname", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "", Name: "backup", }, setupMock: func() {}, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "required") @@ -336,7 +336,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, { name: "not found error", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "server1", Name: "nonexistent", }, @@ -351,8 +351,8 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { ). Return("", nil, fmt.Errorf("cron entry not found: %w", job.ErrNotFound)) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron404JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule404JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "not found") @@ -360,7 +360,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, { name: "does not exist error", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "server1", Name: "missing", }, @@ -375,8 +375,8 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { ). Return("", nil, fmt.Errorf("cron entry does not exist: %w", job.ErrNotFound)) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron404JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule404JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "does not exist") @@ -384,7 +384,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { }, { name: "when job skipped", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", }, @@ -407,20 +407,20 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - r, ok := resp.(gen.DeleteNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + r, ok := resp.(gen.DeleteNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) s.Equal("server1", r.Results[0].Hostname) - s.Equal(gen.CronMutationResultStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "job client error", - request: gen.DeleteNodeScheduleCronRequestObject{ + request: gen.DeleteNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", }, @@ -435,8 +435,8 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.DeleteNodeScheduleCronResponseObject) { - _, ok := resp.(gen.DeleteNodeScheduleCron500JSONResponse) + validateFunc: func(resp gen.DeleteNodeScheduleResponseObject) { + _, ok := resp.(gen.DeleteNodeSchedule500JSONResponse) s.True(ok) }, }, @@ -446,14 +446,14 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCron() { s.Run(tt.name, func() { tt.setupMock() - resp, err := s.handler.DeleteNodeScheduleCron(s.ctx, tt.request) + resp, err := s.handler.DeleteNodeSchedule(s.ctx, tt.request) s.NoError(err) tt.validateFunc(resp) }) } } -func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCronValidationHTTP() { +func (s *ScheduleDeletePublicTestSuite) TestDeleteNodeScheduleValidationHTTP() { tests := []struct { name string path string @@ -462,7 +462,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCronValidationHTTP() { }{ { name: "when valid request", - path: "/api/node/server1/schedule/cron/backup", + path: "/api/node/server1/schedule/backup", setupJobMock: func() *jobmocks.MockJobClient { mock := jobmocks.NewMockJobClient(s.mockCtrl) mock.EXPECT(). @@ -487,7 +487,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCronValidationHTTP() { }, { name: "when target agent not found", - path: "/api/node/nonexistent/schedule/cron/backup", + path: "/api/node/nonexistent/schedule/backup", setupJobMock: func() *jobmocks.MockJobClient { return jobmocks.NewMockJobClient(s.mockCtrl) }, @@ -521,7 +521,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCronValidationHTTP() { const rbacCronDeleteTestSigningKey = "test-signing-key-for-rbac-cron-delete" -func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCronRBACHTTP() { +func (s *ScheduleDeletePublicTestSuite) TestDeleteNodeScheduleRBACHTTP() { tokenManager := authtoken.New(s.logger) tests := []struct { @@ -550,7 +550,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCronRBACHTTP() { rbacCronDeleteTestSigningKey, []string{"read"}, "test-user", - []string{"cron:read"}, + []string{"schedule:read"}, ) s.Require().NoError(err) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) @@ -624,7 +624,7 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCronRBACHTTP() { req := httptest.NewRequest( http.MethodDelete, - "/api/node/server1/schedule/cron/backup", + "/api/node/server1/schedule/backup", nil, ) tc.setupAuth(req) @@ -637,8 +637,8 @@ func (s *CronDeletePublicTestSuite) TestDeleteNodeScheduleCronRBACHTTP() { } } -func TestCronDeletePublicTestSuite( +func TestScheduleDeletePublicTestSuite( t *testing.T, ) { - suite.Run(t, new(CronDeletePublicTestSuite)) + suite.Run(t, new(ScheduleDeletePublicTestSuite)) } diff --git a/internal/controller/api/node/schedule/gen/api.yaml b/internal/controller/api/node/schedule/gen/api.yaml index b2a5dd97b..b9388c1ca 100644 --- a/internal/controller/api/node/schedule/gen/api.yaml +++ b/internal/controller/api/node/schedule/gen/api.yaml @@ -24,33 +24,33 @@ info: title: Schedule Management API version: 1.0.0 tags: - - name: cron_operations - x-displayName: Node/Schedule/Cron - description: Cron drop-in file management on a target node. + - name: schedule_operations + x-displayName: Node/Schedule + description: Scheduled task management on a target node. paths: # -- Cron collection ------------------------------------------------- - /api/node/{hostname}/schedule/cron: + /api/node/{hostname}/schedule: get: - summary: List all cron entries + summary: List all scheduled entries description: > - List all cron drop-in entries on the target node. + List all scheduled entries on the target node. tags: - - cron_operations - operationId: GetNodeScheduleCron + - schedule_operations + operationId: GetNodeSchedule security: - BearerAuth: - - cron:read + - schedule:read parameters: - $ref: '#/components/parameters/Hostname' responses: '200': - description: List of cron entries. + description: List of scheduled entries. content: application/json: schema: - $ref: '#/components/schemas/CronCollectionResponse' + $ref: '#/components/schemas/ScheduleCollectionResponse' '400': description: Bad request - validation error. content: @@ -70,38 +70,38 @@ paths: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' '500': - description: Error listing cron entries. + description: Error listing scheduled entries. content: application/json: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' post: - summary: Create a cron entry + summary: Create a scheduled entry description: > - Create a new cron drop-in entry on the target node. + Create a new scheduled entry on the target node. tags: - - cron_operations - operationId: PostNodeScheduleCron + - schedule_operations + operationId: PostNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' requestBody: - description: Cron entry creation parameters. + description: Scheduled entry creation parameters. required: true content: application/json: schema: - $ref: '#/components/schemas/CronCreateRequest' + $ref: '#/components/schemas/ScheduleCreateRequest' responses: '200': - description: Cron entry created. + description: Scheduled entry created. content: application/json: schema: - $ref: '#/components/schemas/CronCreateResponse' + $ref: '#/components/schemas/ScheduleCreateResponse' '400': description: Invalid request payload. content: @@ -121,7 +121,7 @@ paths: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' '500': - description: Error creating cron entry. + description: Error creating scheduled entry. content: application/json: schema: @@ -129,27 +129,27 @@ paths: # -- Cron individual entry ------------------------------------------- - /api/node/{hostname}/schedule/cron/{name}: + /api/node/{hostname}/schedule/{name}: get: - summary: Get a cron entry + summary: Get a scheduled entry description: > - Get a specific cron drop-in entry by name on the target node. + Get a specific scheduled entry by name on the target node. tags: - - cron_operations - operationId: GetNodeScheduleCronByName + - schedule_operations + operationId: GetNodeScheduleByName security: - BearerAuth: - - cron:read + - schedule:read parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' responses: '200': - description: Cron entry detail. + description: Scheduled entry detail. content: application/json: schema: - $ref: '#/components/schemas/CronGetResponse' + $ref: '#/components/schemas/ScheduleGetResponse' '400': description: Bad request - validation error. content: @@ -169,45 +169,45 @@ paths: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' '500': - description: Error retrieving cron entry. + description: Error retrieving scheduled entry. content: application/json: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' put: - summary: Update a cron entry + summary: Update a scheduled entry description: > - Update an existing cron drop-in entry on the target node. + Update an existing scheduled entry on the target node. tags: - - cron_operations - operationId: PutNodeScheduleCron + - schedule_operations + operationId: PutNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' requestBody: - description: Cron entry update parameters. + description: Scheduled entry update parameters. required: true content: application/json: schema: - $ref: '#/components/schemas/CronUpdateRequest' + $ref: '#/components/schemas/ScheduleUpdateRequest' responses: '200': - description: Cron entry updated. + description: Scheduled entry updated. content: application/json: schema: - $ref: '#/components/schemas/CronUpdateResponse' + $ref: '#/components/schemas/ScheduleUpdateResponse' '400': description: Invalid request payload. content: @@ -227,38 +227,38 @@ paths: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' '500': - description: Error updating cron entry. + description: Error updating scheduled entry. content: application/json: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' delete: - summary: Delete a cron entry + summary: Delete a scheduled entry description: > - Delete a cron drop-in entry from the target node. + Delete a scheduled entry from the target node. tags: - - cron_operations - operationId: DeleteNodeScheduleCron + - schedule_operations + operationId: DeleteNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' responses: '200': - description: Cron entry deleted. + description: Scheduled entry deleted. content: application/json: schema: - $ref: '#/components/schemas/CronDeleteResponse' + $ref: '#/components/schemas/ScheduleDeleteResponse' '400': description: Bad request - validation error. content: @@ -278,13 +278,13 @@ paths: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '../../../common/gen/api.yaml#/components/schemas/ErrorResponse' '500': - description: Error deleting cron entry. + description: Error deleting scheduled entry. content: application/json: schema: @@ -310,12 +310,12 @@ components: type: string minLength: 1 - CronName: + ScheduleName: name: name in: path required: true description: > - Cron entry name. Must contain only alphanumeric characters, + Scheduled entry name. Must contain only alphanumeric characters, underscores, and hyphens. # NOTE: x-oapi-codegen-extra-tags on path params do not generate # validate tags in strict-server mode. Validation is handled @@ -339,7 +339,7 @@ components: # -- Request schemas ------------------------------------------------- - CronCreateRequest: + ScheduleCreateRequest: type: object required: - name @@ -348,7 +348,7 @@ components: name: type: string description: > - Name for the cron drop-in entry. Used as the file name + Name for the scheduled entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. x-oapi-codegen-extra-tags: validate: "required,min=1,max=64" @@ -356,7 +356,7 @@ components: type: string description: > Name of the uploaded file in the object store to deploy - as the cron entry content. + as the scheduled entry content. x-oapi-codegen-extra-tags: validate: "required,min=1" schedule: @@ -402,7 +402,7 @@ components: Template variables. Only used when content_type is "template". - CronUpdateRequest: + ScheduleUpdateRequest: type: object properties: object: @@ -437,9 +437,9 @@ components: # -- Response schemas ------------------------------------------------ - CronEntry: + ScheduleEntry: type: object - description: A cron drop-in entry. + description: A scheduled entry. properties: hostname: type: string @@ -450,7 +450,7 @@ components: description: The status of the operation for this host. name: type: string - description: Cron entry name. + description: Scheduled entry name. object: type: string description: Object store name for the deployed content. @@ -475,7 +475,7 @@ components: "weekly", or "monthly". user: type: string - description: User the cron entry runs as. + description: User the scheduled entry runs as. error: type: string description: Error message if the agent failed to retrieve this entry. @@ -483,7 +483,7 @@ components: - hostname - status - CronCollectionResponse: + ScheduleCollectionResponse: type: object properties: job_id: @@ -494,13 +494,13 @@ components: results: type: array items: - $ref: '#/components/schemas/CronEntry' + $ref: '#/components/schemas/ScheduleEntry' required: - results - CronGetResponse: + ScheduleGetResponse: type: object - description: Collection response for a single cron entry get operation. + description: Collection response for a single scheduled entry get operation. properties: job_id: type: string @@ -510,11 +510,11 @@ components: results: type: array items: - $ref: '#/components/schemas/CronEntry' + $ref: '#/components/schemas/ScheduleEntry' required: - results - CronMutationResult: + ScheduleMutationResult: type: object description: Result of a cron create, update, or delete operation for one host. properties: @@ -527,7 +527,7 @@ components: description: The status of the operation for this host. name: type: string - description: Cron entry name. + description: Scheduled entry name. changed: type: boolean description: Whether the operation modified system state. @@ -538,7 +538,7 @@ components: - hostname - status - CronCreateResponse: + ScheduleCreateResponse: type: object properties: job_id: @@ -549,11 +549,11 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results - CronUpdateResponse: + ScheduleUpdateResponse: type: object properties: job_id: @@ -564,11 +564,11 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results - CronDeleteResponse: + ScheduleDeleteResponse: type: object properties: job_id: @@ -579,6 +579,6 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results diff --git a/internal/controller/api/node/schedule/gen/schedule.gen.go b/internal/controller/api/node/schedule/gen/schedule.gen.go index 9fa36685f..5ae0f05a7 100644 --- a/internal/controller/api/node/schedule/gen/schedule.gen.go +++ b/internal/controller/api/node/schedule/gen/schedule.gen.go @@ -20,157 +20,160 @@ const ( BearerAuthScopes bearerAuthContextKey = "BearerAuth.Scopes" ) -// Defines values for CronCreateRequestContentType. +// Defines values for ScheduleCreateRequestContentType. const ( - CronCreateRequestContentTypeRaw CronCreateRequestContentType = "raw" - CronCreateRequestContentTypeTemplate CronCreateRequestContentType = "template" + ScheduleCreateRequestContentTypeRaw ScheduleCreateRequestContentType = "raw" + ScheduleCreateRequestContentTypeTemplate ScheduleCreateRequestContentType = "template" ) -// Valid indicates whether the value is a known member of the CronCreateRequestContentType enum. -func (e CronCreateRequestContentType) Valid() bool { +// Valid indicates whether the value is a known member of the ScheduleCreateRequestContentType enum. +func (e ScheduleCreateRequestContentType) Valid() bool { switch e { - case CronCreateRequestContentTypeRaw: + case ScheduleCreateRequestContentTypeRaw: return true - case CronCreateRequestContentTypeTemplate: + case ScheduleCreateRequestContentTypeTemplate: return true default: return false } } -// Defines values for CronCreateRequestInterval. +// Defines values for ScheduleCreateRequestInterval. const ( - CronCreateRequestIntervalDaily CronCreateRequestInterval = "daily" - CronCreateRequestIntervalHourly CronCreateRequestInterval = "hourly" - CronCreateRequestIntervalMonthly CronCreateRequestInterval = "monthly" - CronCreateRequestIntervalWeekly CronCreateRequestInterval = "weekly" + ScheduleCreateRequestIntervalDaily ScheduleCreateRequestInterval = "daily" + ScheduleCreateRequestIntervalHourly ScheduleCreateRequestInterval = "hourly" + ScheduleCreateRequestIntervalMonthly ScheduleCreateRequestInterval = "monthly" + ScheduleCreateRequestIntervalWeekly ScheduleCreateRequestInterval = "weekly" ) -// Valid indicates whether the value is a known member of the CronCreateRequestInterval enum. -func (e CronCreateRequestInterval) Valid() bool { +// Valid indicates whether the value is a known member of the ScheduleCreateRequestInterval enum. +func (e ScheduleCreateRequestInterval) Valid() bool { switch e { - case CronCreateRequestIntervalDaily: + case ScheduleCreateRequestIntervalDaily: return true - case CronCreateRequestIntervalHourly: + case ScheduleCreateRequestIntervalHourly: return true - case CronCreateRequestIntervalMonthly: + case ScheduleCreateRequestIntervalMonthly: return true - case CronCreateRequestIntervalWeekly: + case ScheduleCreateRequestIntervalWeekly: return true default: return false } } -// Defines values for CronEntryInterval. +// Defines values for ScheduleEntryInterval. const ( - CronEntryIntervalDaily CronEntryInterval = "daily" - CronEntryIntervalHourly CronEntryInterval = "hourly" - CronEntryIntervalMonthly CronEntryInterval = "monthly" - CronEntryIntervalWeekly CronEntryInterval = "weekly" + ScheduleEntryIntervalDaily ScheduleEntryInterval = "daily" + ScheduleEntryIntervalHourly ScheduleEntryInterval = "hourly" + ScheduleEntryIntervalMonthly ScheduleEntryInterval = "monthly" + ScheduleEntryIntervalWeekly ScheduleEntryInterval = "weekly" ) -// Valid indicates whether the value is a known member of the CronEntryInterval enum. -func (e CronEntryInterval) Valid() bool { +// Valid indicates whether the value is a known member of the ScheduleEntryInterval enum. +func (e ScheduleEntryInterval) Valid() bool { switch e { - case CronEntryIntervalDaily: + case ScheduleEntryIntervalDaily: return true - case CronEntryIntervalHourly: + case ScheduleEntryIntervalHourly: return true - case CronEntryIntervalMonthly: + case ScheduleEntryIntervalMonthly: return true - case CronEntryIntervalWeekly: + case ScheduleEntryIntervalWeekly: return true default: return false } } -// Defines values for CronEntryStatus. +// Defines values for ScheduleEntryStatus. const ( - CronEntryStatusFailed CronEntryStatus = "failed" - CronEntryStatusOk CronEntryStatus = "ok" - CronEntryStatusSkipped CronEntryStatus = "skipped" - CronEntryStatusTimeout CronEntryStatus = "timeout" + ScheduleEntryStatusFailed ScheduleEntryStatus = "failed" + ScheduleEntryStatusOk ScheduleEntryStatus = "ok" + ScheduleEntryStatusSkipped ScheduleEntryStatus = "skipped" + ScheduleEntryStatusTimeout ScheduleEntryStatus = "timeout" ) -// Valid indicates whether the value is a known member of the CronEntryStatus enum. -func (e CronEntryStatus) Valid() bool { +// Valid indicates whether the value is a known member of the ScheduleEntryStatus enum. +func (e ScheduleEntryStatus) Valid() bool { switch e { - case CronEntryStatusFailed: + case ScheduleEntryStatusFailed: return true - case CronEntryStatusOk: + case ScheduleEntryStatusOk: return true - case CronEntryStatusSkipped: + case ScheduleEntryStatusSkipped: return true - case CronEntryStatusTimeout: + case ScheduleEntryStatusTimeout: return true default: return false } } -// Defines values for CronMutationResultStatus. +// Defines values for ScheduleMutationResultStatus. const ( - CronMutationResultStatusFailed CronMutationResultStatus = "failed" - CronMutationResultStatusOk CronMutationResultStatus = "ok" - CronMutationResultStatusSkipped CronMutationResultStatus = "skipped" - CronMutationResultStatusTimeout CronMutationResultStatus = "timeout" + ScheduleMutationResultStatusFailed ScheduleMutationResultStatus = "failed" + ScheduleMutationResultStatusOk ScheduleMutationResultStatus = "ok" + ScheduleMutationResultStatusSkipped ScheduleMutationResultStatus = "skipped" + ScheduleMutationResultStatusTimeout ScheduleMutationResultStatus = "timeout" ) -// Valid indicates whether the value is a known member of the CronMutationResultStatus enum. -func (e CronMutationResultStatus) Valid() bool { +// Valid indicates whether the value is a known member of the ScheduleMutationResultStatus enum. +func (e ScheduleMutationResultStatus) Valid() bool { switch e { - case CronMutationResultStatusFailed: + case ScheduleMutationResultStatusFailed: return true - case CronMutationResultStatusOk: + case ScheduleMutationResultStatusOk: return true - case CronMutationResultStatusSkipped: + case ScheduleMutationResultStatusSkipped: return true - case CronMutationResultStatusTimeout: + case ScheduleMutationResultStatusTimeout: return true default: return false } } -// Defines values for CronUpdateRequestContentType. +// Defines values for ScheduleUpdateRequestContentType. const ( - CronUpdateRequestContentTypeRaw CronUpdateRequestContentType = "raw" - CronUpdateRequestContentTypeTemplate CronUpdateRequestContentType = "template" + ScheduleUpdateRequestContentTypeRaw ScheduleUpdateRequestContentType = "raw" + ScheduleUpdateRequestContentTypeTemplate ScheduleUpdateRequestContentType = "template" ) -// Valid indicates whether the value is a known member of the CronUpdateRequestContentType enum. -func (e CronUpdateRequestContentType) Valid() bool { +// Valid indicates whether the value is a known member of the ScheduleUpdateRequestContentType enum. +func (e ScheduleUpdateRequestContentType) Valid() bool { switch e { - case CronUpdateRequestContentTypeRaw: + case ScheduleUpdateRequestContentTypeRaw: return true - case CronUpdateRequestContentTypeTemplate: + case ScheduleUpdateRequestContentTypeTemplate: return true default: return false } } -// CronCollectionResponse defines model for CronCollectionResponse. -type CronCollectionResponse struct { +// ErrorResponse defines model for ErrorResponse. +type ErrorResponse = externalRef0.ErrorResponse + +// ScheduleCollectionResponse defines model for ScheduleCollectionResponse. +type ScheduleCollectionResponse struct { // JobId The job ID used to process this request. JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronEntry `json:"results"` + Results []ScheduleEntry `json:"results"` } -// CronCreateRequest defines model for CronCreateRequest. -type CronCreateRequest struct { +// ScheduleCreateRequest defines model for ScheduleCreateRequest. +type ScheduleCreateRequest struct { // ContentType Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. - ContentType *CronCreateRequestContentType `json:"content_type,omitempty" validate:"omitempty,oneof=raw template"` + ContentType *ScheduleCreateRequestContentType `json:"content_type,omitempty" validate:"omitempty,oneof=raw template"` // Interval Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. - Interval *CronCreateRequestInterval `json:"interval,omitempty" validate:"required_without=Schedule,excluded_with=Schedule,omitempty,oneof=hourly daily weekly monthly"` + Interval *ScheduleCreateRequestInterval `json:"interval,omitempty" validate:"required_without=Schedule,excluded_with=Schedule,omitempty,oneof=hourly daily weekly monthly"` - // Name Name for the cron drop-in entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. + // Name Name for the scheduled entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. Name string `json:"name" validate:"required,min=1,max=64"` - // Object Name of the uploaded file in the object store to deploy as the cron entry content. + // Object Name of the uploaded file in the object store to deploy as the scheduled entry content. Object string `json:"object" validate:"required,min=1"` // Schedule Cron schedule expression (e.g., "*/5 * * * *"). Mutually exclusive with interval — provide exactly one. @@ -183,28 +186,28 @@ type CronCreateRequest struct { Vars *map[string]interface{} `json:"vars,omitempty"` } -// CronCreateRequestContentType Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. -type CronCreateRequestContentType string +// ScheduleCreateRequestContentType Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. +type ScheduleCreateRequestContentType string -// CronCreateRequestInterval Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. -type CronCreateRequestInterval string +// ScheduleCreateRequestInterval Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. +type ScheduleCreateRequestInterval string -// CronCreateResponse defines model for CronCreateResponse. -type CronCreateResponse struct { +// ScheduleCreateResponse defines model for ScheduleCreateResponse. +type ScheduleCreateResponse struct { // JobId The job ID used to process this request. - JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronMutationResult `json:"results"` + JobId *openapi_types.UUID `json:"job_id,omitempty"` + Results []ScheduleMutationResult `json:"results"` } -// CronDeleteResponse defines model for CronDeleteResponse. -type CronDeleteResponse struct { +// ScheduleDeleteResponse defines model for ScheduleDeleteResponse. +type ScheduleDeleteResponse struct { // JobId The job ID used to process this request. - JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronMutationResult `json:"results"` + JobId *openapi_types.UUID `json:"job_id,omitempty"` + Results []ScheduleMutationResult `json:"results"` } -// CronEntry A cron drop-in entry. -type CronEntry struct { +// ScheduleEntry A scheduled entry. +type ScheduleEntry struct { // Error Error message if the agent failed to retrieve this entry. Error *string `json:"error,omitempty"` @@ -212,9 +215,9 @@ type CronEntry struct { Hostname string `json:"hostname"` // Interval Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. - Interval *CronEntryInterval `json:"interval,omitempty"` + Interval *ScheduleEntryInterval `json:"interval,omitempty"` - // Name Cron entry name. + // Name Scheduled entry name. Name *string `json:"name,omitempty"` // Object Object store name for the deployed content. @@ -227,27 +230,27 @@ type CronEntry struct { Source *string `json:"source,omitempty"` // Status The status of the operation for this host. - Status CronEntryStatus `json:"status"` + Status ScheduleEntryStatus `json:"status"` - // User User the cron entry runs as. + // User User the scheduled entry runs as. User *string `json:"user,omitempty"` } -// CronEntryInterval Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. -type CronEntryInterval string +// ScheduleEntryInterval Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. +type ScheduleEntryInterval string -// CronEntryStatus The status of the operation for this host. -type CronEntryStatus string +// ScheduleEntryStatus The status of the operation for this host. +type ScheduleEntryStatus string -// CronGetResponse Collection response for a single cron entry get operation. -type CronGetResponse struct { +// ScheduleGetResponse Collection response for a single scheduled entry get operation. +type ScheduleGetResponse struct { // JobId The job ID used to process this request. JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronEntry `json:"results"` + Results []ScheduleEntry `json:"results"` } -// CronMutationResult Result of a cron create, update, or delete operation for one host. -type CronMutationResult struct { +// ScheduleMutationResult Result of a cron create, update, or delete operation for one host. +type ScheduleMutationResult struct { // Changed Whether the operation modified system state. Changed *bool `json:"changed,omitempty"` @@ -257,20 +260,20 @@ type CronMutationResult struct { // Hostname Hostname of the agent that processed this operation. Hostname string `json:"hostname"` - // Name Cron entry name. + // Name Scheduled entry name. Name *string `json:"name,omitempty"` // Status The status of the operation for this host. - Status CronMutationResultStatus `json:"status"` + Status ScheduleMutationResultStatus `json:"status"` } -// CronMutationResultStatus The status of the operation for this host. -type CronMutationResultStatus string +// ScheduleMutationResultStatus The status of the operation for this host. +type ScheduleMutationResultStatus string -// CronUpdateRequest defines model for CronUpdateRequest. -type CronUpdateRequest struct { +// ScheduleUpdateRequest defines model for ScheduleUpdateRequest. +type ScheduleUpdateRequest struct { // ContentType Content type: "raw" or "template". - ContentType *CronUpdateRequestContentType `json:"content_type,omitempty" validate:"omitempty,oneof=raw template"` + ContentType *ScheduleUpdateRequestContentType `json:"content_type,omitempty" validate:"omitempty,oneof=raw template"` // Object New object to deploy (redeploy with updated content). Object *string `json:"object,omitempty" validate:"omitempty,min=1"` @@ -285,51 +288,48 @@ type CronUpdateRequest struct { Vars *map[string]interface{} `json:"vars,omitempty"` } -// CronUpdateRequestContentType Content type: "raw" or "template". -type CronUpdateRequestContentType string +// ScheduleUpdateRequestContentType Content type: "raw" or "template". +type ScheduleUpdateRequestContentType string -// CronUpdateResponse defines model for CronUpdateResponse. -type CronUpdateResponse struct { +// ScheduleUpdateResponse defines model for ScheduleUpdateResponse. +type ScheduleUpdateResponse struct { // JobId The job ID used to process this request. - JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronMutationResult `json:"results"` + JobId *openapi_types.UUID `json:"job_id,omitempty"` + Results []ScheduleMutationResult `json:"results"` } -// ErrorResponse defines model for ErrorResponse. -type ErrorResponse = externalRef0.ErrorResponse - -// CronName defines model for CronName. -type CronName = string - // Hostname defines model for Hostname. type Hostname = string +// ScheduleName defines model for ScheduleName. +type ScheduleName = string + // bearerAuthContextKey is the context key for BearerAuth security scheme type bearerAuthContextKey string -// PostNodeScheduleCronJSONRequestBody defines body for PostNodeScheduleCron for application/json ContentType. -type PostNodeScheduleCronJSONRequestBody = CronCreateRequest +// PostNodeScheduleJSONRequestBody defines body for PostNodeSchedule for application/json ContentType. +type PostNodeScheduleJSONRequestBody = ScheduleCreateRequest -// PutNodeScheduleCronJSONRequestBody defines body for PutNodeScheduleCron for application/json ContentType. -type PutNodeScheduleCronJSONRequestBody = CronUpdateRequest +// PutNodeScheduleJSONRequestBody defines body for PutNodeSchedule for application/json ContentType. +type PutNodeScheduleJSONRequestBody = ScheduleUpdateRequest // ServerInterface represents all server handlers. type ServerInterface interface { - // List all cron entries - // (GET /api/node/{hostname}/schedule/cron) - GetNodeScheduleCron(ctx *echo.Context, hostname Hostname) error - // Create a cron entry - // (POST /api/node/{hostname}/schedule/cron) - PostNodeScheduleCron(ctx *echo.Context, hostname Hostname) error - // Delete a cron entry - // (DELETE /api/node/{hostname}/schedule/cron/{name}) - DeleteNodeScheduleCron(ctx *echo.Context, hostname Hostname, name CronName) error - // Get a cron entry - // (GET /api/node/{hostname}/schedule/cron/{name}) - GetNodeScheduleCronByName(ctx *echo.Context, hostname Hostname, name CronName) error - // Update a cron entry - // (PUT /api/node/{hostname}/schedule/cron/{name}) - PutNodeScheduleCron(ctx *echo.Context, hostname Hostname, name CronName) error + // List all scheduled entries + // (GET /api/node/{hostname}/schedule) + GetNodeSchedule(ctx *echo.Context, hostname Hostname) error + // Create a scheduled entry + // (POST /api/node/{hostname}/schedule) + PostNodeSchedule(ctx *echo.Context, hostname Hostname) error + // Delete a scheduled entry + // (DELETE /api/node/{hostname}/schedule/{name}) + DeleteNodeSchedule(ctx *echo.Context, hostname Hostname, name ScheduleName) error + // Get a scheduled entry + // (GET /api/node/{hostname}/schedule/{name}) + GetNodeScheduleByName(ctx *echo.Context, hostname Hostname, name ScheduleName) error + // Update a scheduled entry + // (PUT /api/node/{hostname}/schedule/{name}) + PutNodeSchedule(ctx *echo.Context, hostname Hostname, name ScheduleName) error } // ServerInterfaceWrapper converts echo contexts to parameters. @@ -337,8 +337,8 @@ type ServerInterfaceWrapper struct { Handler ServerInterface } -// GetNodeScheduleCron converts echo context to params. -func (w *ServerInterfaceWrapper) GetNodeScheduleCron(ctx *echo.Context) error { +// GetNodeSchedule converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeSchedule(ctx *echo.Context) error { var err error // ------------- Path parameter "hostname" ------------- var hostname Hostname @@ -348,15 +348,15 @@ func (w *ServerInterfaceWrapper) GetNodeScheduleCron(ctx *echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter hostname: %s", err)) } - ctx.Set(string(BearerAuthScopes), []string{"cron:read"}) + ctx.Set(string(BearerAuthScopes), []string{"schedule:read"}) // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetNodeScheduleCron(ctx, hostname) + err = w.Handler.GetNodeSchedule(ctx, hostname) return err } -// PostNodeScheduleCron converts echo context to params. -func (w *ServerInterfaceWrapper) PostNodeScheduleCron(ctx *echo.Context) error { +// PostNodeSchedule converts echo context to params. +func (w *ServerInterfaceWrapper) PostNodeSchedule(ctx *echo.Context) error { var err error // ------------- Path parameter "hostname" ------------- var hostname Hostname @@ -366,15 +366,15 @@ func (w *ServerInterfaceWrapper) PostNodeScheduleCron(ctx *echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter hostname: %s", err)) } - ctx.Set(string(BearerAuthScopes), []string{"cron:write"}) + ctx.Set(string(BearerAuthScopes), []string{"schedule:write"}) // Invoke the callback with all the unmarshaled arguments - err = w.Handler.PostNodeScheduleCron(ctx, hostname) + err = w.Handler.PostNodeSchedule(ctx, hostname) return err } -// DeleteNodeScheduleCron converts echo context to params. -func (w *ServerInterfaceWrapper) DeleteNodeScheduleCron(ctx *echo.Context) error { +// DeleteNodeSchedule converts echo context to params. +func (w *ServerInterfaceWrapper) DeleteNodeSchedule(ctx *echo.Context) error { var err error // ------------- Path parameter "hostname" ------------- var hostname Hostname @@ -385,22 +385,22 @@ func (w *ServerInterfaceWrapper) DeleteNodeScheduleCron(ctx *echo.Context) error } // ------------- Path parameter "name" ------------- - var name CronName + var name ScheduleName err = runtime.BindStyledParameterWithOptions("simple", "name", ctx.Param("name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter name: %s", err)) } - ctx.Set(string(BearerAuthScopes), []string{"cron:write"}) + ctx.Set(string(BearerAuthScopes), []string{"schedule:write"}) // Invoke the callback with all the unmarshaled arguments - err = w.Handler.DeleteNodeScheduleCron(ctx, hostname, name) + err = w.Handler.DeleteNodeSchedule(ctx, hostname, name) return err } -// GetNodeScheduleCronByName converts echo context to params. -func (w *ServerInterfaceWrapper) GetNodeScheduleCronByName(ctx *echo.Context) error { +// GetNodeScheduleByName converts echo context to params. +func (w *ServerInterfaceWrapper) GetNodeScheduleByName(ctx *echo.Context) error { var err error // ------------- Path parameter "hostname" ------------- var hostname Hostname @@ -411,22 +411,22 @@ func (w *ServerInterfaceWrapper) GetNodeScheduleCronByName(ctx *echo.Context) er } // ------------- Path parameter "name" ------------- - var name CronName + var name ScheduleName err = runtime.BindStyledParameterWithOptions("simple", "name", ctx.Param("name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter name: %s", err)) } - ctx.Set(string(BearerAuthScopes), []string{"cron:read"}) + ctx.Set(string(BearerAuthScopes), []string{"schedule:read"}) // Invoke the callback with all the unmarshaled arguments - err = w.Handler.GetNodeScheduleCronByName(ctx, hostname, name) + err = w.Handler.GetNodeScheduleByName(ctx, hostname, name) return err } -// PutNodeScheduleCron converts echo context to params. -func (w *ServerInterfaceWrapper) PutNodeScheduleCron(ctx *echo.Context) error { +// PutNodeSchedule converts echo context to params. +func (w *ServerInterfaceWrapper) PutNodeSchedule(ctx *echo.Context) error { var err error // ------------- Path parameter "hostname" ------------- var hostname Hostname @@ -437,17 +437,17 @@ func (w *ServerInterfaceWrapper) PutNodeScheduleCron(ctx *echo.Context) error { } // ------------- Path parameter "name" ------------- - var name CronName + var name ScheduleName err = runtime.BindStyledParameterWithOptions("simple", "name", ctx.Param("name"), &name, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: ""}) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter name: %s", err)) } - ctx.Set(string(BearerAuthScopes), []string{"cron:write"}) + ctx.Set(string(BearerAuthScopes), []string{"schedule:write"}) // Invoke the callback with all the unmarshaled arguments - err = w.Handler.PutNodeScheduleCron(ctx, hostname, name) + err = w.Handler.PutNodeSchedule(ctx, hostname, name) return err } @@ -498,25 +498,25 @@ func RegisterHandlersWithOptions(router EchoRouter, si ServerInterface, options Handler: si, } - router.GET(options.BaseURL+"/api/node/:hostname/schedule/cron", wrapper.GetNodeScheduleCron, options.OperationMiddlewares["GetNodeScheduleCron"]...) - router.POST(options.BaseURL+"/api/node/:hostname/schedule/cron", wrapper.PostNodeScheduleCron, options.OperationMiddlewares["PostNodeScheduleCron"]...) - router.DELETE(options.BaseURL+"/api/node/:hostname/schedule/cron/:name", wrapper.DeleteNodeScheduleCron, options.OperationMiddlewares["DeleteNodeScheduleCron"]...) - router.GET(options.BaseURL+"/api/node/:hostname/schedule/cron/:name", wrapper.GetNodeScheduleCronByName, options.OperationMiddlewares["GetNodeScheduleCronByName"]...) - router.PUT(options.BaseURL+"/api/node/:hostname/schedule/cron/:name", wrapper.PutNodeScheduleCron, options.OperationMiddlewares["PutNodeScheduleCron"]...) + router.GET(options.BaseURL+"/api/node/:hostname/schedule", wrapper.GetNodeSchedule, options.OperationMiddlewares["GetNodeSchedule"]...) + router.POST(options.BaseURL+"/api/node/:hostname/schedule", wrapper.PostNodeSchedule, options.OperationMiddlewares["PostNodeSchedule"]...) + router.DELETE(options.BaseURL+"/api/node/:hostname/schedule/:name", wrapper.DeleteNodeSchedule, options.OperationMiddlewares["DeleteNodeSchedule"]...) + router.GET(options.BaseURL+"/api/node/:hostname/schedule/:name", wrapper.GetNodeScheduleByName, options.OperationMiddlewares["GetNodeScheduleByName"]...) + router.PUT(options.BaseURL+"/api/node/:hostname/schedule/:name", wrapper.PutNodeSchedule, options.OperationMiddlewares["PutNodeSchedule"]...) } -type GetNodeScheduleCronRequestObject struct { +type GetNodeScheduleRequestObject struct { Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"` } -type GetNodeScheduleCronResponseObject interface { - VisitGetNodeScheduleCronResponse(w http.ResponseWriter) error +type GetNodeScheduleResponseObject interface { + VisitGetNodeScheduleResponse(w http.ResponseWriter) error } -type GetNodeScheduleCron200JSONResponse CronCollectionResponse +type GetNodeSchedule200JSONResponse ScheduleCollectionResponse -func (response GetNodeScheduleCron200JSONResponse) VisitGetNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response GetNodeSchedule200JSONResponse) VisitGetNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -528,9 +528,9 @@ func (response GetNodeScheduleCron200JSONResponse) VisitGetNodeScheduleCronRespo return err } -type GetNodeScheduleCron400JSONResponse externalRef0.ErrorResponse +type GetNodeSchedule400JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCron400JSONResponse) VisitGetNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response GetNodeSchedule400JSONResponse) VisitGetNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -542,9 +542,9 @@ func (response GetNodeScheduleCron400JSONResponse) VisitGetNodeScheduleCronRespo return err } -type GetNodeScheduleCron401JSONResponse externalRef0.ErrorResponse +type GetNodeSchedule401JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCron401JSONResponse) VisitGetNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response GetNodeSchedule401JSONResponse) VisitGetNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -556,9 +556,9 @@ func (response GetNodeScheduleCron401JSONResponse) VisitGetNodeScheduleCronRespo return err } -type GetNodeScheduleCron403JSONResponse externalRef0.ErrorResponse +type GetNodeSchedule403JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCron403JSONResponse) VisitGetNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response GetNodeSchedule403JSONResponse) VisitGetNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -570,9 +570,9 @@ func (response GetNodeScheduleCron403JSONResponse) VisitGetNodeScheduleCronRespo return err } -type GetNodeScheduleCron500JSONResponse externalRef0.ErrorResponse +type GetNodeSchedule500JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCron500JSONResponse) VisitGetNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response GetNodeSchedule500JSONResponse) VisitGetNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -584,18 +584,18 @@ func (response GetNodeScheduleCron500JSONResponse) VisitGetNodeScheduleCronRespo return err } -type PostNodeScheduleCronRequestObject struct { +type PostNodeScheduleRequestObject struct { Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"` - Body *PostNodeScheduleCronJSONRequestBody + Body *PostNodeScheduleJSONRequestBody } -type PostNodeScheduleCronResponseObject interface { - VisitPostNodeScheduleCronResponse(w http.ResponseWriter) error +type PostNodeScheduleResponseObject interface { + VisitPostNodeScheduleResponse(w http.ResponseWriter) error } -type PostNodeScheduleCron200JSONResponse CronCreateResponse +type PostNodeSchedule200JSONResponse ScheduleCreateResponse -func (response PostNodeScheduleCron200JSONResponse) VisitPostNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PostNodeSchedule200JSONResponse) VisitPostNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -607,9 +607,9 @@ func (response PostNodeScheduleCron200JSONResponse) VisitPostNodeScheduleCronRes return err } -type PostNodeScheduleCron400JSONResponse externalRef0.ErrorResponse +type PostNodeSchedule400JSONResponse externalRef0.ErrorResponse -func (response PostNodeScheduleCron400JSONResponse) VisitPostNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PostNodeSchedule400JSONResponse) VisitPostNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -621,9 +621,9 @@ func (response PostNodeScheduleCron400JSONResponse) VisitPostNodeScheduleCronRes return err } -type PostNodeScheduleCron401JSONResponse externalRef0.ErrorResponse +type PostNodeSchedule401JSONResponse externalRef0.ErrorResponse -func (response PostNodeScheduleCron401JSONResponse) VisitPostNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PostNodeSchedule401JSONResponse) VisitPostNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -635,9 +635,9 @@ func (response PostNodeScheduleCron401JSONResponse) VisitPostNodeScheduleCronRes return err } -type PostNodeScheduleCron403JSONResponse externalRef0.ErrorResponse +type PostNodeSchedule403JSONResponse externalRef0.ErrorResponse -func (response PostNodeScheduleCron403JSONResponse) VisitPostNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PostNodeSchedule403JSONResponse) VisitPostNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -649,9 +649,9 @@ func (response PostNodeScheduleCron403JSONResponse) VisitPostNodeScheduleCronRes return err } -type PostNodeScheduleCron500JSONResponse externalRef0.ErrorResponse +type PostNodeSchedule500JSONResponse externalRef0.ErrorResponse -func (response PostNodeScheduleCron500JSONResponse) VisitPostNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PostNodeSchedule500JSONResponse) VisitPostNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -663,18 +663,18 @@ func (response PostNodeScheduleCron500JSONResponse) VisitPostNodeScheduleCronRes return err } -type DeleteNodeScheduleCronRequestObject struct { - Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"` - Name CronName `json:"name" validate:"required,min=1"` +type DeleteNodeScheduleRequestObject struct { + Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"` + Name ScheduleName `json:"name" validate:"required,min=1"` } -type DeleteNodeScheduleCronResponseObject interface { - VisitDeleteNodeScheduleCronResponse(w http.ResponseWriter) error +type DeleteNodeScheduleResponseObject interface { + VisitDeleteNodeScheduleResponse(w http.ResponseWriter) error } -type DeleteNodeScheduleCron200JSONResponse CronDeleteResponse +type DeleteNodeSchedule200JSONResponse ScheduleDeleteResponse -func (response DeleteNodeScheduleCron200JSONResponse) VisitDeleteNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response DeleteNodeSchedule200JSONResponse) VisitDeleteNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -686,9 +686,9 @@ func (response DeleteNodeScheduleCron200JSONResponse) VisitDeleteNodeScheduleCro return err } -type DeleteNodeScheduleCron400JSONResponse externalRef0.ErrorResponse +type DeleteNodeSchedule400JSONResponse externalRef0.ErrorResponse -func (response DeleteNodeScheduleCron400JSONResponse) VisitDeleteNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response DeleteNodeSchedule400JSONResponse) VisitDeleteNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -700,9 +700,9 @@ func (response DeleteNodeScheduleCron400JSONResponse) VisitDeleteNodeScheduleCro return err } -type DeleteNodeScheduleCron401JSONResponse externalRef0.ErrorResponse +type DeleteNodeSchedule401JSONResponse externalRef0.ErrorResponse -func (response DeleteNodeScheduleCron401JSONResponse) VisitDeleteNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response DeleteNodeSchedule401JSONResponse) VisitDeleteNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -714,9 +714,9 @@ func (response DeleteNodeScheduleCron401JSONResponse) VisitDeleteNodeScheduleCro return err } -type DeleteNodeScheduleCron403JSONResponse externalRef0.ErrorResponse +type DeleteNodeSchedule403JSONResponse externalRef0.ErrorResponse -func (response DeleteNodeScheduleCron403JSONResponse) VisitDeleteNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response DeleteNodeSchedule403JSONResponse) VisitDeleteNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -728,9 +728,9 @@ func (response DeleteNodeScheduleCron403JSONResponse) VisitDeleteNodeScheduleCro return err } -type DeleteNodeScheduleCron404JSONResponse externalRef0.ErrorResponse +type DeleteNodeSchedule404JSONResponse externalRef0.ErrorResponse -func (response DeleteNodeScheduleCron404JSONResponse) VisitDeleteNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response DeleteNodeSchedule404JSONResponse) VisitDeleteNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -742,9 +742,9 @@ func (response DeleteNodeScheduleCron404JSONResponse) VisitDeleteNodeScheduleCro return err } -type DeleteNodeScheduleCron500JSONResponse externalRef0.ErrorResponse +type DeleteNodeSchedule500JSONResponse externalRef0.ErrorResponse -func (response DeleteNodeScheduleCron500JSONResponse) VisitDeleteNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response DeleteNodeSchedule500JSONResponse) VisitDeleteNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -756,18 +756,18 @@ func (response DeleteNodeScheduleCron500JSONResponse) VisitDeleteNodeScheduleCro return err } -type GetNodeScheduleCronByNameRequestObject struct { - Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"` - Name CronName `json:"name" validate:"required,min=1"` +type GetNodeScheduleByNameRequestObject struct { + Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"` + Name ScheduleName `json:"name" validate:"required,min=1"` } -type GetNodeScheduleCronByNameResponseObject interface { - VisitGetNodeScheduleCronByNameResponse(w http.ResponseWriter) error +type GetNodeScheduleByNameResponseObject interface { + VisitGetNodeScheduleByNameResponse(w http.ResponseWriter) error } -type GetNodeScheduleCronByName200JSONResponse CronGetResponse +type GetNodeScheduleByName200JSONResponse ScheduleGetResponse -func (response GetNodeScheduleCronByName200JSONResponse) VisitGetNodeScheduleCronByNameResponse(w http.ResponseWriter) error { +func (response GetNodeScheduleByName200JSONResponse) VisitGetNodeScheduleByNameResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -779,9 +779,9 @@ func (response GetNodeScheduleCronByName200JSONResponse) VisitGetNodeScheduleCro return err } -type GetNodeScheduleCronByName400JSONResponse externalRef0.ErrorResponse +type GetNodeScheduleByName400JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCronByName400JSONResponse) VisitGetNodeScheduleCronByNameResponse(w http.ResponseWriter) error { +func (response GetNodeScheduleByName400JSONResponse) VisitGetNodeScheduleByNameResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -793,9 +793,9 @@ func (response GetNodeScheduleCronByName400JSONResponse) VisitGetNodeScheduleCro return err } -type GetNodeScheduleCronByName401JSONResponse externalRef0.ErrorResponse +type GetNodeScheduleByName401JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCronByName401JSONResponse) VisitGetNodeScheduleCronByNameResponse(w http.ResponseWriter) error { +func (response GetNodeScheduleByName401JSONResponse) VisitGetNodeScheduleByNameResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -807,9 +807,9 @@ func (response GetNodeScheduleCronByName401JSONResponse) VisitGetNodeScheduleCro return err } -type GetNodeScheduleCronByName403JSONResponse externalRef0.ErrorResponse +type GetNodeScheduleByName403JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCronByName403JSONResponse) VisitGetNodeScheduleCronByNameResponse(w http.ResponseWriter) error { +func (response GetNodeScheduleByName403JSONResponse) VisitGetNodeScheduleByNameResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -821,9 +821,9 @@ func (response GetNodeScheduleCronByName403JSONResponse) VisitGetNodeScheduleCro return err } -type GetNodeScheduleCronByName404JSONResponse externalRef0.ErrorResponse +type GetNodeScheduleByName404JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCronByName404JSONResponse) VisitGetNodeScheduleCronByNameResponse(w http.ResponseWriter) error { +func (response GetNodeScheduleByName404JSONResponse) VisitGetNodeScheduleByNameResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -835,9 +835,9 @@ func (response GetNodeScheduleCronByName404JSONResponse) VisitGetNodeScheduleCro return err } -type GetNodeScheduleCronByName500JSONResponse externalRef0.ErrorResponse +type GetNodeScheduleByName500JSONResponse externalRef0.ErrorResponse -func (response GetNodeScheduleCronByName500JSONResponse) VisitGetNodeScheduleCronByNameResponse(w http.ResponseWriter) error { +func (response GetNodeScheduleByName500JSONResponse) VisitGetNodeScheduleByNameResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -849,19 +849,19 @@ func (response GetNodeScheduleCronByName500JSONResponse) VisitGetNodeScheduleCro return err } -type PutNodeScheduleCronRequestObject struct { - Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"` - Name CronName `json:"name" validate:"required,min=1"` - Body *PutNodeScheduleCronJSONRequestBody +type PutNodeScheduleRequestObject struct { + Hostname Hostname `json:"hostname" validate:"required,min=1,valid_target"` + Name ScheduleName `json:"name" validate:"required,min=1"` + Body *PutNodeScheduleJSONRequestBody } -type PutNodeScheduleCronResponseObject interface { - VisitPutNodeScheduleCronResponse(w http.ResponseWriter) error +type PutNodeScheduleResponseObject interface { + VisitPutNodeScheduleResponse(w http.ResponseWriter) error } -type PutNodeScheduleCron200JSONResponse CronUpdateResponse +type PutNodeSchedule200JSONResponse ScheduleUpdateResponse -func (response PutNodeScheduleCron200JSONResponse) VisitPutNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PutNodeSchedule200JSONResponse) VisitPutNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -873,9 +873,9 @@ func (response PutNodeScheduleCron200JSONResponse) VisitPutNodeScheduleCronRespo return err } -type PutNodeScheduleCron400JSONResponse externalRef0.ErrorResponse +type PutNodeSchedule400JSONResponse externalRef0.ErrorResponse -func (response PutNodeScheduleCron400JSONResponse) VisitPutNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PutNodeSchedule400JSONResponse) VisitPutNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -887,9 +887,9 @@ func (response PutNodeScheduleCron400JSONResponse) VisitPutNodeScheduleCronRespo return err } -type PutNodeScheduleCron401JSONResponse externalRef0.ErrorResponse +type PutNodeSchedule401JSONResponse externalRef0.ErrorResponse -func (response PutNodeScheduleCron401JSONResponse) VisitPutNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PutNodeSchedule401JSONResponse) VisitPutNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -901,9 +901,9 @@ func (response PutNodeScheduleCron401JSONResponse) VisitPutNodeScheduleCronRespo return err } -type PutNodeScheduleCron403JSONResponse externalRef0.ErrorResponse +type PutNodeSchedule403JSONResponse externalRef0.ErrorResponse -func (response PutNodeScheduleCron403JSONResponse) VisitPutNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PutNodeSchedule403JSONResponse) VisitPutNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -915,9 +915,9 @@ func (response PutNodeScheduleCron403JSONResponse) VisitPutNodeScheduleCronRespo return err } -type PutNodeScheduleCron404JSONResponse externalRef0.ErrorResponse +type PutNodeSchedule404JSONResponse externalRef0.ErrorResponse -func (response PutNodeScheduleCron404JSONResponse) VisitPutNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PutNodeSchedule404JSONResponse) VisitPutNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -929,9 +929,9 @@ func (response PutNodeScheduleCron404JSONResponse) VisitPutNodeScheduleCronRespo return err } -type PutNodeScheduleCron500JSONResponse externalRef0.ErrorResponse +type PutNodeSchedule500JSONResponse externalRef0.ErrorResponse -func (response PutNodeScheduleCron500JSONResponse) VisitPutNodeScheduleCronResponse(w http.ResponseWriter) error { +func (response PutNodeSchedule500JSONResponse) VisitPutNodeScheduleResponse(w http.ResponseWriter) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(response); err != nil { @@ -945,21 +945,21 @@ func (response PutNodeScheduleCron500JSONResponse) VisitPutNodeScheduleCronRespo // StrictServerInterface represents all server handlers. type StrictServerInterface interface { - // List all cron entries - // (GET /api/node/{hostname}/schedule/cron) - GetNodeScheduleCron(ctx context.Context, request GetNodeScheduleCronRequestObject) (GetNodeScheduleCronResponseObject, error) - // Create a cron entry - // (POST /api/node/{hostname}/schedule/cron) - PostNodeScheduleCron(ctx context.Context, request PostNodeScheduleCronRequestObject) (PostNodeScheduleCronResponseObject, error) - // Delete a cron entry - // (DELETE /api/node/{hostname}/schedule/cron/{name}) - DeleteNodeScheduleCron(ctx context.Context, request DeleteNodeScheduleCronRequestObject) (DeleteNodeScheduleCronResponseObject, error) - // Get a cron entry - // (GET /api/node/{hostname}/schedule/cron/{name}) - GetNodeScheduleCronByName(ctx context.Context, request GetNodeScheduleCronByNameRequestObject) (GetNodeScheduleCronByNameResponseObject, error) - // Update a cron entry - // (PUT /api/node/{hostname}/schedule/cron/{name}) - PutNodeScheduleCron(ctx context.Context, request PutNodeScheduleCronRequestObject) (PutNodeScheduleCronResponseObject, error) + // List all scheduled entries + // (GET /api/node/{hostname}/schedule) + GetNodeSchedule(ctx context.Context, request GetNodeScheduleRequestObject) (GetNodeScheduleResponseObject, error) + // Create a scheduled entry + // (POST /api/node/{hostname}/schedule) + PostNodeSchedule(ctx context.Context, request PostNodeScheduleRequestObject) (PostNodeScheduleResponseObject, error) + // Delete a scheduled entry + // (DELETE /api/node/{hostname}/schedule/{name}) + DeleteNodeSchedule(ctx context.Context, request DeleteNodeScheduleRequestObject) (DeleteNodeScheduleResponseObject, error) + // Get a scheduled entry + // (GET /api/node/{hostname}/schedule/{name}) + GetNodeScheduleByName(ctx context.Context, request GetNodeScheduleByNameRequestObject) (GetNodeScheduleByNameResponseObject, error) + // Update a scheduled entry + // (PUT /api/node/{hostname}/schedule/{name}) + PutNodeSchedule(ctx context.Context, request PutNodeScheduleRequestObject) (PutNodeScheduleResponseObject, error) } type StrictHandlerFunc func(ctx *echo.Context, request any) (any, error) @@ -974,140 +974,140 @@ type strictHandler struct { middlewares []StrictMiddlewareFunc } -// GetNodeScheduleCron operation middleware -func (sh *strictHandler) GetNodeScheduleCron(ctx *echo.Context, hostname Hostname) error { - var request GetNodeScheduleCronRequestObject +// GetNodeSchedule operation middleware +func (sh *strictHandler) GetNodeSchedule(ctx *echo.Context, hostname Hostname) error { + var request GetNodeScheduleRequestObject request.Hostname = hostname handler := func(ctx *echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.GetNodeScheduleCron(ctx.Request().Context(), request.(GetNodeScheduleCronRequestObject)) + return sh.ssi.GetNodeSchedule(ctx.Request().Context(), request.(GetNodeScheduleRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "GetNodeScheduleCron") + handler = middleware(handler, "GetNodeSchedule") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(GetNodeScheduleCronResponseObject); ok { - return validResponse.VisitGetNodeScheduleCronResponse(ctx.Response()) + } else if validResponse, ok := response.(GetNodeScheduleResponseObject); ok { + return validResponse.VisitGetNodeScheduleResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } return nil } -// PostNodeScheduleCron operation middleware -func (sh *strictHandler) PostNodeScheduleCron(ctx *echo.Context, hostname Hostname) error { - var request PostNodeScheduleCronRequestObject +// PostNodeSchedule operation middleware +func (sh *strictHandler) PostNodeSchedule(ctx *echo.Context, hostname Hostname) error { + var request PostNodeScheduleRequestObject request.Hostname = hostname - var body PostNodeScheduleCronJSONRequestBody + var body PostNodeScheduleJSONRequestBody if err := ctx.Bind(&body); err != nil { return err } request.Body = &body handler := func(ctx *echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.PostNodeScheduleCron(ctx.Request().Context(), request.(PostNodeScheduleCronRequestObject)) + return sh.ssi.PostNodeSchedule(ctx.Request().Context(), request.(PostNodeScheduleRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "PostNodeScheduleCron") + handler = middleware(handler, "PostNodeSchedule") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(PostNodeScheduleCronResponseObject); ok { - return validResponse.VisitPostNodeScheduleCronResponse(ctx.Response()) + } else if validResponse, ok := response.(PostNodeScheduleResponseObject); ok { + return validResponse.VisitPostNodeScheduleResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } return nil } -// DeleteNodeScheduleCron operation middleware -func (sh *strictHandler) DeleteNodeScheduleCron(ctx *echo.Context, hostname Hostname, name CronName) error { - var request DeleteNodeScheduleCronRequestObject +// DeleteNodeSchedule operation middleware +func (sh *strictHandler) DeleteNodeSchedule(ctx *echo.Context, hostname Hostname, name ScheduleName) error { + var request DeleteNodeScheduleRequestObject request.Hostname = hostname request.Name = name handler := func(ctx *echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.DeleteNodeScheduleCron(ctx.Request().Context(), request.(DeleteNodeScheduleCronRequestObject)) + return sh.ssi.DeleteNodeSchedule(ctx.Request().Context(), request.(DeleteNodeScheduleRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "DeleteNodeScheduleCron") + handler = middleware(handler, "DeleteNodeSchedule") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(DeleteNodeScheduleCronResponseObject); ok { - return validResponse.VisitDeleteNodeScheduleCronResponse(ctx.Response()) + } else if validResponse, ok := response.(DeleteNodeScheduleResponseObject); ok { + return validResponse.VisitDeleteNodeScheduleResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } return nil } -// GetNodeScheduleCronByName operation middleware -func (sh *strictHandler) GetNodeScheduleCronByName(ctx *echo.Context, hostname Hostname, name CronName) error { - var request GetNodeScheduleCronByNameRequestObject +// GetNodeScheduleByName operation middleware +func (sh *strictHandler) GetNodeScheduleByName(ctx *echo.Context, hostname Hostname, name ScheduleName) error { + var request GetNodeScheduleByNameRequestObject request.Hostname = hostname request.Name = name handler := func(ctx *echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.GetNodeScheduleCronByName(ctx.Request().Context(), request.(GetNodeScheduleCronByNameRequestObject)) + return sh.ssi.GetNodeScheduleByName(ctx.Request().Context(), request.(GetNodeScheduleByNameRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "GetNodeScheduleCronByName") + handler = middleware(handler, "GetNodeScheduleByName") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(GetNodeScheduleCronByNameResponseObject); ok { - return validResponse.VisitGetNodeScheduleCronByNameResponse(ctx.Response()) + } else if validResponse, ok := response.(GetNodeScheduleByNameResponseObject); ok { + return validResponse.VisitGetNodeScheduleByNameResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } return nil } -// PutNodeScheduleCron operation middleware -func (sh *strictHandler) PutNodeScheduleCron(ctx *echo.Context, hostname Hostname, name CronName) error { - var request PutNodeScheduleCronRequestObject +// PutNodeSchedule operation middleware +func (sh *strictHandler) PutNodeSchedule(ctx *echo.Context, hostname Hostname, name ScheduleName) error { + var request PutNodeScheduleRequestObject request.Hostname = hostname request.Name = name - var body PutNodeScheduleCronJSONRequestBody + var body PutNodeScheduleJSONRequestBody if err := ctx.Bind(&body); err != nil { return err } request.Body = &body handler := func(ctx *echo.Context, request interface{}) (interface{}, error) { - return sh.ssi.PutNodeScheduleCron(ctx.Request().Context(), request.(PutNodeScheduleCronRequestObject)) + return sh.ssi.PutNodeSchedule(ctx.Request().Context(), request.(PutNodeScheduleRequestObject)) } for _, middleware := range sh.middlewares { - handler = middleware(handler, "PutNodeScheduleCron") + handler = middleware(handler, "PutNodeSchedule") } response, err := handler(ctx, request) if err != nil { return err - } else if validResponse, ok := response.(PutNodeScheduleCronResponseObject); ok { - return validResponse.VisitPutNodeScheduleCronResponse(ctx.Response()) + } else if validResponse, ok := response.(PutNodeScheduleResponseObject); ok { + return validResponse.VisitPutNodeScheduleResponse(ctx.Response()) } else if response != nil { return fmt.Errorf("unexpected response type: %T", response) } diff --git a/internal/controller/api/node/schedule/cron_get.go b/internal/controller/api/node/schedule/get.go similarity index 71% rename from internal/controller/api/node/schedule/cron_get.go rename to internal/controller/api/node/schedule/get.go index 7b3272283..82b757092 100644 --- a/internal/controller/api/node/schedule/cron_get.go +++ b/internal/controller/api/node/schedule/get.go @@ -29,18 +29,18 @@ import ( "github.com/osapi-io/osapi/internal/controller/api/node/schedule/gen" "github.com/osapi-io/osapi/internal/job" - cronProv "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + cronProv "github.com/osapi-io/osapi/internal/provider/schedule/cron" "github.com/osapi-io/osapi/internal/controller/api/apierr" ) -// GetNodeScheduleCronByName gets a single cron entry by name on a target node. -func (s *Schedule) GetNodeScheduleCronByName( +// GetNodeScheduleByName gets a single cron entry by name on a target node. +func (s *Schedule) GetNodeScheduleByName( ctx context.Context, - request gen.GetNodeScheduleCronByNameRequestObject, -) (gen.GetNodeScheduleCronByNameResponseObject, error) { + request gen.GetNodeScheduleByNameRequestObject, +) (gen.GetNodeScheduleByNameResponseObject, error) { if errMsg, ok := validateHostname(request.Hostname); !ok { - return gen.GetNodeScheduleCronByName400JSONResponse{Error: &errMsg}, nil + return gen.GetNodeScheduleByName400JSONResponse{Error: &errMsg}, nil } hostname := request.Hostname @@ -54,7 +54,7 @@ func (s *Schedule) GetNodeScheduleCronByName( ) if job.IsBroadcastTarget(hostname) { - return s.getNodeScheduleCronByNameBroadcast(ctx, hostname, name) + return s.getNodeScheduleByNameBroadcast(ctx, hostname, name) } jobID, resp, err := s.JobClient.Query( @@ -67,20 +67,20 @@ func (s *Schedule) GetNodeScheduleCronByName( if err != nil { errMsg := err.Error() if apierr.IsMissing(err) { - return gen.GetNodeScheduleCronByName404JSONResponse{Error: &errMsg}, nil + return gen.GetNodeScheduleByName404JSONResponse{Error: &errMsg}, nil } - return gen.GetNodeScheduleCronByName500JSONResponse{Error: &errMsg}, nil + return gen.GetNodeScheduleByName500JSONResponse{Error: &errMsg}, nil } if resp.Status == job.StatusSkipped { e := resp.Error jobUUID := uuid.MustParse(jobID) - return gen.GetNodeScheduleCronByName200JSONResponse{ + return gen.GetNodeScheduleByName200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronEntry{ + Results: []gen.ScheduleEntry{ { Hostname: resp.Hostname, - Status: gen.CronEntryStatusSkipped, + Status: gen.ScheduleEntryStatusSkipped, Error: &e, }, }, @@ -99,12 +99,12 @@ func (s *Schedule) GetNodeScheduleCronByName( user := entry.User agentHostname := resp.Hostname - return gen.GetNodeScheduleCronByName200JSONResponse{ + return gen.GetNodeScheduleByName200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronEntry{ + Results: []gen.ScheduleEntry{ { Hostname: agentHostname, - Status: gen.CronEntryStatusOk, + Status: gen.ScheduleEntryStatusOk, Name: &entryName, Object: &object, Schedule: &schedule, @@ -114,12 +114,12 @@ func (s *Schedule) GetNodeScheduleCronByName( }, nil } -// getNodeScheduleCronByNameBroadcast handles broadcast targets for cron get. -func (s *Schedule) getNodeScheduleCronByNameBroadcast( +// getNodeScheduleByNameBroadcast handles broadcast targets for cron get. +func (s *Schedule) getNodeScheduleByNameBroadcast( ctx context.Context, target string, name string, -) (gen.GetNodeScheduleCronByNameResponseObject, error) { +) (gen.GetNodeScheduleByNameResponseObject, error) { jobID, responses, err := s.JobClient.QueryBroadcast( ctx, target, @@ -129,29 +129,29 @@ func (s *Schedule) getNodeScheduleCronByNameBroadcast( ) if err != nil { errMsg := err.Error() - return gen.GetNodeScheduleCronByName500JSONResponse{Error: &errMsg}, nil + return gen.GetNodeScheduleByName500JSONResponse{Error: &errMsg}, nil } - allResults := make([]gen.CronEntry, 0) + allResults := make([]gen.ScheduleEntry, 0) for host, resp := range responses { - item := gen.CronEntry{ + item := gen.ScheduleEntry{ Hostname: host, } switch resp.Status { case job.StatusFailed: - item.Status = gen.CronEntryStatusFailed + item.Status = gen.ScheduleEntryStatusFailed e := resp.Error item.Error = &e case job.StatusSkipped: - item.Status = gen.CronEntryStatusSkipped + item.Status = gen.ScheduleEntryStatusSkipped e := resp.Error item.Error = &e case job.StatusTimeout: - item.Status = gen.CronEntryStatusTimeout + item.Status = gen.ScheduleEntryStatusTimeout e := resp.Error item.Error = &e default: - item.Status = gen.CronEntryStatusOk + item.Status = gen.ScheduleEntryStatusOk var entry cronProv.Entry if resp.Data != nil { _ = json.Unmarshal(resp.Data, &entry) @@ -170,7 +170,7 @@ func (s *Schedule) getNodeScheduleCronByNameBroadcast( jobUUID := uuid.MustParse(jobID) - return gen.GetNodeScheduleCronByName200JSONResponse{ + return gen.GetNodeScheduleByName200JSONResponse{ JobId: &jobUUID, Results: allResults, }, nil diff --git a/internal/controller/api/node/schedule/cron_get_public_test.go b/internal/controller/api/node/schedule/get_public_test.go similarity index 81% rename from internal/controller/api/node/schedule/cron_get_public_test.go rename to internal/controller/api/node/schedule/get_public_test.go index 6da6d0901..3bbf97c35 100644 --- a/internal/controller/api/node/schedule/cron_get_public_test.go +++ b/internal/controller/api/node/schedule/get_public_test.go @@ -44,7 +44,7 @@ import ( "github.com/osapi-io/osapi/internal/validation" ) -type CronGetPublicTestSuite struct { +type ScheduleGetPublicTestSuite struct { suite.Suite mockCtrl *gomock.Controller @@ -55,7 +55,7 @@ type CronGetPublicTestSuite struct { logger *slog.Logger } -func (s *CronGetPublicTestSuite) SetupSuite() { +func (s *ScheduleGetPublicTestSuite) SetupSuite() { validation.RegisterTargetValidator(func(_ context.Context) ([]validation.AgentTarget, error) { return []validation.AgentTarget{ {Hostname: "server1", Labels: map[string]string{"group": "web"}}, @@ -64,7 +64,7 @@ func (s *CronGetPublicTestSuite) SetupSuite() { }) } -func (s *CronGetPublicTestSuite) SetupTest() { +func (s *ScheduleGetPublicTestSuite) SetupTest() { s.mockCtrl = gomock.NewController(s.T()) s.mockJobClient = jobmocks.NewMockJobClient(s.mockCtrl) s.handler = apischedule.New(slog.Default(), s.mockJobClient) @@ -73,20 +73,20 @@ func (s *CronGetPublicTestSuite) SetupTest() { s.logger = slog.New(slog.NewTextHandler(os.Stdout, nil)) } -func (s *CronGetPublicTestSuite) TearDownTest() { +func (s *ScheduleGetPublicTestSuite) TearDownTest() { s.mockCtrl.Finish() } -func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { +func (s *ScheduleGetPublicTestSuite) TestGetNodeScheduleByName() { tests := []struct { name string - request gen.GetNodeScheduleCronByNameRequestObject + request gen.GetNodeScheduleByNameRequestObject setupMock func() - validateFunc func(resp gen.GetNodeScheduleCronByNameResponseObject) + validateFunc func(resp gen.GetNodeScheduleByNameResponseObject) }{ { name: "success", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "server1", Name: "backup", }, @@ -106,8 +106,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { ), }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -120,7 +120,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, { name: "success with nil response data", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "server1", Name: "backup", }, @@ -138,8 +138,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { Data: nil, }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -149,7 +149,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, { name: "broadcast success", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "_all", Name: "backup", }, @@ -179,8 +179,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -188,7 +188,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, { name: "broadcast with error entries", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "_all", Name: "backup", }, @@ -218,8 +218,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -235,7 +235,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, { name: "broadcast with skipped host", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "_all", Name: "backup", }, @@ -256,19 +256,19 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) - s.Equal(gen.CronEntryStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleEntryStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "broadcast with a host that never answered", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "_all", Name: "backup", }, @@ -289,19 +289,19 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) - s.Equal(gen.CronEntryStatusTimeout, r.Results[0].Status) + s.Equal(gen.ScheduleEntryStatusTimeout, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "timeout: agent did not respond") }, }, { name: "broadcast error collecting responses", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "_all", Name: "backup", }, @@ -316,20 +316,20 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - _, ok := resp.(gen.GetNodeScheduleCronByName500JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + _, ok := resp.(gen.GetNodeScheduleByName500JSONResponse) s.True(ok) }, }, { name: "validation error empty hostname", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "", Name: "backup", }, setupMock: func() {}, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName400JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "required") @@ -337,7 +337,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, { name: "not found error", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "server1", Name: "nonexistent", }, @@ -352,8 +352,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { ). Return("", nil, fmt.Errorf("cron entry not found: %w", job.ErrNotFound)) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName404JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName404JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "not found") @@ -361,7 +361,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, { name: "not managed error", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "server1", Name: "unmanaged", }, @@ -376,8 +376,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { ). Return("", nil, fmt.Errorf("cron entry not managed: %w", job.ErrNotManaged)) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName404JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName404JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "not managed") @@ -385,7 +385,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, { name: "does not exist error", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "server1", Name: "missing", }, @@ -400,8 +400,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { ). Return("", nil, fmt.Errorf("cron entry does not exist: %w", job.ErrNotFound)) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName404JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName404JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "does not exist") @@ -409,7 +409,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { }, { name: "when job skipped", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "server1", Name: "backup", }, @@ -432,20 +432,20 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { nil, ) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCronByName200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + r, ok := resp.(gen.GetNodeScheduleByName200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) s.Equal("server1", r.Results[0].Hostname) - s.Equal(gen.CronEntryStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleEntryStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "job client error", - request: gen.GetNodeScheduleCronByNameRequestObject{ + request: gen.GetNodeScheduleByNameRequestObject{ Hostname: "server1", Name: "backup", }, @@ -460,8 +460,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.GetNodeScheduleCronByNameResponseObject) { - _, ok := resp.(gen.GetNodeScheduleCronByName500JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleByNameResponseObject) { + _, ok := resp.(gen.GetNodeScheduleByName500JSONResponse) s.True(ok) }, }, @@ -471,14 +471,14 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByName() { s.Run(tt.name, func() { tt.setupMock() - resp, err := s.handler.GetNodeScheduleCronByName(s.ctx, tt.request) + resp, err := s.handler.GetNodeScheduleByName(s.ctx, tt.request) s.NoError(err) tt.validateFunc(resp) }) } } -func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByNameValidationHTTP() { +func (s *ScheduleGetPublicTestSuite) TestGetNodeScheduleByNameValidationHTTP() { tests := []struct { name string path string @@ -487,7 +487,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByNameValidationHTTP() { }{ { name: "when valid request", - path: "/api/node/server1/schedule/cron/backup", + path: "/api/node/server1/schedule/backup", setupJobMock: func() *jobmocks.MockJobClient { mock := jobmocks.NewMockJobClient(s.mockCtrl) mock.EXPECT(). @@ -508,7 +508,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByNameValidationHTTP() { }, { name: "when target agent not found", - path: "/api/node/nonexistent/schedule/cron/backup", + path: "/api/node/nonexistent/schedule/backup", setupJobMock: func() *jobmocks.MockJobClient { return jobmocks.NewMockJobClient(s.mockCtrl) }, @@ -542,7 +542,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByNameValidationHTTP() { const rbacCronGetTestSigningKey = "test-signing-key-for-rbac-cron-get" -func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByNameRBACHTTP() { +func (s *ScheduleGetPublicTestSuite) TestGetNodeScheduleByNameRBACHTTP() { tokenManager := authtoken.New(s.logger) tests := []struct { @@ -571,7 +571,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByNameRBACHTTP() { rbacCronGetTestSigningKey, []string{"write"}, "test-user", - []string{"cron:write"}, + []string{"schedule:write"}, ) s.Require().NoError(err) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) @@ -641,7 +641,7 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByNameRBACHTTP() { req := httptest.NewRequest( http.MethodGet, - "/api/node/server1/schedule/cron/backup", + "/api/node/server1/schedule/backup", nil, ) tc.setupAuth(req) @@ -654,8 +654,8 @@ func (s *CronGetPublicTestSuite) TestGetNodeScheduleCronByNameRBACHTTP() { } } -func TestCronGetPublicTestSuite( +func TestScheduleGetPublicTestSuite( t *testing.T, ) { - suite.Run(t, new(CronGetPublicTestSuite)) + suite.Run(t, new(ScheduleGetPublicTestSuite)) } diff --git a/internal/controller/api/node/schedule/handler_public_test.go b/internal/controller/api/node/schedule/handler_public_test.go index d38944103..8bbfc87e9 100644 --- a/internal/controller/api/node/schedule/handler_public_test.go +++ b/internal/controller/api/node/schedule/handler_public_test.go @@ -70,7 +70,7 @@ func (s *HandlerPublicTestSuite) TestHandler() { } s.NotEmpty(e.Router().Routes()) - req := httptest.NewRequest(http.MethodGet, "/api/node/hostname/schedule/cron", nil) + req := httptest.NewRequest(http.MethodGet, "/api/node/hostname/schedule", nil) rec := httptest.NewRecorder() e.ServeHTTP(rec, req) }, diff --git a/internal/controller/api/node/schedule/cron_list_get.go b/internal/controller/api/node/schedule/list_get.go similarity index 69% rename from internal/controller/api/node/schedule/cron_list_get.go rename to internal/controller/api/node/schedule/list_get.go index 1c5a5033a..ead81a304 100644 --- a/internal/controller/api/node/schedule/cron_list_get.go +++ b/internal/controller/api/node/schedule/list_get.go @@ -29,16 +29,16 @@ import ( "github.com/osapi-io/osapi/internal/controller/api/node/schedule/gen" "github.com/osapi-io/osapi/internal/job" - cronProv "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + cronProv "github.com/osapi-io/osapi/internal/provider/schedule/cron" ) -// GetNodeScheduleCron lists all cron entries on a target node. -func (s *Schedule) GetNodeScheduleCron( +// GetNodeSchedule lists all cron entries on a target node. +func (s *Schedule) GetNodeSchedule( ctx context.Context, - request gen.GetNodeScheduleCronRequestObject, -) (gen.GetNodeScheduleCronResponseObject, error) { + request gen.GetNodeScheduleRequestObject, +) (gen.GetNodeScheduleResponseObject, error) { if errMsg, ok := validateHostname(request.Hostname); !ok { - return gen.GetNodeScheduleCron400JSONResponse{Error: &errMsg}, nil + return gen.GetNodeSchedule400JSONResponse{Error: &errMsg}, nil } hostname := request.Hostname @@ -50,24 +50,24 @@ func (s *Schedule) GetNodeScheduleCron( ) if job.IsBroadcastTarget(hostname) { - return s.getNodeScheduleCronBroadcast(ctx, hostname) + return s.getNodeScheduleBroadcast(ctx, hostname) } jobID, resp, err := s.JobClient.Query(ctx, hostname, "schedule", job.OperationCronList, nil) if err != nil { errMsg := err.Error() - return gen.GetNodeScheduleCron500JSONResponse{Error: &errMsg}, nil + return gen.GetNodeSchedule500JSONResponse{Error: &errMsg}, nil } if resp.Status == job.StatusSkipped { e := resp.Error jobUUID := uuid.MustParse(jobID) - return gen.GetNodeScheduleCron200JSONResponse{ + return gen.GetNodeSchedule200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronEntry{ + Results: []gen.ScheduleEntry{ { Hostname: resp.Hostname, - Status: gen.CronEntryStatusSkipped, + Status: gen.ScheduleEntryStatusSkipped, Error: &e, }, }, @@ -77,17 +77,17 @@ func (s *Schedule) GetNodeScheduleCron( results := responseToCronEntries(resp) jobUUID := uuid.MustParse(jobID) - return gen.GetNodeScheduleCron200JSONResponse{ + return gen.GetNodeSchedule200JSONResponse{ JobId: &jobUUID, Results: results, }, nil } -// getNodeScheduleCronBroadcast handles broadcast targets for cron list. -func (s *Schedule) getNodeScheduleCronBroadcast( +// getNodeScheduleBroadcast handles broadcast targets for cron list. +func (s *Schedule) getNodeScheduleBroadcast( ctx context.Context, target string, -) (gen.GetNodeScheduleCronResponseObject, error) { +) (gen.GetNodeScheduleResponseObject, error) { jobID, responses, err := s.JobClient.QueryBroadcast( ctx, target, @@ -97,34 +97,34 @@ func (s *Schedule) getNodeScheduleCronBroadcast( ) if err != nil { errMsg := err.Error() - return gen.GetNodeScheduleCron500JSONResponse{Error: &errMsg}, nil + return gen.GetNodeSchedule500JSONResponse{Error: &errMsg}, nil } - allResults := make([]gen.CronEntry, 0) + allResults := make([]gen.ScheduleEntry, 0) for host, resp := range responses { switch resp.Status { case job.StatusFailed: e := resp.Error h := host - allResults = append(allResults, gen.CronEntry{ + allResults = append(allResults, gen.ScheduleEntry{ Hostname: h, - Status: gen.CronEntryStatusFailed, + Status: gen.ScheduleEntryStatusFailed, Error: &e, }) case job.StatusSkipped: e := resp.Error h := host - allResults = append(allResults, gen.CronEntry{ + allResults = append(allResults, gen.ScheduleEntry{ Hostname: h, - Status: gen.CronEntryStatusSkipped, + Status: gen.ScheduleEntryStatusSkipped, Error: &e, }) case job.StatusTimeout: e := resp.Error h := host - allResults = append(allResults, gen.CronEntry{ + allResults = append(allResults, gen.ScheduleEntry{ Hostname: h, - Status: gen.CronEntryStatusTimeout, + Status: gen.ScheduleEntryStatusTimeout, Error: &e, }) default: @@ -134,16 +134,16 @@ func (s *Schedule) getNodeScheduleCronBroadcast( jobUUID := uuid.MustParse(jobID) - return gen.GetNodeScheduleCron200JSONResponse{ + return gen.GetNodeSchedule200JSONResponse{ JobId: &jobUUID, Results: allResults, }, nil } -// responseToCronEntries converts a job response to gen CronEntry slice. +// responseToCronEntries converts a job response to gen ScheduleEntry slice. func responseToCronEntries( resp *job.Response, -) []gen.CronEntry { +) []gen.ScheduleEntry { var entries []cronProv.Entry if resp.Data != nil { _ = json.Unmarshal(resp.Data, &entries) @@ -151,15 +151,15 @@ func responseToCronEntries( hostname := resp.Hostname - results := make([]gen.CronEntry, 0, len(entries)) + results := make([]gen.ScheduleEntry, 0, len(entries)) for _, e := range entries { name := e.Name object := e.Object source := e.Source - entry := gen.CronEntry{ + entry := gen.ScheduleEntry{ Hostname: hostname, - Status: gen.CronEntryStatusOk, + Status: gen.ScheduleEntryStatusOk, Name: &name, Object: &object, Source: &source, @@ -174,7 +174,7 @@ func responseToCronEntries( entry.User = &user } if e.Interval != "" { - interval := gen.CronEntryInterval(e.Interval) + interval := gen.ScheduleEntryInterval(e.Interval) entry.Interval = &interval } diff --git a/internal/controller/api/node/schedule/cron_list_get_public_test.go b/internal/controller/api/node/schedule/list_get_public_test.go similarity index 83% rename from internal/controller/api/node/schedule/cron_list_get_public_test.go rename to internal/controller/api/node/schedule/list_get_public_test.go index 3d608a3b7..1ba868b6c 100644 --- a/internal/controller/api/node/schedule/cron_list_get_public_test.go +++ b/internal/controller/api/node/schedule/list_get_public_test.go @@ -44,7 +44,7 @@ import ( "github.com/osapi-io/osapi/internal/validation" ) -type CronListGetPublicTestSuite struct { +type ScheduleListGetPublicTestSuite struct { suite.Suite mockCtrl *gomock.Controller @@ -55,7 +55,7 @@ type CronListGetPublicTestSuite struct { logger *slog.Logger } -func (s *CronListGetPublicTestSuite) SetupSuite() { +func (s *ScheduleListGetPublicTestSuite) SetupSuite() { validation.RegisterTargetValidator(func(_ context.Context) ([]validation.AgentTarget, error) { return []validation.AgentTarget{ {Hostname: "server1", Labels: map[string]string{"group": "web"}}, @@ -64,7 +64,7 @@ func (s *CronListGetPublicTestSuite) SetupSuite() { }) } -func (s *CronListGetPublicTestSuite) SetupTest() { +func (s *ScheduleListGetPublicTestSuite) SetupTest() { s.mockCtrl = gomock.NewController(s.T()) s.mockJobClient = jobmocks.NewMockJobClient(s.mockCtrl) s.handler = apischedule.New(slog.Default(), s.mockJobClient) @@ -73,20 +73,20 @@ func (s *CronListGetPublicTestSuite) SetupTest() { s.logger = slog.New(slog.NewTextHandler(os.Stdout, nil)) } -func (s *CronListGetPublicTestSuite) TearDownTest() { +func (s *ScheduleListGetPublicTestSuite) TearDownTest() { s.mockCtrl.Finish() } -func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { +func (s *ScheduleListGetPublicTestSuite) TestGetNodeSchedule() { tests := []struct { name string - request gen.GetNodeScheduleCronRequestObject + request gen.GetNodeScheduleRequestObject setupMock func() - validateFunc func(resp gen.GetNodeScheduleCronResponseObject) + validateFunc func(resp gen.GetNodeScheduleResponseObject) }{ { name: "success", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "server1", }, setupMock: func() { @@ -106,8 +106,8 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { ), }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -119,7 +119,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { }, { name: "success with interval-based entries", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "server1", }, setupMock: func() { @@ -139,8 +139,8 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { ), }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule200JSONResponse) s.True(ok) s.Require().Len(r.Results, 2) @@ -148,7 +148,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { s.Equal("logrotate", *r.Results[0].Name) s.Nil(r.Results[0].Schedule) s.Require().NotNil(r.Results[0].Interval) - s.Equal(gen.CronEntryInterval("daily"), *r.Results[0].Interval) + s.Equal(gen.ScheduleEntryInterval("daily"), *r.Results[0].Interval) s.Equal("daily", *r.Results[0].Source) s.Equal("logrotate-script", *r.Results[0].Object) @@ -161,7 +161,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { }, { name: "success with nil response data", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "server1", }, setupMock: func() { @@ -179,8 +179,8 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { Data: nil, }, nil) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Empty(r.Results) @@ -188,12 +188,12 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { }, { name: "validation error empty hostname", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "", }, setupMock: func() {}, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "required") @@ -201,7 +201,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { }, { name: "when job skipped", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "server1", }, setupMock: func() { @@ -223,20 +223,20 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) s.Equal("server1", r.Results[0].Hostname) - s.Equal(gen.CronEntryStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleEntryStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "job client error", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "server1", }, setupMock: func() { @@ -250,14 +250,14 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - _, ok := resp.(gen.GetNodeScheduleCron500JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + _, ok := resp.(gen.GetNodeSchedule500JSONResponse) s.True(ok) }, }, { name: "broadcast target _all with multiple agents", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "_all", }, setupMock: func() { @@ -292,8 +292,8 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -301,7 +301,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { }, { name: "broadcast target _all includes failed and skipped agents", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "_all", }, setupMock: func() { @@ -338,13 +338,13 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 3) - byHost := make(map[string]*gen.CronEntry) + byHost := make(map[string]*gen.ScheduleEntry) for i := range r.Results { if r.Results[i].Hostname != "" { byHost[r.Results[i].Hostname] = &r.Results[i] @@ -359,13 +359,13 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { s.Contains(*byHost["server2"].Error, "not supported") s.Require().Contains(byHost, "server3") - s.Equal(gen.CronEntryStatusSkipped, byHost["server3"].Status) + s.Equal(gen.ScheduleEntryStatusSkipped, byHost["server3"].Status) s.Contains(*byHost["server3"].Error, "not supported") }, }, { name: "broadcast with a host that never answered", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "_all", }, setupMock: func() { @@ -402,13 +402,13 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 3) - byHost := make(map[string]*gen.CronEntry) + byHost := make(map[string]*gen.ScheduleEntry) for i := range r.Results { if r.Results[i].Hostname != "" { byHost[r.Results[i].Hostname] = &r.Results[i] @@ -423,13 +423,13 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { s.Contains(*byHost["server2"].Error, "timeout: agent did not respond") s.Require().Contains(byHost, "server3") - s.Equal(gen.CronEntryStatusTimeout, byHost["server3"].Status) + s.Equal(gen.ScheduleEntryStatusTimeout, byHost["server3"].Status) s.Contains(*byHost["server3"].Error, "timeout: agent did not respond") }, }, { name: "broadcast target _all with empty responses", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "_all", }, setupMock: func() { @@ -447,8 +447,8 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - r, ok := resp.(gen.GetNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + r, ok := resp.(gen.GetNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Empty(r.Results) @@ -456,7 +456,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { }, { name: "broadcast job client error", - request: gen.GetNodeScheduleCronRequestObject{ + request: gen.GetNodeScheduleRequestObject{ Hostname: "_all", }, setupMock: func() { @@ -470,8 +470,8 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.GetNodeScheduleCronResponseObject) { - _, ok := resp.(gen.GetNodeScheduleCron500JSONResponse) + validateFunc: func(resp gen.GetNodeScheduleResponseObject) { + _, ok := resp.(gen.GetNodeSchedule500JSONResponse) s.True(ok) }, }, @@ -481,14 +481,14 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCron() { s.Run(tt.name, func() { tt.setupMock() - resp, err := s.handler.GetNodeScheduleCron(s.ctx, tt.request) + resp, err := s.handler.GetNodeSchedule(s.ctx, tt.request) s.NoError(err) tt.validateFunc(resp) }) } } -func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCronValidationHTTP() { +func (s *ScheduleListGetPublicTestSuite) TestGetNodeScheduleValidationHTTP() { tests := []struct { name string path string @@ -497,7 +497,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCronValidationHTTP() { }{ { name: "when valid request", - path: "/api/node/server1/schedule/cron", + path: "/api/node/server1/schedule", setupJobMock: func() *jobmocks.MockJobClient { mock := jobmocks.NewMockJobClient(s.mockCtrl) mock.EXPECT(). @@ -516,7 +516,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCronValidationHTTP() { }, { name: "when target agent not found", - path: "/api/node/nonexistent/schedule/cron", + path: "/api/node/nonexistent/schedule", setupJobMock: func() *jobmocks.MockJobClient { return jobmocks.NewMockJobClient(s.mockCtrl) }, @@ -550,7 +550,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCronValidationHTTP() { const rbacCronListTestSigningKey = "test-signing-key-for-rbac-cron-list" -func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCronRBACHTTP() { +func (s *ScheduleListGetPublicTestSuite) TestGetNodeScheduleRBACHTTP() { tokenManager := authtoken.New(s.logger) tests := []struct { @@ -579,7 +579,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCronRBACHTTP() { rbacCronListTestSigningKey, []string{"write"}, "test-user", - []string{"cron:write"}, + []string{"schedule:write"}, ) s.Require().NoError(err) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) @@ -647,7 +647,7 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCronRBACHTTP() { req := httptest.NewRequest( http.MethodGet, - "/api/node/server1/schedule/cron", + "/api/node/server1/schedule", nil, ) tc.setupAuth(req) @@ -660,8 +660,8 @@ func (s *CronListGetPublicTestSuite) TestGetNodeScheduleCronRBACHTTP() { } } -func TestCronListGetPublicTestSuite( +func TestScheduleListGetPublicTestSuite( t *testing.T, ) { - suite.Run(t, new(CronListGetPublicTestSuite)) + suite.Run(t, new(ScheduleListGetPublicTestSuite)) } diff --git a/internal/controller/api/node/schedule/cron_update.go b/internal/controller/api/node/schedule/update.go similarity index 71% rename from internal/controller/api/node/schedule/cron_update.go rename to internal/controller/api/node/schedule/update.go index 004f0ce50..8f7860e7f 100644 --- a/internal/controller/api/node/schedule/cron_update.go +++ b/internal/controller/api/node/schedule/update.go @@ -29,27 +29,27 @@ import ( "github.com/osapi-io/osapi/internal/controller/api/node/schedule/gen" "github.com/osapi-io/osapi/internal/job" - cronProv "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + cronProv "github.com/osapi-io/osapi/internal/provider/schedule/cron" "github.com/osapi-io/osapi/internal/validation" "github.com/osapi-io/osapi/internal/controller/api/apierr" ) -// PutNodeScheduleCron updates a cron entry on a target node. -func (s *Schedule) PutNodeScheduleCron( +// PutNodeSchedule updates a cron entry on a target node. +func (s *Schedule) PutNodeSchedule( ctx context.Context, - request gen.PutNodeScheduleCronRequestObject, -) (gen.PutNodeScheduleCronResponseObject, error) { + request gen.PutNodeScheduleRequestObject, +) (gen.PutNodeScheduleResponseObject, error) { if errMsg, ok := validateHostname(request.Hostname); !ok { - return gen.PutNodeScheduleCron400JSONResponse{Error: &errMsg}, nil + return gen.PutNodeSchedule400JSONResponse{Error: &errMsg}, nil } if errMsg, ok := validation.Struct(request.Body); !ok { - return gen.PutNodeScheduleCron400JSONResponse{Error: &errMsg}, nil + return gen.PutNodeSchedule400JSONResponse{Error: &errMsg}, nil } if errMsg, ok := validation.AtLeastOneField(request.Body); !ok { - return gen.PutNodeScheduleCron400JSONResponse{Error: &errMsg}, nil + return gen.PutNodeSchedule400JSONResponse{Error: &errMsg}, nil } entry := cronProv.Entry{ @@ -81,7 +81,7 @@ func (s *Schedule) PutNodeScheduleCron( ) if job.IsBroadcastTarget(hostname) { - return s.putNodeScheduleCronUpdateBroadcast(ctx, hostname, entry) + return s.putNodeScheduleUpdateBroadcast(ctx, hostname, entry) } jobID, resp, err := s.JobClient.Modify( @@ -94,20 +94,20 @@ func (s *Schedule) PutNodeScheduleCron( if err != nil { errMsg := err.Error() if apierr.IsMissing(err) { - return gen.PutNodeScheduleCron404JSONResponse{Error: &errMsg}, nil + return gen.PutNodeSchedule404JSONResponse{Error: &errMsg}, nil } - return gen.PutNodeScheduleCron500JSONResponse{Error: &errMsg}, nil + return gen.PutNodeSchedule500JSONResponse{Error: &errMsg}, nil } if resp.Status == job.StatusSkipped { jobUUID := uuid.MustParse(jobID) e := resp.Error - return gen.PutNodeScheduleCron200JSONResponse{ + return gen.PutNodeSchedule200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronMutationResult{ + Results: []gen.ScheduleMutationResult{ { Hostname: resp.Hostname, - Status: gen.CronMutationResultStatusSkipped, + Status: gen.ScheduleMutationResultStatusSkipped, Error: &e, }, }, @@ -124,12 +124,12 @@ func (s *Schedule) PutNodeScheduleCron( name := result.Name agentHostname := resp.Hostname - return gen.PutNodeScheduleCron200JSONResponse{ + return gen.PutNodeSchedule200JSONResponse{ JobId: &jobUUID, - Results: []gen.CronMutationResult{ + Results: []gen.ScheduleMutationResult{ { Hostname: agentHostname, - Status: gen.CronMutationResultStatusOk, + Status: gen.ScheduleMutationResultStatusOk, Name: &name, Changed: changed, }, @@ -137,12 +137,12 @@ func (s *Schedule) PutNodeScheduleCron( }, nil } -// putNodeScheduleCronUpdateBroadcast handles broadcast targets for cron update. -func (s *Schedule) putNodeScheduleCronUpdateBroadcast( +// putNodeScheduleUpdateBroadcast handles broadcast targets for cron update. +func (s *Schedule) putNodeScheduleUpdateBroadcast( ctx context.Context, target string, entry cronProv.Entry, -) (gen.PutNodeScheduleCronResponseObject, error) { +) (gen.PutNodeScheduleResponseObject, error) { jobID, responses, err := s.JobClient.ModifyBroadcast( ctx, target, @@ -152,29 +152,29 @@ func (s *Schedule) putNodeScheduleCronUpdateBroadcast( ) if err != nil { errMsg := err.Error() - return gen.PutNodeScheduleCron500JSONResponse{Error: &errMsg}, nil + return gen.PutNodeSchedule500JSONResponse{Error: &errMsg}, nil } - var apiResponses []gen.CronMutationResult + var apiResponses []gen.ScheduleMutationResult for host, resp := range responses { - item := gen.CronMutationResult{ + item := gen.ScheduleMutationResult{ Hostname: host, } switch resp.Status { case job.StatusFailed: - item.Status = gen.CronMutationResultStatusFailed + item.Status = gen.ScheduleMutationResultStatusFailed e := resp.Error item.Error = &e case job.StatusSkipped: - item.Status = gen.CronMutationResultStatusSkipped + item.Status = gen.ScheduleMutationResultStatusSkipped e := resp.Error item.Error = &e case job.StatusTimeout: - item.Status = gen.CronMutationResultStatusTimeout + item.Status = gen.ScheduleMutationResultStatusTimeout e := resp.Error item.Error = &e default: - item.Status = gen.CronMutationResultStatusOk + item.Status = gen.ScheduleMutationResultStatusOk var result cronProv.UpdateResult if resp.Data != nil { _ = json.Unmarshal(resp.Data, &result) @@ -188,7 +188,7 @@ func (s *Schedule) putNodeScheduleCronUpdateBroadcast( jobUUID := uuid.MustParse(jobID) - return gen.PutNodeScheduleCron200JSONResponse{ + return gen.PutNodeSchedule200JSONResponse{ JobId: &jobUUID, Results: apiResponses, }, nil diff --git a/internal/controller/api/node/schedule/cron_update_public_test.go b/internal/controller/api/node/schedule/update_public_test.go similarity index 79% rename from internal/controller/api/node/schedule/cron_update_public_test.go rename to internal/controller/api/node/schedule/update_public_test.go index 6e9fc5991..3338fcd03 100644 --- a/internal/controller/api/node/schedule/cron_update_public_test.go +++ b/internal/controller/api/node/schedule/update_public_test.go @@ -47,7 +47,7 @@ import ( "github.com/osapi-io/osapi/internal/validation" ) -type CronUpdatePublicTestSuite struct { +type ScheduleUpdatePublicTestSuite struct { suite.Suite mockCtrl *gomock.Controller @@ -58,7 +58,7 @@ type CronUpdatePublicTestSuite struct { logger *slog.Logger } -func (s *CronUpdatePublicTestSuite) SetupSuite() { +func (s *ScheduleUpdatePublicTestSuite) SetupSuite() { validation.RegisterTargetValidator(func(_ context.Context) ([]validation.AgentTarget, error) { return []validation.AgentTarget{ {Hostname: "server1", Labels: map[string]string{"group": "web"}}, @@ -67,7 +67,7 @@ func (s *CronUpdatePublicTestSuite) SetupSuite() { }) } -func (s *CronUpdatePublicTestSuite) SetupTest() { +func (s *ScheduleUpdatePublicTestSuite) SetupTest() { s.mockCtrl = gomock.NewController(s.T()) s.mockJobClient = jobmocks.NewMockJobClient(s.mockCtrl) s.handler = apischedule.New(slog.Default(), s.mockJobClient) @@ -76,27 +76,27 @@ func (s *CronUpdatePublicTestSuite) SetupTest() { s.logger = slog.New(slog.NewTextHandler(os.Stdout, nil)) } -func (s *CronUpdatePublicTestSuite) TearDownTest() { +func (s *ScheduleUpdatePublicTestSuite) TearDownTest() { s.mockCtrl.Finish() } -func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { +func (s *ScheduleUpdatePublicTestSuite) TestPutNodeSchedule() { tests := []struct { name string - request gen.PutNodeScheduleCronRequestObject + request gen.PutNodeScheduleRequestObject setupMock func() - validateFunc func(resp gen.PutNodeScheduleCronResponseObject) + validateFunc func(resp gen.PutNodeScheduleResponseObject) }{ { name: "success with all fields", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), Object: ptr.To("backup-v2-script"), User: ptr.To("admin"), - ContentType: (*gen.CronUpdateRequestContentType)(ptr.To("template")), + ContentType: (*gen.ScheduleUpdateRequestContentType)(ptr.To("template")), Vars: &map[string]interface{}{"region": "us-east"}, }, }, @@ -120,8 +120,8 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -133,14 +133,14 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "when empty body returns 400", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{}, + Body: &gen.PutNodeScheduleJSONRequestBody{}, }, setupMock: func() {}, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "at least one field") @@ -148,10 +148,10 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "success with nil response data", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -175,8 +175,8 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) @@ -185,10 +185,10 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "broadcast success", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -216,8 +216,8 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -225,10 +225,10 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "broadcast with error entries", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -256,8 +256,8 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Len(r.Results, 2) @@ -273,10 +273,10 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "broadcast with skipped host", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -297,22 +297,22 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) - s.Equal(gen.CronMutationResultStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "broadcast with a host that never answered", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -333,22 +333,22 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, }, nil) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) - s.Equal(gen.CronMutationResultStatusTimeout, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusTimeout, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "timeout: agent did not respond") }, }, { name: "broadcast error collecting responses", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "_all", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -363,23 +363,23 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - _, ok := resp.(gen.PutNodeScheduleCron500JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + _, ok := resp.(gen.PutNodeSchedule500JSONResponse) s.True(ok) }, }, { name: "body validation error schedule too short", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("short"), }, }, setupMock: func() {}, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "Schedule") @@ -387,16 +387,16 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "validation error empty hostname", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, setupMock: func() {}, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron400JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule400JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "required") @@ -404,10 +404,10 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "not found error", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "server1", Name: "nonexistent", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -422,8 +422,8 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { ). Return("", nil, fmt.Errorf("cron entry not found: %w", job.ErrNotFound)) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron404JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule404JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "not found") @@ -431,10 +431,10 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "does not exist error", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "server1", Name: "missing", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -449,8 +449,8 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { ). Return("", nil, fmt.Errorf("cron entry does not exist: %w", job.ErrNotFound)) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron404JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule404JSONResponse) s.True(ok) s.Require().NotNil(r.Error) s.Contains(*r.Error, "does not exist") @@ -458,10 +458,10 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { }, { name: "when job skipped", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -484,23 +484,23 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { nil, ) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - r, ok := resp.(gen.PutNodeScheduleCron200JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + r, ok := resp.(gen.PutNodeSchedule200JSONResponse) s.True(ok) s.Require().NotNil(r.JobId) s.Require().Len(r.Results, 1) s.Equal("server1", r.Results[0].Hostname) - s.Equal(gen.CronMutationResultStatusSkipped, r.Results[0].Status) + s.Equal(gen.ScheduleMutationResultStatusSkipped, r.Results[0].Status) s.Require().NotNil(r.Results[0].Error) s.Contains(*r.Results[0].Error, "not supported") }, }, { name: "job client error", - request: gen.PutNodeScheduleCronRequestObject{ + request: gen.PutNodeScheduleRequestObject{ Hostname: "server1", Name: "backup", - Body: &gen.PutNodeScheduleCronJSONRequestBody{ + Body: &gen.PutNodeScheduleJSONRequestBody{ Schedule: ptr.To("0 3 * * *"), }, }, @@ -515,8 +515,8 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { ). Return("", nil, assert.AnError) }, - validateFunc: func(resp gen.PutNodeScheduleCronResponseObject) { - _, ok := resp.(gen.PutNodeScheduleCron500JSONResponse) + validateFunc: func(resp gen.PutNodeScheduleResponseObject) { + _, ok := resp.(gen.PutNodeSchedule500JSONResponse) s.True(ok) }, }, @@ -526,14 +526,14 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCron() { s.Run(tt.name, func() { tt.setupMock() - resp, err := s.handler.PutNodeScheduleCron(s.ctx, tt.request) + resp, err := s.handler.PutNodeSchedule(s.ctx, tt.request) s.NoError(err) tt.validateFunc(resp) }) } } -func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronValidationHTTP() { +func (s *ScheduleUpdatePublicTestSuite) TestPutNodeScheduleValidationHTTP() { tests := []struct { name string path string @@ -543,7 +543,7 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronValidationHTTP() { }{ { name: "when valid request", - path: "/api/node/server1/schedule/cron/backup", + path: "/api/node/server1/schedule/backup", body: `{"schedule":"0 3 * * *"}`, setupJobMock: func() *jobmocks.MockJobClient { mock := jobmocks.NewMockJobClient(s.mockCtrl) @@ -569,7 +569,7 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronValidationHTTP() { }, { name: "when empty body returns 400", - path: "/api/node/server1/schedule/cron/backup", + path: "/api/node/server1/schedule/backup", body: `{}`, setupJobMock: func() *jobmocks.MockJobClient { return jobmocks.NewMockJobClient(s.mockCtrl) @@ -582,7 +582,7 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronValidationHTTP() { }, { name: "when invalid cron schedule", - path: "/api/node/server1/schedule/cron/backup", + path: "/api/node/server1/schedule/backup", body: `{"schedule":"not-a-cron"}`, setupJobMock: func() *jobmocks.MockJobClient { return jobmocks.NewMockJobClient(s.mockCtrl) @@ -595,7 +595,7 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronValidationHTTP() { }, { name: "when target agent not found", - path: "/api/node/nonexistent/schedule/cron/backup", + path: "/api/node/nonexistent/schedule/backup", body: `{"schedule":"0 3 * * *"}`, setupJobMock: func() *jobmocks.MockJobClient { return jobmocks.NewMockJobClient(s.mockCtrl) @@ -635,7 +635,7 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronValidationHTTP() { const rbacCronUpdateTestSigningKey = "test-signing-key-for-rbac-cron-update" -func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronRBACHTTP() { +func (s *ScheduleUpdatePublicTestSuite) TestPutNodeScheduleRBACHTTP() { tokenManager := authtoken.New(s.logger) tests := []struct { @@ -664,7 +664,7 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronRBACHTTP() { rbacCronUpdateTestSigningKey, []string{"read"}, "test-user", - []string{"cron:read"}, + []string{"schedule:read"}, ) s.Require().NoError(err) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) @@ -738,7 +738,7 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronRBACHTTP() { req := httptest.NewRequest( http.MethodPut, - "/api/node/server1/schedule/cron/backup", + "/api/node/server1/schedule/backup", strings.NewReader(`{"schedule":"0 3 * * *"}`), ) req.Header.Set("Content-Type", "application/json") @@ -752,8 +752,8 @@ func (s *CronUpdatePublicTestSuite) TestPutNodeScheduleCronRBACHTTP() { } } -func TestCronUpdatePublicTestSuite( +func TestScheduleUpdatePublicTestSuite( t *testing.T, ) { - suite.Run(t, new(CronUpdatePublicTestSuite)) + suite.Run(t, new(ScheduleUpdatePublicTestSuite)) } diff --git a/internal/job/types.go b/internal/job/types.go index 364f429f4..3f03cf7f8 100644 --- a/internal/job/types.go +++ b/internal/job/types.go @@ -27,7 +27,7 @@ import ( "github.com/osapi-io/osapi/internal/provider/node/disk" "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" "github.com/osapi-io/osapi/pkg/sdk/client" ) @@ -185,11 +185,11 @@ const ( // Schedule/Cron operations. const ( - OperationCronList = client.OpCronList - OperationCronGet = client.OpCronGet - OperationCronCreate = client.OpCronCreate - OperationCronUpdate = client.OpCronUpdate - OperationCronDelete = client.OpCronDelete + OperationCronList = client.OpScheduleList + OperationCronGet = client.OpScheduleGet + OperationCronCreate = client.OpScheduleCreate + OperationCronUpdate = client.OpScheduleUpdate + OperationCronDelete = client.OpScheduleDelete ) // Sysctl operations. @@ -629,7 +629,7 @@ type AgentRegistration struct { // LoadAverages contains the system load averages. LoadAverages *load.Result `json:"load_averages,omitempty"` // MemoryStats contains memory usage information. - MemoryStats *mem.Result `json:"memory_stats,omitempty"` + MemoryStats *memory.Result `json:"memory_stats,omitempty"` // AgentVersion is the version of the agent binary. AgentVersion string `json:"agent_version,omitempty"` // Process holds process-level resource usage. @@ -669,7 +669,7 @@ type AgentInfo struct { // LoadAverages contains the system load averages. LoadAverages *load.Result `json:"load_averages,omitempty"` // MemoryStats contains memory usage information. - MemoryStats *mem.Result `json:"memory_stats,omitempty"` + MemoryStats *memory.Result `json:"memory_stats,omitempty"` // AgentVersion is the version of the agent binary. AgentVersion string `json:"agent_version,omitempty"` // Architecture is the CPU architecture (e.g., x86_64, aarch64). @@ -735,7 +735,7 @@ type NodeStatusResponse struct { // LoadAverages from the load provider LoadAverages *load.Result `json:"load_averages"` // MemoryStats from the memory provider - MemoryStats *mem.Result `json:"memory_stats"` + MemoryStats *memory.Result `json:"memory_stats"` // DiskUsage from the disk provider DiskUsage []disk.Result `json:"disk_usage"` // FieldErrors names the reads that failed, by the field they would have diff --git a/internal/job/types_public_test.go b/internal/job/types_public_test.go index fe592cbba..0c866b643 100644 --- a/internal/job/types_public_test.go +++ b/internal/job/types_public_test.go @@ -30,7 +30,7 @@ import ( "github.com/osapi-io/osapi/internal/job" "github.com/osapi-io/osapi/internal/provider/node/host" "github.com/osapi-io/osapi/internal/provider/node/load" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) type TypesPublicTestSuite struct { @@ -225,7 +225,7 @@ func (suite *TypesPublicTestSuite) TestAgentInfoFactsFieldsJSONRoundTrip() { }, Uptime: time.Duration(3600) * time.Second, LoadAverages: &load.Result{Load1: 0.5, Load5: 0.3, Load15: 0.1}, - MemoryStats: &mem.Result{Total: 1024, Free: 512}, + MemoryStats: &memory.Result{Total: 1024, Free: 512}, AgentVersion: "1.0.0", Architecture: "x86_64", KernelVersion: "6.1.0-25-generic", diff --git a/internal/provider/node/mem/darwin.go b/internal/provider/node/memory/darwin.go similarity index 99% rename from internal/provider/node/mem/darwin.go rename to internal/provider/node/memory/darwin.go index 010a989a5..c8cf89c38 100644 --- a/internal/provider/node/mem/darwin.go +++ b/internal/provider/node/memory/darwin.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem +package memory import ( "github.com/shirou/gopsutil/v4/mem" diff --git a/internal/provider/node/mem/darwin_get_vm.go b/internal/provider/node/memory/darwin_get_vm.go similarity index 99% rename from internal/provider/node/mem/darwin_get_vm.go rename to internal/provider/node/memory/darwin_get_vm.go index dfaba7415..c2f013a08 100644 --- a/internal/provider/node/mem/darwin_get_vm.go +++ b/internal/provider/node/memory/darwin_get_vm.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem +package memory // GetStats retrieves memory statistics of the system. // It returns a Stats struct with total, free, and cached memory in diff --git a/internal/provider/node/mem/darwin_get_vm_public_test.go b/internal/provider/node/memory/darwin_get_vm_public_test.go similarity index 88% rename from internal/provider/node/mem/darwin_get_vm_public_test.go rename to internal/provider/node/memory/darwin_get_vm_public_test.go index 342bd8649..12c07e938 100644 --- a/internal/provider/node/mem/darwin_get_vm_public_test.go +++ b/internal/provider/node/memory/darwin_get_vm_public_test.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem_test +package memory_test import ( "testing" @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) type DarwinGetStatsPublicTestSuite struct { @@ -42,7 +42,7 @@ func (suite *DarwinGetStatsPublicTestSuite) TestGetStats() { tests := []struct { name string setupMock func() func() (*sysMem.VirtualMemoryStat, error) - validateFunc func(*mem.Result, error) + validateFunc func(*memory.Result, error) }{ { name: "when GetStats Ok", @@ -55,10 +55,10 @@ func (suite *DarwinGetStatsPublicTestSuite) TestGetStats() { }, nil } }, - validateFunc: func(got *mem.Result, err error) { + validateFunc: func(got *memory.Result, err error) { suite.NoError(err) suite.NotNil(got) - suite.Equal(&mem.Result{ + suite.Equal(&memory.Result{ Total: 1024, Free: 512, Cached: 256, @@ -66,13 +66,13 @@ func (suite *DarwinGetStatsPublicTestSuite) TestGetStats() { }, }, { - name: "when mem.VirtualMemory errors", + name: "when memory.VirtualMemory errors", setupMock: func() func() (*sysMem.VirtualMemoryStat, error) { return func() (*sysMem.VirtualMemoryStat, error) { return nil, assert.AnError } }, - validateFunc: func(got *mem.Result, err error) { + validateFunc: func(got *memory.Result, err error) { suite.Error(err) suite.ErrorContains(err, assert.AnError.Error()) suite.Nil(got) @@ -82,7 +82,7 @@ func (suite *DarwinGetStatsPublicTestSuite) TestGetStats() { for _, tc := range tests { suite.Run(tc.name, func() { - darwin := mem.NewDarwinProvider() + darwin := memory.NewDarwinProvider() if tc.setupMock != nil { darwin.VirtualMemoryFn = tc.setupMock() diff --git a/internal/provider/node/mem/debian.go b/internal/provider/node/memory/debian.go similarity index 99% rename from internal/provider/node/mem/debian.go rename to internal/provider/node/memory/debian.go index 4fe8af833..896c93040 100644 --- a/internal/provider/node/mem/debian.go +++ b/internal/provider/node/memory/debian.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem +package memory import ( "github.com/shirou/gopsutil/v4/mem" diff --git a/internal/provider/node/mem/debian_get_vm.go b/internal/provider/node/memory/debian_get_vm.go similarity index 99% rename from internal/provider/node/mem/debian_get_vm.go rename to internal/provider/node/memory/debian_get_vm.go index deffcf21d..7c6aef677 100644 --- a/internal/provider/node/mem/debian_get_vm.go +++ b/internal/provider/node/memory/debian_get_vm.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem +package memory // GetStats retrieves memory statistics of the system. // It returns a Stats struct with total, free, and cached memory in diff --git a/internal/provider/node/mem/debian_get_vm_public_test.go b/internal/provider/node/memory/debian_get_vm_public_test.go similarity index 88% rename from internal/provider/node/mem/debian_get_vm_public_test.go rename to internal/provider/node/memory/debian_get_vm_public_test.go index b4eb637ec..ab31b34d8 100644 --- a/internal/provider/node/mem/debian_get_vm_public_test.go +++ b/internal/provider/node/memory/debian_get_vm_public_test.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem_test +package memory_test import ( "testing" @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) type DebianGetStatsPublicTestSuite struct { @@ -42,7 +42,7 @@ func (suite *DebianGetStatsPublicTestSuite) TestGetStats() { tests := []struct { name string setupMock func() func() (*sysMem.VirtualMemoryStat, error) - validateFunc func(*mem.Result, error) + validateFunc func(*memory.Result, error) }{ { name: "when GetStats Ok", @@ -55,10 +55,10 @@ func (suite *DebianGetStatsPublicTestSuite) TestGetStats() { }, nil } }, - validateFunc: func(got *mem.Result, err error) { + validateFunc: func(got *memory.Result, err error) { suite.NoError(err) suite.NotNil(got) - suite.Equal(&mem.Result{ + suite.Equal(&memory.Result{ Total: 1024, Free: 512, Cached: 256, @@ -66,13 +66,13 @@ func (suite *DebianGetStatsPublicTestSuite) TestGetStats() { }, }, { - name: "when mem.VirtualMemory errors", + name: "when memory.VirtualMemory errors", setupMock: func() func() (*sysMem.VirtualMemoryStat, error) { return func() (*sysMem.VirtualMemoryStat, error) { return nil, assert.AnError } }, - validateFunc: func(got *mem.Result, err error) { + validateFunc: func(got *memory.Result, err error) { suite.Error(err) suite.ErrorContains(err, assert.AnError.Error()) suite.Nil(got) @@ -82,7 +82,7 @@ func (suite *DebianGetStatsPublicTestSuite) TestGetStats() { for _, tc := range tests { suite.Run(tc.name, func() { - debian := mem.NewDebianProvider() + debian := memory.NewDebianProvider() if tc.setupMock != nil { debian.VirtualMemoryFn = tc.setupMock() diff --git a/internal/provider/node/mem/linux.go b/internal/provider/node/memory/linux.go similarity index 95% rename from internal/provider/node/mem/linux.go rename to internal/provider/node/memory/linux.go index 34610fda9..0ffb8f151 100644 --- a/internal/provider/node/mem/linux.go +++ b/internal/provider/node/memory/linux.go @@ -18,8 +18,8 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// Package mem provides memory usage statistics. -package mem +// Package memory provides memory usage statistics. +package memory import ( "github.com/osapi-io/osapi/internal/provider" diff --git a/internal/provider/node/mem/linux_get_vm.go b/internal/provider/node/memory/linux_get_vm.go similarity index 98% rename from internal/provider/node/mem/linux_get_vm.go rename to internal/provider/node/memory/linux_get_vm.go index 561ab078c..e1aeadae1 100644 --- a/internal/provider/node/mem/linux_get_vm.go +++ b/internal/provider/node/memory/linux_get_vm.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem +package memory import ( "github.com/osapi-io/osapi/internal/provider" diff --git a/internal/provider/node/mem/linux_get_vm_public_test.go b/internal/provider/node/memory/linux_get_vm_public_test.go similarity index 90% rename from internal/provider/node/mem/linux_get_vm_public_test.go rename to internal/provider/node/memory/linux_get_vm_public_test.go index 3f1a1954e..6a75d3ea3 100644 --- a/internal/provider/node/mem/linux_get_vm_public_test.go +++ b/internal/provider/node/memory/linux_get_vm_public_test.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem_test +package memory_test import ( "testing" @@ -26,7 +26,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/osapi-io/osapi/internal/provider" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) type LinuxGetStatsPublicTestSuite struct { @@ -40,11 +40,11 @@ func (suite *LinuxGetStatsPublicTestSuite) TearDownTest() {} func (suite *LinuxGetStatsPublicTestSuite) TestGetStats() { tests := []struct { name string - validateFunc func(*mem.Result, error) + validateFunc func(*memory.Result, error) }{ { name: "returns not implemented error", - validateFunc: func(result *mem.Result, err error) { + validateFunc: func(result *memory.Result, err error) { suite.Nil(result) suite.ErrorIs(err, provider.ErrUnsupported) }, @@ -53,7 +53,7 @@ func (suite *LinuxGetStatsPublicTestSuite) TestGetStats() { for _, tc := range tests { suite.Run(tc.name, func() { - linux := mem.NewLinuxProvider() + linux := memory.NewLinuxProvider() tc.validateFunc(linux.GetStats()) }) diff --git a/internal/provider/node/mem/mocks/generate.go b/internal/provider/node/memory/mocks/generate.go similarity index 100% rename from internal/provider/node/mem/mocks/generate.go rename to internal/provider/node/memory/mocks/generate.go diff --git a/internal/provider/node/mem/mocks/mocks.go b/internal/provider/node/memory/mocks/mocks.go similarity index 93% rename from internal/provider/node/mem/mocks/mocks.go rename to internal/provider/node/memory/mocks/mocks.go index 84a3bf0fd..8efaad12f 100644 --- a/internal/provider/node/mem/mocks/mocks.go +++ b/internal/provider/node/memory/mocks/mocks.go @@ -23,7 +23,7 @@ package mocks import ( "go.uber.org/mock/gomock" - "github.com/osapi-io/osapi/internal/provider/node/mem" + "github.com/osapi-io/osapi/internal/provider/node/memory" ) // NewPlainMockProvider creates a Mock without defaults. @@ -39,7 +39,7 @@ func NewDefaultMockProvider( ) *MockProvider { mock := NewMockProvider(ctrl) - mock.EXPECT().GetStats().Return(&mem.Result{ + mock.EXPECT().GetStats().Return(&memory.Result{ Total: 8388608, Free: 4194304, Cached: 2097152, diff --git a/internal/provider/node/mem/mocks/types.gen.go b/internal/provider/node/memory/mocks/types.gen.go similarity index 89% rename from internal/provider/node/mem/mocks/types.gen.go rename to internal/provider/node/memory/mocks/types.gen.go index d7595bc37..138c90f91 100644 --- a/internal/provider/node/mem/mocks/types.gen.go +++ b/internal/provider/node/memory/mocks/types.gen.go @@ -12,7 +12,7 @@ package mocks import ( reflect "reflect" - mem "github.com/osapi-io/osapi/internal/provider/node/mem" + memory "github.com/osapi-io/osapi/internal/provider/node/memory" gomock "go.uber.org/mock/gomock" ) @@ -41,10 +41,10 @@ func (m *MockProvider) EXPECT() *MockProviderMockRecorder { } // GetStats mocks base method. -func (m *MockProvider) GetStats() (*mem.Result, error) { +func (m *MockProvider) GetStats() (*memory.Result, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetStats") - ret0, _ := ret[0].(*mem.Result) + ret0, _ := ret[0].(*memory.Result) ret1, _ := ret[1].(error) return ret0, ret1 } diff --git a/internal/provider/node/mem/types.go b/internal/provider/node/memory/types.go similarity index 99% rename from internal/provider/node/mem/types.go rename to internal/provider/node/memory/types.go index ab851148b..662e57783 100644 --- a/internal/provider/node/mem/types.go +++ b/internal/provider/node/memory/types.go @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -package mem +package memory // Provider implements the methods to interact with various Mem components. type Provider interface { diff --git a/internal/provider/scheduled/cron/darwin.go b/internal/provider/schedule/cron/darwin.go similarity index 100% rename from internal/provider/scheduled/cron/darwin.go rename to internal/provider/schedule/cron/darwin.go diff --git a/internal/provider/scheduled/cron/darwin_public_test.go b/internal/provider/schedule/cron/darwin_public_test.go similarity index 98% rename from internal/provider/scheduled/cron/darwin_public_test.go rename to internal/provider/schedule/cron/darwin_public_test.go index 424a8381e..8f98696f8 100644 --- a/internal/provider/scheduled/cron/darwin_public_test.go +++ b/internal/provider/schedule/cron/darwin_public_test.go @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/osapi-io/osapi/internal/provider" - "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + "github.com/osapi-io/osapi/internal/provider/schedule/cron" ) type DarwinPublicTestSuite struct { diff --git a/internal/provider/scheduled/cron/debian.go b/internal/provider/schedule/cron/debian.go similarity index 100% rename from internal/provider/scheduled/cron/debian.go rename to internal/provider/schedule/cron/debian.go diff --git a/internal/provider/scheduled/cron/debian_public_test.go b/internal/provider/schedule/cron/debian_public_test.go similarity index 99% rename from internal/provider/scheduled/cron/debian_public_test.go rename to internal/provider/schedule/cron/debian_public_test.go index 29effefa4..ec206accd 100644 --- a/internal/provider/scheduled/cron/debian_public_test.go +++ b/internal/provider/schedule/cron/debian_public_test.go @@ -37,7 +37,7 @@ import ( jobmocks "github.com/osapi-io/osapi/internal/job/mocks" "github.com/osapi-io/osapi/internal/provider/file" filemocks "github.com/osapi-io/osapi/internal/provider/file/mocks" - "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + "github.com/osapi-io/osapi/internal/provider/schedule/cron" ) const testHostname = "test-host" diff --git a/internal/provider/scheduled/cron/linux.go b/internal/provider/schedule/cron/linux.go similarity index 100% rename from internal/provider/scheduled/cron/linux.go rename to internal/provider/schedule/cron/linux.go diff --git a/internal/provider/scheduled/cron/linux_public_test.go b/internal/provider/schedule/cron/linux_public_test.go similarity index 98% rename from internal/provider/scheduled/cron/linux_public_test.go rename to internal/provider/schedule/cron/linux_public_test.go index 30134895a..49a165c71 100644 --- a/internal/provider/scheduled/cron/linux_public_test.go +++ b/internal/provider/schedule/cron/linux_public_test.go @@ -27,7 +27,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/osapi-io/osapi/internal/provider" - "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + "github.com/osapi-io/osapi/internal/provider/schedule/cron" ) type LinuxPublicTestSuite struct { diff --git a/internal/provider/scheduled/cron/mocks/generate.go b/internal/provider/schedule/cron/mocks/generate.go similarity index 100% rename from internal/provider/scheduled/cron/mocks/generate.go rename to internal/provider/schedule/cron/mocks/generate.go diff --git a/internal/provider/scheduled/cron/mocks/provider.gen.go b/internal/provider/schedule/cron/mocks/provider.gen.go similarity index 98% rename from internal/provider/scheduled/cron/mocks/provider.gen.go rename to internal/provider/schedule/cron/mocks/provider.gen.go index fcab12277..3746cfb94 100644 --- a/internal/provider/scheduled/cron/mocks/provider.gen.go +++ b/internal/provider/schedule/cron/mocks/provider.gen.go @@ -13,7 +13,7 @@ import ( context "context" reflect "reflect" - cron "github.com/osapi-io/osapi/internal/provider/scheduled/cron" + cron "github.com/osapi-io/osapi/internal/provider/schedule/cron" gomock "go.uber.org/mock/gomock" ) diff --git a/internal/provider/scheduled/cron/types.go b/internal/provider/schedule/cron/types.go similarity index 100% rename from internal/provider/scheduled/cron/types.go rename to internal/provider/schedule/cron/types.go diff --git a/internal/validation/validation_public_test.go b/internal/validation/validation_public_test.go index df502fdf2..51e29496c 100644 --- a/internal/validation/validation_public_test.go +++ b/internal/validation/validation_public_test.go @@ -295,7 +295,7 @@ func (s *ValidationPublicTestSuite) TestIpOrFact() { } } -func (s *ValidationPublicTestSuite) TestCronSchedule() { +func (s *ValidationPublicTestSuite) TestSchedule() { tests := []struct { name string field string diff --git a/pkg/sdk/client/gen/client.gen.go b/pkg/sdk/client/gen/client.gen.go index 4b559e5f0..37601d1ba 100644 --- a/pkg/sdk/client/gen/client.gen.go +++ b/pkg/sdk/client/gen/client.gen.go @@ -154,138 +154,6 @@ func (e CommandResultItemStatus) Valid() bool { } } -// Defines values for CronCreateRequestContentType. -const ( - CronCreateRequestContentTypeRaw CronCreateRequestContentType = "raw" - CronCreateRequestContentTypeTemplate CronCreateRequestContentType = "template" -) - -// Valid indicates whether the value is a known member of the CronCreateRequestContentType enum. -func (e CronCreateRequestContentType) Valid() bool { - switch e { - case CronCreateRequestContentTypeRaw: - return true - case CronCreateRequestContentTypeTemplate: - return true - default: - return false - } -} - -// Defines values for CronCreateRequestInterval. -const ( - CronCreateRequestIntervalDaily CronCreateRequestInterval = "daily" - CronCreateRequestIntervalHourly CronCreateRequestInterval = "hourly" - CronCreateRequestIntervalMonthly CronCreateRequestInterval = "monthly" - CronCreateRequestIntervalWeekly CronCreateRequestInterval = "weekly" -) - -// Valid indicates whether the value is a known member of the CronCreateRequestInterval enum. -func (e CronCreateRequestInterval) Valid() bool { - switch e { - case CronCreateRequestIntervalDaily: - return true - case CronCreateRequestIntervalHourly: - return true - case CronCreateRequestIntervalMonthly: - return true - case CronCreateRequestIntervalWeekly: - return true - default: - return false - } -} - -// Defines values for CronEntryInterval. -const ( - CronEntryIntervalDaily CronEntryInterval = "daily" - CronEntryIntervalHourly CronEntryInterval = "hourly" - CronEntryIntervalMonthly CronEntryInterval = "monthly" - CronEntryIntervalWeekly CronEntryInterval = "weekly" -) - -// Valid indicates whether the value is a known member of the CronEntryInterval enum. -func (e CronEntryInterval) Valid() bool { - switch e { - case CronEntryIntervalDaily: - return true - case CronEntryIntervalHourly: - return true - case CronEntryIntervalMonthly: - return true - case CronEntryIntervalWeekly: - return true - default: - return false - } -} - -// Defines values for CronEntryStatus. -const ( - CronEntryStatusFailed CronEntryStatus = "failed" - CronEntryStatusOk CronEntryStatus = "ok" - CronEntryStatusSkipped CronEntryStatus = "skipped" - CronEntryStatusTimeout CronEntryStatus = "timeout" -) - -// Valid indicates whether the value is a known member of the CronEntryStatus enum. -func (e CronEntryStatus) Valid() bool { - switch e { - case CronEntryStatusFailed: - return true - case CronEntryStatusOk: - return true - case CronEntryStatusSkipped: - return true - case CronEntryStatusTimeout: - return true - default: - return false - } -} - -// Defines values for CronMutationResultStatus. -const ( - CronMutationResultStatusFailed CronMutationResultStatus = "failed" - CronMutationResultStatusOk CronMutationResultStatus = "ok" - CronMutationResultStatusSkipped CronMutationResultStatus = "skipped" - CronMutationResultStatusTimeout CronMutationResultStatus = "timeout" -) - -// Valid indicates whether the value is a known member of the CronMutationResultStatus enum. -func (e CronMutationResultStatus) Valid() bool { - switch e { - case CronMutationResultStatusFailed: - return true - case CronMutationResultStatusOk: - return true - case CronMutationResultStatusSkipped: - return true - case CronMutationResultStatusTimeout: - return true - default: - return false - } -} - -// Defines values for CronUpdateRequestContentType. -const ( - CronUpdateRequestContentTypeRaw CronUpdateRequestContentType = "raw" - CronUpdateRequestContentTypeTemplate CronUpdateRequestContentType = "template" -) - -// Valid indicates whether the value is a known member of the CronUpdateRequestContentType enum. -func (e CronUpdateRequestContentType) Valid() bool { - switch e { - case CronUpdateRequestContentTypeRaw: - return true - case CronUpdateRequestContentTypeTemplate: - return true - default: - return false - } -} - // Defines values for DNSConfigResponseStatus. const ( DNSConfigResponseStatusFailed DNSConfigResponseStatus = "failed" @@ -1312,6 +1180,138 @@ func (e SSHKeyMutationEntryStatus) Valid() bool { } } +// Defines values for ScheduleCreateRequestContentType. +const ( + ScheduleCreateRequestContentTypeRaw ScheduleCreateRequestContentType = "raw" + ScheduleCreateRequestContentTypeTemplate ScheduleCreateRequestContentType = "template" +) + +// Valid indicates whether the value is a known member of the ScheduleCreateRequestContentType enum. +func (e ScheduleCreateRequestContentType) Valid() bool { + switch e { + case ScheduleCreateRequestContentTypeRaw: + return true + case ScheduleCreateRequestContentTypeTemplate: + return true + default: + return false + } +} + +// Defines values for ScheduleCreateRequestInterval. +const ( + ScheduleCreateRequestIntervalDaily ScheduleCreateRequestInterval = "daily" + ScheduleCreateRequestIntervalHourly ScheduleCreateRequestInterval = "hourly" + ScheduleCreateRequestIntervalMonthly ScheduleCreateRequestInterval = "monthly" + ScheduleCreateRequestIntervalWeekly ScheduleCreateRequestInterval = "weekly" +) + +// Valid indicates whether the value is a known member of the ScheduleCreateRequestInterval enum. +func (e ScheduleCreateRequestInterval) Valid() bool { + switch e { + case ScheduleCreateRequestIntervalDaily: + return true + case ScheduleCreateRequestIntervalHourly: + return true + case ScheduleCreateRequestIntervalMonthly: + return true + case ScheduleCreateRequestIntervalWeekly: + return true + default: + return false + } +} + +// Defines values for ScheduleEntryInterval. +const ( + ScheduleEntryIntervalDaily ScheduleEntryInterval = "daily" + ScheduleEntryIntervalHourly ScheduleEntryInterval = "hourly" + ScheduleEntryIntervalMonthly ScheduleEntryInterval = "monthly" + ScheduleEntryIntervalWeekly ScheduleEntryInterval = "weekly" +) + +// Valid indicates whether the value is a known member of the ScheduleEntryInterval enum. +func (e ScheduleEntryInterval) Valid() bool { + switch e { + case ScheduleEntryIntervalDaily: + return true + case ScheduleEntryIntervalHourly: + return true + case ScheduleEntryIntervalMonthly: + return true + case ScheduleEntryIntervalWeekly: + return true + default: + return false + } +} + +// Defines values for ScheduleEntryStatus. +const ( + ScheduleEntryStatusFailed ScheduleEntryStatus = "failed" + ScheduleEntryStatusOk ScheduleEntryStatus = "ok" + ScheduleEntryStatusSkipped ScheduleEntryStatus = "skipped" + ScheduleEntryStatusTimeout ScheduleEntryStatus = "timeout" +) + +// Valid indicates whether the value is a known member of the ScheduleEntryStatus enum. +func (e ScheduleEntryStatus) Valid() bool { + switch e { + case ScheduleEntryStatusFailed: + return true + case ScheduleEntryStatusOk: + return true + case ScheduleEntryStatusSkipped: + return true + case ScheduleEntryStatusTimeout: + return true + default: + return false + } +} + +// Defines values for ScheduleMutationResultStatus. +const ( + ScheduleMutationResultStatusFailed ScheduleMutationResultStatus = "failed" + ScheduleMutationResultStatusOk ScheduleMutationResultStatus = "ok" + ScheduleMutationResultStatusSkipped ScheduleMutationResultStatus = "skipped" + ScheduleMutationResultStatusTimeout ScheduleMutationResultStatus = "timeout" +) + +// Valid indicates whether the value is a known member of the ScheduleMutationResultStatus enum. +func (e ScheduleMutationResultStatus) Valid() bool { + switch e { + case ScheduleMutationResultStatusFailed: + return true + case ScheduleMutationResultStatusOk: + return true + case ScheduleMutationResultStatusSkipped: + return true + case ScheduleMutationResultStatusTimeout: + return true + default: + return false + } +} + +// Defines values for ScheduleUpdateRequestContentType. +const ( + ScheduleUpdateRequestContentTypeRaw ScheduleUpdateRequestContentType = "raw" + ScheduleUpdateRequestContentTypeTemplate ScheduleUpdateRequestContentType = "template" +) + +// Valid indicates whether the value is a known member of the ScheduleUpdateRequestContentType enum. +func (e ScheduleUpdateRequestContentType) Valid() bool { + switch e { + case ScheduleUpdateRequestContentTypeRaw: + return true + case ScheduleUpdateRequestContentTypeTemplate: + return true + default: + return false + } +} + // Defines values for ServiceGetEntryStatus. const ( ServiceGetEntryStatusFailed ServiceGetEntryStatus = "failed" @@ -2020,149 +2020,6 @@ type CreateJobResponse struct { Timestamp *string `json:"timestamp,omitempty"` } -// CronCollectionResponse defines model for CronCollectionResponse. -type CronCollectionResponse struct { - // JobId The job ID used to process this request. - JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronEntry `json:"results"` -} - -// CronCreateRequest defines model for CronCreateRequest. -type CronCreateRequest struct { - // ContentType Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. - ContentType *CronCreateRequestContentType `json:"content_type,omitempty" validate:"omitempty,oneof=raw template"` - - // Interval Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. - Interval *CronCreateRequestInterval `json:"interval,omitempty" validate:"required_without=Schedule,excluded_with=Schedule,omitempty,oneof=hourly daily weekly monthly"` - - // Name Name for the cron drop-in entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. - Name string `json:"name" validate:"required,min=1,max=64"` - - // Object Name of the uploaded file in the object store to deploy as the cron entry content. - Object string `json:"object" validate:"required,min=1"` - - // Schedule Cron schedule expression (e.g., "*/5 * * * *"). Mutually exclusive with interval — provide exactly one. - Schedule *string `json:"schedule,omitempty" validate:"required_without=Interval,excluded_with=Interval,omitempty,cron_schedule"` - - // User User to run the command as. Only applies when using schedule (cron.d entries include a user field). - User *string `json:"user,omitempty"` - - // Vars Template variables. Only used when content_type is "template". - Vars *map[string]interface{} `json:"vars,omitempty"` -} - -// CronCreateRequestContentType Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. -type CronCreateRequestContentType string - -// CronCreateRequestInterval Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. -type CronCreateRequestInterval string - -// CronCreateResponse defines model for CronCreateResponse. -type CronCreateResponse struct { - // JobId The job ID used to process this request. - JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronMutationResult `json:"results"` -} - -// CronDeleteResponse defines model for CronDeleteResponse. -type CronDeleteResponse struct { - // JobId The job ID used to process this request. - JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronMutationResult `json:"results"` -} - -// CronEntry A cron drop-in entry. -type CronEntry struct { - // Error Error message if the agent failed to retrieve this entry. - Error *string `json:"error,omitempty"` - - // Hostname Hostname of the agent that reported this entry. - Hostname string `json:"hostname"` - - // Interval Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. - Interval *CronEntryInterval `json:"interval,omitempty"` - - // Name Cron entry name. - Name *string `json:"name,omitempty"` - - // Object Object store name for the deployed content. - Object *string `json:"object,omitempty"` - - // Schedule Cron schedule expression. Present for /etc/cron.d/ entries. - Schedule *string `json:"schedule,omitempty"` - - // Source Where the entry lives: "cron.d", "hourly", "daily", "weekly", or "monthly". - Source *string `json:"source,omitempty"` - - // Status The status of the operation for this host. - Status CronEntryStatus `json:"status"` - - // User User the cron entry runs as. - User *string `json:"user,omitempty"` -} - -// CronEntryInterval Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. -type CronEntryInterval string - -// CronEntryStatus The status of the operation for this host. -type CronEntryStatus string - -// CronGetResponse Collection response for a single cron entry get operation. -type CronGetResponse struct { - // JobId The job ID used to process this request. - JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronEntry `json:"results"` -} - -// CronMutationResult Result of a cron create, update, or delete operation for one host. -type CronMutationResult struct { - // Changed Whether the operation modified system state. - Changed *bool `json:"changed,omitempty"` - - // Error Error message if the agent failed. - Error *string `json:"error,omitempty"` - - // Hostname Hostname of the agent that processed this operation. - Hostname string `json:"hostname"` - - // Name Cron entry name. - Name *string `json:"name,omitempty"` - - // Status The status of the operation for this host. - Status CronMutationResultStatus `json:"status"` -} - -// CronMutationResultStatus The status of the operation for this host. -type CronMutationResultStatus string - -// CronUpdateRequest defines model for CronUpdateRequest. -type CronUpdateRequest struct { - // ContentType Content type: "raw" or "template". - ContentType *CronUpdateRequestContentType `json:"content_type,omitempty" validate:"omitempty,oneof=raw template"` - - // Object New object to deploy (redeploy with updated content). - Object *string `json:"object,omitempty" validate:"omitempty,min=1"` - - // Schedule Cron schedule expression (e.g., "*/5 * * * *"). - Schedule *string `json:"schedule,omitempty" validate:"omitempty,cron_schedule"` - - // User User to run the command as. - User *string `json:"user,omitempty"` - - // Vars Template variables. - Vars *map[string]interface{} `json:"vars,omitempty"` -} - -// CronUpdateRequestContentType Content type: "raw" or "template". -type CronUpdateRequestContentType string - -// CronUpdateResponse defines model for CronUpdateResponse. -type CronUpdateResponse struct { - // JobId The job ID used to process this request. - JobId *openapi_types.UUID `json:"job_id,omitempty"` - Results []CronMutationResult `json:"results"` -} - // DNSConfigCollectionResponse defines model for DNSConfigCollectionResponse. type DNSConfigCollectionResponse struct { // JobId The job ID used to process this request. @@ -4110,6 +3967,149 @@ type SSHKeyMutationResponse struct { Results []SSHKeyMutationEntry `json:"results"` } +// ScheduleCollectionResponse defines model for ScheduleCollectionResponse. +type ScheduleCollectionResponse struct { + // JobId The job ID used to process this request. + JobId *openapi_types.UUID `json:"job_id,omitempty"` + Results []ScheduleEntry `json:"results"` +} + +// ScheduleCreateRequest defines model for ScheduleCreateRequest. +type ScheduleCreateRequest struct { + // ContentType Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. + ContentType *ScheduleCreateRequestContentType `json:"content_type,omitempty" validate:"omitempty,oneof=raw template"` + + // Interval Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. + Interval *ScheduleCreateRequestInterval `json:"interval,omitempty" validate:"required_without=Schedule,excluded_with=Schedule,omitempty,oneof=hourly daily weekly monthly"` + + // Name Name for the scheduled entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. + Name string `json:"name" validate:"required,min=1,max=64"` + + // Object Name of the uploaded file in the object store to deploy as the scheduled entry content. + Object string `json:"object" validate:"required,min=1"` + + // Schedule Cron schedule expression (e.g., "*/5 * * * *"). Mutually exclusive with interval — provide exactly one. + Schedule *string `json:"schedule,omitempty" validate:"required_without=Interval,excluded_with=Interval,omitempty,cron_schedule"` + + // User User to run the command as. Only applies when using schedule (cron.d entries include a user field). + User *string `json:"user,omitempty"` + + // Vars Template variables. Only used when content_type is "template". + Vars *map[string]interface{} `json:"vars,omitempty"` +} + +// ScheduleCreateRequestContentType Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. +type ScheduleCreateRequestContentType string + +// ScheduleCreateRequestInterval Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. +type ScheduleCreateRequestInterval string + +// ScheduleCreateResponse defines model for ScheduleCreateResponse. +type ScheduleCreateResponse struct { + // JobId The job ID used to process this request. + JobId *openapi_types.UUID `json:"job_id,omitempty"` + Results []ScheduleMutationResult `json:"results"` +} + +// ScheduleDeleteResponse defines model for ScheduleDeleteResponse. +type ScheduleDeleteResponse struct { + // JobId The job ID used to process this request. + JobId *openapi_types.UUID `json:"job_id,omitempty"` + Results []ScheduleMutationResult `json:"results"` +} + +// ScheduleEntry A scheduled entry. +type ScheduleEntry struct { + // Error Error message if the agent failed to retrieve this entry. + Error *string `json:"error,omitempty"` + + // Hostname Hostname of the agent that reported this entry. + Hostname string `json:"hostname"` + + // Interval Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. + Interval *ScheduleEntryInterval `json:"interval,omitempty"` + + // Name Scheduled entry name. + Name *string `json:"name,omitempty"` + + // Object Object store name for the deployed content. + Object *string `json:"object,omitempty"` + + // Schedule Cron schedule expression. Present for /etc/cron.d/ entries. + Schedule *string `json:"schedule,omitempty"` + + // Source Where the entry lives: "cron.d", "hourly", "daily", "weekly", or "monthly". + Source *string `json:"source,omitempty"` + + // Status The status of the operation for this host. + Status ScheduleEntryStatus `json:"status"` + + // User User the scheduled entry runs as. + User *string `json:"user,omitempty"` +} + +// ScheduleEntryInterval Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. +type ScheduleEntryInterval string + +// ScheduleEntryStatus The status of the operation for this host. +type ScheduleEntryStatus string + +// ScheduleGetResponse Collection response for a single scheduled entry get operation. +type ScheduleGetResponse struct { + // JobId The job ID used to process this request. + JobId *openapi_types.UUID `json:"job_id,omitempty"` + Results []ScheduleEntry `json:"results"` +} + +// ScheduleMutationResult Result of a cron create, update, or delete operation for one host. +type ScheduleMutationResult struct { + // Changed Whether the operation modified system state. + Changed *bool `json:"changed,omitempty"` + + // Error Error message if the agent failed. + Error *string `json:"error,omitempty"` + + // Hostname Hostname of the agent that processed this operation. + Hostname string `json:"hostname"` + + // Name Scheduled entry name. + Name *string `json:"name,omitempty"` + + // Status The status of the operation for this host. + Status ScheduleMutationResultStatus `json:"status"` +} + +// ScheduleMutationResultStatus The status of the operation for this host. +type ScheduleMutationResultStatus string + +// ScheduleUpdateRequest defines model for ScheduleUpdateRequest. +type ScheduleUpdateRequest struct { + // ContentType Content type: "raw" or "template". + ContentType *ScheduleUpdateRequestContentType `json:"content_type,omitempty" validate:"omitempty,oneof=raw template"` + + // Object New object to deploy (redeploy with updated content). + Object *string `json:"object,omitempty" validate:"omitempty,min=1"` + + // Schedule Cron schedule expression (e.g., "*/5 * * * *"). + Schedule *string `json:"schedule,omitempty" validate:"omitempty,cron_schedule"` + + // User User to run the command as. + User *string `json:"user,omitempty"` + + // Vars Template variables. + Vars *map[string]interface{} `json:"vars,omitempty"` +} + +// ScheduleUpdateRequestContentType Content type: "raw" or "template". +type ScheduleUpdateRequestContentType string + +// ScheduleUpdateResponse defines model for ScheduleUpdateResponse. +type ScheduleUpdateResponse struct { + // JobId The job ID used to process this request. + JobId *openapi_types.UUID `json:"job_id,omitempty"` + Results []ScheduleMutationResult `json:"results"` +} + // ServiceCreateRequest defines model for ServiceCreateRequest. type ServiceCreateRequest struct { // Name Service unit name. @@ -4656,9 +4656,6 @@ type UserUpdateRequest struct { // CertName defines model for CertName. type CertName = string -// CronName defines model for CronName. -type CronName = string - // DockerId defines model for DockerId. type DockerId = string @@ -4686,6 +4683,9 @@ type RouteInterfaceName = string // SSHKeyFingerprint defines model for SSHKeyFingerprint. type SSHKeyFingerprint = string +// ScheduleName defines model for ScheduleName. +type ScheduleName = string + // ServiceName defines model for ServiceName. type ServiceName = string @@ -4892,11 +4892,11 @@ type PostNodePowerShutdownJSONRequestBody = PowerRequest // PostNodeProcessSignalJSONRequestBody defines body for PostNodeProcessSignal for application/json ContentType. type PostNodeProcessSignalJSONRequestBody = ProcessSignalRequest -// PostNodeScheduleCronJSONRequestBody defines body for PostNodeScheduleCron for application/json ContentType. -type PostNodeScheduleCronJSONRequestBody = CronCreateRequest +// PostNodeScheduleJSONRequestBody defines body for PostNodeSchedule for application/json ContentType. +type PostNodeScheduleJSONRequestBody = ScheduleCreateRequest -// PutNodeScheduleCronJSONRequestBody defines body for PutNodeScheduleCron for application/json ContentType. -type PutNodeScheduleCronJSONRequestBody = CronUpdateRequest +// PutNodeScheduleJSONRequestBody defines body for PutNodeSchedule for application/json ContentType. +type PutNodeScheduleJSONRequestBody = ScheduleUpdateRequest // PostNodeServiceJSONRequestBody defines body for PostNodeService for application/json ContentType. type PostNodeServiceJSONRequestBody = ServiceCreateRequest @@ -5309,24 +5309,24 @@ type ClientInterface interface { PostNodeProcessSignal(ctx context.Context, hostname Hostname, pid Pid, body PostNodeProcessSignalJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetNodeScheduleCron request - GetNodeScheduleCron(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetNodeSchedule request + GetNodeSchedule(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) - // PostNodeScheduleCronWithBody request with any body - PostNodeScheduleCronWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PostNodeScheduleWithBody request with any body + PostNodeScheduleWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PostNodeScheduleCron(ctx context.Context, hostname Hostname, body PostNodeScheduleCronJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + PostNodeSchedule(ctx context.Context, hostname Hostname, body PostNodeScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - // DeleteNodeScheduleCron request - DeleteNodeScheduleCron(ctx context.Context, hostname Hostname, name CronName, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeleteNodeSchedule request + DeleteNodeSchedule(ctx context.Context, hostname Hostname, name ScheduleName, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetNodeScheduleCronByName request - GetNodeScheduleCronByName(ctx context.Context, hostname Hostname, name CronName, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetNodeScheduleByName request + GetNodeScheduleByName(ctx context.Context, hostname Hostname, name ScheduleName, reqEditors ...RequestEditorFn) (*http.Response, error) - // PutNodeScheduleCronWithBody request with any body - PutNodeScheduleCronWithBody(ctx context.Context, hostname Hostname, name CronName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // PutNodeScheduleWithBody request with any body + PutNodeScheduleWithBody(ctx context.Context, hostname Hostname, name ScheduleName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - PutNodeScheduleCron(ctx context.Context, hostname Hostname, name CronName, body PutNodeScheduleCronJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + PutNodeSchedule(ctx context.Context, hostname Hostname, name ScheduleName, body PutNodeScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetNodeService request GetNodeService(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -6787,8 +6787,8 @@ func (c *Client) PostNodeProcessSignal(ctx context.Context, hostname Hostname, p return c.Client.Do(req) } -func (c *Client) GetNodeScheduleCron(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetNodeScheduleCronRequest(c.Server, hostname) +func (c *Client) GetNodeSchedule(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetNodeScheduleRequest(c.Server, hostname) if err != nil { return nil, err } @@ -6799,8 +6799,8 @@ func (c *Client) GetNodeScheduleCron(ctx context.Context, hostname Hostname, req return c.Client.Do(req) } -func (c *Client) PostNodeScheduleCronWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostNodeScheduleCronRequestWithBody(c.Server, hostname, contentType, body) +func (c *Client) PostNodeScheduleWithBody(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostNodeScheduleRequestWithBody(c.Server, hostname, contentType, body) if err != nil { return nil, err } @@ -6811,8 +6811,8 @@ func (c *Client) PostNodeScheduleCronWithBody(ctx context.Context, hostname Host return c.Client.Do(req) } -func (c *Client) PostNodeScheduleCron(ctx context.Context, hostname Hostname, body PostNodeScheduleCronJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPostNodeScheduleCronRequest(c.Server, hostname, body) +func (c *Client) PostNodeSchedule(ctx context.Context, hostname Hostname, body PostNodeScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPostNodeScheduleRequest(c.Server, hostname, body) if err != nil { return nil, err } @@ -6823,8 +6823,8 @@ func (c *Client) PostNodeScheduleCron(ctx context.Context, hostname Hostname, bo return c.Client.Do(req) } -func (c *Client) DeleteNodeScheduleCron(ctx context.Context, hostname Hostname, name CronName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteNodeScheduleCronRequest(c.Server, hostname, name) +func (c *Client) DeleteNodeSchedule(ctx context.Context, hostname Hostname, name ScheduleName, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteNodeScheduleRequest(c.Server, hostname, name) if err != nil { return nil, err } @@ -6835,8 +6835,8 @@ func (c *Client) DeleteNodeScheduleCron(ctx context.Context, hostname Hostname, return c.Client.Do(req) } -func (c *Client) GetNodeScheduleCronByName(ctx context.Context, hostname Hostname, name CronName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetNodeScheduleCronByNameRequest(c.Server, hostname, name) +func (c *Client) GetNodeScheduleByName(ctx context.Context, hostname Hostname, name ScheduleName, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetNodeScheduleByNameRequest(c.Server, hostname, name) if err != nil { return nil, err } @@ -6847,8 +6847,8 @@ func (c *Client) GetNodeScheduleCronByName(ctx context.Context, hostname Hostnam return c.Client.Do(req) } -func (c *Client) PutNodeScheduleCronWithBody(ctx context.Context, hostname Hostname, name CronName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPutNodeScheduleCronRequestWithBody(c.Server, hostname, name, contentType, body) +func (c *Client) PutNodeScheduleWithBody(ctx context.Context, hostname Hostname, name ScheduleName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPutNodeScheduleRequestWithBody(c.Server, hostname, name, contentType, body) if err != nil { return nil, err } @@ -6859,8 +6859,8 @@ func (c *Client) PutNodeScheduleCronWithBody(ctx context.Context, hostname Hostn return c.Client.Do(req) } -func (c *Client) PutNodeScheduleCron(ctx context.Context, hostname Hostname, name CronName, body PutNodeScheduleCronJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPutNodeScheduleCronRequest(c.Server, hostname, name, body) +func (c *Client) PutNodeSchedule(ctx context.Context, hostname Hostname, name ScheduleName, body PutNodeScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewPutNodeScheduleRequest(c.Server, hostname, name, body) if err != nil { return nil, err } @@ -11001,8 +11001,8 @@ func NewPostNodeProcessSignalRequestWithBody(server string, hostname Hostname, p return req, nil } -// NewGetNodeScheduleCronRequest generates requests for GetNodeScheduleCron -func NewGetNodeScheduleCronRequest(server string, hostname Hostname) (*http.Request, error) { +// NewGetNodeScheduleRequest generates requests for GetNodeSchedule +func NewGetNodeScheduleRequest(server string, hostname Hostname) (*http.Request, error) { var err error var pathParam0 string @@ -11017,7 +11017,7 @@ func NewGetNodeScheduleCronRequest(server string, hostname Hostname) (*http.Requ return nil, err } - operationPath := fmt.Sprintf("/api/node/%s/schedule/cron", pathParam0) + operationPath := fmt.Sprintf("/api/node/%s/schedule", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -11035,19 +11035,19 @@ func NewGetNodeScheduleCronRequest(server string, hostname Hostname) (*http.Requ return req, nil } -// NewPostNodeScheduleCronRequest calls the generic PostNodeScheduleCron builder with application/json body -func NewPostNodeScheduleCronRequest(server string, hostname Hostname, body PostNodeScheduleCronJSONRequestBody) (*http.Request, error) { +// NewPostNodeScheduleRequest calls the generic PostNodeSchedule builder with application/json body +func NewPostNodeScheduleRequest(server string, hostname Hostname, body PostNodeScheduleJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostNodeScheduleCronRequestWithBody(server, hostname, "application/json", bodyReader) + return NewPostNodeScheduleRequestWithBody(server, hostname, "application/json", bodyReader) } -// NewPostNodeScheduleCronRequestWithBody generates requests for PostNodeScheduleCron with any type of body -func NewPostNodeScheduleCronRequestWithBody(server string, hostname Hostname, contentType string, body io.Reader) (*http.Request, error) { +// NewPostNodeScheduleRequestWithBody generates requests for PostNodeSchedule with any type of body +func NewPostNodeScheduleRequestWithBody(server string, hostname Hostname, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -11062,7 +11062,7 @@ func NewPostNodeScheduleCronRequestWithBody(server string, hostname Hostname, co return nil, err } - operationPath := fmt.Sprintf("/api/node/%s/schedule/cron", pathParam0) + operationPath := fmt.Sprintf("/api/node/%s/schedule", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -11082,8 +11082,8 @@ func NewPostNodeScheduleCronRequestWithBody(server string, hostname Hostname, co return req, nil } -// NewDeleteNodeScheduleCronRequest generates requests for DeleteNodeScheduleCron -func NewDeleteNodeScheduleCronRequest(server string, hostname Hostname, name CronName) (*http.Request, error) { +// NewDeleteNodeScheduleRequest generates requests for DeleteNodeSchedule +func NewDeleteNodeScheduleRequest(server string, hostname Hostname, name ScheduleName) (*http.Request, error) { var err error var pathParam0 string @@ -11105,7 +11105,7 @@ func NewDeleteNodeScheduleCronRequest(server string, hostname Hostname, name Cro return nil, err } - operationPath := fmt.Sprintf("/api/node/%s/schedule/cron/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/api/node/%s/schedule/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -11123,8 +11123,8 @@ func NewDeleteNodeScheduleCronRequest(server string, hostname Hostname, name Cro return req, nil } -// NewGetNodeScheduleCronByNameRequest generates requests for GetNodeScheduleCronByName -func NewGetNodeScheduleCronByNameRequest(server string, hostname Hostname, name CronName) (*http.Request, error) { +// NewGetNodeScheduleByNameRequest generates requests for GetNodeScheduleByName +func NewGetNodeScheduleByNameRequest(server string, hostname Hostname, name ScheduleName) (*http.Request, error) { var err error var pathParam0 string @@ -11146,7 +11146,7 @@ func NewGetNodeScheduleCronByNameRequest(server string, hostname Hostname, name return nil, err } - operationPath := fmt.Sprintf("/api/node/%s/schedule/cron/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/api/node/%s/schedule/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -11164,19 +11164,19 @@ func NewGetNodeScheduleCronByNameRequest(server string, hostname Hostname, name return req, nil } -// NewPutNodeScheduleCronRequest calls the generic PutNodeScheduleCron builder with application/json body -func NewPutNodeScheduleCronRequest(server string, hostname Hostname, name CronName, body PutNodeScheduleCronJSONRequestBody) (*http.Request, error) { +// NewPutNodeScheduleRequest calls the generic PutNodeSchedule builder with application/json body +func NewPutNodeScheduleRequest(server string, hostname Hostname, name ScheduleName, body PutNodeScheduleJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPutNodeScheduleCronRequestWithBody(server, hostname, name, "application/json", bodyReader) + return NewPutNodeScheduleRequestWithBody(server, hostname, name, "application/json", bodyReader) } -// NewPutNodeScheduleCronRequestWithBody generates requests for PutNodeScheduleCron with any type of body -func NewPutNodeScheduleCronRequestWithBody(server string, hostname Hostname, name CronName, contentType string, body io.Reader) (*http.Request, error) { +// NewPutNodeScheduleRequestWithBody generates requests for PutNodeSchedule with any type of body +func NewPutNodeScheduleRequestWithBody(server string, hostname Hostname, name ScheduleName, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -11198,7 +11198,7 @@ func NewPutNodeScheduleCronRequestWithBody(server string, hostname Hostname, nam return nil, err } - operationPath := fmt.Sprintf("/api/node/%s/schedule/cron/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/api/node/%s/schedule/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -12767,24 +12767,24 @@ type ClientWithResponsesInterface interface { PostNodeProcessSignalWithResponse(ctx context.Context, hostname Hostname, pid Pid, body PostNodeProcessSignalJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeProcessSignalResponse, error) - // GetNodeScheduleCronWithResponse request - GetNodeScheduleCronWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeScheduleCronResponse, error) + // GetNodeScheduleWithResponse request + GetNodeScheduleWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeScheduleResponse, error) - // PostNodeScheduleCronWithBodyWithResponse request with any body - PostNodeScheduleCronWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeScheduleCronResponse, error) + // PostNodeScheduleWithBodyWithResponse request with any body + PostNodeScheduleWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeScheduleResponse, error) - PostNodeScheduleCronWithResponse(ctx context.Context, hostname Hostname, body PostNodeScheduleCronJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeScheduleCronResponse, error) + PostNodeScheduleWithResponse(ctx context.Context, hostname Hostname, body PostNodeScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeScheduleResponse, error) - // DeleteNodeScheduleCronWithResponse request - DeleteNodeScheduleCronWithResponse(ctx context.Context, hostname Hostname, name CronName, reqEditors ...RequestEditorFn) (*DeleteNodeScheduleCronResponse, error) + // DeleteNodeScheduleWithResponse request + DeleteNodeScheduleWithResponse(ctx context.Context, hostname Hostname, name ScheduleName, reqEditors ...RequestEditorFn) (*DeleteNodeScheduleResponse, error) - // GetNodeScheduleCronByNameWithResponse request - GetNodeScheduleCronByNameWithResponse(ctx context.Context, hostname Hostname, name CronName, reqEditors ...RequestEditorFn) (*GetNodeScheduleCronByNameResponse, error) + // GetNodeScheduleByNameWithResponse request + GetNodeScheduleByNameWithResponse(ctx context.Context, hostname Hostname, name ScheduleName, reqEditors ...RequestEditorFn) (*GetNodeScheduleByNameResponse, error) - // PutNodeScheduleCronWithBodyWithResponse request with any body - PutNodeScheduleCronWithBodyWithResponse(ctx context.Context, hostname Hostname, name CronName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutNodeScheduleCronResponse, error) + // PutNodeScheduleWithBodyWithResponse request with any body + PutNodeScheduleWithBodyWithResponse(ctx context.Context, hostname Hostname, name ScheduleName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutNodeScheduleResponse, error) - PutNodeScheduleCronWithResponse(ctx context.Context, hostname Hostname, name CronName, body PutNodeScheduleCronJSONRequestBody, reqEditors ...RequestEditorFn) (*PutNodeScheduleCronResponse, error) + PutNodeScheduleWithResponse(ctx context.Context, hostname Hostname, name ScheduleName, body PutNodeScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*PutNodeScheduleResponse, error) // GetNodeServiceWithResponse request GetNodeServiceWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeServiceResponse, error) @@ -15802,10 +15802,10 @@ func (r PostNodeProcessSignalResponse) ContentType() string { return "" } -type GetNodeScheduleCronResponse struct { +type GetNodeScheduleResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CronCollectionResponse + JSON200 *ScheduleCollectionResponse JSON400 *ErrorResponse JSON401 *ErrorResponse JSON403 *ErrorResponse @@ -15813,7 +15813,7 @@ type GetNodeScheduleCronResponse struct { } // Status returns HTTPResponse.Status -func (r GetNodeScheduleCronResponse) Status() string { +func (r GetNodeScheduleResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -15821,7 +15821,7 @@ func (r GetNodeScheduleCronResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetNodeScheduleCronResponse) StatusCode() int { +func (r GetNodeScheduleResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -15829,17 +15829,17 @@ func (r GetNodeScheduleCronResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetNodeScheduleCronResponse) ContentType() string { +func (r GetNodeScheduleResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PostNodeScheduleCronResponse struct { +type PostNodeScheduleResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CronCreateResponse + JSON200 *ScheduleCreateResponse JSON400 *ErrorResponse JSON401 *ErrorResponse JSON403 *ErrorResponse @@ -15847,7 +15847,7 @@ type PostNodeScheduleCronResponse struct { } // Status returns HTTPResponse.Status -func (r PostNodeScheduleCronResponse) Status() string { +func (r PostNodeScheduleResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -15855,7 +15855,7 @@ func (r PostNodeScheduleCronResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PostNodeScheduleCronResponse) StatusCode() int { +func (r PostNodeScheduleResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -15863,17 +15863,17 @@ func (r PostNodeScheduleCronResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PostNodeScheduleCronResponse) ContentType() string { +func (r PostNodeScheduleResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type DeleteNodeScheduleCronResponse struct { +type DeleteNodeScheduleResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CronDeleteResponse + JSON200 *ScheduleDeleteResponse JSON400 *ErrorResponse JSON401 *ErrorResponse JSON403 *ErrorResponse @@ -15882,7 +15882,7 @@ type DeleteNodeScheduleCronResponse struct { } // Status returns HTTPResponse.Status -func (r DeleteNodeScheduleCronResponse) Status() string { +func (r DeleteNodeScheduleResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -15890,7 +15890,7 @@ func (r DeleteNodeScheduleCronResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteNodeScheduleCronResponse) StatusCode() int { +func (r DeleteNodeScheduleResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -15898,17 +15898,17 @@ func (r DeleteNodeScheduleCronResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r DeleteNodeScheduleCronResponse) ContentType() string { +func (r DeleteNodeScheduleResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type GetNodeScheduleCronByNameResponse struct { +type GetNodeScheduleByNameResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CronGetResponse + JSON200 *ScheduleGetResponse JSON400 *ErrorResponse JSON401 *ErrorResponse JSON403 *ErrorResponse @@ -15917,7 +15917,7 @@ type GetNodeScheduleCronByNameResponse struct { } // Status returns HTTPResponse.Status -func (r GetNodeScheduleCronByNameResponse) Status() string { +func (r GetNodeScheduleByNameResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -15925,7 +15925,7 @@ func (r GetNodeScheduleCronByNameResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetNodeScheduleCronByNameResponse) StatusCode() int { +func (r GetNodeScheduleByNameResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -15933,17 +15933,17 @@ func (r GetNodeScheduleCronByNameResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r GetNodeScheduleCronByNameResponse) ContentType() string { +func (r GetNodeScheduleByNameResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } return "" } -type PutNodeScheduleCronResponse struct { +type PutNodeScheduleResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *CronUpdateResponse + JSON200 *ScheduleUpdateResponse JSON400 *ErrorResponse JSON401 *ErrorResponse JSON403 *ErrorResponse @@ -15952,7 +15952,7 @@ type PutNodeScheduleCronResponse struct { } // Status returns HTTPResponse.Status -func (r PutNodeScheduleCronResponse) Status() string { +func (r PutNodeScheduleResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -15960,7 +15960,7 @@ func (r PutNodeScheduleCronResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r PutNodeScheduleCronResponse) StatusCode() int { +func (r PutNodeScheduleResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -15968,7 +15968,7 @@ func (r PutNodeScheduleCronResponse) StatusCode() int { } // ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers -func (r PutNodeScheduleCronResponse) ContentType() string { +func (r PutNodeScheduleResponse) ContentType() string { if r.HTTPResponse != nil { return r.HTTPResponse.Header.Get("Content-Type") } @@ -17921,65 +17921,65 @@ func (c *ClientWithResponses) PostNodeProcessSignalWithResponse(ctx context.Cont return ParsePostNodeProcessSignalResponse(rsp) } -// GetNodeScheduleCronWithResponse request returning *GetNodeScheduleCronResponse -func (c *ClientWithResponses) GetNodeScheduleCronWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeScheduleCronResponse, error) { - rsp, err := c.GetNodeScheduleCron(ctx, hostname, reqEditors...) +// GetNodeScheduleWithResponse request returning *GetNodeScheduleResponse +func (c *ClientWithResponses) GetNodeScheduleWithResponse(ctx context.Context, hostname Hostname, reqEditors ...RequestEditorFn) (*GetNodeScheduleResponse, error) { + rsp, err := c.GetNodeSchedule(ctx, hostname, reqEditors...) if err != nil { return nil, err } - return ParseGetNodeScheduleCronResponse(rsp) + return ParseGetNodeScheduleResponse(rsp) } -// PostNodeScheduleCronWithBodyWithResponse request with arbitrary body returning *PostNodeScheduleCronResponse -func (c *ClientWithResponses) PostNodeScheduleCronWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeScheduleCronResponse, error) { - rsp, err := c.PostNodeScheduleCronWithBody(ctx, hostname, contentType, body, reqEditors...) +// PostNodeScheduleWithBodyWithResponse request with arbitrary body returning *PostNodeScheduleResponse +func (c *ClientWithResponses) PostNodeScheduleWithBodyWithResponse(ctx context.Context, hostname Hostname, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostNodeScheduleResponse, error) { + rsp, err := c.PostNodeScheduleWithBody(ctx, hostname, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePostNodeScheduleCronResponse(rsp) + return ParsePostNodeScheduleResponse(rsp) } -func (c *ClientWithResponses) PostNodeScheduleCronWithResponse(ctx context.Context, hostname Hostname, body PostNodeScheduleCronJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeScheduleCronResponse, error) { - rsp, err := c.PostNodeScheduleCron(ctx, hostname, body, reqEditors...) +func (c *ClientWithResponses) PostNodeScheduleWithResponse(ctx context.Context, hostname Hostname, body PostNodeScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*PostNodeScheduleResponse, error) { + rsp, err := c.PostNodeSchedule(ctx, hostname, body, reqEditors...) if err != nil { return nil, err } - return ParsePostNodeScheduleCronResponse(rsp) + return ParsePostNodeScheduleResponse(rsp) } -// DeleteNodeScheduleCronWithResponse request returning *DeleteNodeScheduleCronResponse -func (c *ClientWithResponses) DeleteNodeScheduleCronWithResponse(ctx context.Context, hostname Hostname, name CronName, reqEditors ...RequestEditorFn) (*DeleteNodeScheduleCronResponse, error) { - rsp, err := c.DeleteNodeScheduleCron(ctx, hostname, name, reqEditors...) +// DeleteNodeScheduleWithResponse request returning *DeleteNodeScheduleResponse +func (c *ClientWithResponses) DeleteNodeScheduleWithResponse(ctx context.Context, hostname Hostname, name ScheduleName, reqEditors ...RequestEditorFn) (*DeleteNodeScheduleResponse, error) { + rsp, err := c.DeleteNodeSchedule(ctx, hostname, name, reqEditors...) if err != nil { return nil, err } - return ParseDeleteNodeScheduleCronResponse(rsp) + return ParseDeleteNodeScheduleResponse(rsp) } -// GetNodeScheduleCronByNameWithResponse request returning *GetNodeScheduleCronByNameResponse -func (c *ClientWithResponses) GetNodeScheduleCronByNameWithResponse(ctx context.Context, hostname Hostname, name CronName, reqEditors ...RequestEditorFn) (*GetNodeScheduleCronByNameResponse, error) { - rsp, err := c.GetNodeScheduleCronByName(ctx, hostname, name, reqEditors...) +// GetNodeScheduleByNameWithResponse request returning *GetNodeScheduleByNameResponse +func (c *ClientWithResponses) GetNodeScheduleByNameWithResponse(ctx context.Context, hostname Hostname, name ScheduleName, reqEditors ...RequestEditorFn) (*GetNodeScheduleByNameResponse, error) { + rsp, err := c.GetNodeScheduleByName(ctx, hostname, name, reqEditors...) if err != nil { return nil, err } - return ParseGetNodeScheduleCronByNameResponse(rsp) + return ParseGetNodeScheduleByNameResponse(rsp) } -// PutNodeScheduleCronWithBodyWithResponse request with arbitrary body returning *PutNodeScheduleCronResponse -func (c *ClientWithResponses) PutNodeScheduleCronWithBodyWithResponse(ctx context.Context, hostname Hostname, name CronName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutNodeScheduleCronResponse, error) { - rsp, err := c.PutNodeScheduleCronWithBody(ctx, hostname, name, contentType, body, reqEditors...) +// PutNodeScheduleWithBodyWithResponse request with arbitrary body returning *PutNodeScheduleResponse +func (c *ClientWithResponses) PutNodeScheduleWithBodyWithResponse(ctx context.Context, hostname Hostname, name ScheduleName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PutNodeScheduleResponse, error) { + rsp, err := c.PutNodeScheduleWithBody(ctx, hostname, name, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParsePutNodeScheduleCronResponse(rsp) + return ParsePutNodeScheduleResponse(rsp) } -func (c *ClientWithResponses) PutNodeScheduleCronWithResponse(ctx context.Context, hostname Hostname, name CronName, body PutNodeScheduleCronJSONRequestBody, reqEditors ...RequestEditorFn) (*PutNodeScheduleCronResponse, error) { - rsp, err := c.PutNodeScheduleCron(ctx, hostname, name, body, reqEditors...) +func (c *ClientWithResponses) PutNodeScheduleWithResponse(ctx context.Context, hostname Hostname, name ScheduleName, body PutNodeScheduleJSONRequestBody, reqEditors ...RequestEditorFn) (*PutNodeScheduleResponse, error) { + rsp, err := c.PutNodeSchedule(ctx, hostname, name, body, reqEditors...) if err != nil { return nil, err } - return ParsePutNodeScheduleCronResponse(rsp) + return ParsePutNodeScheduleResponse(rsp) } // GetNodeServiceWithResponse request returning *GetNodeServiceResponse @@ -23009,22 +23009,22 @@ func ParsePostNodeProcessSignalResponse(rsp *http.Response) (*PostNodeProcessSig return response, nil } -// ParseGetNodeScheduleCronResponse parses an HTTP response from a GetNodeScheduleCronWithResponse call -func ParseGetNodeScheduleCronResponse(rsp *http.Response) (*GetNodeScheduleCronResponse, error) { +// ParseGetNodeScheduleResponse parses an HTTP response from a GetNodeScheduleWithResponse call +func ParseGetNodeScheduleResponse(rsp *http.Response) (*GetNodeScheduleResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetNodeScheduleCronResponse{ + response := &GetNodeScheduleResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest CronCollectionResponse + var dest ScheduleCollectionResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -23063,22 +23063,22 @@ func ParseGetNodeScheduleCronResponse(rsp *http.Response) (*GetNodeScheduleCronR return response, nil } -// ParsePostNodeScheduleCronResponse parses an HTTP response from a PostNodeScheduleCronWithResponse call -func ParsePostNodeScheduleCronResponse(rsp *http.Response) (*PostNodeScheduleCronResponse, error) { +// ParsePostNodeScheduleResponse parses an HTTP response from a PostNodeScheduleWithResponse call +func ParsePostNodeScheduleResponse(rsp *http.Response) (*PostNodeScheduleResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostNodeScheduleCronResponse{ + response := &PostNodeScheduleResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest CronCreateResponse + var dest ScheduleCreateResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -23117,22 +23117,22 @@ func ParsePostNodeScheduleCronResponse(rsp *http.Response) (*PostNodeScheduleCro return response, nil } -// ParseDeleteNodeScheduleCronResponse parses an HTTP response from a DeleteNodeScheduleCronWithResponse call -func ParseDeleteNodeScheduleCronResponse(rsp *http.Response) (*DeleteNodeScheduleCronResponse, error) { +// ParseDeleteNodeScheduleResponse parses an HTTP response from a DeleteNodeScheduleWithResponse call +func ParseDeleteNodeScheduleResponse(rsp *http.Response) (*DeleteNodeScheduleResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteNodeScheduleCronResponse{ + response := &DeleteNodeScheduleResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest CronDeleteResponse + var dest ScheduleDeleteResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -23178,22 +23178,22 @@ func ParseDeleteNodeScheduleCronResponse(rsp *http.Response) (*DeleteNodeSchedul return response, nil } -// ParseGetNodeScheduleCronByNameResponse parses an HTTP response from a GetNodeScheduleCronByNameWithResponse call -func ParseGetNodeScheduleCronByNameResponse(rsp *http.Response) (*GetNodeScheduleCronByNameResponse, error) { +// ParseGetNodeScheduleByNameResponse parses an HTTP response from a GetNodeScheduleByNameWithResponse call +func ParseGetNodeScheduleByNameResponse(rsp *http.Response) (*GetNodeScheduleByNameResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetNodeScheduleCronByNameResponse{ + response := &GetNodeScheduleByNameResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest CronGetResponse + var dest ScheduleGetResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -23239,22 +23239,22 @@ func ParseGetNodeScheduleCronByNameResponse(rsp *http.Response) (*GetNodeSchedul return response, nil } -// ParsePutNodeScheduleCronResponse parses an HTTP response from a PutNodeScheduleCronWithResponse call -func ParsePutNodeScheduleCronResponse(rsp *http.Response) (*PutNodeScheduleCronResponse, error) { +// ParsePutNodeScheduleResponse parses an HTTP response from a PutNodeScheduleWithResponse call +func ParsePutNodeScheduleResponse(rsp *http.Response) (*PutNodeScheduleResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PutNodeScheduleCronResponse{ + response := &PutNodeScheduleResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest CronUpdateResponse + var dest ScheduleUpdateResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } diff --git a/pkg/sdk/client/operations.go b/pkg/sdk/client/operations.go index 09ae510bf..e62adad4d 100644 --- a/pkg/sdk/client/operations.go +++ b/pkg/sdk/client/operations.go @@ -84,11 +84,11 @@ const ( // Schedule/Cron operations. const ( - OpCronList JobOperation = "schedule.cron.list" - OpCronGet JobOperation = "schedule.cron.get" - OpCronCreate JobOperation = "schedule.cron.create" - OpCronUpdate JobOperation = "schedule.cron.update" - OpCronDelete JobOperation = "schedule.cron.delete" + OpScheduleList JobOperation = "schedule.cron.list" + OpScheduleGet JobOperation = "schedule.cron.get" + OpScheduleCreate JobOperation = "schedule.cron.create" + OpScheduleUpdate JobOperation = "schedule.cron.update" + OpScheduleDelete JobOperation = "schedule.cron.delete" ) // Sysctl operations. diff --git a/pkg/sdk/client/osapi.go b/pkg/sdk/client/osapi.go index c55cc45ba..f314cb72d 100644 --- a/pkg/sdk/client/osapi.go +++ b/pkg/sdk/client/osapi.go @@ -96,9 +96,9 @@ type Client struct { // inspect, start, stop, remove, exec, pull). Docker *DockerService - // Cron provides cron schedule management operations (list, get, + // Schedule provides scheduled task management operations (list, get, // create, update, delete). - Cron *CronService + Schedule *ScheduleService // Sysctl provides sysctl parameter management operations (list, get, // set, delete). @@ -223,7 +223,7 @@ func New( c.Audit = &AuditService{client: httpClient} c.File = &FileService{client: httpClient} c.Docker = &DockerService{client: httpClient} - c.Cron = &CronService{client: httpClient} + c.Schedule = &ScheduleService{client: httpClient} c.Sysctl = &SysctlService{client: httpClient} c.NTP = &NTPService{client: httpClient} c.Timezone = &TimezoneService{client: httpClient} diff --git a/pkg/sdk/client/osapi_public_test.go b/pkg/sdk/client/osapi_public_test.go index a62d5fb05..cdd3887ff 100644 --- a/pkg/sdk/client/osapi_public_test.go +++ b/pkg/sdk/client/osapi_public_test.go @@ -79,7 +79,7 @@ func (suite *ClientPublicTestSuite) TestNew() { suite.NotNil(c.Health) suite.NotNil(c.Audit) suite.NotNil(c.File) - suite.NotNil(c.Cron) + suite.NotNil(c.Schedule) }, }, { diff --git a/pkg/sdk/client/permissions.go b/pkg/sdk/client/permissions.go index 57ecc09cd..14f31f4d5 100644 --- a/pkg/sdk/client/permissions.go +++ b/pkg/sdk/client/permissions.go @@ -44,8 +44,8 @@ const ( PermDockerRead Permission = "docker:read" PermDockerWrite Permission = "docker:write" PermDockerExecute Permission = "docker:execute" - PermCronRead Permission = "cron:read" - PermCronWrite Permission = "cron:write" + PermCronRead Permission = "schedule:read" + PermCronWrite Permission = "schedule:write" PermSysctlRead Permission = "sysctl:read" PermSysctlWrite Permission = "sysctl:write" PermNtpRead Permission = "ntp:read" diff --git a/pkg/sdk/client/cron.go b/pkg/sdk/client/schedule.go similarity index 79% rename from pkg/sdk/client/cron.go rename to pkg/sdk/client/schedule.go index 00d432f37..153a6cea1 100644 --- a/pkg/sdk/client/cron.go +++ b/pkg/sdk/client/schedule.go @@ -27,17 +27,17 @@ import ( "github.com/osapi-io/osapi/pkg/sdk/client/gen" ) -// CronService provides cron schedule management operations. -type CronService struct { +// ScheduleService provides cron schedule management operations. +type ScheduleService struct { client *gen.ClientWithResponses } // List lists all cron entries on the target host. -func (s *CronService) List( +func (s *ScheduleService) List( ctx context.Context, hostname string, -) (*Response[Collection[CronEntryResult]], error) { - resp, err := s.client.GetNodeScheduleCronWithResponse(ctx, hostname) +) (*Response[Collection[ScheduleEntryResult]], error) { + resp, err := s.client.GetNodeScheduleWithResponse(ctx, hostname) if err != nil { return nil, fmt.Errorf("cron list: %w", err) } @@ -63,12 +63,12 @@ func (s *CronService) List( } // Get retrieves a single cron entry by name on the target host. -func (s *CronService) Get( +func (s *ScheduleService) Get( ctx context.Context, hostname string, name string, -) (*Response[Collection[CronEntryResult]], error) { - resp, err := s.client.GetNodeScheduleCronByNameWithResponse(ctx, hostname, name) +) (*Response[Collection[ScheduleEntryResult]], error) { + resp, err := s.client.GetNodeScheduleByNameWithResponse(ctx, hostname, name) if err != nil { return nil, fmt.Errorf("cron get: %w", err) } @@ -95,12 +95,12 @@ func (s *CronService) Get( } // Create creates a new cron entry on the target host. -func (s *CronService) Create( +func (s *ScheduleService) Create( ctx context.Context, hostname string, - opts CronCreateOpts, -) (*Response[Collection[CronMutationResult]], error) { - body := gen.CronCreateRequest{ + opts ScheduleCreateOpts, +) (*Response[Collection[ScheduleMutationResult]], error) { + body := gen.ScheduleCreateRequest{ Name: opts.Name, Object: opts.Object, } @@ -108,21 +108,21 @@ func (s *CronService) Create( body.Schedule = &opts.Schedule } if opts.Interval != "" { - interval := gen.CronCreateRequestInterval(opts.Interval) + interval := gen.ScheduleCreateRequestInterval(opts.Interval) body.Interval = &interval } if opts.User != "" { body.User = &opts.User } if opts.ContentType != "" { - ct := gen.CronCreateRequestContentType(opts.ContentType) + ct := gen.ScheduleCreateRequestContentType(opts.ContentType) body.ContentType = &ct } if opts.Vars != nil { body.Vars = &opts.Vars } - resp, err := s.client.PostNodeScheduleCronWithResponse(ctx, hostname, body) + resp, err := s.client.PostNodeScheduleWithResponse(ctx, hostname, body) if err != nil { return nil, fmt.Errorf("cron create: %w", err) } @@ -148,13 +148,13 @@ func (s *CronService) Create( } // Update updates an existing cron entry on the target host. -func (s *CronService) Update( +func (s *ScheduleService) Update( ctx context.Context, hostname string, name string, - opts CronUpdateOpts, -) (*Response[Collection[CronMutationResult]], error) { - body := gen.CronUpdateRequest{} + opts ScheduleUpdateOpts, +) (*Response[Collection[ScheduleMutationResult]], error) { + body := gen.ScheduleUpdateRequest{} if opts.Object != "" { body.Object = &opts.Object } @@ -165,14 +165,14 @@ func (s *CronService) Update( body.User = &opts.User } if opts.ContentType != "" { - ct := gen.CronUpdateRequestContentType(opts.ContentType) + ct := gen.ScheduleUpdateRequestContentType(opts.ContentType) body.ContentType = &ct } if opts.Vars != nil { body.Vars = &opts.Vars } - resp, err := s.client.PutNodeScheduleCronWithResponse(ctx, hostname, name, body) + resp, err := s.client.PutNodeScheduleWithResponse(ctx, hostname, name, body) if err != nil { return nil, fmt.Errorf("cron update: %w", err) } @@ -199,12 +199,12 @@ func (s *CronService) Update( } // Delete deletes a cron entry on the target host. -func (s *CronService) Delete( +func (s *ScheduleService) Delete( ctx context.Context, hostname string, name string, -) (*Response[Collection[CronMutationResult]], error) { - resp, err := s.client.DeleteNodeScheduleCronWithResponse(ctx, hostname, name) +) (*Response[Collection[ScheduleMutationResult]], error) { + resp, err := s.client.DeleteNodeScheduleWithResponse(ctx, hostname, name) if err != nil { return nil, fmt.Errorf("cron delete: %w", err) } diff --git a/pkg/sdk/client/cron_public_test.go b/pkg/sdk/client/schedule_public_test.go similarity index 84% rename from pkg/sdk/client/cron_public_test.go rename to pkg/sdk/client/schedule_public_test.go index 170a00f25..8e4f52cfc 100644 --- a/pkg/sdk/client/cron_public_test.go +++ b/pkg/sdk/client/schedule_public_test.go @@ -33,22 +33,22 @@ import ( "github.com/osapi-io/osapi/pkg/sdk/client" ) -type CronPublicTestSuite struct { +type SchedulePublicTestSuite struct { suite.Suite ctx context.Context } -func (suite *CronPublicTestSuite) SetupTest() { +func (suite *SchedulePublicTestSuite) SetupTest() { suite.ctx = context.Background() } -func (suite *CronPublicTestSuite) TestCronList() { +func (suite *SchedulePublicTestSuite) TestScheduleList() { tests := []struct { name string handler http.HandlerFunc serverURL string - validateFunc func(*client.Response[client.Collection[client.CronEntryResult]], error) + validateFunc func(*client.Response[client.Collection[client.ScheduleEntryResult]], error) }{ { name: "when listing cron entries returns results", @@ -62,7 +62,7 @@ func (suite *CronPublicTestSuite) TestCronList() { ) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.NoError(err) @@ -88,7 +88,7 @@ func (suite *CronPublicTestSuite) TestCronList() { ) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.NoError(err) @@ -107,14 +107,14 @@ func (suite *CronPublicTestSuite) TestCronList() { }, }, { - name: "when CronList server returns 403 returns AuthError", + name: "when ScheduleList server returns 403 returns AuthError", handler: func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusForbidden) _, _ = w.Write([]byte(`{"error":"forbidden"}`)) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.Error(err) @@ -129,7 +129,7 @@ func (suite *CronPublicTestSuite) TestCronList() { name: "when client HTTP call fails returns error", serverURL: "http://127.0.0.1:0", validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.Error(err) @@ -143,7 +143,7 @@ func (suite *CronPublicTestSuite) TestCronList() { w.WriteHeader(http.StatusOK) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.Error(err) @@ -180,18 +180,18 @@ func (suite *CronPublicTestSuite) TestCronList() { client.WithLogger(slog.Default()), ) - resp, err := sut.Cron.List(suite.ctx, "_any") + resp, err := sut.Schedule.List(suite.ctx, "_any") tc.validateFunc(resp, err) }) } } -func (suite *CronPublicTestSuite) TestCronGet() { +func (suite *SchedulePublicTestSuite) TestScheduleGet() { tests := []struct { name string handler http.HandlerFunc serverURL string - validateFunc func(*client.Response[client.Collection[client.CronEntryResult]], error) + validateFunc func(*client.Response[client.Collection[client.ScheduleEntryResult]], error) }{ { name: "when getting cron entry returns result collection", @@ -205,7 +205,7 @@ func (suite *CronPublicTestSuite) TestCronGet() { ) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.NoError(err) @@ -231,7 +231,7 @@ func (suite *CronPublicTestSuite) TestCronGet() { ) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.NoError(err) @@ -254,7 +254,7 @@ func (suite *CronPublicTestSuite) TestCronGet() { ) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.NoError(err) @@ -270,7 +270,7 @@ func (suite *CronPublicTestSuite) TestCronGet() { _, _ = w.Write([]byte(`{"error":"cron entry not found"}`)) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.Error(err) @@ -289,7 +289,7 @@ func (suite *CronPublicTestSuite) TestCronGet() { _, _ = w.Write([]byte(`{"error":"forbidden"}`)) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.Error(err) @@ -304,7 +304,7 @@ func (suite *CronPublicTestSuite) TestCronGet() { name: "when client HTTP call fails returns error", serverURL: "http://127.0.0.1:0", validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.Error(err) @@ -318,7 +318,7 @@ func (suite *CronPublicTestSuite) TestCronGet() { w.WriteHeader(http.StatusOK) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronEntryResult]], + resp *client.Response[client.Collection[client.ScheduleEntryResult]], err error, ) { suite.Error(err) @@ -355,19 +355,19 @@ func (suite *CronPublicTestSuite) TestCronGet() { client.WithLogger(slog.Default()), ) - resp, err := sut.Cron.Get(suite.ctx, "_any", "backup") + resp, err := sut.Schedule.Get(suite.ctx, "_any", "backup") tc.validateFunc(resp, err) }) } } -func (suite *CronPublicTestSuite) TestCronCreate() { +func (suite *SchedulePublicTestSuite) TestScheduleCreate() { tests := []struct { name string handler http.HandlerFunc serverURL string - opts client.CronCreateOpts - validateFunc func(*client.Response[client.Collection[client.CronMutationResult]], error) + opts client.ScheduleCreateOpts + validateFunc func(*client.Response[client.Collection[client.ScheduleMutationResult]], error) }{ { name: "when creating cron entry returns result collection", @@ -380,13 +380,13 @@ func (suite *CronPublicTestSuite) TestCronCreate() { ), ) }, - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "backup", Schedule: "0 2 * * *", Object: "/usr/bin/backup.sh", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -409,14 +409,14 @@ func (suite *CronPublicTestSuite) TestCronCreate() { ), ) }, - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "cleanup", Schedule: "*/5 * * * *", Object: "/usr/bin/cleanup.sh", User: "www-data", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -437,13 +437,13 @@ func (suite *CronPublicTestSuite) TestCronCreate() { ), ) }, - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "daily-backup", Interval: "daily", Object: "/usr/bin/backup.sh", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -464,7 +464,7 @@ func (suite *CronPublicTestSuite) TestCronCreate() { ), ) }, - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "template-job", Schedule: "0 1 * * *", Object: "/usr/bin/template-job.sh", @@ -472,7 +472,7 @@ func (suite *CronPublicTestSuite) TestCronCreate() { Vars: map[string]any{"env": "prod"}, }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -493,13 +493,13 @@ func (suite *CronPublicTestSuite) TestCronCreate() { ), ) }, - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "backup", Schedule: "0 2 * * *", Object: "/usr/bin/backup.sh", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -514,13 +514,13 @@ func (suite *CronPublicTestSuite) TestCronCreate() { w.WriteHeader(http.StatusBadRequest) _, _ = w.Write([]byte(`{"error":"invalid schedule"}`)) }, - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "bad", Schedule: "invalid", Object: "echo", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -538,13 +538,13 @@ func (suite *CronPublicTestSuite) TestCronCreate() { w.WriteHeader(http.StatusForbidden) _, _ = w.Write([]byte(`{"error":"forbidden"}`)) }, - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "backup", Schedule: "0 2 * * *", Object: "/usr/bin/backup.sh", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -558,13 +558,13 @@ func (suite *CronPublicTestSuite) TestCronCreate() { { name: "when client HTTP call fails returns error", serverURL: "http://127.0.0.1:0", - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "backup", Schedule: "0 2 * * *", Object: "/usr/bin/backup.sh", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -577,13 +577,13 @@ func (suite *CronPublicTestSuite) TestCronCreate() { handler: func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) }, - opts: client.CronCreateOpts{ + opts: client.ScheduleCreateOpts{ Name: "backup", Schedule: "0 2 * * *", Object: "/usr/bin/backup.sh", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -620,19 +620,19 @@ func (suite *CronPublicTestSuite) TestCronCreate() { client.WithLogger(slog.Default()), ) - resp, err := sut.Cron.Create(suite.ctx, "_any", tc.opts) + resp, err := sut.Schedule.Create(suite.ctx, "_any", tc.opts) tc.validateFunc(resp, err) }) } } -func (suite *CronPublicTestSuite) TestCronUpdate() { +func (suite *SchedulePublicTestSuite) TestScheduleUpdate() { tests := []struct { name string handler http.HandlerFunc serverURL string - opts client.CronUpdateOpts - validateFunc func(*client.Response[client.Collection[client.CronMutationResult]], error) + opts client.ScheduleUpdateOpts + validateFunc func(*client.Response[client.Collection[client.ScheduleMutationResult]], error) }{ { name: "when updating cron entry returns result collection", @@ -645,11 +645,11 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { ), ) }, - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Schedule: "0 3 * * *", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -670,13 +670,13 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { ), ) }, - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Schedule: "0 4 * * *", Object: "/usr/bin/new-backup.sh", User: "admin", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -696,13 +696,13 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { ), ) }, - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Object: "/usr/bin/new-template.sh", ContentType: "template", Vars: map[string]any{"region": "us-east"}, }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -723,11 +723,11 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { ), ) }, - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Schedule: "0 3 * * *", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -742,11 +742,11 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { w.WriteHeader(http.StatusNotFound) _, _ = w.Write([]byte(`{"error":"cron entry not found"}`)) }, - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Schedule: "0 3 * * *", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -764,11 +764,11 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { w.WriteHeader(http.StatusBadRequest) _, _ = w.Write([]byte(`{"error":"invalid schedule"}`)) }, - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Schedule: "bad", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -786,11 +786,11 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { w.WriteHeader(http.StatusForbidden) _, _ = w.Write([]byte(`{"error":"forbidden"}`)) }, - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Schedule: "0 3 * * *", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -804,11 +804,11 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { { name: "when client HTTP call fails returns error", serverURL: "http://127.0.0.1:0", - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Schedule: "0 3 * * *", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -821,11 +821,11 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { handler: func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) }, - opts: client.CronUpdateOpts{ + opts: client.ScheduleUpdateOpts{ Schedule: "0 3 * * *", }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -862,7 +862,7 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { client.WithLogger(slog.Default()), ) - resp, err := sut.Cron.Update( + resp, err := sut.Schedule.Update( suite.ctx, "_any", "backup", @@ -873,12 +873,12 @@ func (suite *CronPublicTestSuite) TestCronUpdate() { } } -func (suite *CronPublicTestSuite) TestCronDelete() { +func (suite *SchedulePublicTestSuite) TestScheduleDelete() { tests := []struct { name string handler http.HandlerFunc serverURL string - validateFunc func(*client.Response[client.Collection[client.CronMutationResult]], error) + validateFunc func(*client.Response[client.Collection[client.ScheduleMutationResult]], error) }{ { name: "when deleting cron entry returns result collection", @@ -892,7 +892,7 @@ func (suite *CronPublicTestSuite) TestCronDelete() { ) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -914,7 +914,7 @@ func (suite *CronPublicTestSuite) TestCronDelete() { ) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.NoError(err) @@ -930,7 +930,7 @@ func (suite *CronPublicTestSuite) TestCronDelete() { _, _ = w.Write([]byte(`{"error":"cron entry not found"}`)) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -949,7 +949,7 @@ func (suite *CronPublicTestSuite) TestCronDelete() { _, _ = w.Write([]byte(`{"error":"forbidden"}`)) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -964,7 +964,7 @@ func (suite *CronPublicTestSuite) TestCronDelete() { name: "when client HTTP call fails returns error", serverURL: "http://127.0.0.1:0", validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -978,7 +978,7 @@ func (suite *CronPublicTestSuite) TestCronDelete() { w.WriteHeader(http.StatusOK) }, validateFunc: func( - resp *client.Response[client.Collection[client.CronMutationResult]], + resp *client.Response[client.Collection[client.ScheduleMutationResult]], err error, ) { suite.Error(err) @@ -1015,14 +1015,14 @@ func (suite *CronPublicTestSuite) TestCronDelete() { client.WithLogger(slog.Default()), ) - resp, err := sut.Cron.Delete(suite.ctx, "_any", "backup") + resp, err := sut.Schedule.Delete(suite.ctx, "_any", "backup") tc.validateFunc(resp, err) }) } } -func TestCronPublicTestSuite( +func TestSchedulePublicTestSuite( t *testing.T, ) { - suite.Run(t, new(CronPublicTestSuite)) + suite.Run(t, new(SchedulePublicTestSuite)) } diff --git a/pkg/sdk/client/cron_types.go b/pkg/sdk/client/schedule_types.go similarity index 68% rename from pkg/sdk/client/cron_types.go rename to pkg/sdk/client/schedule_types.go index ff030a309..13782099b 100644 --- a/pkg/sdk/client/cron_types.go +++ b/pkg/sdk/client/schedule_types.go @@ -24,8 +24,8 @@ import ( "github.com/osapi-io/osapi/pkg/sdk/client/gen" ) -// CronEntryResult represents a cron entry from a single agent. -type CronEntryResult struct { +// ScheduleEntryResult represents a cron entry from a single agent. +type ScheduleEntryResult struct { Hostname string `json:"hostname,omitempty"` Status string `json:"status"` Name string `json:"name"` @@ -37,8 +37,8 @@ type CronEntryResult struct { Error string `json:"error,omitempty"` } -// CronMutationResult represents the result of a cron create/update/delete operation. -type CronMutationResult struct { +// ScheduleMutationResult represents the result of a cron create/update/delete operation. +type ScheduleMutationResult struct { Hostname string `json:"hostname,omitempty"` Status string `json:"status"` Name string `json:"name"` @@ -46,8 +46,8 @@ type CronMutationResult struct { Error string `json:"error,omitempty"` } -// CronCreateOpts contains options for creating a cron entry. -type CronCreateOpts struct { +// ScheduleCreateOpts contains options for creating a cron entry. +type ScheduleCreateOpts struct { // Name is the cron drop-in entry name (required). Name string // Object is the name of the uploaded file in the object store (required). @@ -65,8 +65,8 @@ type CronCreateOpts struct { Vars map[string]any } -// CronUpdateOpts contains options for updating a cron entry. -type CronUpdateOpts struct { +// ScheduleUpdateOpts contains options for updating a cron entry. +type ScheduleUpdateOpts struct { // Object is the new object to deploy (optional). Object string // Schedule is the cron expression (optional). @@ -79,19 +79,19 @@ type CronUpdateOpts struct { Vars map[string]any } -// cronEntryCollectionFromGen converts a gen.CronCollectionResponse -// to a Collection[CronEntryResult]. +// cronEntryCollectionFromGen converts a gen.ScheduleCollectionResponse +// to a Collection[ScheduleEntryResult]. func cronEntryCollectionFromGen( - g *gen.CronCollectionResponse, -) Collection[CronEntryResult] { - results := make([]CronEntryResult, 0, len(g.Results)) + g *gen.ScheduleCollectionResponse, +) Collection[ScheduleEntryResult] { + results := make([]ScheduleEntryResult, 0, len(g.Results)) for _, r := range g.Results { var interval string if r.Interval != nil { interval = string(*r.Interval) } - results = append(results, CronEntryResult{ + results = append(results, ScheduleEntryResult{ Hostname: r.Hostname, Status: string(r.Status), Name: derefString(r.Name), @@ -104,25 +104,25 @@ func cronEntryCollectionFromGen( }) } - return Collection[CronEntryResult]{ + return Collection[ScheduleEntryResult]{ Results: results, JobID: jobIDFromGen(g.JobId), } } -// cronGetCollectionFromGen converts a gen.CronGetResponse -// to a Collection[CronEntryResult]. +// cronGetCollectionFromGen converts a gen.ScheduleGetResponse +// to a Collection[ScheduleEntryResult]. func cronGetCollectionFromGen( - g *gen.CronGetResponse, -) Collection[CronEntryResult] { - results := make([]CronEntryResult, 0, len(g.Results)) + g *gen.ScheduleGetResponse, +) Collection[ScheduleEntryResult] { + results := make([]ScheduleEntryResult, 0, len(g.Results)) for _, r := range g.Results { var interval string if r.Interval != nil { interval = string(*r.Interval) } - results = append(results, CronEntryResult{ + results = append(results, ScheduleEntryResult{ Hostname: r.Hostname, Status: string(r.Status), Name: derefString(r.Name), @@ -135,20 +135,20 @@ func cronGetCollectionFromGen( }) } - return Collection[CronEntryResult]{ + return Collection[ScheduleEntryResult]{ Results: results, JobID: jobIDFromGen(g.JobId), } } -// cronMutationCollectionFromCreate converts a gen.CronCreateResponse -// to a Collection[CronMutationResult]. +// cronMutationCollectionFromCreate converts a gen.ScheduleCreateResponse +// to a Collection[ScheduleMutationResult]. func cronMutationCollectionFromCreate( - g *gen.CronCreateResponse, -) Collection[CronMutationResult] { - results := make([]CronMutationResult, 0, len(g.Results)) + g *gen.ScheduleCreateResponse, +) Collection[ScheduleMutationResult] { + results := make([]ScheduleMutationResult, 0, len(g.Results)) for _, r := range g.Results { - results = append(results, CronMutationResult{ + results = append(results, ScheduleMutationResult{ Hostname: r.Hostname, Status: string(r.Status), Name: derefString(r.Name), @@ -157,20 +157,20 @@ func cronMutationCollectionFromCreate( }) } - return Collection[CronMutationResult]{ + return Collection[ScheduleMutationResult]{ Results: results, JobID: jobIDFromGen(g.JobId), } } -// cronMutationCollectionFromUpdate converts a gen.CronUpdateResponse -// to a Collection[CronMutationResult]. +// cronMutationCollectionFromUpdate converts a gen.ScheduleUpdateResponse +// to a Collection[ScheduleMutationResult]. func cronMutationCollectionFromUpdate( - g *gen.CronUpdateResponse, -) Collection[CronMutationResult] { - results := make([]CronMutationResult, 0, len(g.Results)) + g *gen.ScheduleUpdateResponse, +) Collection[ScheduleMutationResult] { + results := make([]ScheduleMutationResult, 0, len(g.Results)) for _, r := range g.Results { - results = append(results, CronMutationResult{ + results = append(results, ScheduleMutationResult{ Hostname: r.Hostname, Status: string(r.Status), Name: derefString(r.Name), @@ -179,20 +179,20 @@ func cronMutationCollectionFromUpdate( }) } - return Collection[CronMutationResult]{ + return Collection[ScheduleMutationResult]{ Results: results, JobID: jobIDFromGen(g.JobId), } } -// cronMutationCollectionFromDelete converts a gen.CronDeleteResponse -// to a Collection[CronMutationResult]. +// cronMutationCollectionFromDelete converts a gen.ScheduleDeleteResponse +// to a Collection[ScheduleMutationResult]. func cronMutationCollectionFromDelete( - g *gen.CronDeleteResponse, -) Collection[CronMutationResult] { - results := make([]CronMutationResult, 0, len(g.Results)) + g *gen.ScheduleDeleteResponse, +) Collection[ScheduleMutationResult] { + results := make([]ScheduleMutationResult, 0, len(g.Results)) for _, r := range g.Results { - results = append(results, CronMutationResult{ + results = append(results, ScheduleMutationResult{ Hostname: r.Hostname, Status: string(r.Status), Name: derefString(r.Name), @@ -201,7 +201,7 @@ func cronMutationCollectionFromDelete( }) } - return Collection[CronMutationResult]{ + return Collection[ScheduleMutationResult]{ Results: results, JobID: jobIDFromGen(g.JobId), } diff --git a/ui/src/components/domain/result-card.tsx b/ui/src/components/domain/result-card.tsx index 3e875ff2c..d356b0cc5 100644 --- a/ui/src/components/domain/result-card.tsx +++ b/ui/src/components/domain/result-card.tsx @@ -10,7 +10,7 @@ import { import { SearchBox } from "@/components/ui/search-box"; import type { CommandResultItem, - CronMutationResult, + ScheduleMutationResult, DockerResponse, FileDeployResult, FileInfo, @@ -361,7 +361,7 @@ function ListSearchBar({ } // Cron list -function CronListResult({ +function ScheduleListResult({ data, onAction, }: { @@ -369,7 +369,7 @@ function CronListResult({ onAction?: (action: string, name: string) => void; }) { const { search, setSearch } = useListSearch(); - type CronListEntry = { + type ScheduleListEntry = { hostname?: string; status?: string; name?: string; @@ -378,8 +378,8 @@ function CronListResult({ source?: string; error?: string; }; - const entries = data.results as CronListEntry[]; - const byHost = new Map(); + const entries = data.results as ScheduleListEntry[]; + const byHost = new Map(); for (const e of entries) { const h = e.hostname ?? "unknown"; if (!byHost.has(h)) byHost.set(h, []); @@ -403,10 +403,10 @@ function CronListResult({ const isSkipped = hostEntry?.status === "skipped"; const hostError = !isSkipped && items.find((e) => e.error && !e.name); const allCronEntries = isSkipped ? [] : items.filter((e) => e.name); - const cronEntries = allCronEntries.filter((e) => + const scheduleEntries = allCronEntries.filter((e) => matches(search, e.name, e.schedule, e.object, e.source), ); - if (search && cronEntries.length === 0 && !isSkipped && !hostError) + if (search && scheduleEntries.length === 0 && !isSkipped && !hostError) return null; return (
{hostError && ( - {(hostError as CronListEntry).error} + {(hostError as ScheduleListEntry).error} )} - {cronEntries.map((e, i) => ( + {scheduleEntries.map((e, i) => (
; + return ; } // Docker create/start/stop/delete/pull/rm-image — action results @@ -1842,7 +1842,7 @@ export function ResultCard({ type, result, onAction }: ResultCardProps) { // Cron get — per-host single entry if (type === "cron-get" && Array.isArray(data.results)) { - type CronGetEntry = { + type ScheduleGetEntry = { hostname?: string; status?: string; name?: string; @@ -1850,7 +1850,7 @@ export function ResultCard({ type, result, onAction }: ResultCardProps) { object?: string; error?: string; }; - const entries = data.results as CronGetEntry[]; + const entries = data.results as ScheduleGetEntry[]; return ( ; onChange: (data: Record) => void; onStatusChange: (status: BlockStatus) => void; upstreamObjects?: string[]; } -export function CronBlock({ +export function ScheduleBlock({ data, onChange, onStatusChange, upstreamObjects = [], -}: CronBlockProps) { +}: ScheduleBlockProps) { const name = (data.name as string) || ""; const schedule = (data.schedule as string) || ""; const object = (data.object as string) || ""; diff --git a/ui/src/components/domain/cron-delete-block.tsx b/ui/src/components/domain/schedule-delete-block.tsx similarity index 79% rename from ui/src/components/domain/cron-delete-block.tsx rename to ui/src/components/domain/schedule-delete-block.tsx index 7030ed14f..a4dc7c575 100644 --- a/ui/src/components/domain/cron-delete-block.tsx +++ b/ui/src/components/domain/schedule-delete-block.tsx @@ -1,18 +1,18 @@ import { useEffect, useRef } from "react"; -import { CronPicker } from "@/components/domain/cron-picker"; +import { SchedulePicker } from "@/components/domain/schedule-picker"; import type { BlockStatus } from "@/hooks/use-stack"; -interface CronDeleteBlockProps { +interface ScheduleDeleteBlockProps { data: Record; onChange: (data: Record) => void; onStatusChange: (status: BlockStatus) => void; } -export function CronDeleteBlock({ +export function ScheduleDeleteBlock({ data, onChange, onStatusChange, -}: CronDeleteBlockProps) { +}: ScheduleDeleteBlockProps) { const name = (data.name as string) || ""; const prevStatus = useRef(null); @@ -25,7 +25,7 @@ export function CronDeleteBlock({ }, [name, onStatusChange]); return ( - void; } -export function CronPicker({ id, label, value, onChange }: CronPickerProps) { - const [entries, setEntries] = useState([]); +export function SchedulePicker({ id, label, value, onChange }: SchedulePickerProps) { + const [entries, setEntries] = useState([]); const [open, setOpen] = useState(false); const [loading, setLoading] = useState(true); const ref = useRef(null); @@ -29,9 +29,9 @@ export function CronPicker({ id, label, value, onChange }: CronPickerProps) { let mounted = true; const fetch = async () => { try { - const result = await getNodeScheduleCron("_all"); + const result = await getNodeSchedule("_all"); if (mounted && result.status === 200) { - setEntries((result.data as CronCollectionResponse).results ?? []); + setEntries((result.data as ScheduleCollectionResponse).results ?? []); } } catch { // silent diff --git a/ui/src/pages/configure.tsx b/ui/src/pages/configure.tsx index 20678b21d..8bbbe8809 100644 --- a/ui/src/pages/configure.tsx +++ b/ui/src/pages/configure.tsx @@ -5,14 +5,14 @@ import { ContentArea } from "@/components/layout/content-area"; import { BlockCard } from "@/components/domain/block-card"; import { BlockStack } from "@/components/domain/block-stack"; import { ResultCard } from "@/components/domain/result-card"; -import { CronBlock } from "@/components/domain/cron-block"; +import { ScheduleBlock } from "@/components/domain/schedule-block"; import { CommandBlock } from "@/components/domain/command-block"; import { DockerBlock } from "@/components/domain/docker-block"; import { FileBlock } from "@/components/domain/file-block"; import { FileUploadBlock } from "@/components/domain/file-upload-block"; import { SingleInputBlock } from "@/components/domain/single-input-block"; import { FileDeleteBlock } from "@/components/domain/file-delete-block"; -import { CronDeleteBlock } from "@/components/domain/cron-delete-block"; +import { ScheduleDeleteBlock } from "@/components/domain/schedule-delete-block"; import { ContainerActionBlock } from "@/components/domain/container-action-block"; import { DockerExecBlock } from "@/components/domain/docker-exec-block"; import { DnsUpdateBlock } from "@/components/domain/dns-update-block"; @@ -45,12 +45,12 @@ import { useCommands } from "@/hooks/use-commands"; import { useStacks } from "@/hooks/use-stacks"; import { features } from "@/lib/features"; import { - postNodeScheduleCron, - getNodeScheduleCron, - deleteNodeScheduleCron, - getNodeScheduleCronByName, - putNodeScheduleCron, -} from "@/sdk/gen/schedule-management-api-cron-operations/schedule-management-api-cron-operations"; + postNodeSchedule, + getNodeSchedule, + deleteNodeSchedule, + getNodeScheduleByName, + putNodeSchedule, +} from "@/sdk/gen/schedule-management-api-schedule-operations/schedule-management-api-schedule-operations"; import { getNodeService, getNodeServiceByName, @@ -381,7 +381,7 @@ export function Configure() { switch (block.type) { case "cron-create": - result = await postNodeScheduleCron(t, { + result = await postNodeSchedule(t, { name: block.data.name as string, schedule: block.data.schedule as string, object: block.data.object as string, @@ -391,19 +391,19 @@ export function Configure() { }); break; case "cron-list": - result = await getNodeScheduleCron(t); + result = await getNodeSchedule(t); break; case "cron-delete": - result = await deleteNodeScheduleCron(t, block.data.name as string); + result = await deleteNodeSchedule(t, block.data.name as string); break; case "cron-get": - result = await getNodeScheduleCronByName( + result = await getNodeScheduleByName( t, block.data.name as string, ); break; case "cron-update": - result = await putNodeScheduleCron(t, block.data.name as string, { + result = await putNodeSchedule(t, block.data.name as string, { schedule: block.data.schedule as string, object: block.data.object as string, content_type: @@ -1029,7 +1029,7 @@ export function Configure() { switch (block.type) { case "cron-create": return ( - updateBlockData(block.id, data)} onStatusChange={(s: BlockStatus) => setBlockStatus(block.id, s)} @@ -1040,7 +1040,7 @@ export function Configure() { return null; case "cron-delete": return ( - updateBlockData(block.id, data)} onStatusChange={(s: BlockStatus) => setBlockStatus(block.id, s)} @@ -1059,7 +1059,7 @@ export function Configure() { ); case "cron-update": return ( - updateBlockData(block.id, data)} onStatusChange={(s: BlockStatus) => setBlockStatus(block.id, s)} @@ -1614,7 +1614,7 @@ export function Configure() { async (action: string, name: string) => { try { if (action === "cron-delete") { - await deleteNodeScheduleCron("_all", name); + await deleteNodeSchedule("_all", name); } else if (action === "file-delete") { await deleteFileByName(name); } diff --git a/ui/src/sdk/gen/api.yaml b/ui/src/sdk/gen/api.yaml index 91cfc7305..d5eddc26c 100644 --- a/ui/src/sdk/gen/api.yaml +++ b/ui/src/sdk/gen/api.yaml @@ -78,9 +78,9 @@ tags: - name: Process_Management_API_process_operations x-displayName: Node/Process description: Process management operations on a target node. - - name: Schedule_Management_API_cron_operations - x-displayName: Node/Schedule/Cron - description: Cron drop-in file management on a target node. + - name: Schedule_Management_API_schedule_operations + x-displayName: Node/Schedule + description: Scheduled task management on a target node. - name: Service_Management_API_service_operations x-displayName: Node/Service description: Systemd service management on a target node. @@ -4310,27 +4310,27 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - /api/node/{hostname}/schedule/cron: + /api/node/{hostname}/schedule: servers: [] get: - summary: List all cron entries + summary: List all scheduled entries description: | - List all cron drop-in entries on the target node. + List all scheduled entries on the target node. tags: - - Schedule_Management_API_cron_operations - operationId: GetNodeScheduleCron + - Schedule_Management_API_schedule_operations + operationId: GetNodeSchedule security: - BearerAuth: - - cron:read + - schedule:read parameters: - $ref: '#/components/parameters/Hostname' responses: '200': - description: List of cron entries. + description: List of scheduled entries. content: application/json: schema: - $ref: '#/components/schemas/CronCollectionResponse' + $ref: '#/components/schemas/ScheduleCollectionResponse' '400': description: Bad request - validation error. content: @@ -4350,37 +4350,37 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error listing cron entries. + description: Error listing scheduled entries. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' post: - summary: Create a cron entry + summary: Create a scheduled entry description: | - Create a new cron drop-in entry on the target node. + Create a new scheduled entry on the target node. tags: - - Schedule_Management_API_cron_operations - operationId: PostNodeScheduleCron + - Schedule_Management_API_schedule_operations + operationId: PostNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' requestBody: - description: Cron entry creation parameters. + description: Scheduled entry creation parameters. required: true content: application/json: schema: - $ref: '#/components/schemas/CronCreateRequest' + $ref: '#/components/schemas/ScheduleCreateRequest' responses: '200': - description: Cron entry created. + description: Scheduled entry created. content: application/json: schema: - $ref: '#/components/schemas/CronCreateResponse' + $ref: '#/components/schemas/ScheduleCreateResponse' '400': description: Invalid request payload. content: @@ -4400,33 +4400,33 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error creating cron entry. + description: Error creating scheduled entry. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - /api/node/{hostname}/schedule/cron/{name}: + /api/node/{hostname}/schedule/{name}: servers: [] get: - summary: Get a cron entry + summary: Get a scheduled entry description: | - Get a specific cron drop-in entry by name on the target node. + Get a specific scheduled entry by name on the target node. tags: - - Schedule_Management_API_cron_operations - operationId: GetNodeScheduleCronByName + - Schedule_Management_API_schedule_operations + operationId: GetNodeScheduleByName security: - BearerAuth: - - cron:read + - schedule:read parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' responses: '200': - description: Cron entry detail. + description: Scheduled entry detail. content: application/json: schema: - $ref: '#/components/schemas/CronGetResponse' + $ref: '#/components/schemas/ScheduleGetResponse' '400': description: Bad request - validation error. content: @@ -4446,44 +4446,44 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error retrieving cron entry. + description: Error retrieving scheduled entry. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' put: - summary: Update a cron entry + summary: Update a scheduled entry description: | - Update an existing cron drop-in entry on the target node. + Update an existing scheduled entry on the target node. tags: - - Schedule_Management_API_cron_operations - operationId: PutNodeScheduleCron + - Schedule_Management_API_schedule_operations + operationId: PutNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' requestBody: - description: Cron entry update parameters. + description: Scheduled entry update parameters. required: true content: application/json: schema: - $ref: '#/components/schemas/CronUpdateRequest' + $ref: '#/components/schemas/ScheduleUpdateRequest' responses: '200': - description: Cron entry updated. + description: Scheduled entry updated. content: application/json: schema: - $ref: '#/components/schemas/CronUpdateResponse' + $ref: '#/components/schemas/ScheduleUpdateResponse' '400': description: Invalid request payload. content: @@ -4503,37 +4503,37 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error updating cron entry. + description: Error updating scheduled entry. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' delete: - summary: Delete a cron entry + summary: Delete a scheduled entry description: | - Delete a cron drop-in entry from the target node. + Delete a scheduled entry from the target node. tags: - - Schedule_Management_API_cron_operations - operationId: DeleteNodeScheduleCron + - Schedule_Management_API_schedule_operations + operationId: DeleteNodeSchedule security: - BearerAuth: - - cron:write + - schedule:write parameters: - $ref: '#/components/parameters/Hostname' - - $ref: '#/components/parameters/CronName' + - $ref: '#/components/parameters/ScheduleName' responses: '200': - description: Cron entry deleted. + description: Scheduled entry deleted. content: application/json: schema: - $ref: '#/components/schemas/CronDeleteResponse' + $ref: '#/components/schemas/ScheduleDeleteResponse' '400': description: Bad request - validation error. content: @@ -4553,13 +4553,13 @@ paths: schema: $ref: '#/components/schemas/ErrorResponse' '404': - description: Cron entry not found. + description: Scheduled entry not found. content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '500': - description: Error deleting cron entry. + description: Error deleting scheduled entry. content: application/json: schema: @@ -9748,7 +9748,7 @@ components: $ref: '#/components/schemas/ProcessSignalResult' required: - results - CronCreateRequest: + ScheduleCreateRequest: type: object required: - name @@ -9757,15 +9757,15 @@ components: name: type: string description: > - Name for the cron drop-in entry. Used as the file name under + Name for the scheduled entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. x-oapi-codegen-extra-tags: validate: required,min=1,max=64 object: type: string description: > - Name of the uploaded file in the object store to deploy as the cron - entry content. + Name of the uploaded file in the object store to deploy as the + scheduled entry content. x-oapi-codegen-extra-tags: validate: required,min=1 schedule: @@ -9812,7 +9812,7 @@ components: additionalProperties: true description: | Template variables. Only used when content_type is "template". - CronUpdateRequest: + ScheduleUpdateRequest: type: object properties: object: @@ -9844,9 +9844,9 @@ components: additionalProperties: true description: | Template variables. - CronEntry: + ScheduleEntry: type: object - description: A cron drop-in entry. + description: A scheduled entry. properties: hostname: type: string @@ -9861,7 +9861,7 @@ components: description: The status of the operation for this host. name: type: string - description: Cron entry name. + description: Scheduled entry name. object: type: string description: Object store name for the deployed content. @@ -9886,14 +9886,14 @@ components: "monthly". user: type: string - description: User the cron entry runs as. + description: User the scheduled entry runs as. error: type: string description: Error message if the agent failed to retrieve this entry. required: - hostname - status - CronCollectionResponse: + ScheduleCollectionResponse: type: object properties: job_id: @@ -9904,12 +9904,12 @@ components: results: type: array items: - $ref: '#/components/schemas/CronEntry' + $ref: '#/components/schemas/ScheduleEntry' required: - results - CronGetResponse: + ScheduleGetResponse: type: object - description: Collection response for a single cron entry get operation. + description: Collection response for a single scheduled entry get operation. properties: job_id: type: string @@ -9919,10 +9919,10 @@ components: results: type: array items: - $ref: '#/components/schemas/CronEntry' + $ref: '#/components/schemas/ScheduleEntry' required: - results - CronMutationResult: + ScheduleMutationResult: type: object description: Result of a cron create, update, or delete operation for one host. properties: @@ -9939,7 +9939,7 @@ components: description: The status of the operation for this host. name: type: string - description: Cron entry name. + description: Scheduled entry name. changed: type: boolean description: Whether the operation modified system state. @@ -9949,7 +9949,7 @@ components: required: - hostname - status - CronCreateResponse: + ScheduleCreateResponse: type: object properties: job_id: @@ -9960,10 +9960,10 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results - CronUpdateResponse: + ScheduleUpdateResponse: type: object properties: job_id: @@ -9974,10 +9974,10 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results - CronDeleteResponse: + ScheduleDeleteResponse: type: object properties: job_id: @@ -9988,7 +9988,7 @@ components: results: type: array items: - $ref: '#/components/schemas/CronMutationResult' + $ref: '#/components/schemas/ScheduleMutationResult' required: - results ServiceCreateRequest: @@ -10952,13 +10952,13 @@ components: schema: type: integer minimum: 1 - CronName: + ScheduleName: name: name in: path required: true description: > - Cron entry name. Must contain only alphanumeric characters, underscores, - and hyphens. + Scheduled entry name. Must contain only alphanumeric characters, + underscores, and hyphens. x-oapi-codegen-extra-tags: validate: required,min=1 schema: @@ -11095,7 +11095,7 @@ x-tagGroups: - Process_Management_API_process_operations - name: Schedule Management API tags: - - Schedule_Management_API_cron_operations + - Schedule_Management_API_schedule_operations - name: Service Management API tags: - Service_Management_API_service_operations diff --git a/ui/src/sdk/gen/schedule-management-api-cron-operations/schedule-management-api-cron-operations.ts b/ui/src/sdk/gen/schedule-management-api-cron-operations/schedule-management-api-cron-operations.ts deleted file mode 100644 index 59ad2d63e..000000000 --- a/ui/src/sdk/gen/schedule-management-api-cron-operations/schedule-management-api-cron-operations.ts +++ /dev/null @@ -1,339 +0,0 @@ -/** - * Generated by orval 🍺 - * Do not edit manually. - * Agent Management API - * OpenAPI spec version: 1.0.0 - */ -import type { - CronCollectionResponse, - CronCreateRequest, - CronCreateResponse, - CronDeleteResponse, - CronGetResponse, - CronUpdateRequest, - CronUpdateResponse, - ErrorResponse -} from '../schemas'; - -import { apiFetch } from '../../fetch'; - -/** - * List all cron drop-in entries on the target node. - - * @summary List all cron entries - */ -export type getNodeScheduleCronResponse200 = { - data: CronCollectionResponse - status: 200 -} - -export type getNodeScheduleCronResponse400 = { - data: ErrorResponse - status: 400 -} - -export type getNodeScheduleCronResponse401 = { - data: ErrorResponse - status: 401 -} - -export type getNodeScheduleCronResponse403 = { - data: ErrorResponse - status: 403 -} - -export type getNodeScheduleCronResponse500 = { - data: ErrorResponse - status: 500 -} - -export type getNodeScheduleCronResponseSuccess = (getNodeScheduleCronResponse200) & { - headers: Headers; -}; -export type getNodeScheduleCronResponseError = (getNodeScheduleCronResponse400 | getNodeScheduleCronResponse401 | getNodeScheduleCronResponse403 | getNodeScheduleCronResponse500) & { - headers: Headers; -}; - -export type getNodeScheduleCronResponse = (getNodeScheduleCronResponseSuccess | getNodeScheduleCronResponseError) - -export const getGetNodeScheduleCronUrl = (hostname: string,) => { - - - - - return `/api/node/${hostname}/schedule/cron` -} - -export const getNodeScheduleCron = async (hostname: string, options?: RequestInit): Promise => { - - return apiFetch(getGetNodeScheduleCronUrl(hostname), - { - ...options, - method: 'GET' - - - } -);} - - -/** - * Create a new cron drop-in entry on the target node. - - * @summary Create a cron entry - */ -export type postNodeScheduleCronResponse200 = { - data: CronCreateResponse - status: 200 -} - -export type postNodeScheduleCronResponse400 = { - data: ErrorResponse - status: 400 -} - -export type postNodeScheduleCronResponse401 = { - data: ErrorResponse - status: 401 -} - -export type postNodeScheduleCronResponse403 = { - data: ErrorResponse - status: 403 -} - -export type postNodeScheduleCronResponse500 = { - data: ErrorResponse - status: 500 -} - -export type postNodeScheduleCronResponseSuccess = (postNodeScheduleCronResponse200) & { - headers: Headers; -}; -export type postNodeScheduleCronResponseError = (postNodeScheduleCronResponse400 | postNodeScheduleCronResponse401 | postNodeScheduleCronResponse403 | postNodeScheduleCronResponse500) & { - headers: Headers; -}; - -export type postNodeScheduleCronResponse = (postNodeScheduleCronResponseSuccess | postNodeScheduleCronResponseError) - -export const getPostNodeScheduleCronUrl = (hostname: string,) => { - - - - - return `/api/node/${hostname}/schedule/cron` -} - -export const postNodeScheduleCron = async (hostname: string, - cronCreateRequest: CronCreateRequest, options?: RequestInit): Promise => { - - return apiFetch(getPostNodeScheduleCronUrl(hostname), - { - ...options, - method: 'POST', - headers: { 'Content-Type': 'application/json', ...options?.headers }, - body: JSON.stringify( - cronCreateRequest,) - } -);} - - -/** - * Get a specific cron drop-in entry by name on the target node. - - * @summary Get a cron entry - */ -export type getNodeScheduleCronByNameResponse200 = { - data: CronGetResponse - status: 200 -} - -export type getNodeScheduleCronByNameResponse400 = { - data: ErrorResponse - status: 400 -} - -export type getNodeScheduleCronByNameResponse401 = { - data: ErrorResponse - status: 401 -} - -export type getNodeScheduleCronByNameResponse403 = { - data: ErrorResponse - status: 403 -} - -export type getNodeScheduleCronByNameResponse404 = { - data: ErrorResponse - status: 404 -} - -export type getNodeScheduleCronByNameResponse500 = { - data: ErrorResponse - status: 500 -} - -export type getNodeScheduleCronByNameResponseSuccess = (getNodeScheduleCronByNameResponse200) & { - headers: Headers; -}; -export type getNodeScheduleCronByNameResponseError = (getNodeScheduleCronByNameResponse400 | getNodeScheduleCronByNameResponse401 | getNodeScheduleCronByNameResponse403 | getNodeScheduleCronByNameResponse404 | getNodeScheduleCronByNameResponse500) & { - headers: Headers; -}; - -export type getNodeScheduleCronByNameResponse = (getNodeScheduleCronByNameResponseSuccess | getNodeScheduleCronByNameResponseError) - -export const getGetNodeScheduleCronByNameUrl = (hostname: string, - name: string,) => { - - - - - return `/api/node/${hostname}/schedule/cron/${name}` -} - -export const getNodeScheduleCronByName = async (hostname: string, - name: string, options?: RequestInit): Promise => { - - return apiFetch(getGetNodeScheduleCronByNameUrl(hostname,name), - { - ...options, - method: 'GET' - - - } -);} - - -/** - * Update an existing cron drop-in entry on the target node. - - * @summary Update a cron entry - */ -export type putNodeScheduleCronResponse200 = { - data: CronUpdateResponse - status: 200 -} - -export type putNodeScheduleCronResponse400 = { - data: ErrorResponse - status: 400 -} - -export type putNodeScheduleCronResponse401 = { - data: ErrorResponse - status: 401 -} - -export type putNodeScheduleCronResponse403 = { - data: ErrorResponse - status: 403 -} - -export type putNodeScheduleCronResponse404 = { - data: ErrorResponse - status: 404 -} - -export type putNodeScheduleCronResponse500 = { - data: ErrorResponse - status: 500 -} - -export type putNodeScheduleCronResponseSuccess = (putNodeScheduleCronResponse200) & { - headers: Headers; -}; -export type putNodeScheduleCronResponseError = (putNodeScheduleCronResponse400 | putNodeScheduleCronResponse401 | putNodeScheduleCronResponse403 | putNodeScheduleCronResponse404 | putNodeScheduleCronResponse500) & { - headers: Headers; -}; - -export type putNodeScheduleCronResponse = (putNodeScheduleCronResponseSuccess | putNodeScheduleCronResponseError) - -export const getPutNodeScheduleCronUrl = (hostname: string, - name: string,) => { - - - - - return `/api/node/${hostname}/schedule/cron/${name}` -} - -export const putNodeScheduleCron = async (hostname: string, - name: string, - cronUpdateRequest: CronUpdateRequest, options?: RequestInit): Promise => { - - return apiFetch(getPutNodeScheduleCronUrl(hostname,name), - { - ...options, - method: 'PUT', - headers: { 'Content-Type': 'application/json', ...options?.headers }, - body: JSON.stringify( - cronUpdateRequest,) - } -);} - - -/** - * Delete a cron drop-in entry from the target node. - - * @summary Delete a cron entry - */ -export type deleteNodeScheduleCronResponse200 = { - data: CronDeleteResponse - status: 200 -} - -export type deleteNodeScheduleCronResponse400 = { - data: ErrorResponse - status: 400 -} - -export type deleteNodeScheduleCronResponse401 = { - data: ErrorResponse - status: 401 -} - -export type deleteNodeScheduleCronResponse403 = { - data: ErrorResponse - status: 403 -} - -export type deleteNodeScheduleCronResponse404 = { - data: ErrorResponse - status: 404 -} - -export type deleteNodeScheduleCronResponse500 = { - data: ErrorResponse - status: 500 -} - -export type deleteNodeScheduleCronResponseSuccess = (deleteNodeScheduleCronResponse200) & { - headers: Headers; -}; -export type deleteNodeScheduleCronResponseError = (deleteNodeScheduleCronResponse400 | deleteNodeScheduleCronResponse401 | deleteNodeScheduleCronResponse403 | deleteNodeScheduleCronResponse404 | deleteNodeScheduleCronResponse500) & { - headers: Headers; -}; - -export type deleteNodeScheduleCronResponse = (deleteNodeScheduleCronResponseSuccess | deleteNodeScheduleCronResponseError) - -export const getDeleteNodeScheduleCronUrl = (hostname: string, - name: string,) => { - - - - - return `/api/node/${hostname}/schedule/cron/${name}` -} - -export const deleteNodeScheduleCron = async (hostname: string, - name: string, options?: RequestInit): Promise => { - - return apiFetch(getDeleteNodeScheduleCronUrl(hostname,name), - { - ...options, - method: 'DELETE' - - - } -);} - - diff --git a/ui/src/sdk/gen/schedule-management-api-schedule-operations/schedule-management-api-schedule-operations.ts b/ui/src/sdk/gen/schedule-management-api-schedule-operations/schedule-management-api-schedule-operations.ts new file mode 100644 index 000000000..d40405c51 --- /dev/null +++ b/ui/src/sdk/gen/schedule-management-api-schedule-operations/schedule-management-api-schedule-operations.ts @@ -0,0 +1,339 @@ +/** + * Generated by orval 🍺 + * Do not edit manually. + * Agent Management API + * OpenAPI spec version: 1.0.0 + */ +import type { + ErrorResponse, + ScheduleCollectionResponse, + ScheduleCreateRequest, + ScheduleCreateResponse, + ScheduleDeleteResponse, + ScheduleGetResponse, + ScheduleUpdateRequest, + ScheduleUpdateResponse +} from '../schemas'; + +import { apiFetch } from '../../fetch'; + +/** + * List all scheduled entries on the target node. + + * @summary List all scheduled entries + */ +export type getNodeScheduleResponse200 = { + data: ScheduleCollectionResponse + status: 200 +} + +export type getNodeScheduleResponse400 = { + data: ErrorResponse + status: 400 +} + +export type getNodeScheduleResponse401 = { + data: ErrorResponse + status: 401 +} + +export type getNodeScheduleResponse403 = { + data: ErrorResponse + status: 403 +} + +export type getNodeScheduleResponse500 = { + data: ErrorResponse + status: 500 +} + +export type getNodeScheduleResponseSuccess = (getNodeScheduleResponse200) & { + headers: Headers; +}; +export type getNodeScheduleResponseError = (getNodeScheduleResponse400 | getNodeScheduleResponse401 | getNodeScheduleResponse403 | getNodeScheduleResponse500) & { + headers: Headers; +}; + +export type getNodeScheduleResponse = (getNodeScheduleResponseSuccess | getNodeScheduleResponseError) + +export const getGetNodeScheduleUrl = (hostname: string,) => { + + + + + return `/api/node/${hostname}/schedule` +} + +export const getNodeSchedule = async (hostname: string, options?: RequestInit): Promise => { + + return apiFetch(getGetNodeScheduleUrl(hostname), + { + ...options, + method: 'GET' + + + } +);} + + +/** + * Create a new scheduled entry on the target node. + + * @summary Create a scheduled entry + */ +export type postNodeScheduleResponse200 = { + data: ScheduleCreateResponse + status: 200 +} + +export type postNodeScheduleResponse400 = { + data: ErrorResponse + status: 400 +} + +export type postNodeScheduleResponse401 = { + data: ErrorResponse + status: 401 +} + +export type postNodeScheduleResponse403 = { + data: ErrorResponse + status: 403 +} + +export type postNodeScheduleResponse500 = { + data: ErrorResponse + status: 500 +} + +export type postNodeScheduleResponseSuccess = (postNodeScheduleResponse200) & { + headers: Headers; +}; +export type postNodeScheduleResponseError = (postNodeScheduleResponse400 | postNodeScheduleResponse401 | postNodeScheduleResponse403 | postNodeScheduleResponse500) & { + headers: Headers; +}; + +export type postNodeScheduleResponse = (postNodeScheduleResponseSuccess | postNodeScheduleResponseError) + +export const getPostNodeScheduleUrl = (hostname: string,) => { + + + + + return `/api/node/${hostname}/schedule` +} + +export const postNodeSchedule = async (hostname: string, + scheduleCreateRequest: ScheduleCreateRequest, options?: RequestInit): Promise => { + + return apiFetch(getPostNodeScheduleUrl(hostname), + { + ...options, + method: 'POST', + headers: { 'Content-Type': 'application/json', ...options?.headers }, + body: JSON.stringify( + scheduleCreateRequest,) + } +);} + + +/** + * Get a specific scheduled entry by name on the target node. + + * @summary Get a scheduled entry + */ +export type getNodeScheduleByNameResponse200 = { + data: ScheduleGetResponse + status: 200 +} + +export type getNodeScheduleByNameResponse400 = { + data: ErrorResponse + status: 400 +} + +export type getNodeScheduleByNameResponse401 = { + data: ErrorResponse + status: 401 +} + +export type getNodeScheduleByNameResponse403 = { + data: ErrorResponse + status: 403 +} + +export type getNodeScheduleByNameResponse404 = { + data: ErrorResponse + status: 404 +} + +export type getNodeScheduleByNameResponse500 = { + data: ErrorResponse + status: 500 +} + +export type getNodeScheduleByNameResponseSuccess = (getNodeScheduleByNameResponse200) & { + headers: Headers; +}; +export type getNodeScheduleByNameResponseError = (getNodeScheduleByNameResponse400 | getNodeScheduleByNameResponse401 | getNodeScheduleByNameResponse403 | getNodeScheduleByNameResponse404 | getNodeScheduleByNameResponse500) & { + headers: Headers; +}; + +export type getNodeScheduleByNameResponse = (getNodeScheduleByNameResponseSuccess | getNodeScheduleByNameResponseError) + +export const getGetNodeScheduleByNameUrl = (hostname: string, + name: string,) => { + + + + + return `/api/node/${hostname}/schedule/${name}` +} + +export const getNodeScheduleByName = async (hostname: string, + name: string, options?: RequestInit): Promise => { + + return apiFetch(getGetNodeScheduleByNameUrl(hostname,name), + { + ...options, + method: 'GET' + + + } +);} + + +/** + * Update an existing scheduled entry on the target node. + + * @summary Update a scheduled entry + */ +export type putNodeScheduleResponse200 = { + data: ScheduleUpdateResponse + status: 200 +} + +export type putNodeScheduleResponse400 = { + data: ErrorResponse + status: 400 +} + +export type putNodeScheduleResponse401 = { + data: ErrorResponse + status: 401 +} + +export type putNodeScheduleResponse403 = { + data: ErrorResponse + status: 403 +} + +export type putNodeScheduleResponse404 = { + data: ErrorResponse + status: 404 +} + +export type putNodeScheduleResponse500 = { + data: ErrorResponse + status: 500 +} + +export type putNodeScheduleResponseSuccess = (putNodeScheduleResponse200) & { + headers: Headers; +}; +export type putNodeScheduleResponseError = (putNodeScheduleResponse400 | putNodeScheduleResponse401 | putNodeScheduleResponse403 | putNodeScheduleResponse404 | putNodeScheduleResponse500) & { + headers: Headers; +}; + +export type putNodeScheduleResponse = (putNodeScheduleResponseSuccess | putNodeScheduleResponseError) + +export const getPutNodeScheduleUrl = (hostname: string, + name: string,) => { + + + + + return `/api/node/${hostname}/schedule/${name}` +} + +export const putNodeSchedule = async (hostname: string, + name: string, + scheduleUpdateRequest: ScheduleUpdateRequest, options?: RequestInit): Promise => { + + return apiFetch(getPutNodeScheduleUrl(hostname,name), + { + ...options, + method: 'PUT', + headers: { 'Content-Type': 'application/json', ...options?.headers }, + body: JSON.stringify( + scheduleUpdateRequest,) + } +);} + + +/** + * Delete a scheduled entry from the target node. + + * @summary Delete a scheduled entry + */ +export type deleteNodeScheduleResponse200 = { + data: ScheduleDeleteResponse + status: 200 +} + +export type deleteNodeScheduleResponse400 = { + data: ErrorResponse + status: 400 +} + +export type deleteNodeScheduleResponse401 = { + data: ErrorResponse + status: 401 +} + +export type deleteNodeScheduleResponse403 = { + data: ErrorResponse + status: 403 +} + +export type deleteNodeScheduleResponse404 = { + data: ErrorResponse + status: 404 +} + +export type deleteNodeScheduleResponse500 = { + data: ErrorResponse + status: 500 +} + +export type deleteNodeScheduleResponseSuccess = (deleteNodeScheduleResponse200) & { + headers: Headers; +}; +export type deleteNodeScheduleResponseError = (deleteNodeScheduleResponse400 | deleteNodeScheduleResponse401 | deleteNodeScheduleResponse403 | deleteNodeScheduleResponse404 | deleteNodeScheduleResponse500) & { + headers: Headers; +}; + +export type deleteNodeScheduleResponse = (deleteNodeScheduleResponseSuccess | deleteNodeScheduleResponseError) + +export const getDeleteNodeScheduleUrl = (hostname: string, + name: string,) => { + + + + + return `/api/node/${hostname}/schedule/${name}` +} + +export const deleteNodeSchedule = async (hostname: string, + name: string, options?: RequestInit): Promise => { + + return apiFetch(getDeleteNodeScheduleUrl(hostname,name), + { + ...options, + method: 'DELETE' + + + } +);} + + diff --git a/ui/src/sdk/gen/schemas/index.ts b/ui/src/sdk/gen/schemas/index.ts index 7b52a8cd9..69b18617e 100644 --- a/ui/src/sdk/gen/schemas/index.ts +++ b/ui/src/sdk/gen/schemas/index.ts @@ -36,23 +36,6 @@ export * from './componentHealth'; export * from './consumerDetail'; export * from './consumerStats'; export * from './createJobResponse'; -export * from './cronCollectionResponse'; -export * from './cronCreateRequest'; -export * from './cronCreateRequestContentType'; -export * from './cronCreateRequestInterval'; -export * from './cronCreateRequestVars'; -export * from './cronCreateResponse'; -export * from './cronDeleteResponse'; -export * from './cronEntry'; -export * from './cronEntryInterval'; -export * from './cronEntryStatus'; -export * from './cronGetResponse'; -export * from './cronMutationResult'; -export * from './cronMutationResultStatus'; -export * from './cronUpdateRequest'; -export * from './cronUpdateRequestContentType'; -export * from './cronUpdateRequestVars'; -export * from './cronUpdateResponse'; export * from './deleteNodeContainerDockerByIDParams'; export * from './deleteNodeContainerDockerImageParams'; export * from './diskCollectionResponse'; @@ -253,6 +236,23 @@ export * from './routeMutationEntry'; export * from './routeMutationEntryStatus'; export * from './routeMutationResponse'; export * from './routeResponse'; +export * from './scheduleCollectionResponse'; +export * from './scheduleCreateRequest'; +export * from './scheduleCreateRequestContentType'; +export * from './scheduleCreateRequestInterval'; +export * from './scheduleCreateRequestVars'; +export * from './scheduleCreateResponse'; +export * from './scheduleDeleteResponse'; +export * from './scheduleEntry'; +export * from './scheduleEntryInterval'; +export * from './scheduleEntryStatus'; +export * from './scheduleGetResponse'; +export * from './scheduleMutationResult'; +export * from './scheduleMutationResultStatus'; +export * from './scheduleUpdateRequest'; +export * from './scheduleUpdateRequestContentType'; +export * from './scheduleUpdateRequestVars'; +export * from './scheduleUpdateResponse'; export * from './serviceCreateRequest'; export * from './serviceGetEntry'; export * from './serviceGetEntryStatus'; diff --git a/ui/src/sdk/gen/schemas/cronCollectionResponse.ts b/ui/src/sdk/gen/schemas/scheduleCollectionResponse.ts similarity index 59% rename from ui/src/sdk/gen/schemas/cronCollectionResponse.ts rename to ui/src/sdk/gen/schemas/scheduleCollectionResponse.ts index d95145bea..2d6275d55 100644 --- a/ui/src/sdk/gen/schemas/cronCollectionResponse.ts +++ b/ui/src/sdk/gen/schemas/scheduleCollectionResponse.ts @@ -4,10 +4,10 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronEntry } from './cronEntry'; +import type { ScheduleEntry } from './scheduleEntry'; -export interface CronCollectionResponse { +export interface ScheduleCollectionResponse { /** The job ID used to process this request. */ job_id?: string; - results: CronEntry[]; + results: ScheduleEntry[]; } diff --git a/ui/src/sdk/gen/schemas/cronCreateRequest.ts b/ui/src/sdk/gen/schemas/scheduleCreateRequest.ts similarity index 61% rename from ui/src/sdk/gen/schemas/cronCreateRequest.ts rename to ui/src/sdk/gen/schemas/scheduleCreateRequest.ts index 82482be04..75b6b01e2 100644 --- a/ui/src/sdk/gen/schemas/cronCreateRequest.ts +++ b/ui/src/sdk/gen/schemas/scheduleCreateRequest.ts @@ -4,15 +4,15 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronCreateRequestContentType } from './cronCreateRequestContentType'; -import type { CronCreateRequestInterval } from './cronCreateRequestInterval'; -import type { CronCreateRequestVars } from './cronCreateRequestVars'; +import type { ScheduleCreateRequestContentType } from './scheduleCreateRequestContentType'; +import type { ScheduleCreateRequestInterval } from './scheduleCreateRequestInterval'; +import type { ScheduleCreateRequestVars } from './scheduleCreateRequestVars'; -export interface CronCreateRequest { - /** Name for the cron drop-in entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. +export interface ScheduleCreateRequest { + /** Name for the scheduled entry. Used as the file name under /etc/cron.d/ or /etc/cron.{interval}/. */ name: string; - /** Name of the uploaded file in the object store to deploy as the cron entry content. + /** Name of the uploaded file in the object store to deploy as the scheduled entry content. */ object: string; /** Cron schedule expression (e.g., "*\/5 * * * *"). Mutually exclusive with interval — provide exactly one. @@ -20,14 +20,14 @@ export interface CronCreateRequest { schedule?: string; /** Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. */ - interval?: CronCreateRequestInterval; + interval?: ScheduleCreateRequestInterval; /** User to run the command as. Only applies when using schedule (cron.d entries include a user field). */ user?: string; /** Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. */ - content_type?: CronCreateRequestContentType; + content_type?: ScheduleCreateRequestContentType; /** Template variables. Only used when content_type is "template". */ - vars?: CronCreateRequestVars; + vars?: ScheduleCreateRequestVars; } diff --git a/ui/src/sdk/gen/schemas/cronCreateRequestContentType.ts b/ui/src/sdk/gen/schemas/scheduleCreateRequestContentType.ts similarity index 63% rename from ui/src/sdk/gen/schemas/cronCreateRequestContentType.ts rename to ui/src/sdk/gen/schemas/scheduleCreateRequestContentType.ts index 443195d48..bca524a10 100644 --- a/ui/src/sdk/gen/schemas/cronCreateRequestContentType.ts +++ b/ui/src/sdk/gen/schemas/scheduleCreateRequestContentType.ts @@ -9,10 +9,10 @@ * Content type: "raw" or "template". When "template", the file content is rendered through Go text/template with agent facts and user-supplied vars. */ -export type CronCreateRequestContentType = typeof CronCreateRequestContentType[keyof typeof CronCreateRequestContentType]; +export type ScheduleCreateRequestContentType = typeof ScheduleCreateRequestContentType[keyof typeof ScheduleCreateRequestContentType]; -export const CronCreateRequestContentType = { +export const ScheduleCreateRequestContentType = { raw: 'raw', template: 'template', } as const; diff --git a/ui/src/sdk/gen/schemas/cronCreateRequestInterval.ts b/ui/src/sdk/gen/schemas/scheduleCreateRequestInterval.ts similarity index 68% rename from ui/src/sdk/gen/schemas/cronCreateRequestInterval.ts rename to ui/src/sdk/gen/schemas/scheduleCreateRequestInterval.ts index 8f4369d20..44ca690f1 100644 --- a/ui/src/sdk/gen/schemas/cronCreateRequestInterval.ts +++ b/ui/src/sdk/gen/schemas/scheduleCreateRequestInterval.ts @@ -9,10 +9,10 @@ * Periodic interval (hourly, daily, weekly, monthly). Places the script in /etc/cron.{interval}/. Mutually exclusive with schedule — provide exactly one. */ -export type CronCreateRequestInterval = typeof CronCreateRequestInterval[keyof typeof CronCreateRequestInterval]; +export type ScheduleCreateRequestInterval = typeof ScheduleCreateRequestInterval[keyof typeof ScheduleCreateRequestInterval]; -export const CronCreateRequestInterval = { +export const ScheduleCreateRequestInterval = { hourly: 'hourly', daily: 'daily', weekly: 'weekly', diff --git a/ui/src/sdk/gen/schemas/cronCreateRequestVars.ts b/ui/src/sdk/gen/schemas/scheduleCreateRequestVars.ts similarity index 73% rename from ui/src/sdk/gen/schemas/cronCreateRequestVars.ts rename to ui/src/sdk/gen/schemas/scheduleCreateRequestVars.ts index 1346741dc..3c969fe62 100644 --- a/ui/src/sdk/gen/schemas/cronCreateRequestVars.ts +++ b/ui/src/sdk/gen/schemas/scheduleCreateRequestVars.ts @@ -9,4 +9,4 @@ * Template variables. Only used when content_type is "template". */ -export type CronCreateRequestVars = { [key: string]: unknown }; +export type ScheduleCreateRequestVars = { [key: string]: unknown }; diff --git a/ui/src/sdk/gen/schemas/cronUpdateResponse.ts b/ui/src/sdk/gen/schemas/scheduleCreateResponse.ts similarity index 55% rename from ui/src/sdk/gen/schemas/cronUpdateResponse.ts rename to ui/src/sdk/gen/schemas/scheduleCreateResponse.ts index 1916f29c6..f7fd793fb 100644 --- a/ui/src/sdk/gen/schemas/cronUpdateResponse.ts +++ b/ui/src/sdk/gen/schemas/scheduleCreateResponse.ts @@ -4,10 +4,10 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronMutationResult } from './cronMutationResult'; +import type { ScheduleMutationResult } from './scheduleMutationResult'; -export interface CronUpdateResponse { +export interface ScheduleCreateResponse { /** The job ID used to process this request. */ job_id?: string; - results: CronMutationResult[]; + results: ScheduleMutationResult[]; } diff --git a/ui/src/sdk/gen/schemas/cronDeleteResponse.ts b/ui/src/sdk/gen/schemas/scheduleDeleteResponse.ts similarity index 55% rename from ui/src/sdk/gen/schemas/cronDeleteResponse.ts rename to ui/src/sdk/gen/schemas/scheduleDeleteResponse.ts index f60968970..b868b3040 100644 --- a/ui/src/sdk/gen/schemas/cronDeleteResponse.ts +++ b/ui/src/sdk/gen/schemas/scheduleDeleteResponse.ts @@ -4,10 +4,10 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronMutationResult } from './cronMutationResult'; +import type { ScheduleMutationResult } from './scheduleMutationResult'; -export interface CronDeleteResponse { +export interface ScheduleDeleteResponse { /** The job ID used to process this request. */ job_id?: string; - results: CronMutationResult[]; + results: ScheduleMutationResult[]; } diff --git a/ui/src/sdk/gen/schemas/cronEntry.ts b/ui/src/sdk/gen/schemas/scheduleEntry.ts similarity index 69% rename from ui/src/sdk/gen/schemas/cronEntry.ts rename to ui/src/sdk/gen/schemas/scheduleEntry.ts index 26503962b..db1877bad 100644 --- a/ui/src/sdk/gen/schemas/cronEntry.ts +++ b/ui/src/sdk/gen/schemas/scheduleEntry.ts @@ -4,18 +4,18 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronEntryInterval } from './cronEntryInterval'; -import type { CronEntryStatus } from './cronEntryStatus'; +import type { ScheduleEntryInterval } from './scheduleEntryInterval'; +import type { ScheduleEntryStatus } from './scheduleEntryStatus'; /** - * A cron drop-in entry. + * A scheduled entry. */ -export interface CronEntry { +export interface ScheduleEntry { /** Hostname of the agent that reported this entry. */ hostname: string; /** The status of the operation for this host. */ - status: CronEntryStatus; - /** Cron entry name. */ + status: ScheduleEntryStatus; + /** Scheduled entry name. */ name?: string; /** Object store name for the deployed content. */ object?: string; @@ -24,11 +24,11 @@ export interface CronEntry { schedule?: string; /** Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. */ - interval?: CronEntryInterval; + interval?: ScheduleEntryInterval; /** Where the entry lives: "cron.d", "hourly", "daily", "weekly", or "monthly". */ source?: string; - /** User the cron entry runs as. */ + /** User the scheduled entry runs as. */ user?: string; /** Error message if the agent failed to retrieve this entry. */ error?: string; diff --git a/ui/src/sdk/gen/schemas/cronEntryInterval.ts b/ui/src/sdk/gen/schemas/scheduleEntryInterval.ts similarity index 69% rename from ui/src/sdk/gen/schemas/cronEntryInterval.ts rename to ui/src/sdk/gen/schemas/scheduleEntryInterval.ts index a2090d20a..d6583b9b7 100644 --- a/ui/src/sdk/gen/schemas/cronEntryInterval.ts +++ b/ui/src/sdk/gen/schemas/scheduleEntryInterval.ts @@ -9,10 +9,10 @@ * Periodic interval (hourly, daily, weekly, monthly). Present for /etc/cron.{interval}/ entries. */ -export type CronEntryInterval = typeof CronEntryInterval[keyof typeof CronEntryInterval]; +export type ScheduleEntryInterval = typeof ScheduleEntryInterval[keyof typeof ScheduleEntryInterval]; -export const CronEntryInterval = { +export const ScheduleEntryInterval = { hourly: 'hourly', daily: 'daily', weekly: 'weekly', diff --git a/ui/src/sdk/gen/schemas/cronEntryStatus.ts b/ui/src/sdk/gen/schemas/scheduleEntryStatus.ts similarity index 66% rename from ui/src/sdk/gen/schemas/cronEntryStatus.ts rename to ui/src/sdk/gen/schemas/scheduleEntryStatus.ts index 75374cf00..7eaa9bf1f 100644 --- a/ui/src/sdk/gen/schemas/cronEntryStatus.ts +++ b/ui/src/sdk/gen/schemas/scheduleEntryStatus.ts @@ -8,10 +8,10 @@ /** * The status of the operation for this host. */ -export type CronEntryStatus = typeof CronEntryStatus[keyof typeof CronEntryStatus]; +export type ScheduleEntryStatus = typeof ScheduleEntryStatus[keyof typeof ScheduleEntryStatus]; -export const CronEntryStatus = { +export const ScheduleEntryStatus = { ok: 'ok', failed: 'failed', skipped: 'skipped', diff --git a/ui/src/sdk/gen/schemas/cronGetResponse.ts b/ui/src/sdk/gen/schemas/scheduleGetResponse.ts similarity index 50% rename from ui/src/sdk/gen/schemas/cronGetResponse.ts rename to ui/src/sdk/gen/schemas/scheduleGetResponse.ts index d8da8d771..adb118bcb 100644 --- a/ui/src/sdk/gen/schemas/cronGetResponse.ts +++ b/ui/src/sdk/gen/schemas/scheduleGetResponse.ts @@ -4,13 +4,13 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronEntry } from './cronEntry'; +import type { ScheduleEntry } from './scheduleEntry'; /** - * Collection response for a single cron entry get operation. + * Collection response for a single scheduled entry get operation. */ -export interface CronGetResponse { +export interface ScheduleGetResponse { /** The job ID used to process this request. */ job_id?: string; - results: CronEntry[]; + results: ScheduleEntry[]; } diff --git a/ui/src/sdk/gen/schemas/cronMutationResult.ts b/ui/src/sdk/gen/schemas/scheduleMutationResult.ts similarity index 71% rename from ui/src/sdk/gen/schemas/cronMutationResult.ts rename to ui/src/sdk/gen/schemas/scheduleMutationResult.ts index 2d0f7f5de..5a458b2ef 100644 --- a/ui/src/sdk/gen/schemas/cronMutationResult.ts +++ b/ui/src/sdk/gen/schemas/scheduleMutationResult.ts @@ -4,17 +4,17 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronMutationResultStatus } from './cronMutationResultStatus'; +import type { ScheduleMutationResultStatus } from './scheduleMutationResultStatus'; /** * Result of a cron create, update, or delete operation for one host. */ -export interface CronMutationResult { +export interface ScheduleMutationResult { /** Hostname of the agent that processed this operation. */ hostname: string; /** The status of the operation for this host. */ - status: CronMutationResultStatus; - /** Cron entry name. */ + status: ScheduleMutationResultStatus; + /** Scheduled entry name. */ name?: string; /** Whether the operation modified system state. */ changed?: boolean; diff --git a/ui/src/sdk/gen/schemas/cronMutationResultStatus.ts b/ui/src/sdk/gen/schemas/scheduleMutationResultStatus.ts similarity index 60% rename from ui/src/sdk/gen/schemas/cronMutationResultStatus.ts rename to ui/src/sdk/gen/schemas/scheduleMutationResultStatus.ts index a4261786c..5d8f17815 100644 --- a/ui/src/sdk/gen/schemas/cronMutationResultStatus.ts +++ b/ui/src/sdk/gen/schemas/scheduleMutationResultStatus.ts @@ -8,10 +8,10 @@ /** * The status of the operation for this host. */ -export type CronMutationResultStatus = typeof CronMutationResultStatus[keyof typeof CronMutationResultStatus]; +export type ScheduleMutationResultStatus = typeof ScheduleMutationResultStatus[keyof typeof ScheduleMutationResultStatus]; -export const CronMutationResultStatus = { +export const ScheduleMutationResultStatus = { ok: 'ok', failed: 'failed', skipped: 'skipped', diff --git a/ui/src/sdk/gen/schemas/cronUpdateRequest.ts b/ui/src/sdk/gen/schemas/scheduleUpdateRequest.ts similarity index 58% rename from ui/src/sdk/gen/schemas/cronUpdateRequest.ts rename to ui/src/sdk/gen/schemas/scheduleUpdateRequest.ts index ab0b418b5..54228c271 100644 --- a/ui/src/sdk/gen/schemas/cronUpdateRequest.ts +++ b/ui/src/sdk/gen/schemas/scheduleUpdateRequest.ts @@ -4,10 +4,10 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronUpdateRequestContentType } from './cronUpdateRequestContentType'; -import type { CronUpdateRequestVars } from './cronUpdateRequestVars'; +import type { ScheduleUpdateRequestContentType } from './scheduleUpdateRequestContentType'; +import type { ScheduleUpdateRequestVars } from './scheduleUpdateRequestVars'; -export interface CronUpdateRequest { +export interface ScheduleUpdateRequest { /** New object to deploy (redeploy with updated content). */ object?: string; @@ -18,8 +18,8 @@ export interface CronUpdateRequest { user?: string; /** Content type: "raw" or "template". */ - content_type?: CronUpdateRequestContentType; + content_type?: ScheduleUpdateRequestContentType; /** Template variables. */ - vars?: CronUpdateRequestVars; + vars?: ScheduleUpdateRequestVars; } diff --git a/ui/src/sdk/gen/schemas/cronUpdateRequestContentType.ts b/ui/src/sdk/gen/schemas/scheduleUpdateRequestContentType.ts similarity index 53% rename from ui/src/sdk/gen/schemas/cronUpdateRequestContentType.ts rename to ui/src/sdk/gen/schemas/scheduleUpdateRequestContentType.ts index c648b7cc2..a33cf737b 100644 --- a/ui/src/sdk/gen/schemas/cronUpdateRequestContentType.ts +++ b/ui/src/sdk/gen/schemas/scheduleUpdateRequestContentType.ts @@ -9,10 +9,10 @@ * Content type: "raw" or "template". */ -export type CronUpdateRequestContentType = typeof CronUpdateRequestContentType[keyof typeof CronUpdateRequestContentType]; +export type ScheduleUpdateRequestContentType = typeof ScheduleUpdateRequestContentType[keyof typeof ScheduleUpdateRequestContentType]; -export const CronUpdateRequestContentType = { +export const ScheduleUpdateRequestContentType = { raw: 'raw', template: 'template', } as const; diff --git a/ui/src/sdk/gen/schemas/cronUpdateRequestVars.ts b/ui/src/sdk/gen/schemas/scheduleUpdateRequestVars.ts similarity index 68% rename from ui/src/sdk/gen/schemas/cronUpdateRequestVars.ts rename to ui/src/sdk/gen/schemas/scheduleUpdateRequestVars.ts index 887b01c8b..ae298a07b 100644 --- a/ui/src/sdk/gen/schemas/cronUpdateRequestVars.ts +++ b/ui/src/sdk/gen/schemas/scheduleUpdateRequestVars.ts @@ -9,4 +9,4 @@ * Template variables. */ -export type CronUpdateRequestVars = { [key: string]: unknown }; +export type ScheduleUpdateRequestVars = { [key: string]: unknown }; diff --git a/ui/src/sdk/gen/schemas/cronCreateResponse.ts b/ui/src/sdk/gen/schemas/scheduleUpdateResponse.ts similarity index 55% rename from ui/src/sdk/gen/schemas/cronCreateResponse.ts rename to ui/src/sdk/gen/schemas/scheduleUpdateResponse.ts index 817d5320d..1fb6e4464 100644 --- a/ui/src/sdk/gen/schemas/cronCreateResponse.ts +++ b/ui/src/sdk/gen/schemas/scheduleUpdateResponse.ts @@ -4,10 +4,10 @@ * Agent Management API * OpenAPI spec version: 1.0.0 */ -import type { CronMutationResult } from './cronMutationResult'; +import type { ScheduleMutationResult } from './scheduleMutationResult'; -export interface CronCreateResponse { +export interface ScheduleUpdateResponse { /** The job ID used to process this request. */ job_id?: string; - results: CronMutationResult[]; + results: ScheduleMutationResult[]; }