Conversation
…topics Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
Add markFlagsMutuallyExclusive and markFlagsOneRequired helper functions that filter out unregistered flags before calling Cobra, preventing panics when flags are conditionally excluded (e.g. in WASM builds where addParameterFileFlags skips registering --from-file). Migrate all call sites across 19 command files to use the safe wrappers. Move MarkFlagsMutuallyExclusive calls outside unnecessary WASM guards in vps.go, cloud_kube.go, and cloud_instance.go so mutual exclusivity is correctly enforced for flags that do exist in WASM mode. Signed-off-by: Romain Beuque <556072+rbeuque74@users.noreply.github.com>
Implement full lifecycle management for OVHcloud IP firewall (AntiDDoS/ Edge Firewall) under the `ovhcloud ip firewall` command tree: - ip firewall list/add/get/enable/disable/delete - ip firewall rule list/get/create/delete Includes service layer, display templates, command registration, tests with RFC 5737 documentation IPs, and generated doc pages. Signed-off-by: pablotoledo <jptgjuanpablo@gmail.com> Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
…or firewall rules Signed-off-by: pablotoledo <jptgjuanpablo@gmail.com> Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
Signed-off-by: Arthur Amstutz <arthur.amstutz@gmail.com> Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
Signed-off-by: Arthur Amstutz <arthur.amstutz@gmail.com> Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
c61aa20 to
e378d15
Compare
…naged-database-mvp Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces first-class Public Cloud “Managed Database” and “Managed Analytics” base resources in the CLI, splitting the previously combined database-service surface area into two product families and updating the CLI browser + documentation accordingly (Fixes #123).
Changes:
- Add Managed Database / Managed Analytics output templates and parameter samples used by the interactive editor and object rendering.
- Extend
cloud referencewithmanaged-databaseand newmanaged-analyticsreference subcommands (plans, flavors, engines), and update the browser navigation to split the products. - Rework error/exit behavior to be unit-test friendly (avoid hard
os.Exitby allowing override), and update docs to use the correct filter equality operator (==).
Reviewed changes
Copilot reviewed 233 out of 234 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/services/cloud/templates/cloud_managed_database.tmpl | Adds managed-database service “get” template output. |
| internal/services/cloud/templates/cloud_managed_database_user.tmpl | Adds managed-database user “get” template output (roles/valkey permissions). |
| internal/services/cloud/templates/cloud_managed_database_database.tmpl | Adds managed-database database “get” template output. |
| internal/services/cloud/templates/cloud_managed_database_certificate.tmpl | Adds managed-database certificate “get” template output. |
| internal/services/cloud/templates/cloud_managed_database_backup.tmpl | Adds managed-database backup “get” template output. |
| internal/services/cloud/templates/cloud_managed_analytics.tmpl | Adds managed-analytics service “get” template output. |
| internal/services/cloud/templates/cloud_managed_analytics_user.tmpl | Adds managed-analytics user “get” template output (roles / OpenSearch ACLs). |
| internal/services/cloud/templates/cloud_managed_analytics_topic.tmpl | Adds managed-analytics topic “get” template output. |
| internal/services/cloud/templates/cloud_managed_analytics_topic_acl.tmpl | Adds managed-analytics topic ACL “get” template output. |
| internal/services/cloud/templates/cloud_managed_analytics_pattern.tmpl | Adds managed-analytics pattern “get” template output. |
| internal/services/cloud/templates/cloud_managed_analytics_database.tmpl | Adds managed-analytics database “get” template output. |
| internal/services/cloud/templates/cloud_managed_analytics_certificate.tmpl | Adds managed-analytics certificate “get” template output. |
| internal/services/cloud/templates/cloud_managed_analytics_backup.tmpl | Adds managed-analytics backup “get” template output. |
| internal/services/cloud/parameter-samples/managed-database-user-create.json | Adds managed-database user create sample for editor workflow. |
| internal/services/cloud/parameter-samples/managed-database-create.json | Adds managed-database service create sample for editor workflow. |
| internal/services/cloud/parameter-samples/managed-analytics-user-create.json | Adds managed-analytics user create sample for editor workflow. |
| internal/services/cloud/parameter-samples/managed-analytics-topic-create.json | Adds managed-analytics topic create sample for editor workflow. |
| internal/services/cloud/parameter-samples/managed-analytics-pattern-create.json | Adds managed-analytics pattern create sample for editor workflow. |
| internal/services/cloud/parameter-samples/managed-analytics-create.json | Adds managed-analytics service create sample for editor workflow. |
| internal/services/cloud/parameter-samples/database-create.json | Removes old database-service create sample. |
| internal/services/cloud/cloud_reference.go | Adds managed-analytics reference listing + refines managed-database engines output formatting. |
| internal/services/browser/manager.go | Splits “Databases” into “Managed Databases” + “Managed Analytics” in the browser nav and creation hints. |
| internal/services/browser/api.go | Fetches database services filtered by category for /databases vs /analytics. |
| internal/display/display.go | Introduces ExitFunc indirection to avoid hard exits in unit tests. |
| internal/cmd/root.go | Resets stringSlice flags too; fixes filter help example to use ==. |
| internal/cmd/cmd_test.go | Overrides display.ExitFunc in test setup. |
| internal/cmd/cloud_reference.go | Renames reference group to managed-database and adds managed-analytics reference group. |
| internal/cmd/cloud_reference_test.go | Updates tests to target cloud reference managed-database .... |
| internal/cmd/cloud_project.go | Registers managed-database + managed-analytics command initializers. |
| internal/cmd/cloud_database.go | Removes legacy database-service command implementation. |
| internal/cmd/cloud_database_test.go | Removes legacy database-service command tests. |
| doc/ovhcloud_cloud.md | Removes database-service entry; adds managed-database + managed-analytics entries. |
| doc/ovhcloud_cloud_reference.md | Updates reference index to managed-database + managed-analytics. |
| doc/ovhcloud_cloud_reference_managed-database.md | Adds managed-database reference docs index. |
| doc/ovhcloud_cloud_reference_managed-database_list-plans.md | Adds managed-database reference list-plans docs. |
| doc/ovhcloud_cloud_reference_managed-database_list-node-flavors.md | Adds managed-database reference list-node-flavors docs. |
| doc/ovhcloud_cloud_reference_managed-database_list-engines.md | Adds managed-database reference list-engines docs. |
| doc/ovhcloud_cloud_reference_managed-analytics.md | Adds managed-analytics reference docs index. |
| doc/ovhcloud_cloud_reference_managed-analytics_list-plans.md | Adds managed-analytics reference list-plans docs. |
| doc/ovhcloud_cloud_reference_managed-analytics_list-node-flavors.md | Adds managed-analytics reference list-node-flavors docs. |
| doc/ovhcloud_cloud_reference_managed-analytics_list-engines.md | Adds managed-analytics reference list-engines docs. |
| doc/ovhcloud_cloud_managed-database.md | Adds managed-database command docs index. |
| doc/ovhcloud_cloud_managed-database_create.md | Adds managed-database create docs. |
| doc/ovhcloud_cloud_managed-database_edit.md | Updates managed-database edit docs (renamed from database-service). |
| doc/ovhcloud_cloud_managed-database_delete.md | Updates managed-database delete docs (renamed from database-service). |
| doc/ovhcloud_cloud_managed-database_list.md | Updates managed-database list docs (renamed from database-service). |
| doc/ovhcloud_cloud_managed-database_get.md | Updates managed-database get docs (renamed from database-service). |
| doc/ovhcloud_cloud_managed-database_database.md | Updates managed-database database subcommand docs index. |
| doc/ovhcloud_cloud_managed-database_database_create.md | Adds managed-database database create docs. |
| doc/ovhcloud_cloud_managed-database_database_delete.md | Updates managed-database database delete docs. |
| doc/ovhcloud_cloud_managed-database_database_get.md | Updates managed-database database get docs. |
| doc/ovhcloud_cloud_managed-database_database_list.md | Adds managed-database database list docs. |
| doc/ovhcloud_cloud_managed-database_user.md | Adds managed-database user docs index. |
| doc/ovhcloud_cloud_managed-database_user_create.md | Adds managed-database user create docs. |
| doc/ovhcloud_cloud_managed-database_user_edit.md | Adds managed-database user edit docs. |
| doc/ovhcloud_cloud_managed-database_user_delete.md | Adds managed-database user delete docs. |
| doc/ovhcloud_cloud_managed-database_user_get.md | Adds managed-database user get docs. |
| doc/ovhcloud_cloud_managed-database_user_list.md | Adds managed-database user list docs. |
| doc/ovhcloud_cloud_managed-database_user_credentials-reset.md | Adds managed-database user credentials-reset docs. |
| doc/ovhcloud_cloud_managed-database_role.md | Adds managed-database role docs index. |
| doc/ovhcloud_cloud_managed-database_role_list.md | Adds managed-database role list docs. |
| doc/ovhcloud_cloud_managed-database_certificate.md | Adds managed-database certificate docs index. |
| doc/ovhcloud_cloud_managed-database_certificate_get.md | Adds managed-database certificate get docs. |
| doc/ovhcloud_cloud_managed-database_backup.md | Adds managed-database backup docs index. |
| doc/ovhcloud_cloud_managed-database_backup_list.md | Adds managed-database backup list docs. |
| doc/ovhcloud_cloud_managed-database_backup_get.md | Adds managed-database backup get docs. |
| doc/ovhcloud_cloud_managed-database_backup_restore.md | Adds managed-database backup restore docs. |
| doc/ovhcloud_cloud_managed-analytics.md | Adds managed-analytics command docs index. |
| doc/ovhcloud_cloud_managed-analytics_create.md | Adds managed-analytics create docs. |
| doc/ovhcloud_cloud_managed-analytics_edit.md | Adds managed-analytics edit docs. |
| doc/ovhcloud_cloud_managed-analytics_delete.md | Adds managed-analytics delete docs. |
| doc/ovhcloud_cloud_managed-analytics_list.md | Adds managed-analytics list docs. |
| doc/ovhcloud_cloud_managed-analytics_get.md | Adds managed-analytics get docs. |
| doc/ovhcloud_cloud_managed-analytics_database.md | Adds managed-analytics database docs index. |
| doc/ovhcloud_cloud_managed-analytics_database_create.md | Adds managed-analytics database create docs. |
| doc/ovhcloud_cloud_managed-analytics_database_delete.md | Adds managed-analytics database delete docs. |
| doc/ovhcloud_cloud_managed-analytics_database_get.md | Adds managed-analytics database get docs. |
| doc/ovhcloud_cloud_managed-analytics_database_list.md | Adds managed-analytics database list docs. |
| doc/ovhcloud_cloud_managed-analytics_user.md | Adds managed-analytics user docs index. |
| doc/ovhcloud_cloud_managed-analytics_user_create.md | Adds managed-analytics user create docs. |
| doc/ovhcloud_cloud_managed-analytics_user_edit.md | Adds managed-analytics user edit docs. |
| doc/ovhcloud_cloud_managed-analytics_user_delete.md | Adds managed-analytics user delete docs. |
| doc/ovhcloud_cloud_managed-analytics_user_get.md | Adds managed-analytics user get docs. |
| doc/ovhcloud_cloud_managed-analytics_user_list.md | Adds managed-analytics user list docs. |
| doc/ovhcloud_cloud_managed-analytics_user_credentials-reset.md | Adds managed-analytics user credentials-reset docs. |
| doc/ovhcloud_cloud_managed-analytics_role.md | Adds managed-analytics role docs index. |
| doc/ovhcloud_cloud_managed-analytics_role_list.md | Adds managed-analytics role list docs. |
| doc/ovhcloud_cloud_managed-analytics_permission.md | Adds managed-analytics permission docs index. |
| doc/ovhcloud_cloud_managed-analytics_permission_list.md | Adds managed-analytics permission list docs. |
| doc/ovhcloud_cloud_managed-analytics_pattern.md | Adds managed-analytics pattern docs index. |
| doc/ovhcloud_cloud_managed-analytics_pattern_create.md | Adds managed-analytics pattern create docs. |
| doc/ovhcloud_cloud_managed-analytics_pattern_delete.md | Adds managed-analytics pattern delete docs. |
| doc/ovhcloud_cloud_managed-analytics_pattern_get.md | Adds managed-analytics pattern get docs. |
| doc/ovhcloud_cloud_managed-analytics_pattern_list.md | Adds managed-analytics pattern list docs. |
| doc/ovhcloud_cloud_managed-analytics_topic.md | Adds managed-analytics topic docs index. |
| doc/ovhcloud_cloud_managed-analytics_topic_create.md | Adds managed-analytics topic create docs. |
| doc/ovhcloud_cloud_managed-analytics_topic_edit.md | Adds managed-analytics topic edit docs. |
| doc/ovhcloud_cloud_managed-analytics_topic_delete.md | Adds managed-analytics topic delete docs. |
| doc/ovhcloud_cloud_managed-analytics_topic_get.md | Adds managed-analytics topic get docs. |
| doc/ovhcloud_cloud_managed-analytics_topic_list.md | Adds managed-analytics topic list docs. |
| doc/ovhcloud_cloud_managed-analytics_topic-acl.md | Adds managed-analytics topic-acl docs index. |
| doc/ovhcloud_cloud_managed-analytics_topic-acl_create.md | Adds managed-analytics topic-acl create docs. |
| doc/ovhcloud_cloud_managed-analytics_topic-acl_delete.md | Adds managed-analytics topic-acl delete docs. |
| doc/ovhcloud_cloud_managed-analytics_topic-acl_get.md | Adds managed-analytics topic-acl get docs. |
| doc/ovhcloud_cloud_managed-analytics_topic-acl_list.md | Adds managed-analytics topic-acl list docs. |
| doc/ovhcloud_cloud_managed-analytics_backup.md | Adds managed-analytics backup docs index. |
| doc/ovhcloud_cloud_managed-analytics_backup_get.md | Adds managed-analytics backup get docs. |
| doc/ovhcloud_cloud_managed-analytics_backup_list.md | Adds managed-analytics backup list docs. |
| doc/ovhcloud_cloud_managed-analytics_certificate.md | Adds managed-analytics certificate docs index. |
| doc/ovhcloud_cloud_managed-analytics_certificate_get.md | Adds managed-analytics certificate get docs. |
| doc/ovhcloud_cloud_database-service.md | Removes legacy database-service docs entry. |
| doc/ovhcloud_*.md (many list docs) | Bulk doc regeneration updating filter example from = to == across commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func (ms *MockSuite) Setup(t *td.T) error { | ||
| httpmock.Activate(t) | ||
| display.ExitFunc = func(int) {} | ||
|
|
There was a problem hiding this comment.
display.ExitFunc is overwritten in Setup but never restored, so it can leak into other tests (and make failures harder to diagnose if any test expects the default os.Exit). Store the previous value and restore it in PostTest (or via a cleanup hook) so each test runs with a clean global state.
There was a problem hiding this comment.
ExitFunc is intentionally set once in Setup for the entire test suite — no test in this package expects the real os.Exit behavior. The no-op override is the desired state for all tests, so there's nothing to restore. Saving/restoring it in PostTest would just be unnecessary code.
Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 233 out of 234 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 233 out of 234 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // First, get the list of database service IDs (the API returns an array of strings) | ||
| var serviceIDs []string | ||
| endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/service", m.cloudProject) | ||
| endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/service?category=%s", m.cloudProject, category) | ||
| err := httpLib.Client.Get(endpoint, &serviceIDs) | ||
| if err != nil { |
There was a problem hiding this comment.
category is interpolated directly into the query string. Even if current call sites pass constants, this helper accepts arbitrary strings, so a value containing &/? would break the request (or unintentionally add extra query params). Build the URL using url.Values (or at least url.QueryEscape(category)) to ensure correct escaping.
Signed-off-by: Ludwig Patte <ludwig.patte@ovhcloud.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 233 out of 234 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| func ListDatabasesPlans(_ *cobra.Command, _ []string) { | ||
| func ListManagedDatabasesPlans(_ *cobra.Command, _ []string) { |
There was a problem hiding this comment.
The function name ListManagedDatabasesPlans is inconsistent with the other managed database reference helpers (ListManagedDatabaseNodeFlavors, ListManagedDatabaseEngines). Consider renaming it to ListManagedDatabasePlans (singular) for consistency and discoverability, and update the corresponding cobra command wiring.
| func ListManagedAnalyticsPlans(_ *cobra.Command, _ []string) { | ||
| projectID, err := getConfiguredCloudProject() | ||
| if err != nil { | ||
| display.OutputError(&flags.OutputFormatConfig, "%s", err) | ||
| return | ||
| } | ||
|
|
There was a problem hiding this comment.
ListManagedAnalyticsPlans, ListManagedAnalyticsNodeFlavors, and ListManagedAnalyticsEngines largely duplicate the managed-database equivalents (same endpoint, same parsing/formatting, only filter criteria differ). To reduce drift and simplify future changes, consider extracting shared helpers (e.g., a generic capabilities fetch + per-section formatter/filter).
| if !slices.Contains(ManagedDatabaseRoleValidEngines, databaseService["engine"].(string)) { | ||
| display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseValidEngines, ", ")) | ||
| return |
There was a problem hiding this comment.
This branch validates against ManagedDatabaseRoleValidEngines, but the error message lists ManagedDatabaseValidEngines. That will advertise engines (e.g. mysql/valkey) that are not actually supported for roles. Use ManagedDatabaseRoleValidEngines in the message to keep it accurate.
Description
Make doc: Add Database + Analytics and fix filter "==" in docFixes #123
Type of change
Please delete options that are not relevant.
Checklist:
go mod tidy