diff --git a/doc/ovhcloud_account_api_oauth2_client_list.md b/doc/ovhcloud_account_api_oauth2_client_list.md index 6ba20412..e358c4bb 100644 --- a/doc/ovhcloud_account_api_oauth2_client_list.md +++ b/doc/ovhcloud_account_api_oauth2_client_list.md @@ -11,7 +11,7 @@ ovhcloud account api oauth2 client list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_account_ssh-key_list.md b/doc/ovhcloud_account_ssh-key_list.md index 18abd60a..02a0c925 100644 --- a/doc/ovhcloud_account_ssh-key_list.md +++ b/doc/ovhcloud_account_ssh-key_list.md @@ -11,7 +11,7 @@ ovhcloud account ssh-key list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_alldom_list.md b/doc/ovhcloud_alldom_list.md index 19acf485..9b3cae26 100644 --- a/doc/ovhcloud_alldom_list.md +++ b/doc/ovhcloud_alldom_list.md @@ -11,7 +11,7 @@ ovhcloud alldom list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_baremetal_boot_list.md b/doc/ovhcloud_baremetal_boot_list.md index 155ebe38..7acf4021 100644 --- a/doc/ovhcloud_baremetal_boot_list.md +++ b/doc/ovhcloud_baremetal_boot_list.md @@ -11,7 +11,7 @@ ovhcloud baremetal boot list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_baremetal_list-compatible-os.md b/doc/ovhcloud_baremetal_list-compatible-os.md index 8476798e..c06b855b 100644 --- a/doc/ovhcloud_baremetal_list-compatible-os.md +++ b/doc/ovhcloud_baremetal_list-compatible-os.md @@ -11,7 +11,7 @@ ovhcloud baremetal list-compatible-os [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_baremetal_list-interventions.md b/doc/ovhcloud_baremetal_list-interventions.md index abeac06e..9ef13712 100644 --- a/doc/ovhcloud_baremetal_list-interventions.md +++ b/doc/ovhcloud_baremetal_list-interventions.md @@ -11,7 +11,7 @@ ovhcloud baremetal list-interventions [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_baremetal_list-ips.md b/doc/ovhcloud_baremetal_list-ips.md index 36cfe15c..4878e220 100644 --- a/doc/ovhcloud_baremetal_list-ips.md +++ b/doc/ovhcloud_baremetal_list-ips.md @@ -11,7 +11,7 @@ ovhcloud baremetal list-ips [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_baremetal_list-secrets.md b/doc/ovhcloud_baremetal_list-secrets.md index 62eeda21..619ad558 100644 --- a/doc/ovhcloud_baremetal_list-secrets.md +++ b/doc/ovhcloud_baremetal_list-secrets.md @@ -11,7 +11,7 @@ ovhcloud baremetal list-secrets [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_baremetal_list-tasks.md b/doc/ovhcloud_baremetal_list-tasks.md index cc9ee68c..3672f6e2 100644 --- a/doc/ovhcloud_baremetal_list-tasks.md +++ b/doc/ovhcloud_baremetal_list-tasks.md @@ -11,7 +11,7 @@ ovhcloud baremetal list-tasks [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_baremetal_list.md b/doc/ovhcloud_baremetal_list.md index 15d31c38..6aeb60a5 100644 --- a/doc/ovhcloud_baremetal_list.md +++ b/doc/ovhcloud_baremetal_list.md @@ -11,7 +11,7 @@ ovhcloud baremetal list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_baremetal_vni_list.md b/doc/ovhcloud_baremetal_vni_list.md index 20078c0a..319777b7 100644 --- a/doc/ovhcloud_baremetal_vni_list.md +++ b/doc/ovhcloud_baremetal_vni_list.md @@ -11,7 +11,7 @@ ovhcloud baremetal vni list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cdn-dedicated_list.md b/doc/ovhcloud_cdn-dedicated_list.md index 0fde8def..6deff906 100644 --- a/doc/ovhcloud_cdn-dedicated_list.md +++ b/doc/ovhcloud_cdn-dedicated_list.md @@ -11,7 +11,7 @@ ovhcloud cdn-dedicated list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud.md b/doc/ovhcloud_cloud.md index 8d25c3ce..b4d8423e 100644 --- a/doc/ovhcloud_cloud.md +++ b/doc/ovhcloud_cloud.md @@ -32,11 +32,12 @@ Manage your projects and services in the Public Cloud universe (MKS, MPR, MRS, O * [ovhcloud](ovhcloud.md) - CLI to manage your OVHcloud services * [ovhcloud cloud alerting](ovhcloud_cloud_alerting.md) - Manage billing alert configurations in the given cloud project * [ovhcloud cloud container-registry](ovhcloud_cloud_container-registry.md) - Manage container registries in the given cloud project -* [ovhcloud cloud database-service](ovhcloud_cloud_database-service.md) - Manage database services in the given cloud project * [ovhcloud cloud instance](ovhcloud_cloud_instance.md) - Manage instances in the given cloud project * [ovhcloud cloud ip-failover](ovhcloud_cloud_ip-failover.md) - Manage failover IPs in the given cloud project * [ovhcloud cloud kube](ovhcloud_cloud_kube.md) - Manage Kubernetes clusters in the given cloud project * [ovhcloud cloud loadbalancer](ovhcloud_cloud_loadbalancer.md) - Manage loadbalancers in the given cloud project +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project * [ovhcloud cloud network](ovhcloud_cloud_network.md) - Manage networks in the given cloud project * [ovhcloud cloud operation](ovhcloud_cloud_operation.md) - List and get operations in the given cloud project * [ovhcloud cloud project](ovhcloud_cloud_project.md) - Retrieve information and manage your CloudProject services diff --git a/doc/ovhcloud_cloud_alerting_alert_list.md b/doc/ovhcloud_cloud_alerting_alert_list.md index 10409e4a..33ffac4a 100644 --- a/doc/ovhcloud_cloud_alerting_alert_list.md +++ b/doc/ovhcloud_cloud_alerting_alert_list.md @@ -11,7 +11,7 @@ ovhcloud cloud alerting alert list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_alerting_list.md b/doc/ovhcloud_cloud_alerting_list.md index f719d449..d4a0069f 100644 --- a/doc/ovhcloud_cloud_alerting_list.md +++ b/doc/ovhcloud_cloud_alerting_list.md @@ -11,7 +11,7 @@ ovhcloud cloud alerting list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_container-registry_ip-restrictions_management_list.md b/doc/ovhcloud_cloud_container-registry_ip-restrictions_management_list.md index 31002c79..ef7d4585 100644 --- a/doc/ovhcloud_cloud_container-registry_ip-restrictions_management_list.md +++ b/doc/ovhcloud_cloud_container-registry_ip-restrictions_management_list.md @@ -11,7 +11,7 @@ ovhcloud cloud container-registry ip-restrictions management list ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_container-registry_ip-restrictions_registry_list.md b/doc/ovhcloud_cloud_container-registry_ip-restrictions_registry_list.md index ffc19696..5b47145f 100644 --- a/doc/ovhcloud_cloud_container-registry_ip-restrictions_registry_list.md +++ b/doc/ovhcloud_cloud_container-registry_ip-restrictions_registry_list.md @@ -11,7 +11,7 @@ ovhcloud cloud container-registry ip-restrictions registry list [f ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_container-registry_list.md b/doc/ovhcloud_cloud_container-registry_list.md index 39bddf3c..ef3d1d62 100644 --- a/doc/ovhcloud_cloud_container-registry_list.md +++ b/doc/ovhcloud_cloud_container-registry_list.md @@ -11,7 +11,7 @@ ovhcloud cloud container-registry list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_container-registry_plan_list-capabilities.md b/doc/ovhcloud_cloud_container-registry_plan_list-capabilities.md index 01fc657d..84b4a84b 100644 --- a/doc/ovhcloud_cloud_container-registry_plan_list-capabilities.md +++ b/doc/ovhcloud_cloud_container-registry_plan_list-capabilities.md @@ -11,7 +11,7 @@ ovhcloud cloud container-registry plan list-capabilities [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_container-registry_users_list.md b/doc/ovhcloud_cloud_container-registry_users_list.md index 40af827d..ca57f14a 100644 --- a/doc/ovhcloud_cloud_container-registry_users_list.md +++ b/doc/ovhcloud_cloud_container-registry_users_list.md @@ -11,7 +11,7 @@ ovhcloud cloud container-registry users list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_database-service.md b/doc/ovhcloud_cloud_database-service.md deleted file mode 100644 index bbf2a809..00000000 --- a/doc/ovhcloud_cloud_database-service.md +++ /dev/null @@ -1,40 +0,0 @@ -## ovhcloud cloud database-service - -Manage database services in the given cloud project - -### Options - -``` - --cloud-project string Cloud project ID - -h, --help help for database-service -``` - -### Options inherited from parent commands - -``` - -d, --debug Activate debug mode (will log all HTTP requests details) - -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution - -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) - Examples: - --output json - --output yaml - --output interactive - --output 'id' (to extract a single field) - --output 'nested.field.subfield' (to extract a nested field) - --output '[id, "name"]' (to extract multiple fields as an array) - --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) - --output 'name+","+type' (to extract and concatenate fields in a string) - --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) - --profile string Use a specific profile from the configuration file -``` - -### SEE ALSO - -* [ovhcloud cloud](ovhcloud_cloud.md) - Manage your projects and services in the Public Cloud universe (MKS, MPR, MRS, Object Storage...) -* [ovhcloud cloud database-service create](ovhcloud_cloud_database-service_create.md) - Create a new database service -* [ovhcloud cloud database-service database](ovhcloud_cloud_database-service_database.md) - Manage databases in a specific database service -* [ovhcloud cloud database-service delete](ovhcloud_cloud_database-service_delete.md) - Delete a specific database service -* [ovhcloud cloud database-service edit](ovhcloud_cloud_database-service_edit.md) - Edit a specific database service -* [ovhcloud cloud database-service get](ovhcloud_cloud_database-service_get.md) - Get a specific database service -* [ovhcloud cloud database-service list](ovhcloud_cloud_database-service_list.md) - List your database services - diff --git a/doc/ovhcloud_cloud_instance_interface_list.md b/doc/ovhcloud_cloud_instance_interface_list.md index 015559ac..854dc2e1 100644 --- a/doc/ovhcloud_cloud_instance_interface_list.md +++ b/doc/ovhcloud_cloud_instance_interface_list.md @@ -11,7 +11,7 @@ ovhcloud cloud instance interface list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_instance_list.md b/doc/ovhcloud_cloud_instance_list.md index 1591fc94..af36ef57 100644 --- a/doc/ovhcloud_cloud_instance_list.md +++ b/doc/ovhcloud_cloud_instance_list.md @@ -11,7 +11,7 @@ ovhcloud cloud instance list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_instance_snapshot_list.md b/doc/ovhcloud_cloud_instance_snapshot_list.md index 77d6a507..af3cb068 100644 --- a/doc/ovhcloud_cloud_instance_snapshot_list.md +++ b/doc/ovhcloud_cloud_instance_snapshot_list.md @@ -11,7 +11,7 @@ ovhcloud cloud instance snapshot list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_ip-failover_list.md b/doc/ovhcloud_cloud_ip-failover_list.md index ef1e2285..01732176 100644 --- a/doc/ovhcloud_cloud_ip-failover_list.md +++ b/doc/ovhcloud_cloud_ip-failover_list.md @@ -11,7 +11,7 @@ ovhcloud cloud ip-failover list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_kube_ip-restrictions_list.md b/doc/ovhcloud_cloud_kube_ip-restrictions_list.md index 07d472ed..0fdbff38 100644 --- a/doc/ovhcloud_cloud_kube_ip-restrictions_list.md +++ b/doc/ovhcloud_cloud_kube_ip-restrictions_list.md @@ -11,7 +11,7 @@ ovhcloud cloud kube ip-restrictions list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_kube_list.md b/doc/ovhcloud_cloud_kube_list.md index 51185dda..96a7971b 100644 --- a/doc/ovhcloud_cloud_kube_list.md +++ b/doc/ovhcloud_cloud_kube_list.md @@ -11,7 +11,7 @@ ovhcloud cloud kube list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_kube_node_list.md b/doc/ovhcloud_cloud_kube_node_list.md index 6ef3d25f..6967e944 100644 --- a/doc/ovhcloud_cloud_kube_node_list.md +++ b/doc/ovhcloud_cloud_kube_node_list.md @@ -11,7 +11,7 @@ ovhcloud cloud kube node list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_kube_nodepool_list.md b/doc/ovhcloud_cloud_kube_nodepool_list.md index 8b6bc7f1..f89e8718 100644 --- a/doc/ovhcloud_cloud_kube_nodepool_list.md +++ b/doc/ovhcloud_cloud_kube_nodepool_list.md @@ -11,7 +11,7 @@ ovhcloud cloud kube nodepool list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_health-monitor_list.md b/doc/ovhcloud_cloud_loadbalancer_health-monitor_list.md index 989e3fd9..08c94b8b 100644 --- a/doc/ovhcloud_cloud_loadbalancer_health-monitor_list.md +++ b/doc/ovhcloud_cloud_loadbalancer_health-monitor_list.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer health-monitor list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_l7policy_l7rule_list.md b/doc/ovhcloud_cloud_loadbalancer_l7policy_l7rule_list.md index 2c18329e..2e3e4ae8 100644 --- a/doc/ovhcloud_cloud_loadbalancer_l7policy_l7rule_list.md +++ b/doc/ovhcloud_cloud_loadbalancer_l7policy_l7rule_list.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer l7policy l7rule list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_l7policy_list.md b/doc/ovhcloud_cloud_loadbalancer_l7policy_list.md index 90a34f13..c591b6c6 100644 --- a/doc/ovhcloud_cloud_loadbalancer_l7policy_list.md +++ b/doc/ovhcloud_cloud_loadbalancer_l7policy_list.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer l7policy list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_list.md b/doc/ovhcloud_cloud_loadbalancer_list.md index b7a091f7..bf3cdcf1 100644 --- a/doc/ovhcloud_cloud_loadbalancer_list.md +++ b/doc/ovhcloud_cloud_loadbalancer_list.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_listener_list.md b/doc/ovhcloud_cloud_loadbalancer_listener_list.md index 0f74f231..4b92e59a 100644 --- a/doc/ovhcloud_cloud_loadbalancer_listener_list.md +++ b/doc/ovhcloud_cloud_loadbalancer_listener_list.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer listener list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_log_list-kinds.md b/doc/ovhcloud_cloud_loadbalancer_log_list-kinds.md index 7b43c705..94135a25 100644 --- a/doc/ovhcloud_cloud_loadbalancer_log_list-kinds.md +++ b/doc/ovhcloud_cloud_loadbalancer_log_list-kinds.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer log list-kinds [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_log_subscription_list.md b/doc/ovhcloud_cloud_loadbalancer_log_subscription_list.md index 5db5cc55..e0d3b44d 100644 --- a/doc/ovhcloud_cloud_loadbalancer_log_subscription_list.md +++ b/doc/ovhcloud_cloud_loadbalancer_log_subscription_list.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer log subscription list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_pool_list.md b/doc/ovhcloud_cloud_loadbalancer_pool_list.md index 5b215d84..2184d92c 100644 --- a/doc/ovhcloud_cloud_loadbalancer_pool_list.md +++ b/doc/ovhcloud_cloud_loadbalancer_pool_list.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer pool list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_loadbalancer_pool_member_list.md b/doc/ovhcloud_cloud_loadbalancer_pool_member_list.md index 507f00a8..2d100a19 100644 --- a/doc/ovhcloud_cloud_loadbalancer_pool_member_list.md +++ b/doc/ovhcloud_cloud_loadbalancer_pool_member_list.md @@ -11,7 +11,7 @@ ovhcloud cloud loadbalancer pool member list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_managed-analytics.md b/doc/ovhcloud_cloud_managed-analytics.md new file mode 100644 index 00000000..be0eb43c --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics.md @@ -0,0 +1,48 @@ +## ovhcloud cloud managed-analytics + +Manage managed analytics services in the given cloud project + +### Options + +``` + --cloud-project string Cloud project ID + -h, --help help for managed-analytics +``` + +### Options inherited from parent commands + +``` + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud](ovhcloud_cloud.md) - Manage your projects and services in the Public Cloud universe (MKS, MPR, MRS, Object Storage...) +* [ovhcloud cloud managed-analytics backup](ovhcloud_cloud_managed-analytics_backup.md) - Manage backups in a specific managed analytics service +* [ovhcloud cloud managed-analytics certificate](ovhcloud_cloud_managed-analytics_certificate.md) - Manage certificates in a specific managed analytics service +* [ovhcloud cloud managed-analytics create](ovhcloud_cloud_managed-analytics_create.md) - Create a new managed analytics service +* [ovhcloud cloud managed-analytics database](ovhcloud_cloud_managed-analytics_database.md) - Manage databases in a specific managed analytics service +* [ovhcloud cloud managed-analytics delete](ovhcloud_cloud_managed-analytics_delete.md) - Delete a specific managed analytics service +* [ovhcloud cloud managed-analytics edit](ovhcloud_cloud_managed-analytics_edit.md) - Edit a specific managed analytics service +* [ovhcloud cloud managed-analytics get](ovhcloud_cloud_managed-analytics_get.md) - Get a specific managed analytics service +* [ovhcloud cloud managed-analytics list](ovhcloud_cloud_managed-analytics_list.md) - List your managed analytics services +* [ovhcloud cloud managed-analytics pattern](ovhcloud_cloud_managed-analytics_pattern.md) - Manage patterns in a specific managed analytics service +* [ovhcloud cloud managed-analytics permission](ovhcloud_cloud_managed-analytics_permission.md) - Manage permissions in a specific managed analytics service +* [ovhcloud cloud managed-analytics role](ovhcloud_cloud_managed-analytics_role.md) - Manage roles in a specific managed analytics service +* [ovhcloud cloud managed-analytics topic](ovhcloud_cloud_managed-analytics_topic.md) - Manage topics in a specific managed analytics service +* [ovhcloud cloud managed-analytics topic-acl](ovhcloud_cloud_managed-analytics_topic-acl.md) - Manage topic ACLs in a specific managed analytics service +* [ovhcloud cloud managed-analytics user](ovhcloud_cloud_managed-analytics_user.md) - Manage users in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_backup.md b/doc/ovhcloud_cloud_managed-analytics_backup.md new file mode 100644 index 00000000..42469a6c --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_backup.md @@ -0,0 +1,36 @@ +## ovhcloud cloud managed-analytics backup + +Manage backups in a specific managed analytics service + +### Options + +``` + -h, --help help for backup +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics backup get](ovhcloud_cloud_managed-analytics_backup_get.md) - Get a specific backup in the given managed analytics service +* [ovhcloud cloud managed-analytics backup list](ovhcloud_cloud_managed-analytics_backup_list.md) - List all backups in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_backup_get.md b/doc/ovhcloud_cloud_managed-analytics_backup_get.md new file mode 100644 index 00000000..14056fbd --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_backup_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics backup get + +Get a specific backup in the given managed analytics service + +``` +ovhcloud cloud managed-analytics backup get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics backup](ovhcloud_cloud_managed-analytics_backup.md) - Manage backups in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_backup_list.md b/doc/ovhcloud_cloud_managed-analytics_backup_list.md new file mode 100644 index 00000000..0f862cea --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_backup_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics backup list + +List all backups in the given managed analytics service + +``` +ovhcloud cloud managed-analytics backup list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics backup](ovhcloud_cloud_managed-analytics_backup.md) - Manage backups in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_certificate.md b/doc/ovhcloud_cloud_managed-analytics_certificate.md new file mode 100644 index 00000000..e81bdbaf --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_certificate.md @@ -0,0 +1,35 @@ +## ovhcloud cloud managed-analytics certificate + +Manage certificates in a specific managed analytics service + +### Options + +``` + -h, --help help for certificate +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics certificate get](ovhcloud_cloud_managed-analytics_certificate_get.md) - Get certificates in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_certificate_get.md b/doc/ovhcloud_cloud_managed-analytics_certificate_get.md new file mode 100644 index 00000000..63b88c3c --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_certificate_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics certificate get + +Get certificates in the given managed analytics service + +``` +ovhcloud cloud managed-analytics certificate get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics certificate](ovhcloud_cloud_managed-analytics_certificate.md) - Manage certificates in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_create.md b/doc/ovhcloud_cloud_managed-analytics_create.md new file mode 100644 index 00000000..fefc4593 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_create.md @@ -0,0 +1,77 @@ +## ovhcloud cloud managed-analytics create + +Create a new managed analytics service + +### Synopsis + +Use this command to create a managed analytics service in the given public cloud project. +There are two ways to define the creation parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-analytics create --engine kafka --version 4.0 --plan production --nodes-pattern.flavor db1-4 --nodes-pattern.region GRA + +2. Using your default text editor: + + ovhcloud cloud managed-analytics create --engine kafka --editor + You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your + default text editor to update the parameters. When saving the file, the creation will start. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-analytics create --engine kafka --editor --version 3 + + +``` +ovhcloud cloud managed-analytics create [flags] +``` + +### Options + +``` + --backups-regions strings Regions on which the backups are stored + --backups-time string Time on which backups start every day + --description string Analytics description + --disk-size int Disk size (GB) + --editor Use a text editor to define parameters + --engine string Analytics engine (you can get the list of available engines using 'ovhcloud cloud reference managed-analytics list-engines') + --fork-from.backup-id string Backup ID (not compatible with fork-from.point-in-time) + --fork-from.point-in-time string Point in time to restore from (not compatible with fork-from.backup-id) + --fork-from.service-id string Service ID that owns the backups + -h, --help help for create + --ip-restrictions strings IP blocks authorized to access the cluster (CIDR format) + --maintenance-time string Time on which maintenances can start every day + --network-id string Private network ID in which the cluster is deployed + --nodes-list strings List of nodes (format: flavor1:region1,flavor2:region2...) + --nodes-pattern.flavor string Flavor of all nodes + --nodes-pattern.number int Number of nodes + --nodes-pattern.region string Region of all nodes + --plan string Analytics plan (you can get the list of available plans using 'ovhcloud cloud reference managed-analytics list-plans') + --subnet-id string Private subnet ID in which the cluster is deployed + --version string Analytics version (you can get the list of available versions using 'ovhcloud cloud reference managed-analytics list-engines') +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project + diff --git a/doc/ovhcloud_cloud_managed-analytics_database.md b/doc/ovhcloud_cloud_managed-analytics_database.md new file mode 100644 index 00000000..25ff0c7f --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_database.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics database + +Manage databases in a specific managed analytics service + +### Options + +``` + -h, --help help for database +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics database create](ovhcloud_cloud_managed-analytics_database_create.md) - Create a new database in the given managed analytics service +* [ovhcloud cloud managed-analytics database delete](ovhcloud_cloud_managed-analytics_database_delete.md) - Delete a specific database in the given managed analytics service +* [ovhcloud cloud managed-analytics database get](ovhcloud_cloud_managed-analytics_database_get.md) - Get a specific database in the given managed analytics service +* [ovhcloud cloud managed-analytics database list](ovhcloud_cloud_managed-analytics_database_list.md) - List all databases in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_database_create.md b/doc/ovhcloud_cloud_managed-analytics_database_create.md new file mode 100644 index 00000000..5c074e3d --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_database_create.md @@ -0,0 +1,46 @@ +## ovhcloud cloud managed-analytics database create + +Create a new database in the given managed analytics service + +### Synopsis + +Use this command to create a database in the given managed analytics service. + + ovhcloud cloud managed-analytics database create --name mydb + + +``` +ovhcloud cloud managed-analytics database create [flags] +``` + +### Options + +``` + -h, --help help for create + --name string Name of the database to create +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics database](ovhcloud_cloud_managed-analytics_database.md) - Manage databases in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_database-service_database_create.md b/doc/ovhcloud_cloud_managed-analytics_database_delete.md similarity index 80% rename from doc/ovhcloud_cloud_database-service_database_create.md rename to doc/ovhcloud_cloud_managed-analytics_database_delete.md index 8e3181bd..2e70f7b7 100644 --- a/doc/ovhcloud_cloud_database-service_database_create.md +++ b/doc/ovhcloud_cloud_managed-analytics_database_delete.md @@ -1,16 +1,15 @@ -## ovhcloud cloud database-service database create +## ovhcloud cloud managed-analytics database delete -Create a new database in the given database service +Delete a specific database in the given managed analytics service ``` -ovhcloud cloud database-service database create [flags] +ovhcloud cloud managed-analytics database delete [flags] ``` ### Options ``` - -h, --help help for create - --name string Name of the database to create + -h, --help help for delete ``` ### Options inherited from parent commands @@ -35,5 +34,5 @@ ovhcloud cloud database-service database create [flags] ### SEE ALSO -* [ovhcloud cloud database-service database](ovhcloud_cloud_database-service_database.md) - Manage databases in a specific database service +* [ovhcloud cloud managed-analytics database](ovhcloud_cloud_managed-analytics_database.md) - Manage databases in a specific managed analytics service diff --git a/doc/ovhcloud_cloud_managed-analytics_database_get.md b/doc/ovhcloud_cloud_managed-analytics_database_get.md new file mode 100644 index 00000000..272f1fae --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_database_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics database get + +Get a specific database in the given managed analytics service + +``` +ovhcloud cloud managed-analytics database get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics database](ovhcloud_cloud_managed-analytics_database.md) - Manage databases in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_database_list.md b/doc/ovhcloud_cloud_managed-analytics_database_list.md new file mode 100644 index 00000000..8ab3071f --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_database_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics database list + +List all databases in the given managed analytics service + +``` +ovhcloud cloud managed-analytics database list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics database](ovhcloud_cloud_managed-analytics_database.md) - Manage databases in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_delete.md b/doc/ovhcloud_cloud_managed-analytics_delete.md new file mode 100644 index 00000000..f871fbf7 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics delete + +Delete a specific managed analytics service + +``` +ovhcloud cloud managed-analytics delete [flags] +``` + +### Options + +``` + -h, --help help for delete +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project + diff --git a/doc/ovhcloud_cloud_managed-analytics_edit.md b/doc/ovhcloud_cloud_managed-analytics_edit.md new file mode 100644 index 00000000..9c7481c2 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_edit.md @@ -0,0 +1,68 @@ +## ovhcloud cloud managed-analytics edit + +Edit a specific managed analytics service + +### Synopsis + +Use this command to edit a managed analytics service in the given public cloud project. +There are two ways to define the edition parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-analytics edit --description "My analytics service" + +2. Using your default text editor: + + ovhcloud cloud managed-analytics edit --editor + The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-analytics edit --editor --description "My analytics service" + + +``` +ovhcloud cloud managed-analytics edit [flags] +``` + +### Options + +``` + --backups-regions strings Regions on which the backups are stored + --backups-time string Time on which backups start every day + --deletion-protection Enable deletion protection + --description string Description of the cluster + --editor Use a text editor to define parameters + --enable-prometheus Enable Prometheus + --flavor string The VM flavor used for this cluster + -h, --help help for edit + --ip-restrictions strings IP blocks authorized to access the cluster (CIDR format) + --maintenance-time string Time on which maintenances can start every day + --plan string Plan of the cluster + --version string Version of the engine deployed on the cluster +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project + diff --git a/doc/ovhcloud_cloud_managed-analytics_get.md b/doc/ovhcloud_cloud_managed-analytics_get.md new file mode 100644 index 00000000..f0f68ec3 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics get + +Get a specific managed analytics service + +``` +ovhcloud cloud managed-analytics get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project + diff --git a/doc/ovhcloud_cloud_database-service_database_list.md b/doc/ovhcloud_cloud_managed-analytics_list.md similarity index 83% rename from doc/ovhcloud_cloud_database-service_database_list.md rename to doc/ovhcloud_cloud_managed-analytics_list.md index adc7fc53..2a7bee50 100644 --- a/doc/ovhcloud_cloud_database-service_database_list.md +++ b/doc/ovhcloud_cloud_managed-analytics_list.md @@ -1,9 +1,9 @@ -## ovhcloud cloud database-service database list +## ovhcloud cloud managed-analytics list -List all databases in the given database service +List your managed analytics services ``` -ovhcloud cloud database-service database list [flags] +ovhcloud cloud managed-analytics list [flags] ``` ### Options @@ -11,7 +11,7 @@ ovhcloud cloud database-service database list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' @@ -41,5 +41,5 @@ ovhcloud cloud database-service database list [flags] ### SEE ALSO -* [ovhcloud cloud database-service database](ovhcloud_cloud_database-service_database.md) - Manage databases in a specific database service +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project diff --git a/doc/ovhcloud_cloud_managed-analytics_pattern.md b/doc/ovhcloud_cloud_managed-analytics_pattern.md new file mode 100644 index 00000000..2101cae2 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_pattern.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics pattern + +Manage patterns in a specific managed analytics service + +### Options + +``` + -h, --help help for pattern +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics pattern create](ovhcloud_cloud_managed-analytics_pattern_create.md) - Create a new pattern in the given managed analytics service +* [ovhcloud cloud managed-analytics pattern delete](ovhcloud_cloud_managed-analytics_pattern_delete.md) - Delete a specific pattern in the given managed analytics service +* [ovhcloud cloud managed-analytics pattern get](ovhcloud_cloud_managed-analytics_pattern_get.md) - Get a specific pattern in the given managed analytics service +* [ovhcloud cloud managed-analytics pattern list](ovhcloud_cloud_managed-analytics_pattern_list.md) - List patterns in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_pattern_create.md b/doc/ovhcloud_cloud_managed-analytics_pattern_create.md new file mode 100644 index 00000000..fb7df01e --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_pattern_create.md @@ -0,0 +1,41 @@ +## ovhcloud cloud managed-analytics pattern create + +Create a new pattern in the given managed analytics service + +``` +ovhcloud cloud managed-analytics pattern create [flags] +``` + +### Options + +``` + --editor Use a text editor to define parameters + -h, --help help for create + --max-index-count int Maximum number of index for this pattern (clickhouse only) + --pattern string Pattern format +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics pattern](ovhcloud_cloud_managed-analytics_pattern.md) - Manage patterns in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_pattern_delete.md b/doc/ovhcloud_cloud_managed-analytics_pattern_delete.md new file mode 100644 index 00000000..c2bb86be --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_pattern_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics pattern delete + +Delete a specific pattern in the given managed analytics service + +``` +ovhcloud cloud managed-analytics pattern delete [flags] +``` + +### Options + +``` + -h, --help help for delete +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics pattern](ovhcloud_cloud_managed-analytics_pattern.md) - Manage patterns in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_pattern_get.md b/doc/ovhcloud_cloud_managed-analytics_pattern_get.md new file mode 100644 index 00000000..23927e61 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_pattern_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics pattern get + +Get a specific pattern in the given managed analytics service + +``` +ovhcloud cloud managed-analytics pattern get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics pattern](ovhcloud_cloud_managed-analytics_pattern.md) - Manage patterns in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_pattern_list.md b/doc/ovhcloud_cloud_managed-analytics_pattern_list.md new file mode 100644 index 00000000..9a0cf373 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_pattern_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics pattern list + +List patterns in the given managed analytics service + +``` +ovhcloud cloud managed-analytics pattern list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics pattern](ovhcloud_cloud_managed-analytics_pattern.md) - Manage patterns in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_permission.md b/doc/ovhcloud_cloud_managed-analytics_permission.md new file mode 100644 index 00000000..334e68c8 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_permission.md @@ -0,0 +1,35 @@ +## ovhcloud cloud managed-analytics permission + +Manage permissions in a specific managed analytics service + +### Options + +``` + -h, --help help for permission +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics permission list](ovhcloud_cloud_managed-analytics_permission_list.md) - List permissions in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_permission_list.md b/doc/ovhcloud_cloud_managed-analytics_permission_list.md new file mode 100644 index 00000000..d73266db --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_permission_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics permission list + +List permissions in the given managed analytics service + +``` +ovhcloud cloud managed-analytics permission list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics permission](ovhcloud_cloud_managed-analytics_permission.md) - Manage permissions in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_role.md b/doc/ovhcloud_cloud_managed-analytics_role.md new file mode 100644 index 00000000..facec9ea --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_role.md @@ -0,0 +1,35 @@ +## ovhcloud cloud managed-analytics role + +Manage roles in a specific managed analytics service + +### Options + +``` + -h, --help help for role +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics role list](ovhcloud_cloud_managed-analytics_role_list.md) - List roles in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_role_list.md b/doc/ovhcloud_cloud_managed-analytics_role_list.md new file mode 100644 index 00000000..7a82c1f4 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_role_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics role list + +List roles in the given managed analytics service + +``` +ovhcloud cloud managed-analytics role list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics role](ovhcloud_cloud_managed-analytics_role.md) - Manage roles in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic-acl.md b/doc/ovhcloud_cloud_managed-analytics_topic-acl.md new file mode 100644 index 00000000..50c05aba --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic-acl.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics topic-acl + +Manage topic ACLs in a specific managed analytics service + +### Options + +``` + -h, --help help for topic-acl +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics topic-acl create](ovhcloud_cloud_managed-analytics_topic-acl_create.md) - Create a new topic ACL in the given managed analytics service +* [ovhcloud cloud managed-analytics topic-acl delete](ovhcloud_cloud_managed-analytics_topic-acl_delete.md) - Delete a specific topic ACL in the given managed analytics service +* [ovhcloud cloud managed-analytics topic-acl get](ovhcloud_cloud_managed-analytics_topic-acl_get.md) - Get a specific topic ACL in the given managed analytics service +* [ovhcloud cloud managed-analytics topic-acl list](ovhcloud_cloud_managed-analytics_topic-acl_list.md) - List topic ACLs in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic-acl_create.md b/doc/ovhcloud_cloud_managed-analytics_topic-acl_create.md new file mode 100644 index 00000000..6be36c65 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic-acl_create.md @@ -0,0 +1,48 @@ +## ovhcloud cloud managed-analytics topic-acl create + +Create a new topic ACL in the given managed analytics service + +### Synopsis + +Use this command to create a topic ACL in the given managed analytics service (kafka only). + + ovhcloud cloud managed-analytics topic-acl create --permission read --topic my-topic --username myuser + + +``` +ovhcloud cloud managed-analytics topic-acl create [flags] +``` + +### Options + +``` + -h, --help help for create + --permission string ACL permission (e.g. read, write, readwrite) + --topic string Topic name the ACL applies to + --username string Username the ACL applies to +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic-acl](ovhcloud_cloud_managed-analytics_topic-acl.md) - Manage topic ACLs in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic-acl_delete.md b/doc/ovhcloud_cloud_managed-analytics_topic-acl_delete.md new file mode 100644 index 00000000..377076e5 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic-acl_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics topic-acl delete + +Delete a specific topic ACL in the given managed analytics service + +``` +ovhcloud cloud managed-analytics topic-acl delete [flags] +``` + +### Options + +``` + -h, --help help for delete +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic-acl](ovhcloud_cloud_managed-analytics_topic-acl.md) - Manage topic ACLs in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic-acl_get.md b/doc/ovhcloud_cloud_managed-analytics_topic-acl_get.md new file mode 100644 index 00000000..a5b38194 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic-acl_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics topic-acl get + +Get a specific topic ACL in the given managed analytics service + +``` +ovhcloud cloud managed-analytics topic-acl get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic-acl](ovhcloud_cloud_managed-analytics_topic-acl.md) - Manage topic ACLs in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic-acl_list.md b/doc/ovhcloud_cloud_managed-analytics_topic-acl_list.md new file mode 100644 index 00000000..495a4a03 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic-acl_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics topic-acl list + +List topic ACLs in the given managed analytics service + +``` +ovhcloud cloud managed-analytics topic-acl list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic-acl](ovhcloud_cloud_managed-analytics_topic-acl.md) - Manage topic ACLs in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic.md b/doc/ovhcloud_cloud_managed-analytics_topic.md new file mode 100644 index 00000000..819eb6fe --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic.md @@ -0,0 +1,39 @@ +## ovhcloud cloud managed-analytics topic + +Manage topics in a specific managed analytics service + +### Options + +``` + -h, --help help for topic +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics topic create](ovhcloud_cloud_managed-analytics_topic_create.md) - Create a new topic in the given managed analytics service +* [ovhcloud cloud managed-analytics topic delete](ovhcloud_cloud_managed-analytics_topic_delete.md) - Delete a specific topic in the given managed analytics service +* [ovhcloud cloud managed-analytics topic edit](ovhcloud_cloud_managed-analytics_topic_edit.md) - Edit a topic in the given managed analytics service +* [ovhcloud cloud managed-analytics topic get](ovhcloud_cloud_managed-analytics_topic_get.md) - Get a specific topic in the given managed analytics service +* [ovhcloud cloud managed-analytics topic list](ovhcloud_cloud_managed-analytics_topic_list.md) - List topics in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic_create.md b/doc/ovhcloud_cloud_managed-analytics_topic_create.md new file mode 100644 index 00000000..c710224e --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic_create.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics topic create + +Create a new topic in the given managed analytics service + +``` +ovhcloud cloud managed-analytics topic create [flags] +``` + +### Options + +``` + --editor Use a text editor to define parameters + -h, --help help for create + --min-insync-replicas int Minimum in-sync replicas + --name string Topic name + --partitions int Number of partitions + --replication int Number of replications + --retention-bytes int Retention size in bytes (-1 for unlimited) + --retention-hours int Retention duration in hours (-1 for unlimited) +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic](ovhcloud_cloud_managed-analytics_topic.md) - Manage topics in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic_delete.md b/doc/ovhcloud_cloud_managed-analytics_topic_delete.md new file mode 100644 index 00000000..3897af69 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics topic delete + +Delete a specific topic in the given managed analytics service + +``` +ovhcloud cloud managed-analytics topic delete [flags] +``` + +### Options + +``` + -h, --help help for delete +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic](ovhcloud_cloud_managed-analytics_topic.md) - Manage topics in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic_edit.md b/doc/ovhcloud_cloud_managed-analytics_topic_edit.md new file mode 100644 index 00000000..35f6d56e --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic_edit.md @@ -0,0 +1,44 @@ +## ovhcloud cloud managed-analytics topic edit + +Edit a topic in the given managed analytics service + +``` +ovhcloud cloud managed-analytics topic edit [flags] +``` + +### Options + +``` + --editor Use a text editor to define parameters + -h, --help help for edit + --min-insync-replicas int Minimum in-sync replicas + --partitions int Number of partitions + --replication int Number of replications + --retention-bytes int Retention size in bytes (-1 for unlimited) + --retention-hours int Retention duration in hours (-1 for unlimited) +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic](ovhcloud_cloud_managed-analytics_topic.md) - Manage topics in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic_get.md b/doc/ovhcloud_cloud_managed-analytics_topic_get.md new file mode 100644 index 00000000..d1228233 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics topic get + +Get a specific topic in the given managed analytics service + +``` +ovhcloud cloud managed-analytics topic get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic](ovhcloud_cloud_managed-analytics_topic.md) - Manage topics in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_topic_list.md b/doc/ovhcloud_cloud_managed-analytics_topic_list.md new file mode 100644 index 00000000..ee1f7a4c --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_topic_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics topic list + +List topics in the given managed analytics service + +``` +ovhcloud cloud managed-analytics topic list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics topic](ovhcloud_cloud_managed-analytics_topic.md) - Manage topics in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_user.md b/doc/ovhcloud_cloud_managed-analytics_user.md new file mode 100644 index 00000000..f86b042d --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_user.md @@ -0,0 +1,40 @@ +## ovhcloud cloud managed-analytics user + +Manage users in a specific managed analytics service + +### Options + +``` + -h, --help help for user +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics](ovhcloud_cloud_managed-analytics.md) - Manage managed analytics services in the given cloud project +* [ovhcloud cloud managed-analytics user create](ovhcloud_cloud_managed-analytics_user_create.md) - Create a new user in the given managed analytics service +* [ovhcloud cloud managed-analytics user credentials-reset](ovhcloud_cloud_managed-analytics_user_credentials-reset.md) - Reset the credentials of a specific user in the given managed analytics service +* [ovhcloud cloud managed-analytics user delete](ovhcloud_cloud_managed-analytics_user_delete.md) - Delete a specific user in the given managed analytics service +* [ovhcloud cloud managed-analytics user edit](ovhcloud_cloud_managed-analytics_user_edit.md) - Edit a user in the given managed analytics service +* [ovhcloud cloud managed-analytics user get](ovhcloud_cloud_managed-analytics_user_get.md) - Get a specific user in the given managed analytics service +* [ovhcloud cloud managed-analytics user list](ovhcloud_cloud_managed-analytics_user_list.md) - List all users in the given managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_user_create.md b/doc/ovhcloud_cloud_managed-analytics_user_create.md new file mode 100644 index 00000000..ee44e237 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_user_create.md @@ -0,0 +1,70 @@ +## ovhcloud cloud managed-analytics user create + +Create a new user in the given managed analytics service + +### Synopsis + +Use this command to create a user in the given managed analytics service. +There are two ways to define the creation parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-analytics user create --name myuser + + For Clickhouse engine, you can also specify roles: + + ovhcloud cloud managed-analytics user create --name myuser --roles role1,role2 + + For OpenSearch engine, you can specify ACLs: + + ovhcloud cloud managed-analytics user create --name myuser --acls "logs-.*:write" --acls "metrics-.*:read" + +2. Using your default text editor: + + ovhcloud cloud managed-analytics user create --name myuser --editor + You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your + default text editor to update the parameters. When saving the file, the creation will start. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-analytics user create --name myuser --editor --roles role1,role2 + + +``` +ovhcloud cloud managed-analytics user create [flags] +``` + +### Options + +``` + --acls stringArray ACL granted to the user (opensearch only, format: pattern:permission) + --editor Use a text editor to define parameters + -h, --help help for create + --name string Name of the user to create + --roles strings Roles granted to the user (clickhouse only) +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics user](ovhcloud_cloud_managed-analytics_user.md) - Manage users in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_user_credentials-reset.md b/doc/ovhcloud_cloud_managed-analytics_user_credentials-reset.md new file mode 100644 index 00000000..dffa0c01 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_user_credentials-reset.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics user credentials-reset + +Reset the credentials of a specific user in the given managed analytics service + +``` +ovhcloud cloud managed-analytics user credentials-reset [flags] +``` + +### Options + +``` + -h, --help help for credentials-reset +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics user](ovhcloud_cloud_managed-analytics_user.md) - Manage users in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_user_delete.md b/doc/ovhcloud_cloud_managed-analytics_user_delete.md new file mode 100644 index 00000000..1bbb0625 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_user_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics user delete + +Delete a specific user in the given managed analytics service + +``` +ovhcloud cloud managed-analytics user delete [flags] +``` + +### Options + +``` + -h, --help help for delete +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics user](ovhcloud_cloud_managed-analytics_user.md) - Manage users in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_user_edit.md b/doc/ovhcloud_cloud_managed-analytics_user_edit.md new file mode 100644 index 00000000..92f31a86 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_user_edit.md @@ -0,0 +1,66 @@ +## ovhcloud cloud managed-analytics user edit + +Edit a user in the given managed analytics service + +### Synopsis + +Use this command to edit a user in the given managed analytics service. +There are two ways to define the edition parameters: + +1. Using only CLI flags: + + For Clickhouse engine: + + ovhcloud cloud managed-analytics user edit --roles role1,role2 + + For OpenSearch engine: + + ovhcloud cloud managed-analytics user edit --acls "logs-.*:write" --acls "metrics-.*:read" + +2. Using your default text editor: + + ovhcloud cloud managed-analytics user edit --editor + The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-analytics user edit --editor --roles role1,role2 + + +``` +ovhcloud cloud managed-analytics user edit [flags] +``` + +### Options + +``` + --acls stringArray ACL granted to the user (opensearch only, format: pattern:permission) + --editor Use a text editor to define parameters + -h, --help help for edit + --roles strings Roles granted to the user (clickhouse only) +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics user](ovhcloud_cloud_managed-analytics_user.md) - Manage users in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_user_get.md b/doc/ovhcloud_cloud_managed-analytics_user_get.md new file mode 100644 index 00000000..130e6b7c --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_user_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-analytics user get + +Get a specific user in the given managed analytics service + +``` +ovhcloud cloud managed-analytics user get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics user](ovhcloud_cloud_managed-analytics_user.md) - Manage users in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-analytics_user_list.md b/doc/ovhcloud_cloud_managed-analytics_user_list.md new file mode 100644 index 00000000..4b30d919 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-analytics_user_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-analytics user list + +List all users in the given managed analytics service + +``` +ovhcloud cloud managed-analytics user list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-analytics user](ovhcloud_cloud_managed-analytics_user.md) - Manage users in a specific managed analytics service + diff --git a/doc/ovhcloud_cloud_managed-database.md b/doc/ovhcloud_cloud_managed-database.md new file mode 100644 index 00000000..4f1662a0 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database.md @@ -0,0 +1,44 @@ +## ovhcloud cloud managed-database + +Manage managed database services in the given cloud project + +### Options + +``` + --cloud-project string Cloud project ID + -h, --help help for managed-database +``` + +### Options inherited from parent commands + +``` + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud](ovhcloud_cloud.md) - Manage your projects and services in the Public Cloud universe (MKS, MPR, MRS, Object Storage...) +* [ovhcloud cloud managed-database backup](ovhcloud_cloud_managed-database_backup.md) - Manage backups in a specific managed database service +* [ovhcloud cloud managed-database certificate](ovhcloud_cloud_managed-database_certificate.md) - Manage certificates in a specific managed database service +* [ovhcloud cloud managed-database create](ovhcloud_cloud_managed-database_create.md) - Create a new managed database service +* [ovhcloud cloud managed-database database](ovhcloud_cloud_managed-database_database.md) - Manage databases in a specific managed database service +* [ovhcloud cloud managed-database delete](ovhcloud_cloud_managed-database_delete.md) - Delete a specific managed database service +* [ovhcloud cloud managed-database edit](ovhcloud_cloud_managed-database_edit.md) - Edit a specific managed database service +* [ovhcloud cloud managed-database get](ovhcloud_cloud_managed-database_get.md) - Get a specific managed database service +* [ovhcloud cloud managed-database list](ovhcloud_cloud_managed-database_list.md) - List your managed database services +* [ovhcloud cloud managed-database role](ovhcloud_cloud_managed-database_role.md) - Manage roles in a specific managed database service +* [ovhcloud cloud managed-database user](ovhcloud_cloud_managed-database_user.md) - Manage users in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_backup.md b/doc/ovhcloud_cloud_managed-database_backup.md new file mode 100644 index 00000000..f4eda6f5 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_backup.md @@ -0,0 +1,37 @@ +## ovhcloud cloud managed-database backup + +Manage backups in a specific managed database service + +### Options + +``` + -h, --help help for backup +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project +* [ovhcloud cloud managed-database backup get](ovhcloud_cloud_managed-database_backup_get.md) - Get a specific backup in the given managed database service +* [ovhcloud cloud managed-database backup list](ovhcloud_cloud_managed-database_backup_list.md) - List all backups in the given managed database service +* [ovhcloud cloud managed-database backup restore](ovhcloud_cloud_managed-database_backup_restore.md) - Restore a specific backup in the given managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_backup_get.md b/doc/ovhcloud_cloud_managed-database_backup_get.md new file mode 100644 index 00000000..2ccc4771 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_backup_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-database backup get + +Get a specific backup in the given managed database service + +``` +ovhcloud cloud managed-database backup get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database backup](ovhcloud_cloud_managed-database_backup.md) - Manage backups in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_backup_list.md b/doc/ovhcloud_cloud_managed-database_backup_list.md new file mode 100644 index 00000000..19ed0ab2 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_backup_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-database backup list + +List all backups in the given managed database service + +``` +ovhcloud cloud managed-database backup list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database backup](ovhcloud_cloud_managed-database_backup.md) - Manage backups in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_backup_restore.md b/doc/ovhcloud_cloud_managed-database_backup_restore.md new file mode 100644 index 00000000..56a50aad --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_backup_restore.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-database backup restore + +Restore a specific backup in the given managed database service + +``` +ovhcloud cloud managed-database backup restore [flags] +``` + +### Options + +``` + -h, --help help for restore +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database backup](ovhcloud_cloud_managed-database_backup.md) - Manage backups in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_certificate.md b/doc/ovhcloud_cloud_managed-database_certificate.md new file mode 100644 index 00000000..75328457 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_certificate.md @@ -0,0 +1,35 @@ +## ovhcloud cloud managed-database certificate + +Manage certificates in a specific managed database service + +### Options + +``` + -h, --help help for certificate +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project +* [ovhcloud cloud managed-database certificate get](ovhcloud_cloud_managed-database_certificate_get.md) - Get certificates in the given managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_certificate_get.md b/doc/ovhcloud_cloud_managed-database_certificate_get.md new file mode 100644 index 00000000..271318bb --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_certificate_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-database certificate get + +Get certificates in the given managed database service + +``` +ovhcloud cloud managed-database certificate get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database certificate](ovhcloud_cloud_managed-database_certificate.md) - Manage certificates in a specific managed database service + diff --git a/doc/ovhcloud_cloud_database-service_create.md b/doc/ovhcloud_cloud_managed-database_create.md similarity index 83% rename from doc/ovhcloud_cloud_database-service_create.md rename to doc/ovhcloud_cloud_managed-database_create.md index d7632ff1..8cd865c0 100644 --- a/doc/ovhcloud_cloud_database-service_create.md +++ b/doc/ovhcloud_cloud_managed-database_create.md @@ -1,30 +1,29 @@ -## ovhcloud cloud database-service create +## ovhcloud cloud managed-database create -Create a new database service +Create a new managed database service ### Synopsis -Use this command to create a database service in the given public cloud project. +Use this command to create a managed database service in the given public cloud project. There are two ways to define the creation parameters: 1. Using only CLI flags: - ovhcloud cloud database-service create --engine mysql --version 8 --plan essential --nodes-list "db1-4:DE" + ovhcloud cloud managed-database create --engine mysql --version 8 --plan essential --nodes-pattern.flavor db1-4 --nodes-pattern.region DE 2. Using your default text editor: - ovhcloud cloud database-service create --engine kafka --editor - + ovhcloud cloud managed-database create --engine mysql --editor You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your default text editor to update the parameters. When saving the file, the creation will start. Note that it is also possible to override values in the presented examples using command line flags like the following: - ovhcloud cloud database-service create --engine mysql --editor --version 8 + ovhcloud cloud managed-database create --engine mysql --editor --version 8 ``` -ovhcloud cloud database-service create [flags] +ovhcloud cloud managed-database create [flags] ``` ### Options @@ -35,7 +34,7 @@ ovhcloud cloud database-service create [flags] --description string Database description --disk-size int Disk size (GB) --editor Use a text editor to define parameters - --engine string Database engine (you can get the list of available engines using 'ovhcloud cloud reference database list-engines') + --engine string Database engine (you can get the list of available engines using 'ovhcloud cloud reference managed-database list-engines') --fork-from.backup-id string Backup ID (not compatible with fork-from.point-in-time) --fork-from.point-in-time string Point in time to restore from (not compatible with fork-from.backup-id) --fork-from.service-id string Service ID that owns the backups @@ -47,9 +46,9 @@ ovhcloud cloud database-service create [flags] --nodes-pattern.flavor string Flavor of all nodes --nodes-pattern.number int Number of nodes --nodes-pattern.region string Region of all nodes - --plan string Database plan (you can get the list of available plans using 'ovhcloud cloud reference database list-plans') + --plan string Database plan (you can get the list of available plans using 'ovhcloud cloud reference managed-database list-plans') --subnet-id string Private subnet ID in which the cluster is deployed - --version string Database version (you can get the list of available versions using 'ovhcloud cloud reference database list-engines') + --version string Database version (you can get the list of available versions using 'ovhcloud cloud reference managed-database list-engines') ``` ### Options inherited from parent commands @@ -74,5 +73,5 @@ ovhcloud cloud database-service create [flags] ### SEE ALSO -* [ovhcloud cloud database-service](ovhcloud_cloud_database-service.md) - Manage database services in the given cloud project +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project diff --git a/doc/ovhcloud_cloud_database-service_database.md b/doc/ovhcloud_cloud_managed-database_database.md similarity index 60% rename from doc/ovhcloud_cloud_database-service_database.md rename to doc/ovhcloud_cloud_managed-database_database.md index b2fb2c82..9a84aca4 100644 --- a/doc/ovhcloud_cloud_database-service_database.md +++ b/doc/ovhcloud_cloud_managed-database_database.md @@ -1,6 +1,6 @@ -## ovhcloud cloud database-service database +## ovhcloud cloud managed-database database -Manage databases in a specific database service +Manage databases in a specific managed database service ### Options @@ -30,9 +30,9 @@ Manage databases in a specific database service ### SEE ALSO -* [ovhcloud cloud database-service](ovhcloud_cloud_database-service.md) - Manage database services in the given cloud project -* [ovhcloud cloud database-service database create](ovhcloud_cloud_database-service_database_create.md) - Create a new database in the given database service -* [ovhcloud cloud database-service database delete](ovhcloud_cloud_database-service_database_delete.md) - Delete a specific database in the given database service -* [ovhcloud cloud database-service database get](ovhcloud_cloud_database-service_database_get.md) - Get a specific database in the given database service -* [ovhcloud cloud database-service database list](ovhcloud_cloud_database-service_database_list.md) - List all databases in the given database service +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project +* [ovhcloud cloud managed-database database create](ovhcloud_cloud_managed-database_database_create.md) - Create a new database in the given managed database service +* [ovhcloud cloud managed-database database delete](ovhcloud_cloud_managed-database_database_delete.md) - Delete a specific database in the given managed database service +* [ovhcloud cloud managed-database database get](ovhcloud_cloud_managed-database_database_get.md) - Get a specific database in the given managed database service +* [ovhcloud cloud managed-database database list](ovhcloud_cloud_managed-database_database_list.md) - List all databases in the given managed database service diff --git a/doc/ovhcloud_cloud_managed-database_database_create.md b/doc/ovhcloud_cloud_managed-database_database_create.md new file mode 100644 index 00000000..1fc5e2f8 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_database_create.md @@ -0,0 +1,46 @@ +## ovhcloud cloud managed-database database create + +Create a new database in the given managed database service + +### Synopsis + +Use this command to create a database in the given managed database service. + + ovhcloud cloud managed-database database create --name mydb + + +``` +ovhcloud cloud managed-database database create [flags] +``` + +### Options + +``` + -h, --help help for create + --name string Name of the database to create +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database database](ovhcloud_cloud_managed-database_database.md) - Manage databases in a specific managed database service + diff --git a/doc/ovhcloud_cloud_database-service_database_delete.md b/doc/ovhcloud_cloud_managed-database_database_delete.md similarity index 81% rename from doc/ovhcloud_cloud_database-service_database_delete.md rename to doc/ovhcloud_cloud_managed-database_database_delete.md index 647183b7..59681977 100644 --- a/doc/ovhcloud_cloud_database-service_database_delete.md +++ b/doc/ovhcloud_cloud_managed-database_database_delete.md @@ -1,9 +1,9 @@ -## ovhcloud cloud database-service database delete +## ovhcloud cloud managed-database database delete -Delete a specific database in the given database service +Delete a specific database in the given managed database service ``` -ovhcloud cloud database-service database delete [flags] +ovhcloud cloud managed-database database delete [flags] ``` ### Options @@ -34,5 +34,5 @@ ovhcloud cloud database-service database delete [flag ### SEE ALSO -* [ovhcloud cloud database-service database](ovhcloud_cloud_database-service_database.md) - Manage databases in a specific database service +* [ovhcloud cloud managed-database database](ovhcloud_cloud_managed-database_database.md) - Manage databases in a specific managed database service diff --git a/doc/ovhcloud_cloud_database-service_database_get.md b/doc/ovhcloud_cloud_managed-database_database_get.md similarity index 81% rename from doc/ovhcloud_cloud_database-service_database_get.md rename to doc/ovhcloud_cloud_managed-database_database_get.md index ba0de98e..f9be1a17 100644 --- a/doc/ovhcloud_cloud_database-service_database_get.md +++ b/doc/ovhcloud_cloud_managed-database_database_get.md @@ -1,9 +1,9 @@ -## ovhcloud cloud database-service database get +## ovhcloud cloud managed-database database get -Get a specific database in the given database service +Get a specific database in the given managed database service ``` -ovhcloud cloud database-service database get [flags] +ovhcloud cloud managed-database database get [flags] ``` ### Options @@ -34,5 +34,5 @@ ovhcloud cloud database-service database get [flags] ### SEE ALSO -* [ovhcloud cloud database-service database](ovhcloud_cloud_database-service_database.md) - Manage databases in a specific database service +* [ovhcloud cloud managed-database database](ovhcloud_cloud_managed-database_database.md) - Manage databases in a specific managed database service diff --git a/doc/ovhcloud_cloud_managed-database_database_list.md b/doc/ovhcloud_cloud_managed-database_database_list.md new file mode 100644 index 00000000..5e5f17ec --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_database_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-database database list + +List all databases in the given managed database service + +``` +ovhcloud cloud managed-database database list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database database](ovhcloud_cloud_managed-database_database.md) - Manage databases in a specific managed database service + diff --git a/doc/ovhcloud_cloud_database-service_delete.md b/doc/ovhcloud_cloud_managed-database_delete.md similarity index 83% rename from doc/ovhcloud_cloud_database-service_delete.md rename to doc/ovhcloud_cloud_managed-database_delete.md index 0f5c2c24..b2b02f15 100644 --- a/doc/ovhcloud_cloud_database-service_delete.md +++ b/doc/ovhcloud_cloud_managed-database_delete.md @@ -1,9 +1,9 @@ -## ovhcloud cloud database-service delete +## ovhcloud cloud managed-database delete -Delete a specific database service +Delete a specific managed database service ``` -ovhcloud cloud database-service delete [flags] +ovhcloud cloud managed-database delete [flags] ``` ### Options @@ -34,5 +34,5 @@ ovhcloud cloud database-service delete [flags] ### SEE ALSO -* [ovhcloud cloud database-service](ovhcloud_cloud_database-service.md) - Manage database services in the given cloud project +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project diff --git a/doc/ovhcloud_cloud_database-service_edit.md b/doc/ovhcloud_cloud_managed-database_edit.md similarity index 82% rename from doc/ovhcloud_cloud_database-service_edit.md rename to doc/ovhcloud_cloud_managed-database_edit.md index 7d548998..059efc89 100644 --- a/doc/ovhcloud_cloud_database-service_edit.md +++ b/doc/ovhcloud_cloud_managed-database_edit.md @@ -1,29 +1,28 @@ -## ovhcloud cloud database-service edit +## ovhcloud cloud managed-database edit -Edit a specific database service +Edit a specific managed database service ### Synopsis -Use this command to edit a database service in the given public cloud project. +Use this command to edit a managed database service in the given public cloud project. There are two ways to define the edition parameters: 1. Using only CLI flags: - ovhcloud cloud database-service edit --description "My database" + ovhcloud cloud managed-database edit --description "My database" 2. Using your default text editor: - ovhcloud cloud database-service edit --editor - + ovhcloud cloud managed-database edit --editor The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. Note that it is also possible to override values in the presented examples using command line flags like the following: - ovhcloud cloud database-service edit --editor --description "My database cluster" + ovhcloud cloud managed-database edit --editor --description "My database cluster" ``` -ovhcloud cloud database-service edit [flags] +ovhcloud cloud managed-database edit [flags] ``` ### Options @@ -65,5 +64,5 @@ ovhcloud cloud database-service edit [flags] ### SEE ALSO -* [ovhcloud cloud database-service](ovhcloud_cloud_database-service.md) - Manage database services in the given cloud project +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project diff --git a/doc/ovhcloud_cloud_database-service_get.md b/doc/ovhcloud_cloud_managed-database_get.md similarity index 83% rename from doc/ovhcloud_cloud_database-service_get.md rename to doc/ovhcloud_cloud_managed-database_get.md index 056fce30..6305a9a5 100644 --- a/doc/ovhcloud_cloud_database-service_get.md +++ b/doc/ovhcloud_cloud_managed-database_get.md @@ -1,9 +1,9 @@ -## ovhcloud cloud database-service get +## ovhcloud cloud managed-database get -Get a specific database service +Get a specific managed database service ``` -ovhcloud cloud database-service get [flags] +ovhcloud cloud managed-database get [flags] ``` ### Options @@ -34,5 +34,5 @@ ovhcloud cloud database-service get [flags] ### SEE ALSO -* [ovhcloud cloud database-service](ovhcloud_cloud_database-service.md) - Manage database services in the given cloud project +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project diff --git a/doc/ovhcloud_cloud_database-service_list.md b/doc/ovhcloud_cloud_managed-database_list.md similarity index 85% rename from doc/ovhcloud_cloud_database-service_list.md rename to doc/ovhcloud_cloud_managed-database_list.md index e50104b7..d4dd59e3 100644 --- a/doc/ovhcloud_cloud_database-service_list.md +++ b/doc/ovhcloud_cloud_managed-database_list.md @@ -1,9 +1,9 @@ -## ovhcloud cloud database-service list +## ovhcloud cloud managed-database list -List your database services +List your managed database services ``` -ovhcloud cloud database-service list [flags] +ovhcloud cloud managed-database list [flags] ``` ### Options @@ -11,7 +11,7 @@ ovhcloud cloud database-service list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' @@ -41,5 +41,5 @@ ovhcloud cloud database-service list [flags] ### SEE ALSO -* [ovhcloud cloud database-service](ovhcloud_cloud_database-service.md) - Manage database services in the given cloud project +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project diff --git a/doc/ovhcloud_cloud_managed-database_role.md b/doc/ovhcloud_cloud_managed-database_role.md new file mode 100644 index 00000000..25c346ce --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_role.md @@ -0,0 +1,35 @@ +## ovhcloud cloud managed-database role + +Manage roles in a specific managed database service + +### Options + +``` + -h, --help help for role +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project +* [ovhcloud cloud managed-database role list](ovhcloud_cloud_managed-database_role_list.md) - List roles in the given managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_role_list.md b/doc/ovhcloud_cloud_managed-database_role_list.md new file mode 100644 index 00000000..46b62339 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_role_list.md @@ -0,0 +1,46 @@ +## ovhcloud cloud managed-database role list + +List roles in the given managed database service + +``` +ovhcloud cloud managed-database role list [flags] +``` + +### Options + +``` + --advanced Adds the advanced roles to the list of the roles (mongodb only) + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database role](ovhcloud_cloud_managed-database_role.md) - Manage roles in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_user.md b/doc/ovhcloud_cloud_managed-database_user.md new file mode 100644 index 00000000..b970a76b --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_user.md @@ -0,0 +1,40 @@ +## ovhcloud cloud managed-database user + +Manage users in a specific managed database service + +### Options + +``` + -h, --help help for user +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database](ovhcloud_cloud_managed-database.md) - Manage managed database services in the given cloud project +* [ovhcloud cloud managed-database user create](ovhcloud_cloud_managed-database_user_create.md) - Create a new user in the given managed database service +* [ovhcloud cloud managed-database user credentials-reset](ovhcloud_cloud_managed-database_user_credentials-reset.md) - Reset the credentials of a specific user in the given managed database service +* [ovhcloud cloud managed-database user delete](ovhcloud_cloud_managed-database_user_delete.md) - Delete a specific user in the given managed database service +* [ovhcloud cloud managed-database user edit](ovhcloud_cloud_managed-database_user_edit.md) - Edit a user in the given managed database service +* [ovhcloud cloud managed-database user get](ovhcloud_cloud_managed-database_user_get.md) - Get a specific user in the given managed database service +* [ovhcloud cloud managed-database user list](ovhcloud_cloud_managed-database_user_list.md) - List all users in the given managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_user_create.md b/doc/ovhcloud_cloud_managed-database_user_create.md new file mode 100644 index 00000000..8ba1e165 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_user_create.md @@ -0,0 +1,73 @@ +## ovhcloud cloud managed-database user create + +Create a new user in the given managed database service + +### Synopsis + +Use this command to create a user in the given managed database service. +There are two ways to define the creation parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-database user create --name myuser + + For PostgreSQL and MongoDB engines, you can also specify roles: + + ovhcloud cloud managed-database user create --name myuser --roles role1,role2 + + For Valkey engine, you can specify permissions: + + ovhcloud cloud managed-database user create --name myuser --categories "+@read" --commands "+get" + +2. Using your default text editor: + + ovhcloud cloud managed-database user create --name myuser --editor + You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your + default text editor to update the parameters. When saving the file, the creation will start. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-database user create --name myuser --editor --roles role1,role2 + + +``` +ovhcloud cloud managed-database user create [flags] +``` + +### Options + +``` + --categories strings Command categories the user can execute (valkey only) + --channels strings Channels the user can subscribe to (valkey only) + --commands strings Commands the user can execute (valkey only) + --editor Use a text editor to define parameters + -h, --help help for create + --keys strings Keys the user can access (valkey only) + --name string Name of the user to create + --roles strings Roles granted to the user (postgresql and mongodb only) +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database user](ovhcloud_cloud_managed-database_user.md) - Manage users in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_user_credentials-reset.md b/doc/ovhcloud_cloud_managed-database_user_credentials-reset.md new file mode 100644 index 00000000..d7ef9464 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_user_credentials-reset.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-database user credentials-reset + +Reset the credentials of a specific user in the given managed database service + +``` +ovhcloud cloud managed-database user credentials-reset [flags] +``` + +### Options + +``` + -h, --help help for credentials-reset +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database user](ovhcloud_cloud_managed-database_user.md) - Manage users in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_user_delete.md b/doc/ovhcloud_cloud_managed-database_user_delete.md new file mode 100644 index 00000000..39adf226 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_user_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-database user delete + +Delete a specific user in the given managed database service + +``` +ovhcloud cloud managed-database user delete [flags] +``` + +### Options + +``` + -h, --help help for delete +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database user](ovhcloud_cloud_managed-database_user.md) - Manage users in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_user_edit.md b/doc/ovhcloud_cloud_managed-database_user_edit.md new file mode 100644 index 00000000..e798db57 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_user_edit.md @@ -0,0 +1,69 @@ +## ovhcloud cloud managed-database user edit + +Edit a user in the given managed database service + +### Synopsis + +Use this command to edit a user in the given managed database service. +There are two ways to define the edition parameters: + +1. Using only CLI flags: + + For PostgreSQL and MongoDB engines: + + ovhcloud cloud managed-database user edit --roles role1,role2 + + For Valkey engine: + + ovhcloud cloud managed-database user edit --categories "+@read" --commands "+get" + +2. Using your default text editor: + + ovhcloud cloud managed-database user edit --editor + The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-database user edit --editor --roles role1,role2 + + +``` +ovhcloud cloud managed-database user edit [flags] +``` + +### Options + +``` + --categories strings Command categories the user can execute (valkey only) + --channels strings Channels the user can subscribe to (valkey only) + --commands strings Commands the user can execute (valkey only) + --editor Use a text editor to define parameters + -h, --help help for edit + --keys strings Keys the user can access (valkey only) + --roles strings Roles granted to the user (postgresql and mongodb only) +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database user](ovhcloud_cloud_managed-database_user.md) - Manage users in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_user_get.md b/doc/ovhcloud_cloud_managed-database_user_get.md new file mode 100644 index 00000000..7ae7a1c4 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_user_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud managed-database user get + +Get a specific user in the given managed database service + +``` +ovhcloud cloud managed-database user get [flags] +``` + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database user](ovhcloud_cloud_managed-database_user.md) - Manage users in a specific managed database service + diff --git a/doc/ovhcloud_cloud_managed-database_user_list.md b/doc/ovhcloud_cloud_managed-database_user_list.md new file mode 100644 index 00000000..5cb0bb48 --- /dev/null +++ b/doc/ovhcloud_cloud_managed-database_user_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud managed-database user list + +List all users in the given managed database service + +``` +ovhcloud cloud managed-database user list [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud managed-database user](ovhcloud_cloud_managed-database_user.md) - Manage users in a specific managed database service + diff --git a/doc/ovhcloud_cloud_network_gateway_interface_list.md b/doc/ovhcloud_cloud_network_gateway_interface_list.md index fd6a0d1d..04c07a4c 100644 --- a/doc/ovhcloud_cloud_network_gateway_interface_list.md +++ b/doc/ovhcloud_cloud_network_gateway_interface_list.md @@ -11,7 +11,7 @@ ovhcloud cloud network gateway interface list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_network_gateway_list.md b/doc/ovhcloud_cloud_network_gateway_list.md index f715d182..219ae628 100644 --- a/doc/ovhcloud_cloud_network_gateway_list.md +++ b/doc/ovhcloud_cloud_network_gateway_list.md @@ -11,7 +11,7 @@ ovhcloud cloud network gateway list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_network_private_list.md b/doc/ovhcloud_cloud_network_private_list.md index a62040b3..c1e254be 100644 --- a/doc/ovhcloud_cloud_network_private_list.md +++ b/doc/ovhcloud_cloud_network_private_list.md @@ -11,7 +11,7 @@ ovhcloud cloud network private list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_network_private_subnet_list.md b/doc/ovhcloud_cloud_network_private_subnet_list.md index 4a4e5462..d131f7d3 100644 --- a/doc/ovhcloud_cloud_network_private_subnet_list.md +++ b/doc/ovhcloud_cloud_network_private_subnet_list.md @@ -11,7 +11,7 @@ ovhcloud cloud network private subnet list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_network_public_list.md b/doc/ovhcloud_cloud_network_public_list.md index 76300af6..24d18188 100644 --- a/doc/ovhcloud_cloud_network_public_list.md +++ b/doc/ovhcloud_cloud_network_public_list.md @@ -11,7 +11,7 @@ ovhcloud cloud network public list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_operation_list.md b/doc/ovhcloud_cloud_operation_list.md index dd8c21b5..257861d5 100644 --- a/doc/ovhcloud_cloud_operation_list.md +++ b/doc/ovhcloud_cloud_operation_list.md @@ -11,7 +11,7 @@ ovhcloud cloud operation list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_project_list.md b/doc/ovhcloud_cloud_project_list.md index cf434976..ca6e494e 100644 --- a/doc/ovhcloud_cloud_project_list.md +++ b/doc/ovhcloud_cloud_project_list.md @@ -11,7 +11,7 @@ ovhcloud cloud project list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_rancher_list.md b/doc/ovhcloud_cloud_rancher_list.md index 29d867be..021ae6b7 100644 --- a/doc/ovhcloud_cloud_rancher_list.md +++ b/doc/ovhcloud_cloud_rancher_list.md @@ -11,7 +11,7 @@ ovhcloud cloud rancher list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_reference.md b/doc/ovhcloud_cloud_reference.md index 50298e42..c8611fb6 100644 --- a/doc/ovhcloud_cloud_reference.md +++ b/doc/ovhcloud_cloud_reference.md @@ -32,9 +32,10 @@ Fetch reference data in the given cloud project * [ovhcloud cloud](ovhcloud_cloud.md) - Manage your projects and services in the Public Cloud universe (MKS, MPR, MRS, Object Storage...) * [ovhcloud cloud reference container-registry](ovhcloud_cloud_reference_container-registry.md) - Fetch container registry reference data in the given cloud project -* [ovhcloud cloud reference database](ovhcloud_cloud_reference_database.md) - Fetch database reference data in the given cloud project * [ovhcloud cloud reference list-flavors](ovhcloud_cloud_reference_list-flavors.md) - List available flavors in the given cloud project * [ovhcloud cloud reference list-images](ovhcloud_cloud_reference_list-images.md) - List available images in the given cloud project * [ovhcloud cloud reference loadbalancer](ovhcloud_cloud_reference_loadbalancer.md) - Fetch loadbalancer reference data in the given cloud project +* [ovhcloud cloud reference managed-analytics](ovhcloud_cloud_reference_managed-analytics.md) - Fetch managed analytics reference data in the given cloud project +* [ovhcloud cloud reference managed-database](ovhcloud_cloud_reference_managed-database.md) - Fetch managed database reference data in the given cloud project * [ovhcloud cloud reference rancher](ovhcloud_cloud_reference_rancher.md) - Fetch Rancher reference data in the given cloud project diff --git a/doc/ovhcloud_cloud_reference_container-registry_list-plans.md b/doc/ovhcloud_cloud_reference_container-registry_list-plans.md index c32658cb..a1f9ba13 100644 --- a/doc/ovhcloud_cloud_reference_container-registry_list-plans.md +++ b/doc/ovhcloud_cloud_reference_container-registry_list-plans.md @@ -11,7 +11,7 @@ ovhcloud cloud reference container-registry list-plans [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_reference_container-registry_list-regions.md b/doc/ovhcloud_cloud_reference_container-registry_list-regions.md index d817f3f3..9b91548c 100644 --- a/doc/ovhcloud_cloud_reference_container-registry_list-regions.md +++ b/doc/ovhcloud_cloud_reference_container-registry_list-regions.md @@ -11,7 +11,7 @@ ovhcloud cloud reference container-registry list-regions [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_reference_list-flavors.md b/doc/ovhcloud_cloud_reference_list-flavors.md index 8f5366b1..daa09681 100644 --- a/doc/ovhcloud_cloud_reference_list-flavors.md +++ b/doc/ovhcloud_cloud_reference_list-flavors.md @@ -11,7 +11,7 @@ ovhcloud cloud reference list-flavors [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_reference_list-images.md b/doc/ovhcloud_cloud_reference_list-images.md index 590e1c30..11f78777 100644 --- a/doc/ovhcloud_cloud_reference_list-images.md +++ b/doc/ovhcloud_cloud_reference_list-images.md @@ -11,7 +11,7 @@ ovhcloud cloud reference list-images [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_reference_loadbalancer_list-flavors.md b/doc/ovhcloud_cloud_reference_loadbalancer_list-flavors.md index 00303b2b..5fe007e1 100644 --- a/doc/ovhcloud_cloud_reference_loadbalancer_list-flavors.md +++ b/doc/ovhcloud_cloud_reference_loadbalancer_list-flavors.md @@ -11,7 +11,7 @@ ovhcloud cloud reference loadbalancer list-flavors [f ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_reference_managed-analytics.md b/doc/ovhcloud_cloud_reference_managed-analytics.md new file mode 100644 index 00000000..5f7583d1 --- /dev/null +++ b/doc/ovhcloud_cloud_reference_managed-analytics.md @@ -0,0 +1,37 @@ +## ovhcloud cloud reference managed-analytics + +Fetch managed analytics reference data in the given cloud project + +### Options + +``` + -h, --help help for managed-analytics +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud reference](ovhcloud_cloud_reference.md) - Fetch reference data in the given cloud project +* [ovhcloud cloud reference managed-analytics list-engines](ovhcloud_cloud_reference_managed-analytics_list-engines.md) - List available analytics engines in the given cloud project +* [ovhcloud cloud reference managed-analytics list-node-flavors](ovhcloud_cloud_reference_managed-analytics_list-node-flavors.md) - List available analytics node flavors in the given cloud project +* [ovhcloud cloud reference managed-analytics list-plans](ovhcloud_cloud_reference_managed-analytics_list-plans.md) - List available analytics plans in the given cloud project + diff --git a/doc/ovhcloud_cloud_reference_managed-analytics_list-engines.md b/doc/ovhcloud_cloud_reference_managed-analytics_list-engines.md new file mode 100644 index 00000000..160c82a0 --- /dev/null +++ b/doc/ovhcloud_cloud_reference_managed-analytics_list-engines.md @@ -0,0 +1,45 @@ +## ovhcloud cloud reference managed-analytics list-engines + +List available analytics engines in the given cloud project + +``` +ovhcloud cloud reference managed-analytics list-engines [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list-engines +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud reference managed-analytics](ovhcloud_cloud_reference_managed-analytics.md) - Fetch managed analytics reference data in the given cloud project + diff --git a/doc/ovhcloud_cloud_reference_managed-analytics_list-node-flavors.md b/doc/ovhcloud_cloud_reference_managed-analytics_list-node-flavors.md new file mode 100644 index 00000000..03e35561 --- /dev/null +++ b/doc/ovhcloud_cloud_reference_managed-analytics_list-node-flavors.md @@ -0,0 +1,45 @@ +## ovhcloud cloud reference managed-analytics list-node-flavors + +List available analytics node flavors in the given cloud project + +``` +ovhcloud cloud reference managed-analytics list-node-flavors [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list-node-flavors +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud reference managed-analytics](ovhcloud_cloud_reference_managed-analytics.md) - Fetch managed analytics reference data in the given cloud project + diff --git a/doc/ovhcloud_cloud_reference_managed-analytics_list-plans.md b/doc/ovhcloud_cloud_reference_managed-analytics_list-plans.md new file mode 100644 index 00000000..fb38f2f5 --- /dev/null +++ b/doc/ovhcloud_cloud_reference_managed-analytics_list-plans.md @@ -0,0 +1,45 @@ +## ovhcloud cloud reference managed-analytics list-plans + +List available analytics plans in the given cloud project + +``` +ovhcloud cloud reference managed-analytics list-plans [flags] +``` + +### Options + +``` + --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax + Examples: + --filter 'state=="running"' + --filter 'name=~"^my.*"' + --filter 'nested.property.subproperty>10' + --filter 'startDate>="2023-12-01"' + --filter 'name=~"something" && nbField>10' + -h, --help help for list-plans +``` + +### Options inherited from parent commands + +``` + --cloud-project string Cloud project ID + -d, --debug Activate debug mode (will log all HTTP requests details) + -e, --ignore-errors Ignore errors in API calls when it is not fatal to the execution + -o, --output string Output format: json, yaml, interactive, or a custom format expression (using https://github.com/PaesslerAG/gval syntax) + Examples: + --output json + --output yaml + --output interactive + --output 'id' (to extract a single field) + --output 'nested.field.subfield' (to extract a nested field) + --output '[id, "name"]' (to extract multiple fields as an array) + --output '{"newKey": oldKey, "otherKey": nested.field}' (to extract and rename fields in an object) + --output 'name+","+type' (to extract and concatenate fields in a string) + --output '(nbFieldA + nbFieldB) * 10' (to compute values from numeric fields) + --profile string Use a specific profile from the configuration file +``` + +### SEE ALSO + +* [ovhcloud cloud reference managed-analytics](ovhcloud_cloud_reference_managed-analytics.md) - Fetch managed analytics reference data in the given cloud project + diff --git a/doc/ovhcloud_cloud_reference_database.md b/doc/ovhcloud_cloud_reference_managed-database.md similarity index 67% rename from doc/ovhcloud_cloud_reference_database.md rename to doc/ovhcloud_cloud_reference_managed-database.md index abfe6712..38be7abd 100644 --- a/doc/ovhcloud_cloud_reference_database.md +++ b/doc/ovhcloud_cloud_reference_managed-database.md @@ -1,11 +1,11 @@ -## ovhcloud cloud reference database +## ovhcloud cloud reference managed-database -Fetch database reference data in the given cloud project +Fetch managed database reference data in the given cloud project ### Options ``` - -h, --help help for database + -h, --help help for managed-database ``` ### Options inherited from parent commands @@ -31,7 +31,7 @@ Fetch database reference data in the given cloud project ### SEE ALSO * [ovhcloud cloud reference](ovhcloud_cloud_reference.md) - Fetch reference data in the given cloud project -* [ovhcloud cloud reference database list-engines](ovhcloud_cloud_reference_database_list-engines.md) - List available database engines in the given cloud project -* [ovhcloud cloud reference database list-node-flavors](ovhcloud_cloud_reference_database_list-node-flavors.md) - List available database node flavors in the given cloud project -* [ovhcloud cloud reference database list-plans](ovhcloud_cloud_reference_database_list-plans.md) - List available database plans in the given cloud project +* [ovhcloud cloud reference managed-database list-engines](ovhcloud_cloud_reference_managed-database_list-engines.md) - List available database engines in the given cloud project +* [ovhcloud cloud reference managed-database list-node-flavors](ovhcloud_cloud_reference_managed-database_list-node-flavors.md) - List available database node flavors in the given cloud project +* [ovhcloud cloud reference managed-database list-plans](ovhcloud_cloud_reference_managed-database_list-plans.md) - List available database plans in the given cloud project diff --git a/doc/ovhcloud_cloud_reference_database_list-engines.md b/doc/ovhcloud_cloud_reference_managed-database_list-engines.md similarity index 84% rename from doc/ovhcloud_cloud_reference_database_list-engines.md rename to doc/ovhcloud_cloud_reference_managed-database_list-engines.md index 918528e0..6ec7ad86 100644 --- a/doc/ovhcloud_cloud_reference_database_list-engines.md +++ b/doc/ovhcloud_cloud_reference_managed-database_list-engines.md @@ -1,9 +1,9 @@ -## ovhcloud cloud reference database list-engines +## ovhcloud cloud reference managed-database list-engines List available database engines in the given cloud project ``` -ovhcloud cloud reference database list-engines [flags] +ovhcloud cloud reference managed-database list-engines [flags] ``` ### Options @@ -11,7 +11,7 @@ ovhcloud cloud reference database list-engines [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' @@ -41,5 +41,5 @@ ovhcloud cloud reference database list-engines [flags] ### SEE ALSO -* [ovhcloud cloud reference database](ovhcloud_cloud_reference_database.md) - Fetch database reference data in the given cloud project +* [ovhcloud cloud reference managed-database](ovhcloud_cloud_reference_managed-database.md) - Fetch managed database reference data in the given cloud project diff --git a/doc/ovhcloud_cloud_reference_database_list-node-flavors.md b/doc/ovhcloud_cloud_reference_managed-database_list-node-flavors.md similarity index 84% rename from doc/ovhcloud_cloud_reference_database_list-node-flavors.md rename to doc/ovhcloud_cloud_reference_managed-database_list-node-flavors.md index 79582f2c..4b4725f4 100644 --- a/doc/ovhcloud_cloud_reference_database_list-node-flavors.md +++ b/doc/ovhcloud_cloud_reference_managed-database_list-node-flavors.md @@ -1,9 +1,9 @@ -## ovhcloud cloud reference database list-node-flavors +## ovhcloud cloud reference managed-database list-node-flavors List available database node flavors in the given cloud project ``` -ovhcloud cloud reference database list-node-flavors [flags] +ovhcloud cloud reference managed-database list-node-flavors [flags] ``` ### Options @@ -11,7 +11,7 @@ ovhcloud cloud reference database list-node-flavors [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' @@ -41,5 +41,5 @@ ovhcloud cloud reference database list-node-flavors [flags] ### SEE ALSO -* [ovhcloud cloud reference database](ovhcloud_cloud_reference_database.md) - Fetch database reference data in the given cloud project +* [ovhcloud cloud reference managed-database](ovhcloud_cloud_reference_managed-database.md) - Fetch managed database reference data in the given cloud project diff --git a/doc/ovhcloud_cloud_reference_database_list-plans.md b/doc/ovhcloud_cloud_reference_managed-database_list-plans.md similarity index 84% rename from doc/ovhcloud_cloud_reference_database_list-plans.md rename to doc/ovhcloud_cloud_reference_managed-database_list-plans.md index a6d18fa8..ba56c1a5 100644 --- a/doc/ovhcloud_cloud_reference_database_list-plans.md +++ b/doc/ovhcloud_cloud_reference_managed-database_list-plans.md @@ -1,9 +1,9 @@ -## ovhcloud cloud reference database list-plans +## ovhcloud cloud reference managed-database list-plans List available database plans in the given cloud project ``` -ovhcloud cloud reference database list-plans [flags] +ovhcloud cloud reference managed-database list-plans [flags] ``` ### Options @@ -11,7 +11,7 @@ ovhcloud cloud reference database list-plans [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' @@ -41,5 +41,5 @@ ovhcloud cloud reference database list-plans [flags] ### SEE ALSO -* [ovhcloud cloud reference database](ovhcloud_cloud_reference_database.md) - Fetch database reference data in the given cloud project +* [ovhcloud cloud reference managed-database](ovhcloud_cloud_reference_managed-database.md) - Fetch managed database reference data in the given cloud project diff --git a/doc/ovhcloud_cloud_reference_rancher_list-plans.md b/doc/ovhcloud_cloud_reference_rancher_list-plans.md index 0eb2d169..016a6d9d 100644 --- a/doc/ovhcloud_cloud_reference_rancher_list-plans.md +++ b/doc/ovhcloud_cloud_reference_rancher_list-plans.md @@ -11,7 +11,7 @@ ovhcloud cloud reference rancher list-plans [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_reference_rancher_list-versions.md b/doc/ovhcloud_cloud_reference_rancher_list-versions.md index 7c69dffd..5e71ac47 100644 --- a/doc/ovhcloud_cloud_reference_rancher_list-versions.md +++ b/doc/ovhcloud_cloud_reference_rancher_list-versions.md @@ -11,7 +11,7 @@ ovhcloud cloud reference rancher list-versions [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_region_list.md b/doc/ovhcloud_cloud_region_list.md index dea32f60..d5c5bddb 100644 --- a/doc/ovhcloud_cloud_region_list.md +++ b/doc/ovhcloud_cloud_region_list.md @@ -11,7 +11,7 @@ ovhcloud cloud region list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_savings-plan_list-offers.md b/doc/ovhcloud_cloud_savings-plan_list-offers.md index 4e0ffb84..eb166e61 100644 --- a/doc/ovhcloud_cloud_savings-plan_list-offers.md +++ b/doc/ovhcloud_cloud_savings-plan_list-offers.md @@ -21,7 +21,7 @@ ovhcloud cloud savings-plan list-offers [flags] --deployment-type string Deployment type: 1AZ or 3AZ (default: 1AZ) (default "1AZ") --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_savings-plan_list-periods.md b/doc/ovhcloud_cloud_savings-plan_list-periods.md index 27910962..702dff52 100644 --- a/doc/ovhcloud_cloud_savings-plan_list-periods.md +++ b/doc/ovhcloud_cloud_savings-plan_list-periods.md @@ -11,7 +11,7 @@ ovhcloud cloud savings-plan list-periods [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_savings-plan_list.md b/doc/ovhcloud_cloud_savings-plan_list.md index 4aa0ea37..f61f032c 100644 --- a/doc/ovhcloud_cloud_savings-plan_list.md +++ b/doc/ovhcloud_cloud_savings-plan_list.md @@ -11,7 +11,7 @@ ovhcloud cloud savings-plan list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_ssh-key_list.md b/doc/ovhcloud_cloud_ssh-key_list.md index 571a578d..62ebdacc 100644 --- a/doc/ovhcloud_cloud_ssh-key_list.md +++ b/doc/ovhcloud_cloud_ssh-key_list.md @@ -11,7 +11,7 @@ ovhcloud cloud ssh-key list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_storage-block_backup_list.md b/doc/ovhcloud_cloud_storage-block_backup_list.md index 0a00bd67..b4e96eae 100644 --- a/doc/ovhcloud_cloud_storage-block_backup_list.md +++ b/doc/ovhcloud_cloud_storage-block_backup_list.md @@ -11,7 +11,7 @@ ovhcloud cloud storage-block backup list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_storage-block_list.md b/doc/ovhcloud_cloud_storage-block_list.md index bc3ef7ab..e473e0e0 100644 --- a/doc/ovhcloud_cloud_storage-block_list.md +++ b/doc/ovhcloud_cloud_storage-block_list.md @@ -11,7 +11,7 @@ ovhcloud cloud storage-block list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_storage-s3_credentials_list.md b/doc/ovhcloud_cloud_storage-s3_credentials_list.md index 544fa992..802273fa 100644 --- a/doc/ovhcloud_cloud_storage-s3_credentials_list.md +++ b/doc/ovhcloud_cloud_storage-s3_credentials_list.md @@ -11,7 +11,7 @@ ovhcloud cloud storage-s3 credentials list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_storage-s3_list.md b/doc/ovhcloud_cloud_storage-s3_list.md index 6fcd8b80..ba5043ff 100644 --- a/doc/ovhcloud_cloud_storage-s3_list.md +++ b/doc/ovhcloud_cloud_storage-s3_list.md @@ -11,7 +11,7 @@ ovhcloud cloud storage-s3 list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_storage-s3_quota_get.md b/doc/ovhcloud_cloud_storage-s3_quota_get.md index e73e4172..67ad73ed 100644 --- a/doc/ovhcloud_cloud_storage-s3_quota_get.md +++ b/doc/ovhcloud_cloud_storage-s3_quota_get.md @@ -11,7 +11,7 @@ ovhcloud cloud storage-s3 quota get [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_storage-swift_list.md b/doc/ovhcloud_cloud_storage-swift_list.md index 88706ed0..b7447e71 100644 --- a/doc/ovhcloud_cloud_storage-swift_list.md +++ b/doc/ovhcloud_cloud_storage-swift_list.md @@ -11,7 +11,7 @@ ovhcloud cloud storage-swift list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_cloud_user_list.md b/doc/ovhcloud_cloud_user_list.md index e7f75ff3..4d0e02e9 100644 --- a/doc/ovhcloud_cloud_user_list.md +++ b/doc/ovhcloud_cloud_user_list.md @@ -11,7 +11,7 @@ ovhcloud cloud user list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_dedicated-ceph_list.md b/doc/ovhcloud_dedicated-ceph_list.md index b244b583..6fc2ccc7 100644 --- a/doc/ovhcloud_dedicated-ceph_list.md +++ b/doc/ovhcloud_dedicated-ceph_list.md @@ -11,7 +11,7 @@ ovhcloud dedicated-ceph list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_dedicated-cloud_list.md b/doc/ovhcloud_dedicated-cloud_list.md index 292806aa..89ebea1d 100644 --- a/doc/ovhcloud_dedicated-cloud_list.md +++ b/doc/ovhcloud_dedicated-cloud_list.md @@ -11,7 +11,7 @@ ovhcloud dedicated-cloud list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_dedicated-cluster_list.md b/doc/ovhcloud_dedicated-cluster_list.md index ad30a579..90623bec 100644 --- a/doc/ovhcloud_dedicated-cluster_list.md +++ b/doc/ovhcloud_dedicated-cluster_list.md @@ -11,7 +11,7 @@ ovhcloud dedicated-cluster list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_dedicated-nasha_list.md b/doc/ovhcloud_dedicated-nasha_list.md index ec26d2a6..6f8dd9a0 100644 --- a/doc/ovhcloud_dedicated-nasha_list.md +++ b/doc/ovhcloud_dedicated-nasha_list.md @@ -11,7 +11,7 @@ ovhcloud dedicated-nasha list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_domain-name_list.md b/doc/ovhcloud_domain-name_list.md index 1aadf874..63740fd3 100644 --- a/doc/ovhcloud_domain-name_list.md +++ b/doc/ovhcloud_domain-name_list.md @@ -11,7 +11,7 @@ ovhcloud domain-name list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_domain-zone_list.md b/doc/ovhcloud_domain-zone_list.md index 1c90db91..8986fa2f 100644 --- a/doc/ovhcloud_domain-zone_list.md +++ b/doc/ovhcloud_domain-zone_list.md @@ -11,7 +11,7 @@ ovhcloud domain-zone list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_domain-zone_record_list.md b/doc/ovhcloud_domain-zone_record_list.md index 233c8c5b..5bc9fb87 100644 --- a/doc/ovhcloud_domain-zone_record_list.md +++ b/doc/ovhcloud_domain-zone_record_list.md @@ -11,7 +11,7 @@ ovhcloud domain-zone record list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_email-domain_list.md b/doc/ovhcloud_email-domain_list.md index 10056ab8..fc9a4fcb 100644 --- a/doc/ovhcloud_email-domain_list.md +++ b/doc/ovhcloud_email-domain_list.md @@ -11,7 +11,7 @@ ovhcloud email-domain list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_email-domain_redirection_list.md b/doc/ovhcloud_email-domain_redirection_list.md index 619f6e37..f29d3719 100644 --- a/doc/ovhcloud_email-domain_redirection_list.md +++ b/doc/ovhcloud_email-domain_redirection_list.md @@ -11,7 +11,7 @@ ovhcloud email-domain redirection list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_email-mxplan_list.md b/doc/ovhcloud_email-mxplan_list.md index 8d617895..dba73d34 100644 --- a/doc/ovhcloud_email-mxplan_list.md +++ b/doc/ovhcloud_email-mxplan_list.md @@ -11,7 +11,7 @@ ovhcloud email-mxplan list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_email-pro_list.md b/doc/ovhcloud_email-pro_list.md index 964946f0..3d6662ea 100644 --- a/doc/ovhcloud_email-pro_list.md +++ b/doc/ovhcloud_email-pro_list.md @@ -11,7 +11,7 @@ ovhcloud email-pro list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_hosting-private-database_list.md b/doc/ovhcloud_hosting-private-database_list.md index 4e379167..972b036b 100644 --- a/doc/ovhcloud_hosting-private-database_list.md +++ b/doc/ovhcloud_hosting-private-database_list.md @@ -11,7 +11,7 @@ ovhcloud hosting-private-database list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_iam_permissions-group_list.md b/doc/ovhcloud_iam_permissions-group_list.md index 50bc2594..d82b7e21 100644 --- a/doc/ovhcloud_iam_permissions-group_list.md +++ b/doc/ovhcloud_iam_permissions-group_list.md @@ -11,7 +11,7 @@ ovhcloud iam permissions-group list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_iam_policy_list.md b/doc/ovhcloud_iam_policy_list.md index f8ba11e2..fbe61a9c 100644 --- a/doc/ovhcloud_iam_policy_list.md +++ b/doc/ovhcloud_iam_policy_list.md @@ -11,7 +11,7 @@ ovhcloud iam policy list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_iam_resource-group_list.md b/doc/ovhcloud_iam_resource-group_list.md index 7fefef29..56b158c6 100644 --- a/doc/ovhcloud_iam_resource-group_list.md +++ b/doc/ovhcloud_iam_resource-group_list.md @@ -11,7 +11,7 @@ ovhcloud iam resource-group list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_iam_resource_list.md b/doc/ovhcloud_iam_resource_list.md index 71c35459..f7cc7262 100644 --- a/doc/ovhcloud_iam_resource_list.md +++ b/doc/ovhcloud_iam_resource_list.md @@ -11,7 +11,7 @@ ovhcloud iam resource list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_iam_user_list.md b/doc/ovhcloud_iam_user_list.md index 0a24622b..6f274619 100644 --- a/doc/ovhcloud_iam_user_list.md +++ b/doc/ovhcloud_iam_user_list.md @@ -11,7 +11,7 @@ ovhcloud iam user list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_iam_user_token_list.md b/doc/ovhcloud_iam_user_token_list.md index a9cdd1fb..2c6d5bb8 100644 --- a/doc/ovhcloud_iam_user_token_list.md +++ b/doc/ovhcloud_iam_user_token_list.md @@ -11,7 +11,7 @@ ovhcloud iam user token list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_ip_firewall_list.md b/doc/ovhcloud_ip_firewall_list.md index 8b0433c5..05e522b4 100644 --- a/doc/ovhcloud_ip_firewall_list.md +++ b/doc/ovhcloud_ip_firewall_list.md @@ -11,7 +11,7 @@ ovhcloud ip firewall list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_ip_firewall_rule_list.md b/doc/ovhcloud_ip_firewall_rule_list.md index d834cdb7..82d6d784 100644 --- a/doc/ovhcloud_ip_firewall_rule_list.md +++ b/doc/ovhcloud_ip_firewall_rule_list.md @@ -11,7 +11,7 @@ ovhcloud ip firewall rule list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_ip_list.md b/doc/ovhcloud_ip_list.md index b3a7f0fe..93e47d7e 100644 --- a/doc/ovhcloud_ip_list.md +++ b/doc/ovhcloud_ip_list.md @@ -11,7 +11,7 @@ ovhcloud ip list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_iploadbalancing_list.md b/doc/ovhcloud_iploadbalancing_list.md index 6b1eae23..7611f8ac 100644 --- a/doc/ovhcloud_iploadbalancing_list.md +++ b/doc/ovhcloud_iploadbalancing_list.md @@ -11,7 +11,7 @@ ovhcloud iploadbalancing list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_ldp_list.md b/doc/ovhcloud_ldp_list.md index 33681fc4..54ae63a2 100644 --- a/doc/ovhcloud_ldp_list.md +++ b/doc/ovhcloud_ldp_list.md @@ -11,7 +11,7 @@ ovhcloud ldp list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_location_list.md b/doc/ovhcloud_location_list.md index c1798be9..8d9563c1 100644 --- a/doc/ovhcloud_location_list.md +++ b/doc/ovhcloud_location_list.md @@ -11,7 +11,7 @@ ovhcloud location list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_nutanix_list.md b/doc/ovhcloud_nutanix_list.md index 405e0d03..a4e60340 100644 --- a/doc/ovhcloud_nutanix_list.md +++ b/doc/ovhcloud_nutanix_list.md @@ -11,7 +11,7 @@ ovhcloud nutanix list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_okms_list.md b/doc/ovhcloud_okms_list.md index db80b83b..c38b2214 100644 --- a/doc/ovhcloud_okms_list.md +++ b/doc/ovhcloud_okms_list.md @@ -11,7 +11,7 @@ ovhcloud okms list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_overthebox_list.md b/doc/ovhcloud_overthebox_list.md index a7b3cc43..198aa5b3 100644 --- a/doc/ovhcloud_overthebox_list.md +++ b/doc/ovhcloud_overthebox_list.md @@ -11,7 +11,7 @@ ovhcloud overthebox list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_ovhcloudconnect_list.md b/doc/ovhcloud_ovhcloudconnect_list.md index 074fe5e7..cf98c5e1 100644 --- a/doc/ovhcloud_ovhcloudconnect_list.md +++ b/doc/ovhcloud_ovhcloudconnect_list.md @@ -11,7 +11,7 @@ ovhcloud ovhcloudconnect list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_pack-xdsl_list.md b/doc/ovhcloud_pack-xdsl_list.md index 7eb5741f..26e3cccd 100644 --- a/doc/ovhcloud_pack-xdsl_list.md +++ b/doc/ovhcloud_pack-xdsl_list.md @@ -11,7 +11,7 @@ ovhcloud pack-xdsl list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_sms_list.md b/doc/ovhcloud_sms_list.md index 11245351..588b5357 100644 --- a/doc/ovhcloud_sms_list.md +++ b/doc/ovhcloud_sms_list.md @@ -11,7 +11,7 @@ ovhcloud sms list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_ssl-gateway_list.md b/doc/ovhcloud_ssl-gateway_list.md index 19fcd2dc..cc44d58d 100644 --- a/doc/ovhcloud_ssl-gateway_list.md +++ b/doc/ovhcloud_ssl-gateway_list.md @@ -11,7 +11,7 @@ ovhcloud ssl-gateway list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_ssl_list.md b/doc/ovhcloud_ssl_list.md index c83f4faa..eb785ecd 100644 --- a/doc/ovhcloud_ssl_list.md +++ b/doc/ovhcloud_ssl_list.md @@ -11,7 +11,7 @@ ovhcloud ssl list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_storage-netapp_list.md b/doc/ovhcloud_storage-netapp_list.md index c8f65d50..36f18b12 100644 --- a/doc/ovhcloud_storage-netapp_list.md +++ b/doc/ovhcloud_storage-netapp_list.md @@ -11,7 +11,7 @@ ovhcloud storage-netapp list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_support-tickets_list.md b/doc/ovhcloud_support-tickets_list.md index c2679194..62e381bd 100644 --- a/doc/ovhcloud_support-tickets_list.md +++ b/doc/ovhcloud_support-tickets_list.md @@ -11,7 +11,7 @@ ovhcloud support-tickets list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_support-tickets_messages.md b/doc/ovhcloud_support-tickets_messages.md index 68f7285b..ad89e458 100644 --- a/doc/ovhcloud_support-tickets_messages.md +++ b/doc/ovhcloud_support-tickets_messages.md @@ -11,7 +11,7 @@ ovhcloud support-tickets messages [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_telephony_list.md b/doc/ovhcloud_telephony_list.md index 95c3634b..f0d0112d 100644 --- a/doc/ovhcloud_telephony_list.md +++ b/doc/ovhcloud_telephony_list.md @@ -11,7 +11,7 @@ ovhcloud telephony list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_veeamcloudconnect_list.md b/doc/ovhcloud_veeamcloudconnect_list.md index e2d4dd17..a2396b4e 100644 --- a/doc/ovhcloud_veeamcloudconnect_list.md +++ b/doc/ovhcloud_veeamcloudconnect_list.md @@ -11,7 +11,7 @@ ovhcloud veeamcloudconnect list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_veeamenterprise_list.md b/doc/ovhcloud_veeamenterprise_list.md index 1386d54a..2f4cebb7 100644 --- a/doc/ovhcloud_veeamenterprise_list.md +++ b/doc/ovhcloud_veeamenterprise_list.md @@ -11,7 +11,7 @@ ovhcloud veeamenterprise list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vmwareclouddirector-backup_list.md b/doc/ovhcloud_vmwareclouddirector-backup_list.md index ab559f7a..f6e96eb9 100644 --- a/doc/ovhcloud_vmwareclouddirector-backup_list.md +++ b/doc/ovhcloud_vmwareclouddirector-backup_list.md @@ -11,7 +11,7 @@ ovhcloud vmwareclouddirector-backup list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vmwareclouddirector-organization_list.md b/doc/ovhcloud_vmwareclouddirector-organization_list.md index 365cb9c7..59f50fa5 100644 --- a/doc/ovhcloud_vmwareclouddirector-organization_list.md +++ b/doc/ovhcloud_vmwareclouddirector-organization_list.md @@ -11,7 +11,7 @@ ovhcloud vmwareclouddirector-organization list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_automated-backup_list-restore-points.md b/doc/ovhcloud_vps_automated-backup_list-restore-points.md index c995ad2b..e7d9084d 100644 --- a/doc/ovhcloud_vps_automated-backup_list-restore-points.md +++ b/doc/ovhcloud_vps_automated-backup_list-restore-points.md @@ -11,7 +11,7 @@ ovhcloud vps automated-backup list-restore-points [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_automated-backup_list.md b/doc/ovhcloud_vps_automated-backup_list.md index e7382030..a19570b8 100644 --- a/doc/ovhcloud_vps_automated-backup_list.md +++ b/doc/ovhcloud_vps_automated-backup_list.md @@ -11,7 +11,7 @@ ovhcloud vps automated-backup list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_disk_list.md b/doc/ovhcloud_vps_disk_list.md index 995d4f0b..093ae33d 100644 --- a/doc/ovhcloud_vps_disk_list.md +++ b/doc/ovhcloud_vps_disk_list.md @@ -11,7 +11,7 @@ ovhcloud vps disk list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_image_list.md b/doc/ovhcloud_vps_image_list.md index c9771669..2cd85937 100644 --- a/doc/ovhcloud_vps_image_list.md +++ b/doc/ovhcloud_vps_image_list.md @@ -11,7 +11,7 @@ ovhcloud vps image list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_ip_list.md b/doc/ovhcloud_vps_ip_list.md index 8677e62b..94b550d7 100644 --- a/doc/ovhcloud_vps_ip_list.md +++ b/doc/ovhcloud_vps_ip_list.md @@ -11,7 +11,7 @@ ovhcloud vps ip list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_list-options.md b/doc/ovhcloud_vps_list-options.md index 62a35dda..c41fbe4d 100644 --- a/doc/ovhcloud_vps_list-options.md +++ b/doc/ovhcloud_vps_list-options.md @@ -11,7 +11,7 @@ ovhcloud vps list-options [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_list-tasks.md b/doc/ovhcloud_vps_list-tasks.md index c1d83723..37e84fc6 100644 --- a/doc/ovhcloud_vps_list-tasks.md +++ b/doc/ovhcloud_vps_list-tasks.md @@ -11,7 +11,7 @@ ovhcloud vps list-tasks [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_list.md b/doc/ovhcloud_vps_list.md index 8400475e..483ac803 100644 --- a/doc/ovhcloud_vps_list.md +++ b/doc/ovhcloud_vps_list.md @@ -11,7 +11,7 @@ ovhcloud vps list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vps_secondary-dns-domain_list.md b/doc/ovhcloud_vps_secondary-dns-domain_list.md index 867c3354..3ade66c9 100644 --- a/doc/ovhcloud_vps_secondary-dns-domain_list.md +++ b/doc/ovhcloud_vps_secondary-dns-domain_list.md @@ -11,7 +11,7 @@ ovhcloud vps secondary-dns-domain list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vrack_list.md b/doc/ovhcloud_vrack_list.md index fd06860d..0ec70331 100644 --- a/doc/ovhcloud_vrack_list.md +++ b/doc/ovhcloud_vrack_list.md @@ -11,7 +11,7 @@ ovhcloud vrack list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_vrackservices_list.md b/doc/ovhcloud_vrackservices_list.md index 96ad3f35..b7f7c03e 100644 --- a/doc/ovhcloud_vrackservices_list.md +++ b/doc/ovhcloud_vrackservices_list.md @@ -11,7 +11,7 @@ ovhcloud vrackservices list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_webhosting_list.md b/doc/ovhcloud_webhosting_list.md index 7aeacda8..0e6c7183 100644 --- a/doc/ovhcloud_webhosting_list.md +++ b/doc/ovhcloud_webhosting_list.md @@ -11,7 +11,7 @@ ovhcloud webhosting list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/doc/ovhcloud_xdsl_list.md b/doc/ovhcloud_xdsl_list.md index 60dc4169..24ac098b 100644 --- a/doc/ovhcloud_xdsl_list.md +++ b/doc/ovhcloud_xdsl_list.md @@ -11,7 +11,7 @@ ovhcloud xdsl list [flags] ``` --filter stringArray Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/internal/cmd/cloud_database.go b/internal/cmd/cloud_database.go deleted file mode 100644 index 1716ccf3..00000000 --- a/internal/cmd/cloud_database.go +++ /dev/null @@ -1,193 +0,0 @@ -// SPDX-FileCopyrightText: 2025 OVH SAS -// -// SPDX-License-Identifier: Apache-2.0 - -package cmd - -import ( - "github.com/ovh/ovhcloud-cli/internal/services/cloud" - "github.com/spf13/cobra" -) - -func initCloudDatabaseCommand(cloudCmd *cobra.Command) { - databaseCmd := &cobra.Command{ - Use: "database-service", - Short: "Manage database services in the given cloud project", - } - databaseCmd.PersistentFlags().StringVar(&cloud.CloudProject, "cloud-project", "", "Cloud project ID") - - // Cluster commands - databaseListCmd := &cobra.Command{ - Use: "list", - Aliases: []string{"ls"}, - Short: "List your database services", - Run: cloud.ListCloudDatabases, - } - databaseCmd.AddCommand(withFilterFlag(databaseListCmd)) - - databaseCmd.AddCommand(&cobra.Command{ - Use: "get ", - Short: "Get a specific database service", - Run: cloud.GetCloudDatabase, - Args: cobra.ExactArgs(1), - }) - - databaseCmd.AddCommand(getDatabaseCreationCmd()) - databaseCmd.AddCommand(getDatabaseEditCmd()) - - databaseCmd.AddCommand(&cobra.Command{ - Use: "delete ", - Short: "Delete a specific database service", - Run: cloud.DeleteDatabase, - Args: cobra.ExactArgs(1), - }) - - // Database commands - databaseInClusterCmd := &cobra.Command{ - Use: "database", - Short: "Manage databases in a specific database service", - } - databaseCmd.AddCommand(databaseInClusterCmd) - - databaseInClusterCmd.AddCommand(withFilterFlag(&cobra.Command{ - Use: "list ", - Aliases: []string{"ls"}, - Short: "List all databases in the given database service", - Run: cloud.ListDatabasesInDatabase, - Args: cobra.ExactArgs(1), - })) - - databaseInClusterCmd.AddCommand(&cobra.Command{ - Use: "get ", - Short: "Get a specific database in the given database service", - Run: cloud.GetDatabaseInDatabase, - Args: cobra.ExactArgs(2), - }) - - databaseInClusterCreateCmd := &cobra.Command{ - Use: "create ", - Short: "Create a new database in the given database service", - Run: cloud.CreateDatabaseInDatabase, - Args: cobra.ExactArgs(1), - } - databaseInClusterCreateCmd.Flags().StringVar(&cloud.DatabaseDatabaseSpec.Name, "name", "", "Name of the database to create") - databaseInClusterCreateCmd.MarkFlagRequired("name") - databaseInClusterCmd.AddCommand(databaseInClusterCreateCmd) - - databaseInClusterCmd.AddCommand(&cobra.Command{ - Use: "delete ", - Short: "Delete a specific database in the given database service", - Run: cloud.DeleteDatabaseInDatabase, - Args: cobra.ExactArgs(2), - }) - - cloudCmd.AddCommand(databaseCmd) -} - -func getDatabaseCreationCmd() *cobra.Command { - databaseCreateCmd := &cobra.Command{ - Use: "create", - Short: "Create a new database service", - Long: `Use this command to create a database service in the given public cloud project. -There are two ways to define the creation parameters: - -1. Using only CLI flags: - - ovhcloud cloud database-service create --engine mysql --version 8 --plan essential --nodes-list "db1-4:DE" - -2. Using your default text editor: - - ovhcloud cloud database-service create --engine kafka --editor - - You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your - default text editor to update the parameters. When saving the file, the creation will start. - - Note that it is also possible to override values in the presented examples using command line flags like the following: - - ovhcloud cloud database-service create --engine mysql --editor --version 8 -`, - Run: cloud.CreateDatabase, - Args: cobra.NoArgs, - } - - // Database details - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.Engine, "engine", "", "Database engine (you can get the list of available engines using 'ovhcloud cloud reference database list-engines')") - databaseCreateCmd.MarkFlagRequired("engine") - databaseCreateCmd.Flags().StringSliceVar(&cloud.DatabaseSpec.Backups.Regions, "backups-regions", nil, "Regions on which the backups are stored") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.Backups.Time, "backups-time", "", "Time on which backups start every day") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.Description, "description", "", "Database description") - databaseCreateCmd.Flags().IntVar(&cloud.DatabaseSpec.Disk.Size, "disk-size", 0, "Disk size (GB)") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.ForkFrom.BackupID, "fork-from.backup-id", "", "Backup ID (not compatible with fork-from.point-in-time)") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.ForkFrom.PointInTime, "fork-from.point-in-time", "", "Point in time to restore from (not compatible with fork-from.backup-id)") - markFlagsMutuallyExclusive(databaseCreateCmd, "fork-from.backup-id", "fork-from.point-in-time") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.ForkFrom.ServiceID, "fork-from.service-id", "", "Service ID that owns the backups") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.MaintenanceTime, "maintenance-time", "", "Time on which maintenances can start every day") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.Plan, "plan", "", "Database plan (you can get the list of available plans using 'ovhcloud cloud reference database list-plans')") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.Version, "version", "", "Database version (you can get the list of available versions using 'ovhcloud cloud reference database list-engines')") - - // Network configuration - databaseCreateCmd.Flags().StringSliceVar(&cloud.DatabaseSpec.CLIIPRestrictions, "ip-restrictions", nil, "IP blocks authorized to access the cluster (CIDR format)") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.NetworkID, "network-id", "", "Private network ID in which the cluster is deployed") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.SubnetID, "subnet-id", "", "Private subnet ID in which the cluster is deployed") - - // Nodes pattern definition - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.NodesPattern.Flavor, "nodes-pattern.flavor", "", "Flavor of all nodes") - databaseCreateCmd.Flags().IntVar(&cloud.DatabaseSpec.NodesPattern.Number, "nodes-pattern.number", 0, "Number of nodes") - databaseCreateCmd.Flags().StringVar(&cloud.DatabaseSpec.NodesPattern.Region, "nodes-pattern.region", "", "Region of all nodes") - - // Nodes list definition - databaseCreateCmd.Flags().StringSliceVar(&cloud.DatabaseSpec.CLINodesList, "nodes-list", nil, "List of nodes (format: flavor1:region1,flavor2:region2...)") - markFlagsMutuallyExclusive(databaseCreateCmd, "nodes-pattern.flavor", "nodes-list") - markFlagsMutuallyExclusive(databaseCreateCmd, "nodes-pattern.number", "nodes-list") - markFlagsMutuallyExclusive(databaseCreateCmd, "nodes-pattern.region", "nodes-list") - - // Common flags for other mean to define parameters - addInteractiveEditorFlag(databaseCreateCmd) - - return databaseCreateCmd -} - -func getDatabaseEditCmd() *cobra.Command { - databaseEditCmd := &cobra.Command{ - Use: "edit ", - Short: "Edit a specific database service", - Long: `Use this command to edit a database service in the given public cloud project. -There are two ways to define the edition parameters: - -1. Using only CLI flags: - - ovhcloud cloud database-service edit --description "My database" - -2. Using your default text editor: - - ovhcloud cloud database-service edit --editor - - The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. - - Note that it is also possible to override values in the presented examples using command line flags like the following: - - ovhcloud cloud database-service edit --editor --description "My database cluster" -`, - Run: cloud.EditDatabase, - Args: cobra.ExactArgs(1), - } - - // Database details - databaseEditCmd.Flags().StringSliceVar(&cloud.DatabaseSpec.Backups.Regions, "backups-regions", nil, "Regions on which the backups are stored") - databaseEditCmd.Flags().StringVar(&cloud.DatabaseSpec.Backups.Time, "backups-time", "", "Time on which backups start every day") - databaseEditCmd.Flags().BoolVar(&cloud.DatabaseSpec.DeletionProtection, "deletion-protection", false, "Enable deletion protection") - databaseEditCmd.Flags().StringVar(&cloud.DatabaseSpec.Description, "description", "", "Description of the cluster") - databaseEditCmd.Flags().BoolVar(&cloud.DatabaseSpec.EnablePrometheus, "enable-prometheus", false, "Enable Prometheus") - databaseEditCmd.Flags().StringVar(&cloud.DatabaseSpec.NodesPattern.Flavor, "flavor", "", "The VM flavor used for this cluster") - databaseEditCmd.Flags().StringVar(&cloud.DatabaseSpec.MaintenanceTime, "maintenance-time", "", "Time on which maintenances can start every day") - databaseEditCmd.Flags().StringVar(&cloud.DatabaseSpec.Plan, "plan", "", "Plan of the cluster") - databaseEditCmd.Flags().StringVar(&cloud.DatabaseSpec.Version, "version", "", "Version of the engine deployed on the cluster") - - // Network configuration - databaseEditCmd.Flags().StringSliceVar(&cloud.DatabaseSpec.CLIIPRestrictions, "ip-restrictions", nil, "IP blocks authorized to access the cluster (CIDR format)") - - // Common flags for other mean to define parameters - addInteractiveEditorFlag(databaseEditCmd) - - return databaseEditCmd -} diff --git a/internal/cmd/cloud_database_test.go b/internal/cmd/cloud_database_test.go deleted file mode 100644 index af8d5e1f..00000000 --- a/internal/cmd/cloud_database_test.go +++ /dev/null @@ -1,142 +0,0 @@ -// SPDX-FileCopyrightText: 2025 OVH SAS -// -// SPDX-License-Identifier: Apache-2.0 - -package cmd_test - -import ( - "net/http" - - "github.com/jarcoal/httpmock" - "github.com/maxatome/go-testdeep/td" - "github.com/maxatome/tdhttpmock" - "github.com/ovh/ovhcloud-cli/internal/cmd" -) - -func (ms *MockSuite) TestCloudDatabaseCreateCmd(assert, require *td.T) { - httpmock.RegisterMatcherResponder(http.MethodPost, - "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql", - tdhttpmock.JSONBody(td.JSON(` - { - "nodesList": [ - { - "flavor": "db1-4", - "region": "DE" - } - ], - "plan": "essential", - "version": "8" - }`), - ), - httpmock.NewStringResponder(200, `{"id": "0f0c43f0-979a-11f0-94fd-0050568ce122"}`), - ) - - out, err := cmd.Execute("cloud", "database-service", "create", "--cloud-project", "fakeProjectID", "--engine", "mysql", "--version", "8", "--plan", "essential", "--nodes-list", "db1-4:DE") - - require.CmpNoError(err) - assert.String(out, `✅ Database created successfully (id: 0f0c43f0-979a-11f0-94fd-0050568ce122)`) -} - -func (ms *MockSuite) TestCloudDatabaseEditCmd(assert, require *td.T) { - httpmock.RegisterResponder(http.MethodGet, - "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", - httpmock.NewStringResponder(200, `{ - "id": "fakeDatabaseID", - "engine": "mysql" - }`), - ) - - httpmock.RegisterResponder(http.MethodGet, - "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID", - httpmock.NewStringResponder(200, `{ - "createdAt": "2025-09-22T14:16:18.506458+02:00", - "plan": "essential", - "disk": { - "type": "high-speed", - "size": 80 - }, - "storage": { - "type": "high-speed", - "size": { - "unit": "GB", - "value": 80 - } - }, - "id": "9d1e7e8a-9abd-11f0-ab87-0050568ce122", - "engine": "mysql", - "category": "operational", - "ipRestrictions": [], - "status": "READY", - "nodes": [ - { - "id": "b282a940-9abd-11f0-a9f2-0050568ce122", - "createdAt": "2025-09-22T14:16:18.558113+02:00", - "flavor": "db1-4", - "name": "mysql-aa3b2t56-aa5f9a639-1.database.cloud.ovh.net", - "port": 2014, - "region": "DE", - "status": "READY" - } - ], - "nodeNumber": 1, - "description": "Default description", - "version": "6", - "networkType": "public", - "flavor": "db1-4", - "maintenanceTime": "13:16:00", - "backupTime": "09:10:00", - "backups": { - "time": "09:10:00", - "regions": [ - "DE", - "GRA" - ], - "retentionDays": 2, - "pitr": "2025-09-24T11:10:11+02:00" - }, - "enablePrometheus": false, - "deletionProtection": false - }`), - ) - - httpmock.RegisterMatcherResponder(http.MethodPut, - "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID", - tdhttpmock.JSONBody(td.JSON(` - { - "backupTime": "09:10:00", - "backups": { - "regions": [ - "DE", - "GRA" - ], - "time": "09:10:00" - }, - "deletionProtection": false, - "description": "Default description", - "disk": { - "size": 80 - }, - "enablePrometheus": false, - "flavor": "db1-4", - "ipRestrictions": [], - "maintenanceTime": "13:16:00", - "nodeNumber": 1, - "plan": "discovery", - "storage": { - "size": { - "unit": "GB", - "value": 80 - } - }, - "version": "8" - }`), - ), - httpmock.NewStringResponder(200, `{"id": "0f0c43f0-979a-11f0-94fd-0050568ce122"}`), - ) - - out, err := cmd.Execute("cloud", "database-service", "edit", "fakeDatabaseID", "--cloud-project", "fakeProjectID", "--version", "8", "--plan", "discovery", "-o", "yaml") - - require.CmpNoError(err) - assert.String(out, `message: ✅ Resource updated successfully -`) -} diff --git a/internal/cmd/cloud_managed_analytics.go b/internal/cmd/cloud_managed_analytics.go new file mode 100644 index 00000000..237e0062 --- /dev/null +++ b/internal/cmd/cloud_managed_analytics.go @@ -0,0 +1,597 @@ +// SPDX-FileCopyrightText: 2025 OVH SAS +// +// SPDX-License-Identifier: Apache-2.0 + +package cmd + +import ( + "github.com/ovh/ovhcloud-cli/internal/services/cloud" + "github.com/spf13/cobra" +) + +func initManagedAnalyticsCommand(cloudCmd *cobra.Command) { + managedAnalyticsCmd := &cobra.Command{ + Use: "managed-analytics", + Short: "Manage managed analytics services in the given cloud project", + } + managedAnalyticsCmd.PersistentFlags().StringVar(&cloud.CloudProject, "cloud-project", "", "Cloud project ID") + // Managed analytics commands + managedAnalyticsCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list", + Aliases: []string{"ls"}, + Short: "List your managed analytics services", + Run: cloud.ListManagedAnalytics, + })) + + managedAnalyticsCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific managed analytics service", + Run: cloud.GetManagedAnalytics, + Args: cobra.ExactArgs(1), + }) + + managedAnalyticsCmd.AddCommand(managedAnalyticsCreationCmd()) + managedAnalyticsCmd.AddCommand(managedAnalyticsEditCmd()) + + managedAnalyticsCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific managed analytics service", + Run: cloud.DeleteManagedAnalytics, + Args: cobra.ExactArgs(1), + }) + + initManagedAnalyticsDatabaseCommand(managedAnalyticsCmd) + initManagedAnalyticsUserCommand(managedAnalyticsCmd) + initManagedAnalyticsRoleCommand(managedAnalyticsCmd) + initManagedAnalyticsPermissionCommand(managedAnalyticsCmd) + initManagedAnalyticsPatternCommand(managedAnalyticsCmd) + initManagedAnalyticsCertificateCommand(managedAnalyticsCmd) + initManagedAnalyticsBackupCommand(managedAnalyticsCmd) + initManagedAnalyticsTopicCommand(managedAnalyticsCmd) + initManagedAnalyticsTopicACLCommand(managedAnalyticsCmd) + + cloudCmd.AddCommand(managedAnalyticsCmd) +} + +func initManagedAnalyticsDatabaseCommand(managedAnalyticsCmd *cobra.Command) { + databaseCmd := &cobra.Command{ + Use: "database", + Short: "Manage databases in a specific managed analytics service", + } + + databaseCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List all databases in the given managed analytics service", + Run: cloud.ListManagedAnalyticsDatabases, + Args: cobra.ExactArgs(1), + })) + + databaseCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific database in the given managed analytics service", + Run: cloud.GetManagedAnalyticsDatabase, + Args: cobra.ExactArgs(2), + }) + + databaseCmd.AddCommand(managedAnalyticsDatabaseCreateCmd()) + databaseCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific database in the given managed analytics service", + Run: cloud.DeleteManagedAnalyticsDatabase, + Args: cobra.ExactArgs(2), + }) + + managedAnalyticsCmd.AddCommand(databaseCmd) +} + +func initManagedAnalyticsUserCommand(managedAnalyticsCmd *cobra.Command) { + userCmd := &cobra.Command{ + Use: "user", + Short: "Manage users in a specific managed analytics service", + } + + userCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List all users in the given managed analytics service", + Run: cloud.ListManagedAnalyticsUsers, + Args: cobra.ExactArgs(1), + })) + + userCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific user in the given managed analytics service", + Run: cloud.GetManagedAnalyticsUser, + Args: cobra.ExactArgs(2), + }) + + userCmd.AddCommand(managedAnalyticsUserCreateCmd()) + userCmd.AddCommand(managedAnalyticsUserEditCmd()) + + userCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific user in the given managed analytics service", + Run: cloud.DeleteManagedAnalyticsUser, + Args: cobra.ExactArgs(2), + }) + + userCmd.AddCommand(&cobra.Command{ + Use: "credentials-reset ", + Short: "Reset the credentials of a specific user in the given managed analytics service", + Run: cloud.ResetManagedAnalyticsUserCredentials, + Args: cobra.ExactArgs(2), + }) + + managedAnalyticsCmd.AddCommand(userCmd) +} + +func initManagedAnalyticsRoleCommand(managedAnalyticsCmd *cobra.Command) { + roleCmd := &cobra.Command{ + Use: "role", + Short: "Manage roles in a specific managed analytics service", + } + + roleCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List roles in the given managed analytics service", + Run: cloud.ListManagedAnalyticsRoles, + Args: cobra.ExactArgs(1), + })) + + managedAnalyticsCmd.AddCommand(roleCmd) +} + +func initManagedAnalyticsPermissionCommand(managedAnalyticsCmd *cobra.Command) { + permissionCmd := &cobra.Command{ + Use: "permission", + Short: "Manage permissions in a specific managed analytics service", + } + + permissionCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List permissions in the given managed analytics service", + Run: cloud.ListManagedAnalyticsPermissions, + Args: cobra.ExactArgs(1), + })) + + managedAnalyticsCmd.AddCommand(permissionCmd) +} + +func initManagedAnalyticsPatternCommand(managedAnalyticsCmd *cobra.Command) { + patternCmd := &cobra.Command{ + Use: "pattern", + Short: "Manage patterns in a specific managed analytics service", + } + + patternCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List patterns in the given managed analytics service", + Run: cloud.ListManagedAnalyticsPatterns, + Args: cobra.ExactArgs(1), + })) + + patternCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific pattern in the given managed analytics service", + Run: cloud.GetManagedAnalyticsPattern, + Args: cobra.ExactArgs(2), + }) + + patternCmd.AddCommand(managedAnalyticsPatternCreateCmd()) + + patternCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific pattern in the given managed analytics service", + Run: cloud.DeleteManagedAnalyticsPattern, + Args: cobra.ExactArgs(2), + }) + + managedAnalyticsCmd.AddCommand(patternCmd) +} + +func initManagedAnalyticsCertificateCommand(managedAnalyticsCmd *cobra.Command) { + certificateCmd := &cobra.Command{ + Use: "certificate", + Short: "Manage certificates in a specific managed analytics service", + } + + certificateCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get certificates in the given managed analytics service", + Run: cloud.GetManagedAnalyticsCertificates, + Args: cobra.ExactArgs(1), + }) + + managedAnalyticsCmd.AddCommand(certificateCmd) +} + +func initManagedAnalyticsBackupCommand(managedAnalyticsCmd *cobra.Command) { + backupCmd := &cobra.Command{ + Use: "backup", + Short: "Manage backups in a specific managed analytics service", + } + + backupCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List all backups in the given managed analytics service", + Run: cloud.ListManagedAnalyticsBackups, + Args: cobra.ExactArgs(1), + })) + + backupCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific backup in the given managed analytics service", + Run: cloud.GetManagedAnalyticsBackup, + Args: cobra.ExactArgs(2), + }) + + managedAnalyticsCmd.AddCommand(backupCmd) +} + +func initManagedAnalyticsTopicCommand(managedAnalyticsCmd *cobra.Command) { + topicCmd := &cobra.Command{ + Use: "topic", + Short: "Manage topics in a specific managed analytics service", + } + + topicCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List topics in the given managed analytics service", + Run: cloud.ListManagedAnalyticsTopics, + Args: cobra.ExactArgs(1), + })) + + topicCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific topic in the given managed analytics service", + Run: cloud.GetManagedAnalyticsTopic, + Args: cobra.ExactArgs(2), + }) + + topicCmd.AddCommand(managedAnalyticsTopicCreateCmd()) + topicCmd.AddCommand(managedAnalyticsTopicEditCmd()) + + topicCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific topic in the given managed analytics service", + Run: cloud.DeleteManagedAnalyticsTopic, + Args: cobra.ExactArgs(2), + }) + + managedAnalyticsCmd.AddCommand(topicCmd) +} + +func initManagedAnalyticsTopicACLCommand(managedAnalyticsCmd *cobra.Command) { + topicACLCmd := &cobra.Command{ + Use: "topic-acl", + Short: "Manage topic ACLs in a specific managed analytics service", + } + + topicACLCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List topic ACLs in the given managed analytics service", + Run: cloud.ListManagedAnalyticsTopicACLs, + Args: cobra.ExactArgs(1), + })) + + topicACLCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific topic ACL in the given managed analytics service", + Run: cloud.GetManagedAnalyticsTopicACL, + Args: cobra.ExactArgs(2), + }) + + topicACLCmd.AddCommand(managedAnalyticsTopicACLCreateCmd()) + + topicACLCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific topic ACL in the given managed analytics service", + Run: cloud.DeleteManagedAnalyticsTopicACL, + Args: cobra.ExactArgs(2), + }) + + managedAnalyticsCmd.AddCommand(topicACLCmd) +} + +func managedAnalyticsCreationCmd() *cobra.Command { + managedAnalyticsCreateCmd := &cobra.Command{ + Use: "create", + Short: "Create a new managed analytics service", + Long: `Use this command to create a managed analytics service in the given public cloud project. +There are two ways to define the creation parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-analytics create --engine kafka --version 4.0 --plan production --nodes-pattern.flavor db1-4 --nodes-pattern.region GRA + +2. Using your default text editor: + + ovhcloud cloud managed-analytics create --engine kafka --editor + You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your + default text editor to update the parameters. When saving the file, the creation will start. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-analytics create --engine kafka --editor --version 3 +`, + PreRunE: cloud.CreateManagedAnalyticsPreRun, + Run: cloud.CreateManagedAnalytics, + Args: cobra.NoArgs, + } + + // Analytics details + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Engine, "engine", "", "Analytics engine (you can get the list of available engines using 'ovhcloud cloud reference managed-analytics list-engines')") + managedAnalyticsCreateCmd.MarkFlagRequired("engine") + managedAnalyticsCreateCmd.RegisterFlagCompletionFunc("engine", func(cmd *cobra.Command, args []string, toComplete string) ([]cobra.Completion, cobra.ShellCompDirective) { + return cloud.ManagedAnalyticsValidEngines, cobra.ShellCompDirectiveNoFileComp + }) + managedAnalyticsCreateCmd.Flags().StringSliceVar(&cloud.ManagedAnalyticsSpec.Backups.Regions, "backups-regions", nil, "Regions on which the backups are stored") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Backups.Time, "backups-time", "", "Time on which backups start every day") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Description, "description", "", "Analytics description") + managedAnalyticsCreateCmd.Flags().IntVar(&cloud.ManagedAnalyticsSpec.Disk.Size, "disk-size", 0, "Disk size (GB)") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.ForkFrom.BackupID, "fork-from.backup-id", "", "Backup ID (not compatible with fork-from.point-in-time)") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.ForkFrom.PointInTime, "fork-from.point-in-time", "", "Point in time to restore from (not compatible with fork-from.backup-id)") + managedAnalyticsCreateCmd.MarkFlagsMutuallyExclusive("fork-from.backup-id", "fork-from.point-in-time") + markFlagsMutuallyExclusive(managedAnalyticsCreateCmd, "fork-from.backup-id", "fork-from.point-in-time") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.ForkFrom.ServiceID, "fork-from.service-id", "", "Service ID that owns the backups") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.MaintenanceTime, "maintenance-time", "", "Time on which maintenances can start every day") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Plan, "plan", "", "Analytics plan (you can get the list of available plans using 'ovhcloud cloud reference managed-analytics list-plans')") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Version, "version", "", "Analytics version (you can get the list of available versions using 'ovhcloud cloud reference managed-analytics list-engines')") + + // Network configuration + managedAnalyticsCreateCmd.Flags().StringSliceVar(&cloud.ManagedAnalyticsSpec.CLIIPRestrictions, "ip-restrictions", nil, "IP blocks authorized to access the cluster (CIDR format)") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.NetworkID, "network-id", "", "Private network ID in which the cluster is deployed") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.SubnetID, "subnet-id", "", "Private subnet ID in which the cluster is deployed") + + // Nodes pattern definition + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.NodesPattern.Flavor, "nodes-pattern.flavor", "", "Flavor of all nodes") + managedAnalyticsCreateCmd.Flags().IntVar(&cloud.ManagedAnalyticsSpec.NodesPattern.Number, "nodes-pattern.number", 0, "Number of nodes") + managedAnalyticsCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.NodesPattern.Region, "nodes-pattern.region", "", "Region of all nodes") + + // Nodes list definition + managedAnalyticsCreateCmd.Flags().StringSliceVar(&cloud.ManagedAnalyticsSpec.CLINodesList, "nodes-list", nil, "List of nodes (format: flavor1:region1,flavor2:region2...)") + markFlagsMutuallyExclusive(managedAnalyticsCreateCmd, "nodes-pattern.flavor", "nodes-list") + markFlagsMutuallyExclusive(managedAnalyticsCreateCmd, "nodes-pattern.number", "nodes-list") + markFlagsMutuallyExclusive(managedAnalyticsCreateCmd, "nodes-pattern.region", "nodes-list") + + // Common flags for other mean to define parameters + addInteractiveEditorFlag(managedAnalyticsCreateCmd) + return managedAnalyticsCreateCmd +} + +func managedAnalyticsEditCmd() *cobra.Command { + managedAnalyticsEditCmd := &cobra.Command{ + Use: "edit ", + Short: "Edit a specific managed analytics service", + Long: `Use this command to edit a managed analytics service in the given public cloud project. +There are two ways to define the edition parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-analytics edit --description "My analytics service" + +2. Using your default text editor: + + ovhcloud cloud managed-analytics edit --editor + The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-analytics edit --editor --description "My analytics service" +`, + Run: cloud.EditManagedAnalytics, + Args: cobra.ExactArgs(1), + } + + // Analytics details + managedAnalyticsEditCmd.Flags().StringSliceVar(&cloud.ManagedAnalyticsSpec.Backups.Regions, "backups-regions", nil, "Regions on which the backups are stored") + managedAnalyticsEditCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Backups.Time, "backups-time", "", "Time on which backups start every day") + managedAnalyticsEditCmd.Flags().BoolVar(&cloud.ManagedAnalyticsSpec.DeletionProtection, "deletion-protection", false, "Enable deletion protection") + managedAnalyticsEditCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Description, "description", "", "Description of the cluster") + managedAnalyticsEditCmd.Flags().BoolVar(&cloud.ManagedAnalyticsSpec.EnablePrometheus, "enable-prometheus", false, "Enable Prometheus") + managedAnalyticsEditCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.NodesPattern.Flavor, "flavor", "", "The VM flavor used for this cluster") + managedAnalyticsEditCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.MaintenanceTime, "maintenance-time", "", "Time on which maintenances can start every day") + managedAnalyticsEditCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Plan, "plan", "", "Plan of the cluster") + managedAnalyticsEditCmd.Flags().StringVar(&cloud.ManagedAnalyticsSpec.Version, "version", "", "Version of the engine deployed on the cluster") + + // Network configuration + managedAnalyticsEditCmd.Flags().StringSliceVar(&cloud.ManagedAnalyticsSpec.CLIIPRestrictions, "ip-restrictions", nil, "IP blocks authorized to access the cluster (CIDR format)") + + // Common flags for other mean to define parameters + addInteractiveEditorFlag(managedAnalyticsEditCmd) + + return managedAnalyticsEditCmd +} + +func managedAnalyticsDatabaseCreateCmd() *cobra.Command { + databaseCreateCmd := &cobra.Command{ + Use: "create ", + Short: "Create a new database in the given managed analytics service", + Long: `Use this command to create a database in the given managed analytics service. + + ovhcloud cloud managed-analytics database create --name mydb +`, + Run: cloud.CreateManagedAnalyticsDatabase, + Args: cobra.ExactArgs(1), + } + + databaseCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsDatabaseSpec.Name, "name", "", "Name of the database to create") + databaseCreateCmd.MarkFlagRequired("name") + + return databaseCreateCmd +} + +func managedAnalyticsUserCreateCmd() *cobra.Command { + userCreateCmd := &cobra.Command{ + Use: "create ", + Short: "Create a new user in the given managed analytics service", + Long: `Use this command to create a user in the given managed analytics service. +There are two ways to define the creation parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-analytics user create --name myuser + + For Clickhouse engine, you can also specify roles: + + ovhcloud cloud managed-analytics user create --name myuser --roles role1,role2 + + For OpenSearch engine, you can specify ACLs: + + ovhcloud cloud managed-analytics user create --name myuser --acls "logs-.*:write" --acls "metrics-.*:read" + +2. Using your default text editor: + + ovhcloud cloud managed-analytics user create --name myuser --editor + You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your + default text editor to update the parameters. When saving the file, the creation will start. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-analytics user create --name myuser --editor --roles role1,role2 +`, + Run: cloud.CreateManagedAnalyticsUser, + Args: cobra.ExactArgs(1), + } + + userCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsUserSpec.Name, "name", "", "Name of the user to create") + userCreateCmd.MarkFlagRequired("name") + + // Clickhouse specific flags + userCreateCmd.Flags().StringSliceVar(&cloud.ManagedAnalyticsUserSpec.Roles, "roles", nil, "Roles granted to the user (clickhouse only)") + + // OpenSearch specific flags + userCreateCmd.Flags().StringArrayVar(&cloud.ManagedAnalyticsUserSpec.CLIAcls, "acls", nil, "ACL granted to the user (opensearch only, format: pattern:permission)") + + addInteractiveEditorFlag(userCreateCmd) + + return userCreateCmd +} + +func managedAnalyticsUserEditCmd() *cobra.Command { + userEditCmd := &cobra.Command{ + Use: "edit ", + Short: "Edit a user in the given managed analytics service", + Long: `Use this command to edit a user in the given managed analytics service. +There are two ways to define the edition parameters: + +1. Using only CLI flags: + + For Clickhouse engine: + + ovhcloud cloud managed-analytics user edit --roles role1,role2 + + For OpenSearch engine: + + ovhcloud cloud managed-analytics user edit --acls "logs-.*:write" --acls "metrics-.*:read" + +2. Using your default text editor: + + ovhcloud cloud managed-analytics user edit --editor + The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-analytics user edit --editor --roles role1,role2 +`, + Run: cloud.EditManagedAnalyticsUser, + Args: cobra.ExactArgs(2), + } + + // Clickhouse specific flags + userEditCmd.Flags().StringSliceVar(&cloud.ManagedAnalyticsUserSpec.Roles, "roles", nil, "Roles granted to the user (clickhouse only)") + + // OpenSearch specific flags + userEditCmd.Flags().StringArrayVar(&cloud.ManagedAnalyticsUserSpec.CLIAcls, "acls", nil, "ACL granted to the user (opensearch only, format: pattern:permission)") + + addInteractiveEditorFlag(userEditCmd) + + return userEditCmd +} + +func managedAnalyticsPatternCreateCmd() *cobra.Command { + patternCreateCmd := &cobra.Command{ + Use: "create ", + Short: "Create a new pattern in the given managed analytics service", + Run: cloud.CreateManagedAnalyticsPattern, + Args: cobra.ExactArgs(1), + } + + patternCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsPatternSpec.Pattern, "pattern", "", "Pattern format") + patternCreateCmd.MarkFlagRequired("pattern") + + patternCreateCmd.Flags().IntVar(&cloud.ManagedAnalyticsPatternSpec.MaxIndexCount, "max-index-count", 0, "Maximum number of index for this pattern (clickhouse only)") + + addInteractiveEditorFlag(patternCreateCmd) + + return patternCreateCmd +} + +func managedAnalyticsTopicCreateCmd() *cobra.Command { + topicCreateCmd := &cobra.Command{ + Use: "create ", + Short: "Create a new topic in the given managed analytics service", + Run: cloud.CreateManagedAnalyticsTopic, + Args: cobra.ExactArgs(1), + } + + topicCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsTopicSpec.Name, "name", "", "Topic name") + topicCreateCmd.MarkFlagRequired("name") + topicCreateCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.MinInsyncReplicas, "min-insync-replicas", 0, "Minimum in-sync replicas") + topicCreateCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.Partitions, "partitions", 0, "Number of partitions") + topicCreateCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.Replication, "replication", 0, "Number of replications") + topicCreateCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.RetentionBytes, "retention-bytes", 0, "Retention size in bytes (-1 for unlimited)") + topicCreateCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.RetentionHours, "retention-hours", 0, "Retention duration in hours (-1 for unlimited)") + + addInteractiveEditorFlag(topicCreateCmd) + + return topicCreateCmd +} + +func managedAnalyticsTopicEditCmd() *cobra.Command { + topicEditCmd := &cobra.Command{ + Use: "edit ", + Short: "Edit a topic in the given managed analytics service", + Run: cloud.EditManagedAnalyticsTopic, + Args: cobra.ExactArgs(2), + } + + topicEditCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.MinInsyncReplicas, "min-insync-replicas", 0, "Minimum in-sync replicas") + topicEditCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.Partitions, "partitions", 0, "Number of partitions") + topicEditCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.Replication, "replication", 0, "Number of replications") + topicEditCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.RetentionBytes, "retention-bytes", 0, "Retention size in bytes (-1 for unlimited)") + topicEditCmd.Flags().IntVar(&cloud.ManagedAnalyticsTopicSpec.RetentionHours, "retention-hours", 0, "Retention duration in hours (-1 for unlimited)") + + addInteractiveEditorFlag(topicEditCmd) + + return topicEditCmd +} + +func managedAnalyticsTopicACLCreateCmd() *cobra.Command { + topicACLCreateCmd := &cobra.Command{ + Use: "create ", + Short: "Create a new topic ACL in the given managed analytics service", + Long: `Use this command to create a topic ACL in the given managed analytics service (kafka only). + + ovhcloud cloud managed-analytics topic-acl create --permission read --topic my-topic --username myuser +`, + Run: cloud.CreateManagedAnalyticsTopicACL, + Args: cobra.ExactArgs(1), + } + + topicACLCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsTopicACLSpec.Permission, "permission", "", "ACL permission (e.g. read, write, readwrite)") + topicACLCreateCmd.MarkFlagRequired("permission") + topicACLCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsTopicACLSpec.Topic, "topic", "", "Topic name the ACL applies to") + topicACLCreateCmd.MarkFlagRequired("topic") + topicACLCreateCmd.Flags().StringVar(&cloud.ManagedAnalyticsTopicACLSpec.Username, "username", "", "Username the ACL applies to") + topicACLCreateCmd.MarkFlagRequired("username") + + return topicACLCreateCmd +} diff --git a/internal/cmd/cloud_managed_analytics_test.go b/internal/cmd/cloud_managed_analytics_test.go new file mode 100644 index 00000000..1115ddca --- /dev/null +++ b/internal/cmd/cloud_managed_analytics_test.go @@ -0,0 +1,822 @@ +// SPDX-FileCopyrightText: 2025 OVH SAS +// +// SPDX-License-Identifier: Apache-2.0 + +package cmd_test + +import ( + "net/http" + + "github.com/jarcoal/httpmock" + "github.com/maxatome/go-testdeep/td" + "github.com/maxatome/tdhttpmock" + "github.com/ovh/ovhcloud-cli/internal/cmd" +) + +// fullAnalyticsServiceResponse is a complete API response for an analytics service, +// covering all fields accessed by the managed-analytics template. +const fullAnalyticsServiceResponse = `{ + "id": "fakeAnalyticsID", + "engine": "kafka", + "version": "3", + "description": "test analytics", + "status": "READY", + "category": "analysis", + "plan": "essential", + "flavor": "db1-4", + "createdAt": "2025-01-01T00:00:00Z", + "networkType": "public", + "storage": {"size": {"value": 80, "unit": "GB"}}, + "nodes": [{"id": "nodeID", "flavor": "db1-4", "region": "DE", "status": "READY"}] +}` + +// ── Service ────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service", + httpmock.NewStringResponder(200, `["fakeAnalyticsID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, fullAnalyticsServiceResponse), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "list", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeAnalyticsID")) +} + +func (ms *MockSuite) TestManagedAnalyticsGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, fullAnalyticsServiceResponse), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "get", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeAnalyticsID")) +} + +func (ms *MockSuite) TestManagedAnalyticsCreateCmd(assert, require *td.T) { + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka", + tdhttpmock.JSONBody(td.JSON(` + { + "nodesList": [ + { + "flavor": "db1-4", + "region": "DE" + } + ], + "plan": "essential", + "version": "3" + }`), + ), + httpmock.NewStringResponder(200, `{"id": "0f0c43f0-979a-11f0-94fd-0050568ce122"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "create", "--cloud-project", "fakeProjectID", "--engine", "kafka", "--version", "3", "--plan", "essential", "--nodes-list", "db1-4:DE") + + require.CmpNoError(err) + assert.String(out, `✅ Managed analytics service created successfully (id: 0f0c43f0-979a-11f0-94fd-0050568ce122)`) +} + +func (ms *MockSuite) TestManagedAnalyticsCreateInvalidEngineCmd(assert, require *td.T) { + out, err := cmd.Execute("cloud", "managed-analytics", "create", "--cloud-project", "fakeProjectID", "--engine", "invalid", "--version", "1", "--plan", "essential", "--nodes-list", "db1-4:DE") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑 invalid engine invalid")) +} + +func (ms *MockSuite) TestManagedAnalyticsEditCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{ + "id": "fakeAnalyticsID", + "engine": "kafka" + }`), + ) + + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{ + "id": "fakeAnalyticsID", + "engine": "kafka", + "category": "analysis", + "plan": "essential", + "disk": {"size": 80}, + "storage": {"size": {"unit": "GB", "value": 80}}, + "ipRestrictions": [], + "status": "READY", + "nodes": [{"id": "nodeID", "flavor": "db1-4", "region": "DE", "status": "READY"}], + "description": "Default description", + "version": "3", + "networkType": "public", + "flavor": "db1-4", + "maintenanceTime": "13:16:00", + "enablePrometheus": false, + "deletionProtection": false + }`), + ) + + httpmock.RegisterMatcherResponder(http.MethodPut, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID", + tdhttpmock.JSONBody(td.JSON(` + { + "deletionProtection": false, + "description": "Default description", + "disk": {"size": 80}, + "enablePrometheus": false, + "flavor": "db1-4", + "ipRestrictions": [], + "maintenanceTime": "13:16:00", + "plan": "discovery", + "storage": {"size": {"unit": "GB", "value": 80}}, + "version": "4" + }`), + ), + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "edit", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--version", "4", "--plan", "discovery", "-o", "yaml") + + require.CmpNoError(err) + assert.String(out, `message: ✅ Resource updated successfully +`) +} + +func (ms *MockSuite) TestManagedAnalyticsDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "delete", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ Managed analytics service deleted successfully`) +} + +// ── Database ────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsDatabaseListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/database", + httpmock.NewStringResponder(200, `["fakeDbID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/database/fakeDbID", + httpmock.NewStringResponder(200, `{"id": "fakeDbID", "name": "mydb", "default": false}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "database", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeDbID")) +} + +func (ms *MockSuite) TestManagedAnalyticsDatabaseGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/database/fakeDbID", + httpmock.NewStringResponder(200, `{"id": "fakeDbID", "name": "mydb", "default": false}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "database", "get", "fakeAnalyticsID", "fakeDbID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeDbID")) +} + +func (ms *MockSuite) TestManagedAnalyticsDatabaseCreateCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/database", + tdhttpmock.JSONBody(td.JSON(`{"name": "mydb"}`)), + httpmock.NewStringResponder(200, `{"id": "fakeDbID", "name": "mydb", "default": false}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "database", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--name", "mydb") + + require.CmpNoError(err) + assert.String(out, `✅ Database created successfully (id: fakeDbID)`) +} + +func (ms *MockSuite) TestManagedAnalyticsDatabaseCreateInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "database", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--name", "mydb") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +func (ms *MockSuite) TestManagedAnalyticsDatabaseDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/database/fakeDbID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "database", "delete", "fakeAnalyticsID", "fakeDbID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ Database deleted successfully`) +} + +// ── User ────────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsUserListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/user", + httpmock.NewStringResponder(200, `["fakeUserID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/user/fakeUserID", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "status": "READY"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeUserID")) +} + +func (ms *MockSuite) TestManagedAnalyticsUserGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/user/fakeUserID", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "status": "READY"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "get", "fakeAnalyticsID", "fakeUserID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeUserID")) +} + +func (ms *MockSuite) TestManagedAnalyticsUserCreateCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/user", + tdhttpmock.JSONBody(td.JSON(`{"name": "myuser"}`)), + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "password": "s3cr3t", "status": "READY"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--name", "myuser") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("Password: s3cr3t")) +} + +func (ms *MockSuite) TestManagedAnalyticsUserCreateWithRolesCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + // Use simple responder: CreateResource schema filtering may alter the exact body + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/user", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "password": "s3cr3t", "status": "READY"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--name", "myuser", "--roles", "analyst") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("Password: s3cr3t")) +} + +func (ms *MockSuite) TestManagedAnalyticsUserCreateInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + // kafkaMirrorMaker is not in UserPostValidEngines + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafkaMirrorMaker"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--name", "myuser") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +func (ms *MockSuite) TestManagedAnalyticsUserEditWithAclsCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "opensearch"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/opensearch/fakeAnalyticsID/user/fakeUserID", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "acls": [], "status": "READY"}`), + ) + httpmock.RegisterResponder(http.MethodPut, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/opensearch/fakeAnalyticsID/user/fakeUserID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "edit", "fakeAnalyticsID", "fakeUserID", "--cloud-project", "fakeProjectID", "--acls", "logs-.*:readwrite") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("✅ Resource updated successfully")) +} + +func (ms *MockSuite) TestManagedAnalyticsUserEditInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + // kafka is not in UserEditValidEngines + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "edit", "fakeAnalyticsID", "fakeUserID", "--cloud-project", "fakeProjectID", "--acls", "logs-.*:readwrite") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +func (ms *MockSuite) TestManagedAnalyticsUserDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/user/fakeUserID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "delete", "fakeAnalyticsID", "fakeUserID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ User deleted successfully`) +} + +func (ms *MockSuite) TestManagedAnalyticsUserCredentialsResetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/user/fakeUserID/credentials/reset", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "password": "n3wS3cr3t"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "user", "credentials-reset", "fakeAnalyticsID", "fakeUserID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("Password: n3wS3cr3t")) +} + +// ── Roles ───────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsRoleListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/roles", + httpmock.NewStringResponder(200, `["analyst", "admin"]`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "role", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("analyst")) +} + +func (ms *MockSuite) TestManagedAnalyticsRoleListInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "role", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +// ── Permissions ─────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsPermissionListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "opensearch"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/opensearch/fakeAnalyticsID/permissions", + httpmock.NewStringResponder(200, `{"names": ["indices:data/read/get", "indices:data/write/index"]}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "permission", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("indices:data/read/get")) +} + +func (ms *MockSuite) TestManagedAnalyticsPermissionListInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "permission", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +// ── Patterns ────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsPatternListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "opensearch"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/opensearch/fakeAnalyticsID/pattern", + httpmock.NewStringResponder(200, `["fakePatternID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/opensearch/fakeAnalyticsID/pattern/fakePatternID", + httpmock.NewStringResponder(200, `{"id": "fakePatternID", "pattern": "logs-*", "maxIndexCount": 10}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "pattern", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakePatternID")) +} + +func (ms *MockSuite) TestManagedAnalyticsPatternGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "opensearch"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/opensearch/fakeAnalyticsID/pattern/fakePatternID", + httpmock.NewStringResponder(200, `{"id": "fakePatternID", "pattern": "logs-*", "maxIndexCount": 10}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "pattern", "get", "fakeAnalyticsID", "fakePatternID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakePatternID")) +} + +func (ms *MockSuite) TestManagedAnalyticsPatternCreateCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "opensearch"}`), + ) + // Use simple responder: example JSON includes maxIndexCount which affects the POST body + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/opensearch/fakeAnalyticsID/pattern", + httpmock.NewStringResponder(200, `{"id": "fakePatternID", "pattern": "logs-*", "maxIndexCount": 0}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "pattern", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--pattern", "logs-*") + + require.CmpNoError(err) + assert.String(out, `✅ Pattern created successfully (id: fakePatternID)`) +} + +func (ms *MockSuite) TestManagedAnalyticsPatternCreateInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "pattern", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--pattern", "logs-*") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +func (ms *MockSuite) TestManagedAnalyticsPatternDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "opensearch"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/opensearch/fakeAnalyticsID/pattern/fakePatternID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "pattern", "delete", "fakeAnalyticsID", "fakePatternID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ Pattern deleted successfully`) +} + +// ── Certificate ─────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsCertificateGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/certificates", + httpmock.NewStringResponder(200, `{"ca": "-----BEGIN CERTIFICATE-----\nMIIB..."}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "certificate", "get", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("-----BEGIN CERTIFICATE-----")) +} + +func (ms *MockSuite) TestManagedAnalyticsCertificateGetInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + // opensearch is not in CertificateValidEngines + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "opensearch"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "certificate", "get", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +// ── Backup ──────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsBackupListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/backup", + httpmock.NewStringResponder(200, `["fakeBackupID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/backup/fakeBackupID", + httpmock.NewStringResponder(200, `{"id": "fakeBackupID", "createdAt": "2025-01-01T00:00:00Z", "type": "AUTOMATIC", "status": "READY", "description": "Daily backup"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "backup", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeBackupID")) +} + +func (ms *MockSuite) TestManagedAnalyticsBackupGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/clickhouse/fakeAnalyticsID/backup/fakeBackupID", + httpmock.NewStringResponder(200, `{"id": "fakeBackupID", "createdAt": "2025-01-01T00:00:00Z", "type": "AUTOMATIC", "status": "READY", "description": "Daily backup", "size": {"value": 80, "unit": "GB"}, "regions": [{"name": "DE"}]}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "backup", "get", "fakeAnalyticsID", "fakeBackupID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeBackupID")) +} + +func (ms *MockSuite) TestManagedAnalyticsBackupListInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + // kafka is not in BackupValidEngines + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "backup", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +// ── Topics ──────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsTopicListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topic", + httpmock.NewStringResponder(200, `["fakeTopicID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topic/fakeTopicID", + httpmock.NewStringResponder(200, `{"id": "fakeTopicID", "name": "my-topic", "partitions": 3, "replication": 1, "minInsyncReplicas": 1, "retentionBytes": -1, "retentionHours": 168}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeTopicID")) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topic/fakeTopicID", + httpmock.NewStringResponder(200, `{"id": "fakeTopicID", "name": "my-topic", "partitions": 3, "replication": 1, "minInsyncReplicas": 1, "retentionBytes": -1, "retentionHours": 168}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic", "get", "fakeAnalyticsID", "fakeTopicID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeTopicID")) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicCreateCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topic", + tdhttpmock.JSONBody(td.JSON(`{"name": "my-topic", "partitions": 3, "replication": 1, "minInsyncReplicas": 1, "retentionBytes": -1, "retentionHours": 168}`)), + httpmock.NewStringResponder(200, `{"id": "fakeTopicID", "name": "my-topic", "partitions": 3, "replication": 1, "minInsyncReplicas": 1, "retentionBytes": -1, "retentionHours": 168}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic", "create", "fakeAnalyticsID", + "--cloud-project", "fakeProjectID", + "--name", "my-topic", + "--partitions", "3", + "--replication", "1", + "--min-insync-replicas", "1", + "--retention-bytes", "-1", + "--retention-hours", "168", + ) + + require.CmpNoError(err) + assert.String(out, `✅ Topic created successfully (id: fakeTopicID)`) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicEditCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topic/fakeTopicID", + httpmock.NewStringResponder(200, `{"id": "fakeTopicID", "name": "my-topic", "partitions": 3, "replication": 1, "minInsyncReplicas": 1, "retentionBytes": -1, "retentionHours": 168}`), + ) + httpmock.RegisterResponder(http.MethodPut, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topic/fakeTopicID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic", "edit", "fakeAnalyticsID", "fakeTopicID", + "--cloud-project", "fakeProjectID", + "--retention-hours", "72", + ) + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("✅ Resource updated successfully")) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topic/fakeTopicID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic", "delete", "fakeAnalyticsID", "fakeTopicID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ Topic deleted successfully`) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicListInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + // clickhouse is not in TopicValidEngines + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "clickhouse"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +// ── Topic ACLs ──────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedAnalyticsTopicACLListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topicAcl", + httpmock.NewStringResponder(200, `["fakeACLID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topicAcl/fakeACLID", + httpmock.NewStringResponder(200, `{"id": "fakeACLID", "username": "myuser", "topic": "my-topic", "permission": "read"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic-acl", "list", "fakeAnalyticsID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeACLID")) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicACLGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topicAcl/fakeACLID", + httpmock.NewStringResponder(200, `{"id": "fakeACLID", "username": "myuser", "topic": "my-topic", "permission": "read"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic-acl", "get", "fakeAnalyticsID", "fakeACLID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeACLID")) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicACLCreateCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topicAcl", + tdhttpmock.JSONBody(td.JSON(`{"permission": "read", "topic": "my-topic", "username": "myuser"}`)), + httpmock.NewStringResponder(200, `{"id": "fakeACLID", "username": "myuser", "topic": "my-topic", "permission": "read"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic-acl", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--permission", "read", "--topic", "my-topic", "--username", "myuser") + + require.CmpNoError(err) + assert.String(out, `✅ Topic ACL created successfully (id: fakeACLID)`) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicACLCreateInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + // opensearch is not in TopicValidEngines + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "opensearch"}`), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic-acl", "create", "fakeAnalyticsID", "--cloud-project", "fakeProjectID", "--permission", "read", "--topic", "my-topic", "--username", "myuser") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +func (ms *MockSuite) TestManagedAnalyticsTopicACLDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeAnalyticsID", + httpmock.NewStringResponder(200, `{"id": "fakeAnalyticsID", "engine": "kafka"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/kafka/fakeAnalyticsID/topicAcl/fakeACLID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-analytics", "topic-acl", "delete", "fakeAnalyticsID", "fakeACLID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ Topic ACL deleted successfully`) +} diff --git a/internal/cmd/cloud_managed_database.go b/internal/cmd/cloud_managed_database.go new file mode 100644 index 00000000..d4c9dad5 --- /dev/null +++ b/internal/cmd/cloud_managed_database.go @@ -0,0 +1,419 @@ +// SPDX-FileCopyrightText: 2025 OVH SAS +// +// SPDX-License-Identifier: Apache-2.0 + +package cmd + +import ( + "github.com/ovh/ovhcloud-cli/internal/services/cloud" + "github.com/spf13/cobra" +) + +func initManagedDatabaseCommand(cloudCmd *cobra.Command) { + managedDatabaseCmd := &cobra.Command{ + Use: "managed-database", + Short: "Manage managed database services in the given cloud project", + } + managedDatabaseCmd.PersistentFlags().StringVar(&cloud.CloudProject, "cloud-project", "", "Cloud project ID") + + // Managed database commands + managedDatabaseCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list", + Aliases: []string{"ls"}, + Short: "List your managed database services", + Run: cloud.ListManagedDatabases, + })) + + managedDatabaseCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific managed database service", + Run: cloud.GetManagedDatabase, + Args: cobra.ExactArgs(1), + }) + + managedDatabaseCmd.AddCommand(managedDatabaseCreationCmd()) + managedDatabaseCmd.AddCommand(managedDatabaseEditCmd()) + + managedDatabaseCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific managed database service", + Run: cloud.DeleteManagedDatabase, + Args: cobra.ExactArgs(1), + }) + + initManagedDatabaseDatabaseCommand(managedDatabaseCmd) + initManagedDatabaseUserCommand(managedDatabaseCmd) + initManagedDatabaseRoleCommand(managedDatabaseCmd) + initManagedDatabaseCertificateCommand(managedDatabaseCmd) + initManagedDatabaseBackupCommand(managedDatabaseCmd) + + cloudCmd.AddCommand(managedDatabaseCmd) +} + +func initManagedDatabaseDatabaseCommand(managedDatabaseCmd *cobra.Command) { + databaseCmd := &cobra.Command{ + Use: "database", + Short: "Manage databases in a specific managed database service", + } + + databaseCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List all databases in the given managed database service", + Run: cloud.ListManagedDatabaseDatabases, + Args: cobra.ExactArgs(1), + })) + + databaseCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific database in the given managed database service", + Run: cloud.GetManagedDatabaseDatabase, + Args: cobra.ExactArgs(2), + }) + + databaseCmd.AddCommand(managedDatabaseDatabaseCreateCmd()) + + databaseCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific database in the given managed database service", + Run: cloud.DeleteManagedDatabaseDatabase, + Args: cobra.ExactArgs(2), + }) + + managedDatabaseCmd.AddCommand(databaseCmd) +} + +func initManagedDatabaseUserCommand(managedDatabaseCmd *cobra.Command) { + userCmd := &cobra.Command{ + Use: "user", + Short: "Manage users in a specific managed database service", + } + + userCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List all users in the given managed database service", + Run: cloud.ListManagedDatabaseUsers, + Args: cobra.ExactArgs(1), + })) + + userCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific user in the given managed database service", + Run: cloud.GetManagedDatabaseUser, + Args: cobra.ExactArgs(2), + }) + + userCmd.AddCommand(managedDatabaseUserCreateCmd()) + userCmd.AddCommand(managedDatabaseUserEditCmd()) + + userCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a specific user in the given managed database service", + Run: cloud.DeleteManagedDatabaseUser, + Args: cobra.ExactArgs(2), + }) + + userCmd.AddCommand(&cobra.Command{ + Use: "credentials-reset ", + Short: "Reset the credentials of a specific user in the given managed database service", + Run: cloud.ResetManagedDatabaseUserCredentials, + Args: cobra.ExactArgs(2), + }) + + managedDatabaseCmd.AddCommand(userCmd) +} + +func initManagedDatabaseRoleCommand(managedDatabaseCmd *cobra.Command) { + roleCmd := &cobra.Command{ + Use: "role", + Short: "Manage roles in a specific managed database service", + } + + roleCmd.AddCommand(withFilterFlag(managedDatabaseRoleListCmd())) + + managedDatabaseCmd.AddCommand(roleCmd) +} + +func initManagedDatabaseCertificateCommand(managedDatabaseCmd *cobra.Command) { + certificateCmd := &cobra.Command{ + Use: "certificate", + Short: "Manage certificates in a specific managed database service", + } + + certificateCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get certificates in the given managed database service", + Run: cloud.GetManagedDatabaseCertificates, + Args: cobra.ExactArgs(1), + }) + + managedDatabaseCmd.AddCommand(certificateCmd) +} + +func initManagedDatabaseBackupCommand(managedDatabaseCmd *cobra.Command) { + backupCmd := &cobra.Command{ + Use: "backup", + Short: "Manage backups in a specific managed database service", + } + + backupCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List all backups in the given managed database service", + Run: cloud.ListManagedDatabaseBackups, + Args: cobra.ExactArgs(1), + })) + + backupCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific backup in the given managed database service", + Run: cloud.GetManagedDatabaseBackup, + Args: cobra.ExactArgs(2), + }) + + backupCmd.AddCommand(&cobra.Command{ + Use: "restore ", + Short: "Restore a specific backup in the given managed database service", + Run: cloud.RestoreManagedDatabaseBackup, + Args: cobra.ExactArgs(2), + }) + + managedDatabaseCmd.AddCommand(backupCmd) +} + +func managedDatabaseCreationCmd() *cobra.Command { + managedDatabaseCreateCmd := &cobra.Command{ + Use: "create", + Short: "Create a new managed database service", + Long: `Use this command to create a managed database service in the given public cloud project. +There are two ways to define the creation parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-database create --engine mysql --version 8 --plan essential --nodes-pattern.flavor db1-4 --nodes-pattern.region DE + +2. Using your default text editor: + + ovhcloud cloud managed-database create --engine mysql --editor + You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your + default text editor to update the parameters. When saving the file, the creation will start. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-database create --engine mysql --editor --version 8 +`, + PreRunE: cloud.CreateManagedDatabasePreRun, + Run: cloud.CreateManagedDatabase, + Args: cobra.NoArgs, + } + + // Database details + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Engine, "engine", "", "Database engine (you can get the list of available engines using 'ovhcloud cloud reference managed-database list-engines')") + managedDatabaseCreateCmd.MarkFlagRequired("engine") + managedDatabaseCreateCmd.RegisterFlagCompletionFunc("engine", func(cmd *cobra.Command, args []string, toComplete string) ([]cobra.Completion, cobra.ShellCompDirective) { + return cloud.ManagedDatabaseValidEngines, cobra.ShellCompDirectiveNoFileComp + }) + managedDatabaseCreateCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseSpec.Backups.Regions, "backups-regions", nil, "Regions on which the backups are stored") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Backups.Time, "backups-time", "", "Time on which backups start every day") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Description, "description", "", "Database description") + managedDatabaseCreateCmd.Flags().IntVar(&cloud.ManagedDatabaseSpec.Disk.Size, "disk-size", 0, "Disk size (GB)") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.ForkFrom.BackupID, "fork-from.backup-id", "", "Backup ID (not compatible with fork-from.point-in-time)") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.ForkFrom.PointInTime, "fork-from.point-in-time", "", "Point in time to restore from (not compatible with fork-from.backup-id)") + markFlagsMutuallyExclusive(managedDatabaseCreateCmd, "fork-from.backup-id", "fork-from.point-in-time") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.ForkFrom.ServiceID, "fork-from.service-id", "", "Service ID that owns the backups") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.MaintenanceTime, "maintenance-time", "", "Time on which maintenances can start every day") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Plan, "plan", "", "Database plan (you can get the list of available plans using 'ovhcloud cloud reference managed-database list-plans')") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Version, "version", "", "Database version (you can get the list of available versions using 'ovhcloud cloud reference managed-database list-engines')") + + // Network configuration + managedDatabaseCreateCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseSpec.CLIIPRestrictions, "ip-restrictions", nil, "IP blocks authorized to access the cluster (CIDR format)") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.NetworkID, "network-id", "", "Private network ID in which the cluster is deployed") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.SubnetID, "subnet-id", "", "Private subnet ID in which the cluster is deployed") + + // Nodes pattern definition + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.NodesPattern.Flavor, "nodes-pattern.flavor", "", "Flavor of all nodes") + managedDatabaseCreateCmd.Flags().IntVar(&cloud.ManagedDatabaseSpec.NodesPattern.Number, "nodes-pattern.number", 0, "Number of nodes") + managedDatabaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.NodesPattern.Region, "nodes-pattern.region", "", "Region of all nodes") + + // Nodes list definition + managedDatabaseCreateCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseSpec.CLINodesList, "nodes-list", nil, "List of nodes (format: flavor1:region1,flavor2:region2...)") + markFlagsMutuallyExclusive(managedDatabaseCreateCmd, "nodes-pattern.flavor", "nodes-list") + markFlagsMutuallyExclusive(managedDatabaseCreateCmd, "nodes-pattern.number", "nodes-list") + markFlagsMutuallyExclusive(managedDatabaseCreateCmd, "nodes-pattern.region", "nodes-list") + + // Common flags for other mean to define parameters + addInteractiveEditorFlag(managedDatabaseCreateCmd) + return managedDatabaseCreateCmd +} + +func managedDatabaseEditCmd() *cobra.Command { + managedDatabaseEditCmd := &cobra.Command{ + Use: "edit ", + Short: "Edit a specific managed database service", + Long: `Use this command to edit a managed database service in the given public cloud project. +There are two ways to define the edition parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-database edit --description "My database" + +2. Using your default text editor: + + ovhcloud cloud managed-database edit --editor + The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-database edit --editor --description "My database cluster" +`, + Run: cloud.EditManagedDatabase, + Args: cobra.ExactArgs(1), + } + + // Database details + managedDatabaseEditCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseSpec.Backups.Regions, "backups-regions", nil, "Regions on which the backups are stored") + managedDatabaseEditCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Backups.Time, "backups-time", "", "Time on which backups start every day") + managedDatabaseEditCmd.Flags().BoolVar(&cloud.ManagedDatabaseSpec.DeletionProtection, "deletion-protection", false, "Enable deletion protection") + managedDatabaseEditCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Description, "description", "", "Description of the cluster") + managedDatabaseEditCmd.Flags().BoolVar(&cloud.ManagedDatabaseSpec.EnablePrometheus, "enable-prometheus", false, "Enable Prometheus") + managedDatabaseEditCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.NodesPattern.Flavor, "flavor", "", "The VM flavor used for this cluster") + managedDatabaseEditCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.MaintenanceTime, "maintenance-time", "", "Time on which maintenances can start every day") + managedDatabaseEditCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Plan, "plan", "", "Plan of the cluster") + managedDatabaseEditCmd.Flags().StringVar(&cloud.ManagedDatabaseSpec.Version, "version", "", "Version of the engine deployed on the cluster") + + // Network configuration + managedDatabaseEditCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseSpec.CLIIPRestrictions, "ip-restrictions", nil, "IP blocks authorized to access the cluster (CIDR format)") + + // Common flags for other mean to define parameters + addInteractiveEditorFlag(managedDatabaseEditCmd) + + return managedDatabaseEditCmd +} + +func managedDatabaseDatabaseCreateCmd() *cobra.Command { + databaseCreateCmd := &cobra.Command{ + Use: "create ", + Short: "Create a new database in the given managed database service", + Long: `Use this command to create a database in the given managed database service. + + ovhcloud cloud managed-database database create --name mydb +`, + Run: cloud.CreateManagedDatabaseDatabase, + Args: cobra.ExactArgs(1), + } + + databaseCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseDatabaseSpec.Name, "name", "", "Name of the database to create") + databaseCreateCmd.MarkFlagRequired("name") + + return databaseCreateCmd +} + +func managedDatabaseUserCreateCmd() *cobra.Command { + userCreateCmd := &cobra.Command{ + Use: "create ", + Short: "Create a new user in the given managed database service", + Long: `Use this command to create a user in the given managed database service. +There are two ways to define the creation parameters: + +1. Using only CLI flags: + + ovhcloud cloud managed-database user create --name myuser + + For PostgreSQL and MongoDB engines, you can also specify roles: + + ovhcloud cloud managed-database user create --name myuser --roles role1,role2 + + For Valkey engine, you can specify permissions: + + ovhcloud cloud managed-database user create --name myuser --categories "+@read" --commands "+get" + +2. Using your default text editor: + + ovhcloud cloud managed-database user create --name myuser --editor + You will be able to choose from several examples of parameters. Once an example has been selected, the CLI will open your + default text editor to update the parameters. When saving the file, the creation will start. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-database user create --name myuser --editor --roles role1,role2 +`, + Run: cloud.CreateManagedDatabaseUser, + Args: cobra.ExactArgs(1), + } + + userCreateCmd.Flags().StringVar(&cloud.ManagedDatabaseUserSpec.Name, "name", "", "Name of the user to create") + userCreateCmd.MarkFlagRequired("name") + + // PostgreSQL and MongoDB specific flags + userCreateCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Roles, "roles", nil, "Roles granted to the user (postgresql and mongodb only)") + + // Valkey specific flags + userCreateCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Categories, "categories", nil, "Command categories the user can execute (valkey only)") + userCreateCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Channels, "channels", nil, "Channels the user can subscribe to (valkey only)") + userCreateCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Commands, "commands", nil, "Commands the user can execute (valkey only)") + userCreateCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Keys, "keys", nil, "Keys the user can access (valkey only)") + + addInteractiveEditorFlag(userCreateCmd) + + return userCreateCmd +} + +func managedDatabaseUserEditCmd() *cobra.Command { + userEditCmd := &cobra.Command{ + Use: "edit ", + Short: "Edit a user in the given managed database service", + Long: `Use this command to edit a user in the given managed database service. +There are two ways to define the edition parameters: + +1. Using only CLI flags: + + For PostgreSQL and MongoDB engines: + + ovhcloud cloud managed-database user edit --roles role1,role2 + + For Valkey engine: + + ovhcloud cloud managed-database user edit --categories "+@read" --commands "+get" + +2. Using your default text editor: + + ovhcloud cloud managed-database user edit --editor + The CLI will open your default text editor to update the parameters. When saving the file, the edition will be applied. + + Note that it is also possible to override values in the presented examples using command line flags like the following: + + ovhcloud cloud managed-database user edit --editor --roles role1,role2 +`, + Run: cloud.EditManagedDatabaseUser, + Args: cobra.ExactArgs(2), + } + + // PostgreSQL and MongoDB specific flags + userEditCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Roles, "roles", nil, "Roles granted to the user (postgresql and mongodb only)") + + // Valkey specific flags + userEditCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Categories, "categories", nil, "Command categories the user can execute (valkey only)") + userEditCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Channels, "channels", nil, "Channels the user can subscribe to (valkey only)") + userEditCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Commands, "commands", nil, "Commands the user can execute (valkey only)") + userEditCmd.Flags().StringSliceVar(&cloud.ManagedDatabaseUserSpec.Keys, "keys", nil, "Keys the user can access (valkey only)") + + addInteractiveEditorFlag(userEditCmd) + + return userEditCmd +} + +func managedDatabaseRoleListCmd() *cobra.Command { + roleListCmd := &cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List roles in the given managed database service", + Run: cloud.ListManagedDatabaseRoles, + Args: cobra.ExactArgs(1), + } + + // MongoDB specific flags + roleListCmd.Flags().BoolVar(&cloud.ManagedDatabaseRoleSpec.Advanced, "advanced", false, "Adds the advanced roles to the list of the roles (mongodb only)") + + return roleListCmd +} diff --git a/internal/cmd/cloud_managed_database_test.go b/internal/cmd/cloud_managed_database_test.go new file mode 100644 index 00000000..7bf712b5 --- /dev/null +++ b/internal/cmd/cloud_managed_database_test.go @@ -0,0 +1,529 @@ +// SPDX-FileCopyrightText: 2025 OVH SAS +// +// SPDX-License-Identifier: Apache-2.0 + +package cmd_test + +import ( + "net/http" + + "github.com/jarcoal/httpmock" + "github.com/maxatome/go-testdeep/td" + "github.com/maxatome/tdhttpmock" + "github.com/ovh/ovhcloud-cli/internal/cmd" +) + +// fullServiceResponse is a complete API response for a database service, +// covering all fields accessed by the managed-database template. +const fullDBServiceResponse = `{ + "id": "fakeDatabaseID", + "engine": "mysql", + "version": "8", + "description": "test db", + "status": "READY", + "category": "operational", + "plan": "essential", + "flavor": "db1-4", + "createdAt": "2025-01-01T00:00:00Z", + "networkType": "public", + "storage": {"size": {"value": 80, "unit": "GB"}}, + "nodes": [{"id": "nodeID", "flavor": "db1-4", "region": "DE", "status": "READY"}] +}` + +// ── Service ────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedDatabaseListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service", + httpmock.NewStringResponder(200, `["fakeDatabaseID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, fullDBServiceResponse), + ) + + out, err := cmd.Execute("cloud", "managed-database", "list", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeDatabaseID")) +} + +func (ms *MockSuite) TestManagedDatabaseGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, fullDBServiceResponse), + ) + + out, err := cmd.Execute("cloud", "managed-database", "get", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeDatabaseID")) +} + +func (ms *MockSuite) TestManagedDatabaseCreateCmd(assert, require *td.T) { + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql", + tdhttpmock.JSONBody(td.JSON(` + { + "nodesList": [ + { + "flavor": "db1-4", + "region": "DE" + } + ], + "plan": "essential", + "version": "8" + }`), + ), + httpmock.NewStringResponder(200, `{"id": "0f0c43f0-979a-11f0-94fd-0050568ce122"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "create", "--cloud-project", "fakeProjectID", "--engine", "mysql", "--version", "8", "--plan", "essential", "--nodes-list", "db1-4:DE") + + require.CmpNoError(err) + assert.String(out, `✅ Managed database created successfully (id: 0f0c43f0-979a-11f0-94fd-0050568ce122)`) +} + +func (ms *MockSuite) TestManagedDatabaseCreateInvalidEngineCmd(assert, require *td.T) { + out, err := cmd.Execute("cloud", "managed-database", "create", "--cloud-project", "fakeProjectID", "--engine", "invalid", "--version", "1", "--plan", "essential", "--nodes-list", "db1-4:DE") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑 invalid engine invalid")) +} + +func (ms *MockSuite) TestManagedDatabaseEditCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{ + "id": "fakeDatabaseID", + "engine": "mysql" + }`), + ) + + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID", + httpmock.NewStringResponder(200, `{ + "createdAt": "2025-09-22T14:16:18.506458+02:00", + "plan": "essential", + "disk": {"type": "high-speed", "size": 80}, + "storage": {"type": "high-speed", "size": {"unit": "GB", "value": 80}}, + "id": "fakeDatabaseID", + "engine": "mysql", + "category": "operational", + "ipRestrictions": [], + "status": "READY", + "nodes": [{"id": "nodeID", "createdAt": "2025-09-22T14:16:18.558113+02:00", "flavor": "db1-4", "name": "mysql-node.database.cloud.ovh.net", "port": 2014, "region": "DE", "status": "READY"}], + "nodeNumber": 1, + "description": "Default description", + "version": "6", + "networkType": "public", + "flavor": "db1-4", + "maintenanceTime": "13:16:00", + "backupTime": "09:10:00", + "backups": {"time": "09:10:00", "regions": ["DE", "GRA"], "retentionDays": 2, "pitr": "2025-09-24T11:10:11+02:00"}, + "enablePrometheus": false, + "deletionProtection": false + }`), + ) + + httpmock.RegisterMatcherResponder(http.MethodPut, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID", + tdhttpmock.JSONBody(td.JSON(` + { + "backupTime": "09:10:00", + "backups": {"regions": ["DE", "GRA"], "time": "09:10:00"}, + "deletionProtection": false, + "description": "Default description", + "disk": {"size": 80}, + "enablePrometheus": false, + "flavor": "db1-4", + "ipRestrictions": [], + "maintenanceTime": "13:16:00", + "nodeNumber": 1, + "plan": "discovery", + "storage": {"size": {"unit": "GB", "value": 80}}, + "version": "8" + }`), + ), + httpmock.NewStringResponder(200, `{"id": "0f0c43f0-979a-11f0-94fd-0050568ce122"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "edit", "fakeDatabaseID", "--cloud-project", "fakeProjectID", "--version", "8", "--plan", "discovery", "-o", "yaml") + + require.CmpNoError(err) + assert.String(out, `message: ✅ Resource updated successfully +`) +} + +func (ms *MockSuite) TestManagedDatabaseDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-database", "delete", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ Managed database deleted successfully`) +} + +// ── Database ────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedDatabaseDatabaseListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/database", + httpmock.NewStringResponder(200, `["fakeDbID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/database/fakeDbID", + httpmock.NewStringResponder(200, `{"id": "fakeDbID", "name": "mydb", "default": false}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "database", "list", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeDbID")) +} + +func (ms *MockSuite) TestManagedDatabaseDatabaseGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/database/fakeDbID", + httpmock.NewStringResponder(200, `{"id": "fakeDbID", "name": "mydb", "default": false}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "database", "get", "fakeDatabaseID", "fakeDbID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeDbID")) +} + +func (ms *MockSuite) TestManagedDatabaseDatabaseCreateCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/database", + tdhttpmock.JSONBody(td.JSON(`{"name": "mydb"}`)), + httpmock.NewStringResponder(200, `{"id": "fakeDbID", "name": "mydb", "default": false}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "database", "create", "fakeDatabaseID", "--cloud-project", "fakeProjectID", "--name", "mydb") + + require.CmpNoError(err) + assert.String(out, `✅ Database created successfully (id: fakeDbID)`) +} + +func (ms *MockSuite) TestManagedDatabaseDatabaseCreateInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mongodb"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "database", "create", "fakeDatabaseID", "--cloud-project", "fakeProjectID", "--name", "mydb") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +func (ms *MockSuite) TestManagedDatabaseDatabaseDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/database/fakeDbID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-database", "database", "delete", "fakeDatabaseID", "fakeDbID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ Database deleted successfully`) +} + +// ── User ────────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedDatabaseUserListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/user", + httpmock.NewStringResponder(200, `["fakeUserID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/user/fakeUserID", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "status": "READY"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "list", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeUserID")) +} + +func (ms *MockSuite) TestManagedDatabaseUserGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/user/fakeUserID", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "status": "READY"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "get", "fakeDatabaseID", "fakeUserID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeUserID")) +} + +func (ms *MockSuite) TestManagedDatabaseUserCreateCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/user", + tdhttpmock.JSONBody(td.JSON(`{"name": "myuser"}`)), + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "password": "s3cr3t", "status": "READY"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "create", "fakeDatabaseID", "--cloud-project", "fakeProjectID", "--name", "myuser") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("Password: s3cr3t")) +} + +func (ms *MockSuite) TestManagedDatabaseUserCreateWithRolesCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "postgresql"}`), + ) + // Use simple responder: CreateResource schema filtering may alter the exact body + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/postgresql/fakeDatabaseID/user", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "password": "s3cr3t", "status": "READY"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "create", "fakeDatabaseID", "--cloud-project", "fakeProjectID", "--name", "myuser", "--roles", "replication") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("Password: s3cr3t")) +} + +func (ms *MockSuite) TestManagedDatabaseUserCreateRolesInvalidForMysqlCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "create", "fakeDatabaseID", "--cloud-project", "fakeProjectID", "--name", "myuser", "--roles", "replication") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +func (ms *MockSuite) TestManagedDatabaseUserEditCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "postgresql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/postgresql/fakeDatabaseID/user/fakeUserID", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "roles": [], "status": "READY"}`), + ) + httpmock.RegisterResponder(http.MethodPut, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/postgresql/fakeDatabaseID/user/fakeUserID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "edit", "fakeDatabaseID", "fakeUserID", "--cloud-project", "fakeProjectID", "--roles", "replication") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("✅ Resource updated successfully")) +} + +func (ms *MockSuite) TestManagedDatabaseUserEditInvalidEngineForMysqlCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "edit", "fakeDatabaseID", "fakeUserID", "--cloud-project", "fakeProjectID", "--roles", "replication") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +func (ms *MockSuite) TestManagedDatabaseUserDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/user/fakeUserID", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "delete", "fakeDatabaseID", "fakeUserID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ User deleted successfully`) +} + +func (ms *MockSuite) TestManagedDatabaseUserCredentialsResetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/user/fakeUserID/credentials/reset", + httpmock.NewStringResponder(200, `{"id": "fakeUserID", "username": "myuser", "password": "n3wS3cr3t"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "user", "credentials-reset", "fakeDatabaseID", "fakeUserID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("Password: n3wS3cr3t")) +} + +// ── Roles ───────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedDatabaseRoleListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "postgresql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/postgresql/fakeDatabaseID/roles", + httpmock.NewStringResponder(200, `["replication", "superuser"]`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "role", "list", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("replication")) +} + +func (ms *MockSuite) TestManagedDatabaseRoleListInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "role", "list", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +// ── Certificate ─────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedDatabaseCertificateGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/certificates", + httpmock.NewStringResponder(200, `{"ca": "-----BEGIN CERTIFICATE-----\nMIIB..."}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "certificate", "get", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("-----BEGIN CERTIFICATE-----")) +} + +func (ms *MockSuite) TestManagedDatabaseCertificateGetInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mongodb"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "certificate", "get", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} + +// ── Backup ──────────────────────────────────────────────────────────────────── + +func (ms *MockSuite) TestManagedDatabaseBackupListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/backup", + httpmock.NewStringResponder(200, `["fakeBackupID"]`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/backup/fakeBackupID", + httpmock.NewStringResponder(200, `{"id": "fakeBackupID", "createdAt": "2025-01-01T00:00:00Z", "type": "AUTOMATIC", "status": "READY", "description": "Daily backup"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "backup", "list", "fakeDatabaseID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeBackupID")) +} + +func (ms *MockSuite) TestManagedDatabaseBackupGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mysql/fakeDatabaseID/backup/fakeBackupID", + httpmock.NewStringResponder(200, `{"id": "fakeBackupID", "createdAt": "2025-01-01T00:00:00Z", "type": "AUTOMATIC", "status": "READY", "description": "Daily backup", "size": {"value": 80, "unit": "GB"}, "regions": [{"name": "DE"}]}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "backup", "get", "fakeDatabaseID", "fakeBackupID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("fakeBackupID")) +} + +func (ms *MockSuite) TestManagedDatabaseBackupRestoreCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mongodb"}`), + ) + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/mongodb/fakeDatabaseID/backup/fakeBackupID/restore", + httpmock.NewStringResponder(200, ``), + ) + + out, err := cmd.Execute("cloud", "managed-database", "backup", "restore", "fakeDatabaseID", "fakeBackupID", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, `✅ Backup restore started successfully`) +} + +func (ms *MockSuite) TestManagedDatabaseBackupRestoreInvalidEngineCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/service/fakeDatabaseID", + httpmock.NewStringResponder(200, `{"id": "fakeDatabaseID", "engine": "mysql"}`), + ) + + out, err := cmd.Execute("cloud", "managed-database", "backup", "restore", "fakeDatabaseID", "fakeBackupID", "--cloud-project", "fakeProjectID") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("🛑")) +} diff --git a/internal/cmd/cloud_project.go b/internal/cmd/cloud_project.go index dbcca82b..629e476e 100644 --- a/internal/cmd/cloud_project.go +++ b/internal/cmd/cloud_project.go @@ -103,7 +103,8 @@ func init() { initKubeCommand(cloudCmd) initContainerRegistryCommand(cloudCmd) - initCloudDatabaseCommand(cloudCmd) + initManagedDatabaseCommand(cloudCmd) + initManagedAnalyticsCommand(cloudCmd) initInstanceCommand(cloudCmd) initCloudLoadbalancerCommand(cloudCmd) initCloudNetworkCommand(cloudCmd) diff --git a/internal/cmd/cloud_reference.go b/internal/cmd/cloud_reference.go index ecd48bdf..5d0f1d7e 100644 --- a/internal/cmd/cloud_reference.go +++ b/internal/cmd/cloud_reference.go @@ -90,31 +90,59 @@ func initCloudReferenceCmd(cloudCmd *cobra.Command) { rancherPlansListCmd.Flags().StringP("rancher-id", "r", "", "Rancher service ID to filter available plans") rancherReferenceCmd.AddCommand(rancherPlansListCmd) - // Databases reference commands - databaseReferenceCmd := &cobra.Command{ - Use: "database", - Short: "Fetch database reference data in the given cloud project", + // Managed Databases reference commands + managedDatabaseReferenceCmd := &cobra.Command{ + Use: "managed-database", + Short: "Fetch managed database reference data in the given cloud project", } - referenceCmd.AddCommand(databaseReferenceCmd) + referenceCmd.AddCommand(managedDatabaseReferenceCmd) - databaseReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ + managedDatabaseReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ Use: "list-plans", Short: "List available database plans in the given cloud project", - Run: cloud.ListDatabasesPlans, + Run: cloud.ListManagedDatabasePlans, Args: cobra.NoArgs, })) - databaseReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ + managedDatabaseReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ Use: "list-node-flavors", Short: "List available database node flavors in the given cloud project", - Run: cloud.ListDatabasesNodeFlavors, + Run: cloud.ListManagedDatabaseNodeFlavors, Args: cobra.NoArgs, })) - databaseReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ + managedDatabaseReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ Use: "list-engines", Short: "List available database engines in the given cloud project", - Run: cloud.ListDatabaseEngines, + Run: cloud.ListManagedDatabaseEngines, + Args: cobra.NoArgs, + })) + + // Managed Analytics reference commands + managedAnalyticsReferenceCmd := &cobra.Command{ + Use: "managed-analytics", + Short: "Fetch managed analytics reference data in the given cloud project", + } + referenceCmd.AddCommand(managedAnalyticsReferenceCmd) + + managedAnalyticsReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list-plans", + Short: "List available analytics plans in the given cloud project", + Run: cloud.ListManagedAnalyticsPlans, + Args: cobra.NoArgs, + })) + + managedAnalyticsReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list-node-flavors", + Short: "List available analytics node flavors in the given cloud project", + Run: cloud.ListManagedAnalyticsNodeFlavors, + Args: cobra.NoArgs, + })) + + managedAnalyticsReferenceCmd.AddCommand(withFilterFlag(&cobra.Command{ + Use: "list-engines", + Short: "List available analytics engines in the given cloud project", + Run: cloud.ListManagedAnalyticsEngines, Args: cobra.NoArgs, })) diff --git a/internal/cmd/cloud_reference_test.go b/internal/cmd/cloud_reference_test.go index 06780fcc..c2de381b 100644 --- a/internal/cmd/cloud_reference_test.go +++ b/internal/cmd/cloud_reference_test.go @@ -138,7 +138,7 @@ func (ms *MockSuite) TestCloudReferenceDatabasesPlansListCmd(assert, require *td ] }`).Once()) - out, err := cmd.Execute("cloud", "reference", "database", "list-plans", "--cloud-project", "fakeProjectID", "--filter", `lifecycle.startDate>"2022-01-01"`) + out, err := cmd.Execute("cloud", "reference", "managed-database", "list-plans", "--cloud-project", "fakeProjectID", "--filter", `lifecycle.startDate>"2022-01-01"`) require.CmpNoError(err) assert.String(out, ` @@ -204,7 +204,7 @@ func (ms *MockSuite) TestCloudReferenceDatabasesFlavorsListCmd(assert, require * ] }`).Once()) - out, err := cmd.Execute("cloud", "reference", "database", "list-node-flavors", "--cloud-project", "fakeProjectID") + out, err := cmd.Execute("cloud", "reference", "managed-database", "list-node-flavors", "--cloud-project", "fakeProjectID") require.CmpNoError(err) assert.String(out, ` @@ -271,7 +271,7 @@ func (ms *MockSuite) TestCloudReferenceDatabasesEnginesListCmd(assert, require * ] }`).Once()) - out, err := cmd.Execute("cloud", "reference", "database", "list-engines", "--cloud-project", "fakeProjectID") + out, err := cmd.Execute("cloud", "reference", "managed-database", "list-engines", "--cloud-project", "fakeProjectID") require.CmpNoError(err) assert.String(out, ` @@ -523,3 +523,176 @@ func (ms *MockSuite) TestCloudReferenceLoadbalancerFlavorsListCmdJSON(assert, re } ]`)) } + +func (ms *MockSuite) TestCloudReferenceLoadbalancerFlavorGetCmd(assert, require *td.T) { + httpmock.RegisterResponder("GET", "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/region/GRA9/loadbalancing/flavor/lb-flavor-id-1", + httpmock.NewStringResponder(200, `{ + "id": "lb-flavor-id-1", + "name": "small", + "region": "GRA9" + }`).Once()) + + out, err := cmd.Execute("cloud", "reference", "loadbalancer", "get-flavor", "GRA9", "lb-flavor-id-1", "-o", "json", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(json.RawMessage(out), td.JSON(`{ + "id": "lb-flavor-id-1", + "name": "small", + "region": "GRA9" + }`)) +} + +func (ms *MockSuite) TestCloudReferenceManagedAnalyticsPlansListCmd(assert, require *td.T) { + httpmock.RegisterResponder("GET", "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/capabilities", + httpmock.NewStringResponder(200, `{ + "plans": [ + { + "lifecycle": { + "status": "STABLE", + "startDate": "2023-12-07" + }, + "name": "essential", + "description": "Essential plan", + "backupRetention": "P2D", + "order": 1, + "tags": [] + }, + { + "lifecycle": { + "status": "STABLE", + "startDate": "2023-12-07" + }, + "name": "business", + "description": "Business plan", + "backupRetention": "P14D", + "order": 2, + "tags": [] + } + ] + }`).Once()) + + out, err := cmd.Execute("cloud", "reference", "managed-analytics", "list-plans", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, ` +┌───────────┬────────────────┬────────┬─────────────────┐ +│ name │ description │ status │ backupRetention │ +├───────────┼────────────────┼────────┼─────────────────┤ +│ essential │ Essential plan │ STABLE │ P2D │ +│ business │ Business plan │ STABLE │ P14D │ +└───────────┴────────────────┴────────┴─────────────────┘ +💡 Use option -o json or -o yaml to get the raw output with all information`[1:]) +} + +func (ms *MockSuite) TestCloudReferenceManagedAnalyticsNodeFlavorsListCmd(assert, require *td.T) { + httpmock.RegisterResponder("GET", "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/capabilities", + httpmock.NewStringResponder(200, `{ + "flavors": [ + { + "lifecycle": { + "status": "STABLE", + "startDate": "2023-12-07" + }, + "name": "db2-free", + "core": 0, + "memory": 0, + "storage": 512, + "specifications": { + "core": 0, + "memory": { + "unit": "MB", + "value": 0 + }, + "storage": { + "unit": "MB", + "value": 512 + } + }, + "order": 0, + "tags": [] + }, + { + "lifecycle": { + "status": "STABLE", + "startDate": "2023-12-07" + }, + "name": "db2-4", + "core": 2, + "memory": 4, + "storage": 20, + "specifications": { + "core": 2, + "memory": { + "unit": "GB", + "value": 4 + }, + "storage": { + "unit": "GB", + "value": 20 + } + }, + "order": 1, + "tags": [] + } + ] + }`).Once()) + + out, err := cmd.Execute("cloud", "reference", "managed-analytics", "list-node-flavors", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, ` +┌──────────┬──────┬────────┬─────────┐ +│ name │ core │ memory │ storage │ +├──────────┼──────┼────────┼─────────┤ +│ db2-free │ 0 │ 0 MB │ 512 MB │ +│ db2-4 │ 2 │ 4 GB │ 20 GB │ +└──────────┴──────┴────────┴─────────┘ +💡 Use option -o json or -o yaml to get the raw output with all information`[1:]) +} + +func (ms *MockSuite) TestCloudReferenceManagedAnalyticsEnginesListCmd(assert, require *td.T) { + httpmock.RegisterResponder("GET", "https://eu.api.ovh.com/v1/cloud/project/fakeProjectID/database/capabilities", + httpmock.NewStringResponder(200, `{ + "engines": [ + { + "name": "postgresql", + "storage": "replicated", + "versions": ["17"], + "defaultVersion": "17", + "description": "object-relational database management system", + "sslModes": ["require"], + "category": "operational" + }, + { + "name": "kafka", + "storage": "distributed", + "versions": ["3.7", "3.8"], + "defaultVersion": "3.8", + "description": "distributed event streaming platform", + "sslModes": ["required"], + "category": "analysis" + }, + { + "name": "opensearch", + "storage": "distributed", + "versions": ["2"], + "defaultVersion": "2", + "description": "search and analytics engine", + "sslModes": ["required"], + "category": "analysis" + } + ] + }`).Once()) + + out, err := cmd.Execute("cloud", "reference", "managed-analytics", "list-engines", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.String(out, ` +┌────────────┬──────────────────────────────────────┬──────────┬───────────┬────────────────┐ +│ name │ description │ category │ versions │ defaultVersion │ +├────────────┼──────────────────────────────────────┼──────────┼───────────┼────────────────┤ +│ kafka │ Distributed Event Streaming Platform │ analysis │ 3.7 | 3.8 │ 3.8 │ +│ opensearch │ Search And Analytics Engine │ analysis │ 2 │ 2 │ +└────────────┴──────────────────────────────────────┴──────────┴───────────┴────────────────┘ +💡 Use option -o json or -o yaml to get the raw output with all information`[1:]) +} diff --git a/internal/cmd/cmd_test.go b/internal/cmd/cmd_test.go index 637a1ac6..79141b07 100644 --- a/internal/cmd/cmd_test.go +++ b/internal/cmd/cmd_test.go @@ -13,6 +13,7 @@ import ( "github.com/maxatome/go-testdeep/td" "github.com/ovh/go-ovh/ovh" "github.com/ovh/ovhcloud-cli/internal/cmd" + "github.com/ovh/ovhcloud-cli/internal/display" httplib "github.com/ovh/ovhcloud-cli/internal/http" ) @@ -20,6 +21,7 @@ type MockSuite struct{} func (ms *MockSuite) Setup(t *td.T) error { httpmock.Activate(t) + display.ExitFunc = func(int) {} client, err := ovh.NewClient("ovh-eu", "app_key", "app_secret", "consumer_key") if err != nil { diff --git a/internal/cmd/root.go b/internal/cmd/root.go index f9a9fe62..6baaa424 100644 --- a/internal/cmd/root.go +++ b/internal/cmd/root.go @@ -89,8 +89,8 @@ func resetSubCommandFlagValues(root *cobra.Command) { for _, c := range root.Commands() { c.Flags().VisitAll(func(f *pflag.Flag) { if f.Changed { - if f.Value.Type() == "stringArray" { - // Special handling for stringArray for which we cannot + if f.Value.Type() == "stringArray" || f.Value.Type() == "stringSlice" { + // Special handling for stringArray/stringSlice for which we cannot // use DefValue since it is equal to "[]". if r, ok := f.Value.(pflag.SliceValue); ok { r.Replace(nil) @@ -247,7 +247,7 @@ func withFilterFlag(c *cobra.Command) *cobra.Command { nil, `Filter results by any property using https://github.com/PaesslerAG/gval syntax Examples: - --filter 'state="running"' + --filter 'state=="running"' --filter 'name=~"^my.*"' --filter 'nested.property.subproperty>10' --filter 'startDate>="2023-12-01"' diff --git a/internal/display/display.go b/internal/display/display.go index 29172551..1868a6e1 100644 --- a/internal/display/display.go +++ b/internal/display/display.go @@ -33,6 +33,10 @@ const ( maxCellWidth = 50 ) +var ( + ExitFunc = os.Exit +) + func renderCustomFormat(value any, format string) error { ev, err := gval.Full(filters.AdditionalEvaluators...).NewEvaluable(format) if err != nil { @@ -322,7 +326,7 @@ func exitError(message string, params ...any) { resultString := fmt.Sprintf("🛑 "+message, params...) fmt.Println(resultString) ResultError = errors.New(resultString) - os.Exit(1) + ExitFunc(1) } func outputf(message string, params ...any) { @@ -365,10 +369,10 @@ func OutputWithFormat(msg *OutputMessage, outputFormat *OutputFormat) { if msg.Error { ResultError = errors.New(msg.Message) - os.Exit(1) + ExitFunc(1) } else if msg.Warning { ResultError = errors.New(msg.Message) - os.Exit(0) + ExitFunc(0) } } diff --git a/internal/services/browser/api.go b/internal/services/browser/api.go index 43d1b79d..0f735489 100644 --- a/internal/services/browser/api.go +++ b/internal/services/browser/api.go @@ -9,6 +9,7 @@ package browser import ( "encoding/json" "fmt" + "net/url" "math/rand" "os" "os/exec" @@ -51,7 +52,13 @@ func (m Model) fetchDataForPath(path string) tea.Cmd { } case "/databases": return func() tea.Msg { - msg := m.fetchDatabasesData() + msg := m.fetchDatabasesData("operational") + msg.forProduct = product + return msg + } + case "/analytics": + return func() tea.Msg { + msg := m.fetchDatabasesData("analysis") msg.forProduct = product return msg } @@ -604,8 +611,8 @@ func (m Model) handleKubeconfigReadyForK9s(msg kubeconfigReadyForK9sMsg) (tea.Mo }) } -// fetchDatabasesData fetches the list of database services -func (m Model) fetchDatabasesData() dataLoadedMsg { +// fetchDatabasesData fetches the list of database services filtered by category +func (m Model) fetchDatabasesData(category string) dataLoadedMsg { if m.cloudProject == "" { return dataLoadedMsg{ err: fmt.Errorf("no cloud project selected"), @@ -614,7 +621,7 @@ func (m Model) fetchDatabasesData() dataLoadedMsg { // 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, url.QueryEscape(category)) err := httpLib.Client.Get(endpoint, &serviceIDs) if err != nil { return dataLoadedMsg{ diff --git a/internal/services/browser/manager.go b/internal/services/browser/manager.go index 82b2a1e0..db56293d 100644 --- a/internal/services/browser/manager.go +++ b/internal/services/browser/manager.go @@ -44,10 +44,10 @@ const ( KubeUpgradeView // Kubernetes cluster upgrade selection KubePolicyEditView // Kubernetes cluster policy edit KubeDeleteConfirmView // Kubernetes cluster delete confirmation - NodePoolScaleView // Node pool scale view - NodePoolDeleteConfirmView // Node pool delete confirmation - KubeKubeconfigPickerView // Directory picker for saving kubeconfig - ComingSoonView // Coming soon placeholder for unimplemented products + NodePoolScaleView // Node pool scale view + NodePoolDeleteConfirmView // Node pool delete confirmation + KubeKubeconfigPickerView // Directory picker for saving kubeconfig + ComingSoonView // Coming soon placeholder for unimplemented products ) // ASCII OVHcloud logo for loading screen @@ -95,7 +95,8 @@ type ProductType int const ( ProductInstances ProductType = iota ProductKubernetes - ProductDatabases + ProductManagedDatabases + ProductManagedAnalytics ProductStorage ProductNetworks ProductProjects @@ -534,7 +535,8 @@ func getNavItems() []NavItem { return []NavItem{ {Label: "Instances", Icon: "💻", Product: ProductInstances, Path: "/instances"}, {Label: "Kubernetes", Icon: "☸️", Product: ProductKubernetes, Path: "/kubernetes"}, - {Label: "Databases", Icon: "🗄️", Product: ProductDatabases, Path: "/databases"}, + {Label: "Managed Databases", Icon: "🗄️", Product: ProductManagedDatabases, Path: "/databases"}, + {Label: "Managed Analytics", Icon: "📈", Product: ProductManagedAnalytics, Path: "/analytics"}, {Label: "Storage", Icon: "💾", Product: ProductStorage, Path: "/storage/s3"}, {Label: "Private networks", Icon: "🌐", Product: ProductNetworks, Path: "/networks/private"}, } @@ -3267,8 +3269,10 @@ func (m Model) getProductCreationInfo() (string, string) { return "instances", fmt.Sprintf("ovhcloud cloud instance create --cloud-project %s", m.cloudProject) case ProductKubernetes: return "Kubernetes clusters", fmt.Sprintf("ovhcloud cloud kube create --cloud-project %s", m.cloudProject) - case ProductDatabases: - return "databases", fmt.Sprintf("ovhcloud cloud database-service create --cloud-project %s", m.cloudProject) + case ProductManagedDatabases: + return "databases", fmt.Sprintf("ovhcloud cloud managed-database create --cloud-project %s", m.cloudProject) + case ProductManagedAnalytics: + return "analytics", fmt.Sprintf("ovhcloud cloud managed-analytics create --cloud-project %s", m.cloudProject) case ProductStorage: return "storage containers", fmt.Sprintf("ovhcloud cloud storage-s3 create --cloud-project %s", m.cloudProject) case ProductNetworks: @@ -5838,7 +5842,7 @@ func (m Model) loadCurrentProduct() (Model, tea.Cmd) { m.currentData = nil // Show coming soon view for unimplemented products - if currentNav.Product == ProductDatabases || currentNav.Product == ProductStorage || currentNav.Product == ProductNetworks { + if currentNav.Product == ProductStorage || currentNav.Product == ProductNetworks { m.mode = ComingSoonView return m, nil } diff --git a/internal/services/cloud/cloud_database.go b/internal/services/cloud/cloud_database.go deleted file mode 100644 index 46b5da61..00000000 --- a/internal/services/cloud/cloud_database.go +++ /dev/null @@ -1,306 +0,0 @@ -// SPDX-FileCopyrightText: 2025 OVH SAS -// -// SPDX-License-Identifier: Apache-2.0 - -package cloud - -import ( - _ "embed" - "fmt" - "net/url" - "strings" - - "github.com/ovh/ovhcloud-cli/internal/assets" - "github.com/ovh/ovhcloud-cli/internal/display" - "github.com/ovh/ovhcloud-cli/internal/flags" - httpLib "github.com/ovh/ovhcloud-cli/internal/http" - "github.com/ovh/ovhcloud-cli/internal/services/common" - "github.com/spf13/cobra" -) - -var ( - cloudprojectDatabaseColumnsToDisplay = []string{"id", "engine", "version", "description", "status"} - - //go:embed templates/cloud_database.tmpl - cloudDatabaseTemplate string - - //go:embed parameter-samples/database-create.json - DatabaseCreationExample string - - DatabaseSpec struct { - Backups struct { - Regions []string `json:"regions,omitempty"` - Time string `json:"time,omitempty"` - } `json:"backups,omitzero"` - DeletionProtection bool `json:"deletionProtection,omitempty"` - Description string `json:"description,omitempty"` - Disk struct { - Size int `json:"size,omitempty"` - } `json:"disk,omitzero"` - EnablePrometheus bool `json:"enablePrometheus,omitempty"` - ForkFrom struct { - BackupID string `json:"backupId,omitempty"` - PointInTime string `json:"pointInTime,omitempty"` - ServiceID string `json:"serviceId,omitempty"` - } `json:"forkFrom,omitzero"` - IPRestrictions []databaseIPRestriction `json:"ipRestrictions,omitempty"` - MaintenanceTime string `json:"maintenanceTime,omitempty"` - NetworkID string `json:"networkId,omitempty"` - NodesList []databaseNode `json:"nodesList,omitempty"` - NodesPattern struct { - Flavor string `json:"flavor,omitempty"` - Number int `json:"number,omitempty"` - Region string `json:"region,omitempty"` - } `json:"nodesPattern,omitzero"` - Plan string `json:"plan,omitempty"` - SubnetID string `json:"subnetId,omitempty"` - Version string `json:"version,omitempty"` - - // Extra fields for CLI only - Engine string `json:"-"` - CLIIPRestrictions []string `json:"-"` - CLINodesList []string `json:"-"` - } - - DatabaseDatabaseSpec struct { - Name string `json:"name"` - } -) - -type ( - databaseIPRestriction struct { - Description string `json:"description,omitempty"` - IP string `json:"ip,omitempty"` - } - - databaseNode struct { - Flavor string `json:"flavor,omitempty"` - Region string `json:"region,omitempty"` - Role string `json:"role,omitempty"` - } -) - -func ListCloudDatabases(_ *cobra.Command, _ []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - common.ManageListRequest(fmt.Sprintf("/v1/cloud/project/%s/database/service", projectID), "", cloudprojectDatabaseColumnsToDisplay, flags.GenericFilters) -} - -func GetCloudDatabase(_ *cobra.Command, args []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - common.ManageObjectRequest(fmt.Sprintf("/v1/cloud/project/%s/database/service", projectID), args[0], cloudDatabaseTemplate) -} - -func CreateDatabase(cmd *cobra.Command, args []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - // Parse IP restrictions - for _, restriction := range DatabaseSpec.CLIIPRestrictions { - DatabaseSpec.IPRestrictions = append(DatabaseSpec.IPRestrictions, databaseIPRestriction{IP: restriction}) - } - - // Parse nodes list - for _, node := range DatabaseSpec.CLINodesList { - parts := strings.Split(node, ":") - if len(parts) != 2 { - display.OutputError(&flags.OutputFormatConfig, "invalid node format: %s (expected format: flavor1:region1,flavor2:region2...)", node) - return - } - DatabaseSpec.NodesList = append(DatabaseSpec.NodesList, databaseNode{ - Flavor: parts[0], - Region: parts[1], - }) - } - - endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/%s", projectID, url.PathEscape(DatabaseSpec.Engine)) - database, err := common.CreateResource( - cmd, - "/cloud/project/{serviceName}/database/"+url.PathEscape(DatabaseSpec.Engine), - endpoint, - DatabaseCreationExample, - DatabaseSpec, - assets.CloudOpenapiSchema, - []string{"version", "plan"}) - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to create database: %s", err) - return - } - - display.OutputInfo(&flags.OutputFormatConfig, database, "✅ Database created successfully (id: %s)", database["id"]) -} - -func DeleteDatabase(cmd *cobra.Command, args []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - // Fetch database service to retrieve the engine - var databaseService map[string]any - if err := httpLib.Client.Get(fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) - return - } - - // Delete the database - endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])) - if err := httpLib.Client.Delete(endpoint, nil); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to delete database: %s", err) - return - } - - display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Database deleted successfully") -} - -func EditDatabase(cmd *cobra.Command, args []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - // Fetch database service to retrieve the engine - var databaseService map[string]any - if err := httpLib.Client.Get(fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) - return - } - - // Parse IP restrictions - for _, restriction := range DatabaseSpec.CLIIPRestrictions { - DatabaseSpec.IPRestrictions = append(DatabaseSpec.IPRestrictions, databaseIPRestriction{IP: restriction}) - } - - // Edit resource - if err := common.EditResource( - cmd, - "/cloud/project/{serviceName}/database/"+url.PathEscape(databaseService["engine"].(string))+"/{clusterId}", - fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), - DatabaseSpec, - assets.CloudOpenapiSchema, - ); err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } -} - -func CreateDatabaseInDatabase(_ *cobra.Command, args []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - // Fetch database service to retrieve the engine - var databaseService map[string]any - if err := httpLib.Client.Get( - fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) - return - } - - endpoint := fmt.Sprintf( - "/v1/cloud/project/%s/database/%s/%s/database", - projectID, - url.PathEscape(databaseService["engine"].(string)), - url.PathEscape(args[0]), - ) - - var responseBody map[string]any - if err := httpLib.Client.Post(endpoint, &DatabaseDatabaseSpec, &responseBody); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to create database: %s", err) - return - } - - display.OutputInfo(&flags.OutputFormatConfig, responseBody, "✅ Database created successfully (id: %s)", responseBody["id"]) -} - -func DeleteDatabaseInDatabase(_ *cobra.Command, args []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - // Fetch database service to retrieve the engine - var databaseService map[string]any - if err := httpLib.Client.Get( - fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) - return - } - - // Delete the database in the given database cluster - endpoint := fmt.Sprintf( - "/v1/cloud/project/%s/database/%s/%s/database/%s", - projectID, - url.PathEscape(databaseService["engine"].(string)), - url.PathEscape(args[0]), - url.PathEscape(args[1]), - ) - if err := httpLib.Client.Delete(endpoint, nil); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to delete database: %s", err) - return - } - - display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Database deleted successfully") -} - -func ListDatabasesInDatabase(_ *cobra.Command, args []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - // Fetch database service to retrieve the engine - var databaseService map[string]any - if err := httpLib.Client.Get( - fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) - return - } - - common.ManageListRequest( - fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/database", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), - "", - []string{"id", "name", "default"}, - flags.GenericFilters, - ) -} - -func GetDatabaseInDatabase(_ *cobra.Command, args []string) { - projectID, err := getConfiguredCloudProject() - if err != nil { - display.OutputError(&flags.OutputFormatConfig, "%s", err) - return - } - - // Fetch database service to retrieve the engine - var databaseService map[string]any - if err := httpLib.Client.Get( - fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) - return - } - - common.ManageObjectRequest( - fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/database", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), - args[1], - "", - ) -} diff --git a/internal/services/cloud/cloud_managed_analytics.go b/internal/services/cloud/cloud_managed_analytics.go new file mode 100644 index 00000000..020ff412 --- /dev/null +++ b/internal/services/cloud/cloud_managed_analytics.go @@ -0,0 +1,1265 @@ +// SPDX-FileCopyrightText: 2025 OVH SAS +// +// SPDX-License-Identifier: Apache-2.0 + +package cloud + +import ( + _ "embed" + "fmt" + "net/url" + "slices" + "strings" + + "github.com/ovh/ovhcloud-cli/internal/assets" + "github.com/ovh/ovhcloud-cli/internal/display" + filtersLib "github.com/ovh/ovhcloud-cli/internal/filters" + "github.com/ovh/ovhcloud-cli/internal/flags" + httpLib "github.com/ovh/ovhcloud-cli/internal/http" + "github.com/ovh/ovhcloud-cli/internal/services/common" + "github.com/spf13/cobra" +) + +var ( + ManagedAnalyticsValidEngines = []string{"clickhouse", "grafana", "kafka", "kafkaConnect", "kafkaMirrorMaker", "opensearch"} + ManagedAnalyticsDatabaseValidEngines = []string{"clickhouse"} + ManagedAnalyticsUserEditValidEngines = []string{"clickhouse", "opensearch"} + ManagedAnalyticsUserPostValidEngines = append(ManagedAnalyticsUserEditValidEngines, "kafka", "kafkaConnect") + ManagedAnalyticsUserValidEngines = append(ManagedAnalyticsUserPostValidEngines, "grafana") + ManagedAnalyticsRoleValidEngines = []string{"clickhouse"} + ManagedAnalyticsPermissionValidEngines = []string{"opensearch"} + ManagedAnalyticsPatternValidEngines = []string{"opensearch"} + ManagedAnalyticsBackupValidEngines = []string{"clickhouse", "grafana", "opensearch"} + ManagedAnalyticsCertificateValidEngines = []string{"clickhouse", "kafka"} + ManagedAnalyticsTopicValidEngines = []string{"kafka"} + + cloudprojectManagedAnalyticsColumnsToDisplay = []string{"id", "engine", "version", "description", "status"} + cloudprojectManagedAnalyticsDatabaseColumnsToDisplay = []string{"id", "name", "default"} + cloudprojectManagedAnalyticsUserColumnsToDisplay = []string{"id", "username", "status", "createdAt"} + cloudprojectManagedAnalyticsClickhouseUserColumnsToDisplay = []string{"id", "username", "status", "roles", "createdAt"} + cloudprojectManagedAnalyticsRoleColumnsToDisplay = []string{"role"} + cloudprojectManagedAnalyticsPermissionColumnsToDisplay = []string{"name"} + cloudprojectManagedAnalyticsPatternColumnsToDisplay = []string{"id", "maxIndexCount", "pattern"} + cloudprojectManagedAnalyticsBackupColumnsToDisplay = []string{"id", "createdAt", "type", "status", "description"} + cloudprojectManagedAnalyticsTopicColumnsToDisplay = []string{"id", "name", "partitions", "replication", "minInsyncReplicas", "retentionBytes", "retentionHours"} + cloudprojectManagedAnalyticsTopicACLColumnsToDisplay = []string{"id", "username", "topic", "permission"} + + //go:embed templates/cloud_managed_analytics.tmpl + managedAnalyticsTemplate string + //go:embed templates/cloud_managed_analytics_database.tmpl + managedAnalyticsDatabaseTemplate string + //go:embed templates/cloud_managed_analytics_user.tmpl + managedAnalyticsUserTemplate string + //go:embed templates/cloud_managed_analytics_pattern.tmpl + managedAnalyticsPatternTemplate string + //go:embed templates/cloud_managed_analytics_certificate.tmpl + managedAnalyticsCertificateTemplate string + //go:embed templates/cloud_managed_analytics_backup.tmpl + managedAnalyticsBackupTemplate string + //go:embed templates/cloud_managed_analytics_topic.tmpl + managedAnalyticsTopicTemplate string + //go:embed templates/cloud_managed_analytics_topic_acl.tmpl + managedAnalyticsTopicACLTemplate string + + //go:embed parameter-samples/managed-analytics-create.json + ManagedAnalyticsCreationExample string + //go:embed parameter-samples/managed-analytics-user-create.json + ManagedAnalyticsUserCreationExample string + //go:embed parameter-samples/managed-analytics-pattern-create.json + ManagedAnalyticsPatternCreationExample string + //go:embed parameter-samples/managed-analytics-topic-create.json + ManagedAnalyticsTopicCreationExample string + ManagedAnalyticsSpec struct { + Backups struct { + Regions []string `json:"regions,omitempty"` + Time string `json:"time,omitempty"` + } `json:"backups,omitzero"` + DeletionProtection bool `json:"deletionProtection,omitempty"` + Description string `json:"description,omitempty"` + Disk struct { + Size int `json:"size,omitempty"` + } `json:"disk,omitzero"` + EnablePrometheus bool `json:"enablePrometheus,omitempty"` + ForkFrom struct { + BackupID string `json:"backupId,omitempty"` + PointInTime string `json:"pointInTime,omitempty"` + ServiceID string `json:"serviceId,omitempty"` + } `json:"forkFrom,omitzero"` + IPRestrictions []managedAnalyticsIPRestriction `json:"ipRestrictions,omitempty"` + MaintenanceTime string `json:"maintenanceTime,omitempty"` + NetworkID string `json:"networkId,omitempty"` + NodesList []managedAnalyticsNode `json:"nodesList,omitempty"` + NodesPattern struct { + Flavor string `json:"flavor,omitempty"` + Number int `json:"number,omitempty"` + Region string `json:"region,omitempty"` + } `json:"nodesPattern,omitzero"` + Plan string `json:"plan,omitempty"` + SubnetID string `json:"subnetId,omitempty"` + Version string `json:"version,omitempty"` + + // Extra fields for CLI only + Engine string `json:"-"` + CLIIPRestrictions []string `json:"-"` + CLINodesList []string `json:"-"` + } + + ManagedAnalyticsDatabaseSpec struct { + Name string `json:"name"` + } + + ManagedAnalyticsUserSpec ManagedAnalyticsUser + + ManagedAnalyticsPatternSpec struct { + Pattern string `json:"pattern"` + MaxIndexCount int `json:"maxIndexCount,omitempty"` + } + + ManagedAnalyticsTopicSpec struct { + Name string `json:"name"` + MinInsyncReplicas int `json:"minInsyncReplicas,omitempty"` + Partitions int `json:"partitions,omitempty"` + Replication int `json:"replication,omitempty"` + RetentionBytes int `json:"retentionBytes,omitempty"` + RetentionHours int `json:"retentionHours,omitempty"` + } + + ManagedAnalyticsTopicACLSpec struct { + Permission string `json:"permission"` + Topic string `json:"topic"` + Username string `json:"username"` + } +) + +type ( + managedAnalyticsIPRestriction struct { + Description string `json:"description,omitempty"` + IP string `json:"ip,omitempty"` + } + + managedAnalyticsNode struct { + Flavor string `json:"flavor,omitempty"` + Region string `json:"region,omitempty"` + Role string `json:"role,omitempty"` + } + + ManagedAnalyticsUser struct { + Name string `json:"name"` + + // Clickhouse specific field + Roles []string `json:"roles,omitempty"` + + // OpenSearch specific field + Acls []managedAnalyticsUserAcl `json:"acls,omitempty"` + + // Extra fields for CLI only + CLIAcls []string `json:"-"` + } + + managedAnalyticsUserAcl struct { + Pattern string `json:"pattern"` + Permission string `json:"permission"` + } +) + +func ListManagedAnalytics(_ *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageListRequest(fmt.Sprintf("/v1/cloud/project/%s/database/service", projectID), + "", + cloudprojectManagedAnalyticsColumnsToDisplay, + append(flags.GenericFilters, `category == "analysis"`)) +} + +func GetManagedAnalytics(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch managed analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get(fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsValidEngines, ", ")) + return + } + + common.ManageObjectRequest(fmt.Sprintf("/v1/cloud/project/%s/database/service", projectID), + args[0], + managedAnalyticsTemplate) +} + +func CreateManagedAnalyticsPreRun(_ *cobra.Command, _ []string) error { + if !slices.Contains(ManagedAnalyticsValidEngines, ManagedAnalyticsSpec.Engine) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", ManagedAnalyticsSpec.Engine, strings.Join(ManagedAnalyticsValidEngines, ", ")) + return fmt.Errorf("invalid engine %s", ManagedAnalyticsSpec.Engine) + } + return nil +} + +func CreateManagedAnalytics(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Parse IP restrictions + for _, restriction := range ManagedAnalyticsSpec.CLIIPRestrictions { + ManagedAnalyticsSpec.IPRestrictions = append(ManagedAnalyticsSpec.IPRestrictions, managedAnalyticsIPRestriction{IP: restriction}) + } + + // Parse nodes list + for _, node := range ManagedAnalyticsSpec.CLINodesList { + parts := strings.Split(node, ":") + if len(parts) != 2 { + display.OutputError(&flags.OutputFormatConfig, "invalid node format: %s (expected format: flavor1:region1,flavor2:region2...)", node) + return + } + ManagedAnalyticsSpec.NodesList = append(ManagedAnalyticsSpec.NodesList, managedAnalyticsNode{ + Flavor: parts[0], + Region: parts[1], + }) + } + + analytics, err := common.CreateResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s", url.PathEscape(ManagedAnalyticsSpec.Engine)), + fmt.Sprintf("/v1/cloud/project/%s/database/%s", projectID, url.PathEscape(ManagedAnalyticsSpec.Engine)), + ManagedAnalyticsCreationExample, + ManagedAnalyticsSpec, + assets.CloudOpenapiSchema, + []string{"version", "plan"}) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create managed analytics service: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, analytics, "✅ Managed analytics service created successfully (id: %s)", analytics["id"]) +} + +func EditManagedAnalytics(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get(fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsValidEngines, ", ")) + return + } + + // Parse IP restrictions + for _, restriction := range ManagedAnalyticsSpec.CLIIPRestrictions { + ManagedAnalyticsSpec.IPRestrictions = append(ManagedAnalyticsSpec.IPRestrictions, managedAnalyticsIPRestriction{IP: restriction}) + } + + // Edit resource + if err := common.EditResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}", url.PathEscape(analyticsService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + ManagedAnalyticsSpec, + assets.CloudOpenapiSchema, + ); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } +} + +func DeleteManagedAnalytics(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get(fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsValidEngines, ", ")) + return + } + + // Delete the analytics service + endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete managed analytics service: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Managed analytics service deleted successfully") +} + +func ListManagedAnalyticsDatabases(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsDatabaseValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support databases, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsDatabaseValidEngines, ", ")) + return + } + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/database", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + "", + cloudprojectManagedAnalyticsDatabaseColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedAnalyticsDatabase(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsDatabaseValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support databases, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsDatabaseValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/database", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedAnalyticsDatabaseTemplate, + ) +} + +func CreateManagedAnalyticsDatabase(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsDatabaseValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support databases, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsDatabaseValidEngines, ", ")) + return + } + + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/database", + projectID, + url.PathEscape(analyticsService["engine"].(string)), + url.PathEscape(args[0]), + ) + + var database map[string]any + if err := httpLib.Client.Post(endpoint, &ManagedAnalyticsDatabaseSpec, &database); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create database: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Database created successfully (id: %s)", database["id"]) +} + +func DeleteManagedAnalyticsDatabase(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsDatabaseValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support databases, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsDatabaseValidEngines, ", ")) + return + } + + // Delete the database in the given analytics cluster + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/database/%s", + projectID, + url.PathEscape(analyticsService["engine"].(string)), + url.PathEscape(args[0]), + url.PathEscape(args[1]), + ) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete database: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Database deleted successfully") +} + +func ListManagedAnalyticsUsers(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsUserValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support users, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsUserValidEngines, ", ")) + return + } + + columnsToDisplay := cloudprojectManagedAnalyticsUserColumnsToDisplay + if analyticsService["engine"].(string) == "clickhouse" { + columnsToDisplay = cloudprojectManagedAnalyticsClickhouseUserColumnsToDisplay + } + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/user", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + "", + columnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedAnalyticsUser(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsUserValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support users, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsUserValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/user", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedAnalyticsUserTemplate, + ) +} + +func CreateManagedAnalyticsUser(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsUserPostValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support users, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsUserPostValidEngines, ", ")) + return + } + + // Parse ACLs + for _, acl := range ManagedAnalyticsUserSpec.CLIAcls { + parts := strings.SplitN(acl, ":", 2) + if len(parts) != 2 { + display.OutputError(&flags.OutputFormatConfig, "invalid acl format: %s (expected format: pattern:permission)", acl) + return + } + ManagedAnalyticsUserSpec.Acls = append(ManagedAnalyticsUserSpec.Acls, managedAnalyticsUserAcl{ + Pattern: parts[0], + Permission: parts[1], + }) + } + + if err := ManagedAnalyticsUserSpec.validateForEngine(analyticsService["engine"].(string)); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + userSpec := ManagedAnalyticsUserSpec.forEngine(analyticsService["engine"].(string)) + + user, err := common.CreateResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}/user", url.PathEscape(analyticsService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/user", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + ManagedAnalyticsUserCreationExample, + userSpec, + assets.CloudOpenapiSchema, + nil) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create user: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, user, "✅ User created successfully (id: %s)", user["id"]) + display.OutputInfo(&flags.OutputFormatConfig, nil, "⚠️ Save this password now, it will not be shown again:\n\nPassword: %s", user["password"]) +} + +func EditManagedAnalyticsUser(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsUserEditValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support users, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsUserEditValidEngines, ", ")) + return + } + + // Parse ACLs + for _, acl := range ManagedAnalyticsUserSpec.CLIAcls { + parts := strings.SplitN(acl, ":", 2) + if len(parts) != 2 { + display.OutputError(&flags.OutputFormatConfig, "invalid acl format: %s (expected format: pattern:permission)", acl) + return + } + ManagedAnalyticsUserSpec.Acls = append(ManagedAnalyticsUserSpec.Acls, managedAnalyticsUserAcl{ + Pattern: parts[0], + Permission: parts[1], + }) + } + + if err := ManagedAnalyticsUserSpec.validateForEngine(analyticsService["engine"].(string)); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + userSpec := ManagedAnalyticsUserSpec.forEngine(analyticsService["engine"].(string)) + + // Edit resource + if err := common.EditResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}/user/{userId}", url.PathEscape(analyticsService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/user/%s", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0]), url.PathEscape(args[1])), + userSpec, + assets.CloudOpenapiSchema, + ); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } +} + +func DeleteManagedAnalyticsUser(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsUserPostValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support users, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsUserPostValidEngines, ", ")) + return + } + + // Delete the user in the given analytics cluster + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/user/%s", + projectID, + url.PathEscape(analyticsService["engine"].(string)), + url.PathEscape(args[0]), + url.PathEscape(args[1]), + ) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete user: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ User deleted successfully") +} + +func ResetManagedAnalyticsUserCredentials(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsUserValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support users, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsUserValidEngines, ", ")) + return + } + + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/user/%s/credentials/reset", + projectID, + url.PathEscape(analyticsService["engine"].(string)), + url.PathEscape(args[0]), + url.PathEscape(args[1]), + ) + + var user map[string]any + if err := httpLib.Client.Post(endpoint, nil, &user); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to reset user credentials: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ User credentials reset successfully") + display.OutputInfo(&flags.OutputFormatConfig, nil, "⚠️ Save this password now, it will not be shown again:\n\nPassword: %s", user["password"]) +} + +func (s ManagedAnalyticsUser) validateForEngine(engine string) error { + if len(s.Roles) > 0 && engine != "clickhouse" { + return fmt.Errorf("flag --roles is only supported for the clickhouse engine") + } + if len(s.Acls) > 0 && engine != "opensearch" { + return fmt.Errorf("flag --acl is only supported for the opensearch engine") + } + return nil +} + +func (s ManagedAnalyticsUser) forEngine(engine string) ManagedAnalyticsUser { + result := ManagedAnalyticsUser{Name: s.Name} + switch engine { + case "clickhouse": + result.Roles = s.Roles + case "opensearch": + result.Acls = s.Acls + } + return result +} + +func ListManagedAnalyticsRoles(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsRoleValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedAnalyticsRoleValidEngines, ", ")) + return + } + + var rawRoles []string + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/roles", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + &rawRoles); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch roles: %s", err) + return + } + + rows := make([]map[string]any, len(rawRoles)) + for i, role := range rawRoles { + rows[i] = map[string]any{"role": role} + } + + filteredRows, err := filtersLib.FilterLines(rows, flags.GenericFilters) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to filter results: %s", err) + return + } + + display.RenderTable(filteredRows, cloudprojectManagedAnalyticsRoleColumnsToDisplay, &flags.OutputFormatConfig) +} + +func ListManagedAnalyticsPermissions(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsPermissionValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedAnalyticsPermissionValidEngines, ", ")) + return + } + + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/permissions", + projectID, + url.PathEscape(databaseService["engine"].(string)), + url.PathEscape(args[0]), + ) + + var result struct { + Names []string `json:"names"` + } + if err := httpLib.Client.Get(endpoint, &result); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch permissions: %s", err) + return + } + + rows := make([]map[string]any, len(result.Names)) + for i, name := range result.Names { + rows[i] = map[string]any{"name": name} + } + + display.RenderTable(rows, cloudprojectManagedAnalyticsPermissionColumnsToDisplay, &flags.OutputFormatConfig) +} + +func ListManagedAnalyticsPatterns(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsPatternValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support patterns, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsPatternValidEngines, ", ")) + return + } + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/pattern", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + "", + cloudprojectManagedAnalyticsPatternColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedAnalyticsPattern(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsPatternValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support patterns, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsPatternValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/pattern", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedAnalyticsPatternTemplate, + ) +} + +func CreateManagedAnalyticsPattern(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsPatternValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support patterns, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsPatternValidEngines, ", ")) + return + } + + pattern, err := common.CreateResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}/pattern", url.PathEscape(analyticsService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/pattern", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + ManagedAnalyticsPatternCreationExample, + ManagedAnalyticsPatternSpec, + assets.CloudOpenapiSchema, + nil) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create pattern: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, pattern, "✅ Pattern created successfully (id: %s)", pattern["id"]) +} + +func DeleteManagedAnalyticsPattern(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch analytics service to retrieve the engine + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch managed analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsPatternValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support patterns, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsPatternValidEngines, ", ")) + return + } + + // Delete the pattern in the given analytics cluster + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/pattern/%s", + projectID, + url.PathEscape(analyticsService["engine"].(string)), + url.PathEscape(args[0]), + url.PathEscape(args[1]), + ) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete pattern: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Pattern deleted successfully") +} + +func GetManagedAnalyticsCertificates(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsCertificateValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support certificates, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsCertificateValidEngines, ", ")) + return + } + + var certificate map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/certificates", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + &certificate); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch certificate: %s", err) + return + } + + display.OutputObject(certificate, "", managedAnalyticsCertificateTemplate, &flags.OutputFormatConfig) +} + +func ListManagedAnalyticsBackups(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsBackupValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsBackupValidEngines, ", ")) + return + } + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/backup", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + "", + cloudprojectManagedAnalyticsBackupColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedAnalyticsBackup(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsBackupValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsBackupValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/backup", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedAnalyticsBackupTemplate, + ) +} + +func ListManagedAnalyticsTopics(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topics, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topic", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + "", + cloudprojectManagedAnalyticsTopicColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedAnalyticsTopic(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topics, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topic", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedAnalyticsTopicTemplate, + ) +} + +func CreateManagedAnalyticsTopic(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topics, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + topic, err := common.CreateResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}/topic", url.PathEscape(analyticsService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topic", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + ManagedAnalyticsTopicCreationExample, + ManagedAnalyticsTopicSpec, + assets.CloudOpenapiSchema, + nil) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create topic: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, topic, "✅ Topic created successfully (id: %s)", topic["id"]) +} + +func EditManagedAnalyticsTopic(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topics, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + // Edit resource + if err := common.EditResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}/topic/{topicId}", url.PathEscape(analyticsService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topic/%s", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0]), url.PathEscape(args[1])), + ManagedAnalyticsTopicSpec, + assets.CloudOpenapiSchema, + ); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } +} + +func DeleteManagedAnalyticsTopic(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topics, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + if err := httpLib.Client.Delete( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topic/%s", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0]), url.PathEscape(args[1])), + nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete topic: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Topic deleted successfully") +} + +func ListManagedAnalyticsTopicACLs(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topic ACLs, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topicAcl", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + "", + cloudprojectManagedAnalyticsTopicACLColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedAnalyticsTopicACL(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topic ACLs, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topicAcl", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedAnalyticsTopicACLTemplate, + ) +} + +func CreateManagedAnalyticsTopicACL(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topic ACLs, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + var topicACL map[string]any + if err := httpLib.Client.Post( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topicAcl", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0])), + &ManagedAnalyticsTopicACLSpec, + &topicACL, + ); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create topic ACL: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, topicACL, "✅ Topic ACL created successfully (id: %s)", topicACL["id"]) +} + +func DeleteManagedAnalyticsTopicACL(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var analyticsService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &analyticsService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics service: %s", err) + return + } + + if !slices.Contains(ManagedAnalyticsTopicValidEngines, analyticsService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support topic ACLs, valid engines: %s", analyticsService["engine"].(string), strings.Join(ManagedAnalyticsTopicValidEngines, ", ")) + return + } + + if err := httpLib.Client.Delete( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/topicAcl/%s", projectID, url.PathEscape(analyticsService["engine"].(string)), url.PathEscape(args[0]), url.PathEscape(args[1])), + nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete topic ACL: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Topic ACL deleted successfully") +} diff --git a/internal/services/cloud/cloud_managed_database.go b/internal/services/cloud/cloud_managed_database.go new file mode 100644 index 00000000..b828686d --- /dev/null +++ b/internal/services/cloud/cloud_managed_database.go @@ -0,0 +1,825 @@ +// SPDX-FileCopyrightText: 2025 OVH SAS +// +// SPDX-License-Identifier: Apache-2.0 + +package cloud + +import ( + _ "embed" + "fmt" + "net/url" + "slices" + "strconv" + "strings" + + "github.com/ovh/ovhcloud-cli/internal/assets" + "github.com/ovh/ovhcloud-cli/internal/display" + filtersLib "github.com/ovh/ovhcloud-cli/internal/filters" + "github.com/ovh/ovhcloud-cli/internal/flags" + httpLib "github.com/ovh/ovhcloud-cli/internal/http" + "github.com/ovh/ovhcloud-cli/internal/services/common" + "github.com/spf13/cobra" +) + +var ( + ManagedDatabaseValidEngines = []string{"mongodb", "mysql", "postgresql", "valkey"} + ManagedDatabaseDatabaseValidEngines = []string{"mysql", "postgresql"} + ManagedDatabaseUserEditValidEngines = []string{"mongodb", "postgresql", "valkey"} + ManagedDatabaseUserValidEngines = append(ManagedDatabaseUserEditValidEngines, "mysql") + ManagedDatabaseRoleValidEngines = []string{"mongodb", "postgresql"} + ManagedDatabaseCertificateValidEngines = []string{"mysql", "postgresql"} + ManagedDatabaseBackupRestoreValidEngines = []string{"mongodb"} + + cloudprojectManagedDatabaseColumnsToDisplay = []string{"id", "engine", "version", "description", "status"} + cloudprojectManagedDatabaseDatabaseColumnsToDisplay = []string{"id", "name", "default"} + cloudprojectManagedDatabaseUserWithRoleColumnsToDisplay = []string{"id", "username", "status", "roles", "createdAt"} + cloudprojectManagedDatabaseUserColumnsToDisplay = []string{"id", "username", "status", "createdAt"} + cloudprojectManagedDatabaseValkeyUserColumnsToDisplay = []string{"id", "username", "status", "categories", "channels", "commands", "keys", "createdAt"} + cloudprojectManagedDatabaseRoleColumnsToDisplay = []string{"role"} + cloudprojectManagedDatabaseBackupColumnsToDisplay = []string{"id", "createdAt", "type", "status", "description"} + + //go:embed templates/cloud_managed_database.tmpl + managedDatabaseTemplate string + //go:embed templates/cloud_managed_database_database.tmpl + managedDatabaseDatabaseTemplate string + //go:embed templates/cloud_managed_database_user.tmpl + managedDatabaseUserTemplate string + //go:embed templates/cloud_managed_database_certificate.tmpl + managedDatabaseCertificateTemplate string + //go:embed templates/cloud_managed_database_backup.tmpl + managedDatabaseBackupTemplate string + + //go:embed parameter-samples/managed-database-create.json + ManagedDatabaseCreationExample string + //go:embed parameter-samples/managed-database-user-create.json + ManagedDatabaseUserCreationExample string + + ManagedDatabaseSpec struct { + Backups struct { + Regions []string `json:"regions,omitempty"` + Time string `json:"time,omitempty"` + } `json:"backups,omitzero"` + DeletionProtection bool `json:"deletionProtection,omitempty"` + Description string `json:"description,omitempty"` + Disk struct { + Size int `json:"size,omitempty"` + } `json:"disk,omitzero"` + EnablePrometheus bool `json:"enablePrometheus,omitempty"` + ForkFrom struct { + BackupID string `json:"backupId,omitempty"` + PointInTime string `json:"pointInTime,omitempty"` + ServiceID string `json:"serviceId,omitempty"` + } `json:"forkFrom,omitzero"` + IPRestrictions []managedDatabaseIPRestriction `json:"ipRestrictions,omitempty"` + MaintenanceTime string `json:"maintenanceTime,omitempty"` + NetworkID string `json:"networkId,omitempty"` + NodesList []managedDatabaseNode `json:"nodesList,omitempty"` + NodesPattern struct { + Flavor string `json:"flavor,omitempty"` + Number int `json:"number,omitempty"` + Region string `json:"region,omitempty"` + } `json:"nodesPattern,omitzero"` + Plan string `json:"plan,omitempty"` + SubnetID string `json:"subnetId,omitempty"` + Version string `json:"version,omitempty"` + + // Extra fields for CLI only + Engine string `json:"-"` + CLIIPRestrictions []string `json:"-"` + CLINodesList []string `json:"-"` + } + + ManagedDatabaseDatabaseSpec struct { + Name string `json:"name"` + } + + ManagedDatabaseUserSpec ManagedDatabaseUser + + ManagedDatabaseRoleSpec struct { + Advanced bool `json:"-"` + } +) + +type ( + managedDatabaseIPRestriction struct { + Description string `json:"description,omitempty"` + IP string `json:"ip,omitempty"` + } + + managedDatabaseNode struct { + Flavor string `json:"flavor,omitempty"` + Region string `json:"region,omitempty"` + Role string `json:"role,omitempty"` + } + + ManagedDatabaseUser struct { + Name string `json:"name"` + + // PostgreSQL and MongoDB specific field + Roles []string `json:"roles,omitempty"` + + // Valkey specific fields + Categories []string `json:"categories,omitempty"` + Channels []string `json:"channels,omitempty"` + Commands []string `json:"commands,omitempty"` + Keys []string `json:"keys,omitempty"` + } +) + +func ListManagedDatabases(_ *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageListRequest(fmt.Sprintf("/v1/cloud/project/%s/database/service", projectID), + "", + cloudprojectManagedDatabaseColumnsToDisplay, + append(flags.GenericFilters, `category == "operational"`)) +} + +func GetManagedDatabase(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get(fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseValidEngines, ", ")) + return + } + + common.ManageObjectRequest(fmt.Sprintf("/v1/cloud/project/%s/database/service", projectID), + args[0], + managedDatabaseTemplate) +} + +func CreateManagedDatabasePreRun(_ *cobra.Command, _ []string) error { + if !slices.Contains(ManagedDatabaseValidEngines, ManagedDatabaseSpec.Engine) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", ManagedDatabaseSpec.Engine, strings.Join(ManagedDatabaseValidEngines, ", ")) + return fmt.Errorf("invalid engine %s", ManagedDatabaseSpec.Engine) + } + return nil +} + +func CreateManagedDatabase(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Parse IP restrictions + for _, restriction := range ManagedDatabaseSpec.CLIIPRestrictions { + ManagedDatabaseSpec.IPRestrictions = append(ManagedDatabaseSpec.IPRestrictions, managedDatabaseIPRestriction{IP: restriction}) + } + + // Parse nodes list + for _, node := range ManagedDatabaseSpec.CLINodesList { + parts := strings.Split(node, ":") + if len(parts) != 2 { + display.OutputError(&flags.OutputFormatConfig, "invalid node format: %s (expected format: flavor1:region1,flavor2:region2...)", node) + return + } + ManagedDatabaseSpec.NodesList = append(ManagedDatabaseSpec.NodesList, managedDatabaseNode{ + Flavor: parts[0], + Region: parts[1], + }) + } + + managedDatabase, err := common.CreateResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s", url.PathEscape(ManagedDatabaseSpec.Engine)), + fmt.Sprintf("/v1/cloud/project/%s/database/%s", projectID, url.PathEscape(ManagedDatabaseSpec.Engine)), + ManagedDatabaseCreationExample, + ManagedDatabaseSpec, + assets.CloudOpenapiSchema, + []string{"version", "plan"}) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create managed database: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, managedDatabase, "✅ Managed database created successfully (id: %s)", managedDatabase["id"]) +} + +func EditManagedDatabase(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get(fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseValidEngines, ", ")) + return + } + + // Parse IP restrictions + for _, restriction := range ManagedDatabaseSpec.CLIIPRestrictions { + ManagedDatabaseSpec.IPRestrictions = append(ManagedDatabaseSpec.IPRestrictions, managedDatabaseIPRestriction{IP: restriction}) + } + + // Edit resource + if err := common.EditResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}", url.PathEscape(databaseService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + ManagedDatabaseSpec, + assets.CloudOpenapiSchema, + ); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } +} + +func DeleteManagedDatabase(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get(fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseValidEngines, ", ")) + return + } + + // Delete the database + endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete database: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Managed database deleted successfully") +} + +func ListManagedDatabaseDatabases(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseDatabaseValidEngines, ", ")) + return + } + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/database", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + "", + cloudprojectManagedDatabaseDatabaseColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedDatabaseDatabase(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseDatabaseValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/database", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedDatabaseDatabaseTemplate, + ) +} + +func CreateManagedDatabaseDatabase(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseDatabaseValidEngines, ", ")) + return + } + + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/database", + projectID, + url.PathEscape(databaseService["engine"].(string)), + url.PathEscape(args[0]), + ) + + var database map[string]any + if err := httpLib.Client.Post(endpoint, &ManagedDatabaseDatabaseSpec, &database); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create database: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Database created successfully (id: %s)", database["id"]) +} + +func DeleteManagedDatabaseDatabase(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseDatabaseValidEngines, ", ")) + return + } + + // Delete the database in the given database cluster + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/database/%s", + projectID, + url.PathEscape(databaseService["engine"].(string)), + url.PathEscape(args[0]), + url.PathEscape(args[1]), + ) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete database: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Database deleted successfully") +} + +func ListManagedDatabaseUsers(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseUserValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseUserValidEngines, ", ")) + return + } + + columnsToDisplay := ManagedDatabaseUserSpec.displayByEngine(databaseService["engine"].(string)) + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/user", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + "", + columnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedDatabaseUser(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseUserValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseUserValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/user", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedDatabaseUserTemplate, + ) +} + +func CreateManagedDatabaseUser(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseUserValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseUserValidEngines, ", ")) + return + } + + if err := ManagedDatabaseUserSpec.validateForEngine(databaseService["engine"].(string)); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + userSpec := ManagedDatabaseUserSpec.byEngine(databaseService["engine"].(string)) + + user, err := common.CreateResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}/user", url.PathEscape(databaseService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/user", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + ManagedDatabaseUserCreationExample, + userSpec, + assets.CloudOpenapiSchema, + nil) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create user: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, user, "✅ User created successfully (id: %s)", user["id"]) + display.OutputInfo(&flags.OutputFormatConfig, nil, "⚠️ Save this password now, it will not be shown again:\n\nPassword: %s", user["password"]) +} + +func EditManagedDatabaseUser(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseUserEditValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseUserEditValidEngines, ", ")) + return + } + + if err := ManagedDatabaseUserSpec.validateForEngine(databaseService["engine"].(string)); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + userSpec := ManagedDatabaseUserSpec.byEngine(databaseService["engine"].(string)) + + // Edit resource + if err := common.EditResource( + cmd, + fmt.Sprintf("/cloud/project/{serviceName}/database/%s/{clusterId}/user/{userId}", url.PathEscape(databaseService["engine"].(string))), + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/user/%s", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0]), url.PathEscape(args[1])), + userSpec, + assets.CloudOpenapiSchema, + ); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } +} + +func DeleteManagedDatabaseUser(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseUserValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseUserValidEngines, ", ")) + return + } + + // Delete the user in the given database cluster + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/user/%s", + projectID, + url.PathEscape(databaseService["engine"].(string)), + url.PathEscape(args[0]), + url.PathEscape(args[1]), + ) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete user: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ User deleted successfully") +} + +func ResetManagedDatabaseUserCredentials(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseUserValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseUserValidEngines, ", ")) + return + } + + endpoint := fmt.Sprintf( + "/v1/cloud/project/%s/database/%s/%s/user/%s/credentials/reset", + projectID, + url.PathEscape(databaseService["engine"].(string)), + url.PathEscape(args[0]), + url.PathEscape(args[1]), + ) + + var user map[string]any + if err := httpLib.Client.Post(endpoint, nil, &user); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to reset user credentials: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ User credentials reset successfully") + display.OutputInfo(&flags.OutputFormatConfig, nil, "⚠️ Save this password now, it will not be shown again:\n\nPassword: %s", user["password"]) +} + +func (s ManagedDatabaseUser) validateForEngine(engine string) error { + if len(s.Roles) > 0 && !slices.Contains(ManagedDatabaseRoleValidEngines, engine) { + return fmt.Errorf("flag --roles is only supported for postgresql and mongodb engines") + } + if (len(s.Categories) > 0 || len(s.Channels) > 0 || len(s.Commands) > 0 || len(s.Keys) > 0) && engine != "valkey" { + return fmt.Errorf("flags --categories, --channels, --commands, --keys are only supported for the valkey engine") + } + return nil +} + +func (s ManagedDatabaseUser) byEngine(engine string) ManagedDatabaseUser { + result := ManagedDatabaseUser{Name: s.Name} + switch engine { + case "valkey": + result.Categories = s.Categories + result.Channels = s.Channels + result.Commands = s.Commands + result.Keys = s.Keys + default: + if slices.Contains(ManagedDatabaseRoleValidEngines, engine) { + result.Roles = s.Roles + } + } + return result +} + +func (s ManagedDatabaseUser) displayByEngine(engine string) []string { + result := []string{} + switch engine { + case "mysql": + result = cloudprojectManagedDatabaseUserColumnsToDisplay + case "valkey": + result = cloudprojectManagedDatabaseValkeyUserColumnsToDisplay + default: + if slices.Contains(ManagedDatabaseRoleValidEngines, engine) { + result = cloudprojectManagedDatabaseUserWithRoleColumnsToDisplay + } + } + return result +} + +func ListManagedDatabaseRoles(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseRoleValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseRoleValidEngines, ", ")) + return + } + + if ManagedDatabaseRoleSpec.Advanced && databaseService["engine"].(string) != "mongodb" { + display.OutputError(&flags.OutputFormatConfig, "flag --advanced is only supported for mongodb engines") + return + } + + endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/roles", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])) + if databaseService["engine"].(string) == "mongodb" { + endpoint += "?advanced=" + strconv.FormatBool(ManagedDatabaseRoleSpec.Advanced) + } + + var rawRoles []string + if err := httpLib.Client.Get(endpoint, &rawRoles); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch roles: %s", err) + return + } + + rows := make([]map[string]any, len(rawRoles)) + for i, role := range rawRoles { + rows[i] = map[string]any{"role": role} + } + + filteredRows, err := filtersLib.FilterLines(rows, flags.GenericFilters) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to filter results: %s", err) + return + } + + display.RenderTable(filteredRows, cloudprojectManagedDatabaseRoleColumnsToDisplay, &flags.OutputFormatConfig) +} + +func GetManagedDatabaseCertificates(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + // Fetch database service to retrieve the engine + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseCertificateValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseCertificateValidEngines, ", ")) + return + } + + var certificate map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/certificates", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + &certificate); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch certificate: %s", err) + return + } + + display.OutputObject(certificate, "", managedDatabaseCertificateTemplate, &flags.OutputFormatConfig) +} + +func ListManagedDatabaseBackups(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseValidEngines, ", ")) + return + } + + common.ManageListRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/backup", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + "", + cloudprojectManagedDatabaseBackupColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetManagedDatabaseBackup(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "invalid engine %s, valid values: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseValidEngines, ", ")) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/backup", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0])), + args[1], + managedDatabaseBackupTemplate, + ) +} + +func RestoreManagedDatabaseBackup(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + var databaseService map[string]any + if err := httpLib.Client.Get( + fmt.Sprintf("/v1/cloud/project/%s/database/service/%s", projectID, url.PathEscape(args[0])), &databaseService); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database service: %s", err) + return + } + + if !slices.Contains(ManagedDatabaseBackupRestoreValidEngines, databaseService["engine"].(string)) { + display.OutputError(&flags.OutputFormatConfig, "engine %s does not support backup restore, valid engines: %s", databaseService["engine"].(string), strings.Join(ManagedDatabaseBackupRestoreValidEngines, ", ")) + return + } + + if err := httpLib.Client.Post( + fmt.Sprintf("/v1/cloud/project/%s/database/%s/%s/backup/%s/restore", projectID, url.PathEscape(databaseService["engine"].(string)), url.PathEscape(args[0]), url.PathEscape(args[1])), + nil, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to restore backup: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Backup restore started successfully") +} diff --git a/internal/services/cloud/cloud_reference.go b/internal/services/cloud/cloud_reference.go index ec6fe683..bc66d00d 100644 --- a/internal/services/cloud/cloud_reference.go +++ b/internal/services/cloud/cloud_reference.go @@ -15,6 +15,8 @@ import ( httpLib "github.com/ovh/ovhcloud-cli/internal/http" "github.com/ovh/ovhcloud-cli/internal/services/common" "github.com/spf13/cobra" + "golang.org/x/text/cases" + "golang.org/x/text/language" ) func GetFlavors(region string) { @@ -174,7 +176,7 @@ func ListRancherAvailablePlans(cmd *cobra.Command, _ []string) { common.ManageListRequestNoExpand(endpoint, []string{"name", "status", "message"}, flags.GenericFilters) } -func ListDatabasesPlans(_ *cobra.Command, _ []string) { +func ListManagedDatabasePlans(_ *cobra.Command, _ []string) { projectID, err := getConfiguredCloudProject() if err != nil { display.OutputError(&flags.OutputFormatConfig, "%s", err) @@ -202,7 +204,7 @@ func ListDatabasesPlans(_ *cobra.Command, _ []string) { display.RenderTable(plans, []string{"name", "description", "lifecycle.status status", "backupRetention"}, &flags.OutputFormatConfig) } -func ListDatabasesNodeFlavors(_ *cobra.Command, _ []string) { +func ListManagedDatabaseNodeFlavors(_ *cobra.Command, _ []string) { projectID, err := getConfiguredCloudProject() if err != nil { display.OutputError(&flags.OutputFormatConfig, "%s", err) @@ -212,7 +214,7 @@ func ListDatabasesNodeFlavors(_ *cobra.Command, _ []string) { endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/capabilities", projectID) var body map[string]any if err := httpLib.Client.Get(endpoint, &body); err != nil { - display.OutputError(&flags.OutputFormatConfig, "failed to fetch database plans: %s", err) + display.OutputError(&flags.OutputFormatConfig, "failed to fetch database node flavors: %s", err) return } @@ -239,7 +241,7 @@ func ListDatabasesNodeFlavors(_ *cobra.Command, _ []string) { display.RenderTable(flavors, []string{"name", "core", "memory", "storage"}, &flags.OutputFormatConfig) } -func ListDatabaseEngines(_ *cobra.Command, _ []string) { +func ListManagedDatabaseEngines(_ *cobra.Command, _ []string) { projectID, err := getConfiguredCloudProject() if err != nil { display.OutputError(&flags.OutputFormatConfig, "%s", err) @@ -257,8 +259,123 @@ func ListDatabaseEngines(_ *cobra.Command, _ []string) { for _, engine := range body["engines"].([]any) { engineMap := engine.(map[string]any) + // keep only engines with category "operational" for managed database + if engineMap["category"] != "operational" { + continue + } + + // Reformat description + engineMap["description"] = cases.Title(language.English).String(engineMap["description"].(string)) + + // Transform versions array into human readable string + var versions []string + for _, v := range engineMap["versions"].([]any) { + versions = append(versions, v.(string)) + } + engineMap["versions"] = strings.Join(versions, " | ") + + engines = append(engines, engineMap) + } + + engines, err = filtersLib.FilterLines(engines, flags.GenericFilters) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to filter results: %s", err) + return + } + + display.RenderTable(engines, []string{"name", "description", "category", "versions", "defaultVersion"}, &flags.OutputFormatConfig) +} + +func ListManagedAnalyticsPlans(_ *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/capabilities", projectID) + var body map[string]any + if err := httpLib.Client.Get(endpoint, &body); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics plans: %s", err) + return + } + + var plans []map[string]any + for _, plan := range body["plans"].([]any) { + plans = append(plans, plan.(map[string]any)) + } + + plans, err = filtersLib.FilterLines(plans, flags.GenericFilters) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to filter results: %s", err) + return + } + + display.RenderTable(plans, []string{"name", "description", "lifecycle.status status", "backupRetention"}, &flags.OutputFormatConfig) +} + +func ListManagedAnalyticsNodeFlavors(_ *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/capabilities", projectID) + var body map[string]any + if err := httpLib.Client.Get(endpoint, &body); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics node flavors: %s", err) + return + } + + var flavors []map[string]any + for _, flavor := range body["flavors"].([]any) { + flavorMap := flavor.(map[string]any) + + // Transform specifications map into human readable strings + specs := flavorMap["specifications"].(map[string]any) + memorySpec := specs["memory"].(map[string]any) + storageSpec := specs["storage"].(map[string]any) + flavorMap["memory"] = fmt.Sprintf("%s %s", memorySpec["value"], memorySpec["unit"]) + flavorMap["storage"] = fmt.Sprintf("%s %s", storageSpec["value"], storageSpec["unit"]) + + flavors = append(flavors, flavorMap) + } + + flavors, err = filtersLib.FilterLines(flavors, flags.GenericFilters) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to filter results: %s", err) + return + } + + display.RenderTable(flavors, []string{"name", "core", "memory", "storage"}, &flags.OutputFormatConfig) +} + +func ListManagedAnalyticsEngines(_ *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v1/cloud/project/%s/database/capabilities", projectID) + var body map[string]any + if err := httpLib.Client.Get(endpoint, &body); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch analytics engines: %s", err) + return + } + + var engines []map[string]any + for _, engine := range body["engines"].([]any) { + engineMap := engine.(map[string]any) + + // keep only engines with category "analysis" for managed analytics + if engineMap["category"] != "analysis" { + continue + } + // Reformat description - engineMap["description"] = strings.Title(engineMap["description"].(string)) + engineMap["description"] = cases.Title(language.English).String(engineMap["description"].(string)) // Transform versions array into human readable string var versions []string diff --git a/internal/services/cloud/parameter-samples/database-create.json b/internal/services/cloud/parameter-samples/database-create.json deleted file mode 100644 index 2a2b34d4..00000000 --- a/internal/services/cloud/parameter-samples/database-create.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "description": "Example mysql database", - "nodesList": [ - { - "flavor": "db1-4", - "region": "DE" - } - ], - "plan": "essential", - "version": "8" -} \ No newline at end of file diff --git a/internal/services/cloud/parameter-samples/managed-analytics-create.json b/internal/services/cloud/parameter-samples/managed-analytics-create.json new file mode 100644 index 00000000..5f7bf851 --- /dev/null +++ b/internal/services/cloud/parameter-samples/managed-analytics-create.json @@ -0,0 +1,10 @@ +{ + "description": "Example kafka cluster", + "nodesPattern": { + "flavor": "db1-4", + "number": 1, + "region": "GRA" + }, + "plan": "production", + "version": "4.0" +} diff --git a/internal/services/cloud/parameter-samples/managed-analytics-pattern-create.json b/internal/services/cloud/parameter-samples/managed-analytics-pattern-create.json new file mode 100644 index 00000000..0b4e9166 --- /dev/null +++ b/internal/services/cloud/parameter-samples/managed-analytics-pattern-create.json @@ -0,0 +1,4 @@ +{ + "pattern": "my-index-*", + "maxIndexCount": 10 +} diff --git a/internal/services/cloud/parameter-samples/managed-analytics-topic-create.json b/internal/services/cloud/parameter-samples/managed-analytics-topic-create.json new file mode 100644 index 00000000..137ba307 --- /dev/null +++ b/internal/services/cloud/parameter-samples/managed-analytics-topic-create.json @@ -0,0 +1,8 @@ +{ + "name": "my-topic", + "partitions": 3, + "replication": 1, + "minInsyncReplicas": 1, + "retentionBytes": -1, + "retentionHours": 168 +} diff --git a/internal/services/cloud/parameter-samples/managed-analytics-user-create.json b/internal/services/cloud/parameter-samples/managed-analytics-user-create.json new file mode 100644 index 00000000..5ffbd6f4 --- /dev/null +++ b/internal/services/cloud/parameter-samples/managed-analytics-user-create.json @@ -0,0 +1,3 @@ +{ + "name": "myuser" +} diff --git a/internal/services/cloud/parameter-samples/managed-database-create.json b/internal/services/cloud/parameter-samples/managed-database-create.json new file mode 100644 index 00000000..de024422 --- /dev/null +++ b/internal/services/cloud/parameter-samples/managed-database-create.json @@ -0,0 +1,10 @@ +{ + "description": "Example mysql database", + "nodesPattern": { + "flavor": "db1-4", + "number": 1, + "region": "GRA" + }, + "plan": "production", + "version": "8" +} diff --git a/internal/services/cloud/parameter-samples/managed-database-user-create.json b/internal/services/cloud/parameter-samples/managed-database-user-create.json new file mode 100644 index 00000000..5ffbd6f4 --- /dev/null +++ b/internal/services/cloud/parameter-samples/managed-database-user-create.json @@ -0,0 +1,3 @@ +{ + "name": "myuser" +} diff --git a/internal/services/cloud/templates/cloud_managed_analytics.tmpl b/internal/services/cloud/templates/cloud_managed_analytics.tmpl new file mode 100644 index 00000000..758a3601 --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_analytics.tmpl @@ -0,0 +1,41 @@ +🚀 Managed Analytics {{.ServiceName}} +======= + +_{{index .Result "description"}}_ + +## Service configuration + +**Plan**: {{index .Result "plan"}} +**Flavor**: {{index .Result "flavor"}} +**Engine**: {{index .Result "engine"}} {{index .Result "version"}} +**Creation date**: {{index .Result "createdAt"}} + +## Cluster state + +**Status**: {{index .Result "status"}} +**Usable storage**: {{index .Result "storage" "size" "value"}} {{index .Result "storage" "size" "unit"}} +**Network type**: {{index .Result "networkType"}} + +Endpoints: {{range index .Result "endpoints"}} +- {{.uri}} +{{end}} + +### Nodes + +| ID | Flavor | Region | Status | +| --- | --- | --- | --- | +{{ range index .Result "nodes" }}| {{.id}} | {{.flavor}} | {{.region}} | {{.status}} | +{{end}} + +{{if index .Result "backups"}} +## Backups + +**Backup time**: {{index .Result "backups" "time"}} +**Retention days**: {{index .Result "backups" "retentionDays"}} + +Regions: {{range index .Result "backups" "regions"}} +- {{.}} +{{end}} +{{end}} + +💡 Use option -o json or -o yaml to get the raw output with all information \ No newline at end of file diff --git a/internal/services/cloud/templates/cloud_managed_analytics_backup.tmpl b/internal/services/cloud/templates/cloud_managed_analytics_backup.tmpl new file mode 100644 index 00000000..df9fb3bc --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_analytics_backup.tmpl @@ -0,0 +1,14 @@ +🚀 Managed Analytics - Backup +======= + +## General information + +**ID**: {{index .Result "id"}} +**Created at**: {{index .Result "createdAt"}} +**Type**: {{index .Result "type"}} +**Status**: {{index .Result "status"}} +**Description**: {{index .Result "description"}} +**Size**: {{with index .Result "size"}}{{index . "value"}} {{index . "unit"}}{{end}} +**Regions**: {{range index .Result "regions"}}{{index . "name"}} {{end}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_analytics_certificate.tmpl b/internal/services/cloud/templates/cloud_managed_analytics_certificate.tmpl new file mode 100644 index 00000000..b2779fed --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_analytics_certificate.tmpl @@ -0,0 +1,8 @@ +🚀 Managed Analytics - Certificate +======= + +## CA Certificate + +{{index .Result "ca"}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_analytics_database.tmpl b/internal/services/cloud/templates/cloud_managed_analytics_database.tmpl new file mode 100644 index 00000000..9037eba0 --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_analytics_database.tmpl @@ -0,0 +1,10 @@ +🚀 Managed Analytics - Database +======= + +## General information + +**ID**: {{index .Result "id"}} +**Name**: {{index .Result "name"}} +**Default**: {{index .Result "default"}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_analytics_pattern.tmpl b/internal/services/cloud/templates/cloud_managed_analytics_pattern.tmpl new file mode 100644 index 00000000..5ee926bb --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_analytics_pattern.tmpl @@ -0,0 +1,10 @@ +🚀 Managed Analytics - Pattern +======= + +## General information + +**ID**: {{index .Result "id"}} +**Pattern**: {{index .Result "pattern"}} +**Max index count**: {{index .Result "maxIndexCount"}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_analytics_topic.tmpl b/internal/services/cloud/templates/cloud_managed_analytics_topic.tmpl new file mode 100644 index 00000000..46d7e737 --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_analytics_topic.tmpl @@ -0,0 +1,14 @@ +🚀 Managed Analytics - Topic +======= + +## General information + +**ID**: {{index .Result "id"}} +**Name**: {{index .Result "name"}} +**Partitions**: {{index .Result "partitions"}} +**Replication**: {{index .Result "replication"}} +**Min in-sync replicas**: {{index .Result "minInsyncReplicas"}} +**Retention bytes**: {{index .Result "retentionBytes"}} +**Retention hours**: {{index .Result "retentionHours"}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_analytics_topic_acl.tmpl b/internal/services/cloud/templates/cloud_managed_analytics_topic_acl.tmpl new file mode 100644 index 00000000..e9df360e --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_analytics_topic_acl.tmpl @@ -0,0 +1,11 @@ +🚀 Managed Analytics - Topic ACL +======= + +## General information + +**ID**: {{index .Result "id"}} +**Username**: {{index .Result "username"}} +**Topic**: {{index .Result "topic"}} +**Permission**: {{index .Result "permission"}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_analytics_user.tmpl b/internal/services/cloud/templates/cloud_managed_analytics_user.tmpl new file mode 100644 index 00000000..f4152c40 --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_analytics_user.tmpl @@ -0,0 +1,27 @@ +🚀 Managed Analytics User +======= + +## General information + +**ID**: {{index .Result "id"}} +**Username**: {{index .Result "username"}} +**Status**: {{index .Result "status"}} +**Created at**: {{index .Result "createdAt"}} + +{{if index .Result "roles"}} +## Roles + +{{range index .Result "roles"}} +- {{.}} +{{end}} +{{end}} +{{if index .Result "acls"}} +## OpenSearch ACLs + +| Pattern | Permission | +| --- | --- | +{{range index .Result "acls"}}| {{.pattern}} | {{.permission}} | +{{end}} +{{end}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_database.tmpl b/internal/services/cloud/templates/cloud_managed_database.tmpl similarity index 90% rename from internal/services/cloud/templates/cloud_database.tmpl rename to internal/services/cloud/templates/cloud_managed_database.tmpl index 757b204e..df2dd6b3 100644 --- a/internal/services/cloud/templates/cloud_database.tmpl +++ b/internal/services/cloud/templates/cloud_managed_database.tmpl @@ -13,7 +13,7 @@ _{{index .Result "description"}}_ ## Cluster state **Status**: {{index .Result "status"}} -**Usable storage**: {{index .Result "storage" "size" "value"}}{{index .Result "storage" "size" "unit"}} +**Usable storage**: {{index .Result "storage" "size" "value"}} {{index .Result "storage" "size" "unit"}} **Network type**: {{index .Result "networkType"}} Endpoints: {{range index .Result "endpoints"}} diff --git a/internal/services/cloud/templates/cloud_managed_database_backup.tmpl b/internal/services/cloud/templates/cloud_managed_database_backup.tmpl new file mode 100644 index 00000000..2d14b5b4 --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_database_backup.tmpl @@ -0,0 +1,14 @@ +🚀 Managed Database - Backup +======= + +## General information + +**ID**: {{index .Result "id"}} +**Created at**: {{index .Result "createdAt"}} +**Type**: {{index .Result "type"}} +**Status**: {{index .Result "status"}} +**Description**: {{index .Result "description"}} +**Size**: {{with index .Result "size"}}{{index . "value"}} {{index . "unit"}}{{end}} +**Regions**: {{range index .Result "regions"}}{{index . "name"}} {{end}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_database_certificate.tmpl b/internal/services/cloud/templates/cloud_managed_database_certificate.tmpl new file mode 100644 index 00000000..60f0aff1 --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_database_certificate.tmpl @@ -0,0 +1,8 @@ +🚀 Managed Database - Certificate +======= + +## CA Certificate + +{{index .Result "ca"}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_database_database.tmpl b/internal/services/cloud/templates/cloud_managed_database_database.tmpl new file mode 100644 index 00000000..64500e26 --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_database_database.tmpl @@ -0,0 +1,10 @@ +🚀 Managed Database - Database +======= + +## General information + +**ID**: {{index .Result "id"}} +**Name**: {{index .Result "name"}} +**Default**: {{index .Result "default"}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/templates/cloud_managed_database_user.tmpl b/internal/services/cloud/templates/cloud_managed_database_user.tmpl new file mode 100644 index 00000000..66b72390 --- /dev/null +++ b/internal/services/cloud/templates/cloud_managed_database_user.tmpl @@ -0,0 +1,27 @@ +🚀 Managed Database User +======= + +## General information + +**ID**: {{index .Result "id"}} +**Username**: {{index .Result "username"}} +**Status**: {{index .Result "status"}} +**Created at**: {{index .Result "createdAt"}} + +{{if index .Result "roles"}} +## Roles + +{{range index .Result "roles"}} +- {{.}} +{{end}} +{{end}} +{{if index .Result "categories"}} +## Valkey permissions + +**Categories**: {{range index .Result "categories"}}{{.}} {{end}} +**Channels**: {{range index .Result "channels"}}{{.}} {{end}} +**Commands**: {{range index .Result "commands"}}{{.}} {{end}} +**Keys**: {{range index .Result "keys"}}{{.}} {{end}} +{{end}} + +💡 Use option -o json or -o yaml to get the raw output with all information