diff --git a/doc/ovhcloud_cloud.md b/doc/ovhcloud_cloud.md index 72336089..94b75da3 100644 --- a/doc/ovhcloud_cloud.md +++ b/doc/ovhcloud_cloud.md @@ -34,6 +34,7 @@ Manage your projects and services in the Public Cloud universe (MKS, MPR, MRS, O * [ovhcloud cloud alerting](ovhcloud_cloud_alerting.md) - Manage billing alert configurations in the given cloud project * [ovhcloud cloud instance](ovhcloud_cloud_instance.md) - Manage instances in the given cloud project * [ovhcloud cloud ip](ovhcloud_cloud_ip.md) - Manage public IPs (floating and failover) in the given cloud project +* [ovhcloud cloud key-manager](ovhcloud_cloud_key-manager.md) - Manage Key Management Service (KMS) resources 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 diff --git a/doc/ovhcloud_cloud_key-manager.md b/doc/ovhcloud_cloud_key-manager.md new file mode 100644 index 00000000..9eff59ab --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager.md @@ -0,0 +1,36 @@ +## ovhcloud cloud key-manager + +Manage Key Management Service (KMS) resources in the given cloud project + +### Options + +``` + --cloud-project string Cloud project ID + -h, --help help for key-manager +``` + +### 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 key-manager container](ovhcloud_cloud_key-manager_container.md) - Manage Key Manager containers +* [ovhcloud cloud key-manager secret](ovhcloud_cloud_key-manager_secret.md) - Manage Key Manager secrets + diff --git a/doc/ovhcloud_cloud_key-manager_container.md b/doc/ovhcloud_cloud_key-manager_container.md new file mode 100644 index 00000000..23f09064 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container.md @@ -0,0 +1,40 @@ +## ovhcloud cloud key-manager container + +Manage Key Manager containers + +### Options + +``` + -h, --help help for container +``` + +### 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 key-manager](ovhcloud_cloud_key-manager.md) - Manage Key Management Service (KMS) resources in the given cloud project +* [ovhcloud cloud key-manager container consumer](ovhcloud_cloud_key-manager_container_consumer.md) - Manage consumers of a Key Manager container +* [ovhcloud cloud key-manager container create](ovhcloud_cloud_key-manager_container_create.md) - Create a new Key Manager container +* [ovhcloud cloud key-manager container delete](ovhcloud_cloud_key-manager_container_delete.md) - Delete the given Key Manager container +* [ovhcloud cloud key-manager container edit](ovhcloud_cloud_key-manager_container_edit.md) - Edit the given Key Manager container (only secret references are mutable) +* [ovhcloud cloud key-manager container get](ovhcloud_cloud_key-manager_container_get.md) - Get a specific Key Manager container +* [ovhcloud cloud key-manager container list](ovhcloud_cloud_key-manager_container_list.md) - List Key Manager containers + diff --git a/doc/ovhcloud_cloud_key-manager_container_consumer.md b/doc/ovhcloud_cloud_key-manager_container_consumer.md new file mode 100644 index 00000000..c7b8faa7 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_consumer.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager container consumer + +Manage consumers of a Key Manager container + +### Options + +``` + -h, --help help for consumer +``` + +### 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 key-manager container](ovhcloud_cloud_key-manager_container.md) - Manage Key Manager containers +* [ovhcloud cloud key-manager container consumer delete](ovhcloud_cloud_key-manager_container_consumer_delete.md) - Delete a consumer from the given container +* [ovhcloud cloud key-manager container consumer get](ovhcloud_cloud_key-manager_container_consumer_get.md) - Get a specific consumer of the given container +* [ovhcloud cloud key-manager container consumer list](ovhcloud_cloud_key-manager_container_consumer_list.md) - List consumers registered for the given container +* [ovhcloud cloud key-manager container consumer register](ovhcloud_cloud_key-manager_container_consumer_register.md) - Register a consumer for the given container + diff --git a/doc/ovhcloud_cloud_key-manager_container_consumer_delete.md b/doc/ovhcloud_cloud_key-manager_container_consumer_delete.md new file mode 100644 index 00000000..699a193c --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_consumer_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager container consumer delete + +Delete a consumer from the given container + +``` +ovhcloud cloud key-manager container consumer 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 key-manager container consumer](ovhcloud_cloud_key-manager_container_consumer.md) - Manage consumers of a Key Manager container + diff --git a/doc/ovhcloud_cloud_key-manager_container_consumer_get.md b/doc/ovhcloud_cloud_key-manager_container_consumer_get.md new file mode 100644 index 00000000..f3592a85 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_consumer_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager container consumer get + +Get a specific consumer of the given container + +``` +ovhcloud cloud key-manager container consumer 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 key-manager container consumer](ovhcloud_cloud_key-manager_container_consumer.md) - Manage consumers of a Key Manager container + diff --git a/doc/ovhcloud_cloud_key-manager_container_consumer_list.md b/doc/ovhcloud_cloud_key-manager_container_consumer_list.md new file mode 100644 index 00000000..507310c2 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_consumer_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud key-manager container consumer list + +List consumers registered for the given container + +``` +ovhcloud cloud key-manager container consumer 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 key-manager container consumer](ovhcloud_cloud_key-manager_container_consumer.md) - Manage consumers of a Key Manager container + diff --git a/doc/ovhcloud_cloud_key-manager_container_consumer_register.md b/doc/ovhcloud_cloud_key-manager_container_consumer_register.md new file mode 100644 index 00000000..f10d3d59 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_consumer_register.md @@ -0,0 +1,41 @@ +## ovhcloud cloud key-manager container consumer register + +Register a consumer for the given container + +``` +ovhcloud cloud key-manager container consumer register [flags] +``` + +### Options + +``` + -h, --help help for register + --resource-id string UUID of the resource consuming the secret/container + --resource-type string Type of the consuming resource (IMAGE, INSTANCE, LOADBALANCER) + --service string OpenStack service type of the consumer (COMPUTE, IMAGE, LOADBALANCER, NETWORK) +``` + +### 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 key-manager container consumer](ovhcloud_cloud_key-manager_container_consumer.md) - Manage consumers of a Key Manager container + diff --git a/doc/ovhcloud_cloud_key-manager_container_create.md b/doc/ovhcloud_cloud_key-manager_container_create.md new file mode 100644 index 00000000..08e47000 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_create.md @@ -0,0 +1,48 @@ +## ovhcloud cloud key-manager container create + +Create a new Key Manager container + +``` +ovhcloud cloud key-manager container create [flags] +``` + +### Options + +``` + --availability-zone string Availability zone within the region + --editor Use a text editor to define parameters + --from-file string File containing parameters + -h, --help help for create + --init-file string Create a file with example parameters + --name string Desired container name + --region string Region code where the container is located + --replace Replace parameters file if it already exists + --secret-ref stringArray Secret reference as '=' (repeatable) + --type string Type of the container (CERTIFICATE, GENERIC, RSA) + --wait Wait for the container to be ready before exiting +``` + +### 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 key-manager container](ovhcloud_cloud_key-manager_container.md) - Manage Key Manager containers + diff --git a/doc/ovhcloud_cloud_key-manager_container_delete.md b/doc/ovhcloud_cloud_key-manager_container_delete.md new file mode 100644 index 00000000..e28b3c46 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager container delete + +Delete the given Key Manager container + +``` +ovhcloud cloud key-manager container 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 key-manager container](ovhcloud_cloud_key-manager_container.md) - Manage Key Manager containers + diff --git a/doc/ovhcloud_cloud_key-manager_container_edit.md b/doc/ovhcloud_cloud_key-manager_container_edit.md new file mode 100644 index 00000000..cae6b030 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_edit.md @@ -0,0 +1,40 @@ +## ovhcloud cloud key-manager container edit + +Edit the given Key Manager container (only secret references are mutable) + +``` +ovhcloud cloud key-manager container edit [flags] +``` + +### Options + +``` + --editor Use a text editor to define parameters + -h, --help help for edit + --secret-ref stringArray Secret reference as '=' (repeatable, replaces all existing references) +``` + +### 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 key-manager container](ovhcloud_cloud_key-manager_container.md) - Manage Key Manager containers + diff --git a/doc/ovhcloud_cloud_key-manager_container_get.md b/doc/ovhcloud_cloud_key-manager_container_get.md new file mode 100644 index 00000000..5ebee252 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager container get + +Get a specific Key Manager container + +``` +ovhcloud cloud key-manager container 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 key-manager container](ovhcloud_cloud_key-manager_container.md) - Manage Key Manager containers + diff --git a/doc/ovhcloud_cloud_key-manager_container_list.md b/doc/ovhcloud_cloud_key-manager_container_list.md new file mode 100644 index 00000000..1dcecf38 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_container_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud key-manager container list + +List Key Manager containers + +``` +ovhcloud cloud key-manager container 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 key-manager container](ovhcloud_cloud_key-manager_container.md) - Manage Key Manager containers + diff --git a/doc/ovhcloud_cloud_key-manager_secret.md b/doc/ovhcloud_cloud_key-manager_secret.md new file mode 100644 index 00000000..a197beb1 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret.md @@ -0,0 +1,41 @@ +## ovhcloud cloud key-manager secret + +Manage Key Manager secrets + +### Options + +``` + -h, --help help for secret +``` + +### 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 key-manager](ovhcloud_cloud_key-manager.md) - Manage Key Management Service (KMS) resources in the given cloud project +* [ovhcloud cloud key-manager secret consumer](ovhcloud_cloud_key-manager_secret_consumer.md) - Manage consumers of a Key Manager secret +* [ovhcloud cloud key-manager secret create](ovhcloud_cloud_key-manager_secret_create.md) - Create a new Key Manager secret +* [ovhcloud cloud key-manager secret delete](ovhcloud_cloud_key-manager_secret_delete.md) - Delete the given Key Manager secret +* [ovhcloud cloud key-manager secret edit](ovhcloud_cloud_key-manager_secret_edit.md) - Edit the given Key Manager secret (only metadata is mutable) +* [ovhcloud cloud key-manager secret get](ovhcloud_cloud_key-manager_secret_get.md) - Get a specific Key Manager secret +* [ovhcloud cloud key-manager secret list](ovhcloud_cloud_key-manager_secret_list.md) - List Key Manager secrets +* [ovhcloud cloud key-manager secret payload](ovhcloud_cloud_key-manager_secret_payload.md) - Fetch the payload (sensitive material) of the given Key Manager secret + diff --git a/doc/ovhcloud_cloud_key-manager_secret_consumer.md b/doc/ovhcloud_cloud_key-manager_secret_consumer.md new file mode 100644 index 00000000..3354593d --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_consumer.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager secret consumer + +Manage consumers of a Key Manager secret + +### Options + +``` + -h, --help help for consumer +``` + +### 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 key-manager secret](ovhcloud_cloud_key-manager_secret.md) - Manage Key Manager secrets +* [ovhcloud cloud key-manager secret consumer delete](ovhcloud_cloud_key-manager_secret_consumer_delete.md) - Delete a consumer from the given secret +* [ovhcloud cloud key-manager secret consumer get](ovhcloud_cloud_key-manager_secret_consumer_get.md) - Get a specific consumer of the given secret +* [ovhcloud cloud key-manager secret consumer list](ovhcloud_cloud_key-manager_secret_consumer_list.md) - List consumers registered for the given secret +* [ovhcloud cloud key-manager secret consumer register](ovhcloud_cloud_key-manager_secret_consumer_register.md) - Register a consumer for the given secret + diff --git a/doc/ovhcloud_cloud_key-manager_secret_consumer_delete.md b/doc/ovhcloud_cloud_key-manager_secret_consumer_delete.md new file mode 100644 index 00000000..5f116b80 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_consumer_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager secret consumer delete + +Delete a consumer from the given secret + +``` +ovhcloud cloud key-manager secret consumer 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 key-manager secret consumer](ovhcloud_cloud_key-manager_secret_consumer.md) - Manage consumers of a Key Manager secret + diff --git a/doc/ovhcloud_cloud_key-manager_secret_consumer_get.md b/doc/ovhcloud_cloud_key-manager_secret_consumer_get.md new file mode 100644 index 00000000..efccf5e6 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_consumer_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager secret consumer get + +Get a specific consumer of the given secret + +``` +ovhcloud cloud key-manager secret consumer 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 key-manager secret consumer](ovhcloud_cloud_key-manager_secret_consumer.md) - Manage consumers of a Key Manager secret + diff --git a/doc/ovhcloud_cloud_key-manager_secret_consumer_list.md b/doc/ovhcloud_cloud_key-manager_secret_consumer_list.md new file mode 100644 index 00000000..111c8c92 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_consumer_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud key-manager secret consumer list + +List consumers registered for the given secret + +``` +ovhcloud cloud key-manager secret consumer 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 key-manager secret consumer](ovhcloud_cloud_key-manager_secret_consumer.md) - Manage consumers of a Key Manager secret + diff --git a/doc/ovhcloud_cloud_key-manager_secret_consumer_register.md b/doc/ovhcloud_cloud_key-manager_secret_consumer_register.md new file mode 100644 index 00000000..aac181cb --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_consumer_register.md @@ -0,0 +1,41 @@ +## ovhcloud cloud key-manager secret consumer register + +Register a consumer for the given secret + +``` +ovhcloud cloud key-manager secret consumer register [flags] +``` + +### Options + +``` + -h, --help help for register + --resource-id string UUID of the resource consuming the secret/container + --resource-type string Type of the consuming resource (IMAGE, INSTANCE, LOADBALANCER) + --service string OpenStack service type of the consumer (COMPUTE, IMAGE, LOADBALANCER, NETWORK) +``` + +### 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 key-manager secret consumer](ovhcloud_cloud_key-manager_secret_consumer.md) - Manage consumers of a Key Manager secret + diff --git a/doc/ovhcloud_cloud_key-manager_secret_create.md b/doc/ovhcloud_cloud_key-manager_secret_create.md new file mode 100644 index 00000000..291cb604 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_create.md @@ -0,0 +1,54 @@ +## ovhcloud cloud key-manager secret create + +Create a new Key Manager secret + +``` +ovhcloud cloud key-manager secret create [flags] +``` + +### Options + +``` + --algorithm string Algorithm associated with the secret (AES, DH, DSA, EC, RSA) + --availability-zone string Availability zone within the region + --bit-length int Bit length of the secret (128, 256, 512, 1024, 2048, 4096) + --editor Use a text editor to define parameters + --expiration string Expiration date and time of the secret (RFC3339) + --from-file string File containing parameters + -h, --help help for create + --init-file string Create a file with example parameters + --metadata stringToString Metadata key-value pairs for the secret (default []) + --mode string Mode of the algorithm (CBC, CTR) + --name string Human-readable name of the secret + --payload string Secret payload data (base64-encoded, write-only). Requires --payload-content-type + --payload-content-type string Content type of the payload (APPLICATION_OCTET_STREAM, APPLICATION_PKCS8, APPLICATION_PKIX_CERT, TEXT_PLAIN) + --region string Region code where the secret is located + --replace Replace parameters file if it already exists + --secret-type string Type of the secret (CERTIFICATE, OPAQUE, PASSPHRASE, PRIVATE, PUBLIC, SYMMETRIC) + --wait Wait for the secret to be ready before exiting +``` + +### 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 key-manager secret](ovhcloud_cloud_key-manager_secret.md) - Manage Key Manager secrets + diff --git a/doc/ovhcloud_cloud_key-manager_secret_delete.md b/doc/ovhcloud_cloud_key-manager_secret_delete.md new file mode 100644 index 00000000..b08501cb --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_delete.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager secret delete + +Delete the given Key Manager secret + +``` +ovhcloud cloud key-manager secret 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 key-manager secret](ovhcloud_cloud_key-manager_secret.md) - Manage Key Manager secrets + diff --git a/doc/ovhcloud_cloud_key-manager_secret_edit.md b/doc/ovhcloud_cloud_key-manager_secret_edit.md new file mode 100644 index 00000000..a1c477aa --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_edit.md @@ -0,0 +1,40 @@ +## ovhcloud cloud key-manager secret edit + +Edit the given Key Manager secret (only metadata is mutable) + +``` +ovhcloud cloud key-manager secret edit [flags] +``` + +### Options + +``` + --editor Use a text editor to define parameters + -h, --help help for edit + --metadata stringToString Metadata key-value pairs (replaces all existing metadata) (default []) +``` + +### 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 key-manager secret](ovhcloud_cloud_key-manager_secret.md) - Manage Key Manager secrets + diff --git a/doc/ovhcloud_cloud_key-manager_secret_get.md b/doc/ovhcloud_cloud_key-manager_secret_get.md new file mode 100644 index 00000000..5f721d2f --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_get.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager secret get + +Get a specific Key Manager secret + +``` +ovhcloud cloud key-manager secret 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 key-manager secret](ovhcloud_cloud_key-manager_secret.md) - Manage Key Manager secrets + diff --git a/doc/ovhcloud_cloud_key-manager_secret_list.md b/doc/ovhcloud_cloud_key-manager_secret_list.md new file mode 100644 index 00000000..0a0e4279 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_list.md @@ -0,0 +1,45 @@ +## ovhcloud cloud key-manager secret list + +List Key Manager secrets + +``` +ovhcloud cloud key-manager secret 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 key-manager secret](ovhcloud_cloud_key-manager_secret.md) - Manage Key Manager secrets + diff --git a/doc/ovhcloud_cloud_key-manager_secret_payload.md b/doc/ovhcloud_cloud_key-manager_secret_payload.md new file mode 100644 index 00000000..a2441c39 --- /dev/null +++ b/doc/ovhcloud_cloud_key-manager_secret_payload.md @@ -0,0 +1,38 @@ +## ovhcloud cloud key-manager secret payload + +Fetch the payload (sensitive material) of the given Key Manager secret + +``` +ovhcloud cloud key-manager secret payload [flags] +``` + +### Options + +``` + -h, --help help for payload +``` + +### 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 key-manager secret](ovhcloud_cloud_key-manager_secret.md) - Manage Key Manager secrets + diff --git a/internal/assets/api-schemas/cloud_v2.json b/internal/assets/api-schemas/cloud_v2.json index d03d70b5..1cff0e7a 100644 --- a/internal/assets/api-schemas/cloud_v2.json +++ b/internal/assets/api-schemas/cloud_v2.json @@ -1157,32 +1157,2864 @@ "description": "Time (e.g., 15:04:05)", "format": "time", "example": "15:04:05" + }, + "publicCloud.keyManager.SecretConsumerInput": { + "type": "object", + "description": "Payload to register or unregister a consumer for a Key Manager secret", + "properties": { + "resourceId": { + "type": "string", + "description": "UUID of the resource consuming the secret", + "format": "uuid" + }, + "resourceType": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ConsumerResourceTypeEnum" + } + ], + "description": "Type of the resource consuming the secret" + }, + "service": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ConsumerServiceEnum" + } + ], + "description": "OpenStack service type of the consumer" + } + }, + "required": [ + "resourceId", + "resourceType", + "service" + ] + }, + "publicCloud.keyManager.ModeEnum": { + "type": "string", + "description": "Block cipher mode associated with a Key Manager secret", + "enum": [ + "CBC", + "CTR" + ] + }, + "publicCloud.keyManager.SecretCurrentState": { + "type": "object", + "description": "Current state of a Key Manager secret from OpenStack", + "properties": { + "algorithm": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.AlgorithmEnum" + } + ], + "description": "Algorithm associated with the secret", + "nullable": true, + "readOnly": true + }, + "bitLength": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.BitLengthEnum" + } + ], + "description": "Bit length of the secret", + "nullable": true, + "readOnly": true + }, + "creatorId": { + "type": "string", + "description": "Identifier of the user who created the secret", + "nullable": true, + "readOnly": true + }, + "expiration": { + "type": "string", + "description": "Expiration date and time of the secret", + "nullable": true, + "format": "date-time", + "readOnly": true + }, + "location": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.common.Location" + } + ], + "description": "Current location of the secret", + "readOnly": true + }, + "metadata": { + "type": "object", + "description": "Key-value metadata pairs for the secret", + "nullable": true, + "additionalProperties": { + "type": "string" + }, + "readOnly": true + }, + "mode": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ModeEnum" + } + ], + "description": "Mode of the algorithm", + "nullable": true, + "readOnly": true + }, + "name": { + "type": "string", + "description": "Human-readable name of the secret", + "nullable": true, + "readOnly": true + }, + "payloadContentType": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.PayloadContentTypeEnum" + } + ], + "description": "Content type of the secret payload", + "nullable": true, + "readOnly": true + }, + "secretType": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretTypeEnum" + } + ], + "description": "Type of the secret", + "readOnly": true + }, + "status": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretStatusEnum" + } + ], + "description": "OpenStack status of the secret", + "readOnly": true + } + } + }, + "publicCloud.keyManager.AlgorithmEnum": { + "type": "string", + "description": "Algorithm associated with a Key Manager secret", + "enum": [ + "AES", + "DH", + "DSA", + "EC", + "RSA" + ] + }, + "publicCloud.keyManager.SecretUpdate": { + "type": "object", + "description": "Payload to update a Public Cloud Key Manager secret", + "properties": { + "checksum": { + "type": "string", + "description": "Computed hash controlling concurrent modifications" + }, + "targetSpec": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretUpdateTargetSpec" + } + ], + "description": "Desired target specification for the secret" + } + }, + "required": [ + "checksum", + "targetSpec" + ] + }, + "publicCloud.keyManager.ContainerCreation": { + "type": "object", + "description": "Payload to create a Public Cloud key manager container", + "properties": { + "targetSpec": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerTargetSpec" + } + ], + "description": "Desired target specification for the container" + } + }, + "required": [ + "targetSpec" + ] + }, + "publicCloud.keyManager.ContainerCurrentState": { + "type": "object", + "description": "Current state of a key manager container as observed from the infrastructure", + "properties": { + "creatorId": { + "type": "string", + "description": "Identifier of the user who created the container", + "nullable": true, + "readOnly": true + }, + "location": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.common.Location" + } + ], + "description": "Current location", + "readOnly": true + }, + "name": { + "type": "string", + "description": "Current container name", + "readOnly": true + }, + "secretRefs": { + "type": "array", + "description": "Current secret references in the container", + "nullable": true, + "items": { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerSecretRef" + }, + "readOnly": true + }, + "status": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerStatusEnum" + } + ], + "description": "OpenStack container status", + "readOnly": true + }, + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerTypeEnum" + } + ], + "description": "Current container type", + "readOnly": true + } + } + }, + "publicCloud.keyManager.ConsumerServiceEnum": { + "type": "string", + "description": "Type of service consuming a Key Manager secret", + "enum": [ + "COMPUTE", + "IMAGE", + "LOADBALANCER", + "NETWORK" + ] + }, + "publicCloud.keyManager.SecretStatusEnum": { + "type": "string", + "description": "Status of a Key Manager secret in OpenStack", + "enum": [ + "ACTIVE", + "ERROR" + ] + }, + "publicCloud.keyManager.Secret": { + "type": "object", + "description": "A Public Cloud Key Manager secret", + "properties": { + "checksum": { + "type": "string", + "description": "Computed hash representing the current target specification value", + "readOnly": true + }, + "createdAt": { + "type": "string", + "description": "Creation date of the secret", + "format": "date-time", + "readOnly": true + }, + "currentState": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretCurrentState" + } + ], + "description": "Current state of the secret", + "nullable": true, + "readOnly": true + }, + "currentTasks": { + "type": "array", + "description": "Ongoing asynchronous tasks related to the secret", + "nullable": true, + "items": { + "$ref": "#/components/schemas/common.CurrentTask" + }, + "readOnly": true + }, + "id": { + "type": "string", + "description": "Unique identifier of the secret", + "format": "uuid", + "readOnly": true + }, + "resourceStatus": { + "allOf": [ + { + "$ref": "#/components/schemas/common.ResourceStatusEnum" + } + ], + "description": "Secret readiness in the system", + "readOnly": true + }, + "targetSpec": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretTargetSpec" + } + ], + "description": "Last target specification of the secret", + "readOnly": true + }, + "updatedAt": { + "type": "string", + "description": "Last update date of the secret", + "format": "date-time", + "readOnly": true + } + } + }, + "publicCloud.keyManager.ConsumerResourceTypeEnum": { + "type": "string", + "description": "Type of resource consuming a Key Manager secret", + "enum": [ + "IMAGE", + "INSTANCE", + "LOADBALANCER" + ] + }, + "publicCloud.keyManager.ContainerSecretRefSecret": { + "type": "object", + "description": "Reference to a secret by ID", + "properties": { + "id": { + "type": "string", + "description": "Unique identifier of the referenced secret", + "format": "uuid" + } + }, + "required": [ + "id" + ] + }, + "publicCloud.keyManager.ContainerUpdateTargetSpec": { + "type": "object", + "description": "Target specification for updating a Key Manager container (only secretRefs are mutable)", + "properties": { + "secretRefs": { + "type": "array", + "description": "Desired list of secret references. Replaces all existing references.", + "items": { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerSecretRef" + } + } + }, + "required": [ + "secretRefs" + ] + }, + "publicCloud.keyManager.ContainerStatusEnum": { + "type": "string", + "description": "Status of a Key Manager container in OpenStack", + "enum": [ + "ACTIVE", + "ERROR" + ] + }, + "publicCloud.keyManager.SecretPayload": { + "type": "object", + "description": "Payload content of a Key Manager secret", + "properties": { + "payload": { + "type": "string", + "description": "Secret payload data", + "format": "password", + "readOnly": true + } + } + }, + "publicCloud.keyManager.SecretConsumer": { + "type": "object", + "description": "A consumer registered for a Key Manager secret", + "properties": { + "id": { + "type": "string", + "description": "Computed consumer identifier", + "readOnly": true + }, + "resourceId": { + "type": "string", + "description": "UUID of the resource consuming the secret", + "format": "uuid", + "readOnly": true + }, + "resourceType": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ConsumerResourceTypeEnum" + } + ], + "description": "Type of the resource consuming the secret", + "readOnly": true + }, + "service": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ConsumerServiceEnum" + } + ], + "description": "OpenStack service type of the consumer", + "readOnly": true + } + } + }, + "publicCloud.keyManager.SecretTypeEnum": { + "type": "string", + "description": "Type of a Key Manager secret", + "enum": [ + "CERTIFICATE", + "OPAQUE", + "PASSPHRASE", + "PRIVATE", + "PUBLIC", + "SYMMETRIC" + ] + }, + "publicCloud.keyManager.ContainerTargetSpec": { + "type": "object", + "description": "Target specification for a key manager container", + "properties": { + "location": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.common.Location" + } + ], + "description": "Target location" + }, + "name": { + "type": "string", + "description": "Desired container name" + }, + "secretRefs": { + "type": "array", + "description": "Secret references to include in the container", + "nullable": true, + "items": { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerSecretRef" + } + }, + "type": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerTypeEnum" + } + ], + "description": "Type of the container" + } + }, + "required": [ + "location", + "name", + "type" + ] + }, + "publicCloud.keyManager.ContainerTypeEnum": { + "type": "string", + "description": "Possible types for a key manager container", + "enum": [ + "CERTIFICATE", + "GENERIC", + "RSA" + ] + }, + "publicCloud.keyManager.ContainerConsumer": { + "type": "object", + "description": "A consumer registered for a Key Manager container", + "properties": { + "id": { + "type": "string", + "description": "Computed consumer identifier", + "readOnly": true + }, + "resourceId": { + "type": "string", + "description": "UUID of the resource consuming the container", + "format": "uuid", + "readOnly": true + }, + "resourceType": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ConsumerResourceTypeEnum" + } + ], + "description": "Type of the resource consuming the container", + "readOnly": true + }, + "service": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ConsumerServiceEnum" + } + ], + "description": "OpenStack service type of the consumer", + "readOnly": true + } + } + }, + "publicCloud.keyManager.ContainerUpdate": { + "type": "object", + "description": "Payload to update a Public Cloud key manager container", + "properties": { + "checksum": { + "type": "string", + "description": "Computed hash controlling concurrent modifications" + }, + "targetSpec": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerUpdateTargetSpec" + } + ], + "description": "Desired target specification for the container" + } + }, + "required": [ + "checksum", + "targetSpec" + ] + }, + "publicCloud.keyManager.SecretTargetSpec": { + "type": "object", + "description": "Desired specification for a Key Manager secret", + "properties": { + "algorithm": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.AlgorithmEnum" + } + ], + "description": "Algorithm associated with the secret", + "nullable": true + }, + "bitLength": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.BitLengthEnum" + } + ], + "description": "Bit length of the secret", + "nullable": true + }, + "expiration": { + "type": "string", + "description": "Expiration date and time of the secret", + "nullable": true, + "format": "date-time" + }, + "location": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.common.Location" + } + ], + "description": "Target location for the secret" + }, + "metadata": { + "type": "object", + "description": "Key-value metadata pairs for the secret", + "nullable": true, + "additionalProperties": { + "type": "string" + } + }, + "mode": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ModeEnum" + } + ], + "description": "Mode of the algorithm", + "nullable": true + }, + "name": { + "type": "string", + "description": "Human-readable name of the secret", + "nullable": true + }, + "payload": { + "type": "string", + "description": "Secret payload data (base64-encoded). Write-only, never returned in responses. Requires payloadContentType.", + "nullable": true, + "format": "password" + }, + "payloadContentType": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.PayloadContentTypeEnum" + } + ], + "description": "Content type of the secret payload", + "nullable": true + }, + "secretType": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretTypeEnum" + } + ], + "description": "Type of the secret" + } + }, + "required": [ + "location", + "secretType" + ] + }, + "publicCloud.keyManager.PayloadContentTypeEnum": { + "type": "string", + "description": "Content type of a Key Manager secret payload", + "enum": [ + "APPLICATION_OCTET_STREAM", + "APPLICATION_PKCS8", + "APPLICATION_PKIX_CERT", + "TEXT_PLAIN" + ] + }, + "publicCloud.common.Location": { + "type": "object", + "description": "Resource location", + "properties": { + "availabilityZone": { + "type": "string", + "description": "Availability zone within the region", + "nullable": true + }, + "region": { + "type": "string", + "description": "Region code" + } + }, + "required": [ + "region" + ] + }, + "publicCloud.keyManager.SecretCreation": { + "type": "object", + "description": "Payload to create a Key Manager secret", + "properties": { + "targetSpec": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretTargetSpec" + } + ], + "description": "Desired target specification for the secret to create" + } + }, + "required": [ + "targetSpec" + ] + }, + "publicCloud.keyManager.Container": { + "type": "object", + "description": "A Public Cloud key manager container", + "properties": { + "checksum": { + "type": "string", + "description": "Computed hash representing the current target specification value", + "readOnly": true + }, + "createdAt": { + "type": "string", + "description": "Creation date of the container", + "format": "date-time", + "readOnly": true + }, + "currentState": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerCurrentState" + } + ], + "description": "Current observed state of the container from the infrastructure", + "nullable": true, + "readOnly": true + }, + "currentTasks": { + "type": "array", + "description": "Ongoing asynchronous tasks related to the container", + "nullable": true, + "items": { + "$ref": "#/components/schemas/common.CurrentTask" + }, + "readOnly": true + }, + "id": { + "type": "string", + "description": "Unique identifier of the container", + "format": "uuid", + "readOnly": true + }, + "resourceStatus": { + "allOf": [ + { + "$ref": "#/components/schemas/common.ResourceStatusEnum" + } + ], + "description": "Container readiness in the system", + "readOnly": true + }, + "targetSpec": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerTargetSpec" + } + ], + "description": "Last target specification of the container", + "readOnly": true + }, + "updatedAt": { + "type": "string", + "description": "Last update date of the container", + "format": "date-time", + "readOnly": true + } + } + }, + "publicCloud.keyManager.SecretUpdateTargetSpec": { + "type": "object", + "description": "Target specification for updating a Key Manager secret (only metadata is mutable)", + "properties": { + "metadata": { + "type": "object", + "description": "Metadata key-value pairs for the secret. Replaces all existing metadata.", + "additionalProperties": { + "type": "string" + } + } + }, + "required": [ + "metadata" + ] + }, + "publicCloud.keyManager.BitLengthEnum": { + "type": "integer", + "description": "Bit length of a Key Manager secret", + "enum": [ + 128, + 256, + 512, + 1024, + 2048, + 4096 + ] + }, + "publicCloud.keyManager.ContainerSecretRef": { + "type": "object", + "description": "A secret reference within a key manager container", + "properties": { + "name": { + "type": "string", + "description": "Role name of the secret reference (e.g. private_key, certificate, public_key)" + }, + "secret": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerSecretRefSecret" + } + ], + "description": "Reference to the secret" + } + }, + "required": [ + "name", + "secret" + ] + }, + "publicCloud.keyManager.ContainerConsumerInput": { + "type": "object", + "description": "Payload to register or unregister a consumer for a Key Manager container", + "properties": { + "resourceId": { + "type": "string", + "description": "UUID of the resource consuming the container", + "format": "uuid" + }, + "resourceType": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ConsumerResourceTypeEnum" + } + ], + "description": "Type of the resource consuming the container" + }, + "service": { + "allOf": [ + { + "$ref": "#/components/schemas/publicCloud.keyManager.ConsumerServiceEnum" + } + ], + "description": "OpenStack service type of the consumer" + } + }, + "required": [ + "resourceId", + "resourceType", + "service" + ] + } + }, + "securitySchemes": { + "oAuth2AuthCode": { + "type": "oauth2", + "description": "Oauth2", + "x-client-id": "1bb9c7df371741c0", + "x-client-secret": "a5b4de870aca620d10fbf63cd18d205b", + "flows": { + "authorizationCode": { + "authorizationUrl": "https://www.ovh.com/auth/oauth2/authorize", + "tokenUrl": "https://www.ovh.com/auth/oauth2/token", + "scopes": { + "account/all": "Manage your account", + "all": "Manage your whole account and all your services", + "services/all": "Manage your services lifecycle and billing" + } + } + } + } + } + }, + "paths": { + "/publicCloud/project": { + "get": { + "summary": "List all Public Cloud projects", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "query", + "name": "iamTags", + "description": "Filter resources on IAM tags", + "schema": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/iam.resource.TagFilter" + } + } + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.project.ProjectAsyncWithIAM" + } + } + } + } + } + }, + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:get", + "required": true + } + ], + "x-expanded-response": "PublicCloudProjectProjectAsyncWithIAM" + }, + "post": { + "summary": "Create a new cloud project", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.project.ProjectCreation" + } + } + } + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.project.ProjectAsync" + } + } + } + } + }, + "x-badges": [ + { + "color": "orange", + "label": "Internal use only" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:create", + "required": true + }, + { + "name": "billingAccount:apiovh:subscription/publicCloudProject/create", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}": { + "get": { + "summary": "Get details on a Public Cloud project", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.project.ProjectAsyncWithIAM" + } + } + } + } + }, + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:get", + "required": true + } + ] + }, + "put": { + "summary": "Update an existing cloud project", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.project.ProjectCreation" + } + } + } + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.project.ProjectAsync" + } + } + } + } + }, + "x-badges": [ + { + "color": "orange", + "label": "Internal use only" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:edit", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/rancher": { + "get": { + "summary": "List managed Rancher services", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.rancher.Rancher" + } + }, + "examples": { + "Example": { + "value": [ + { + "createdAt": "2020-12-31T07:39:19Z", + "currentState": { + "iamAuthEnabled": false, + "ipRestrictions": [ + { + "cidrBlock": "198.51.100.1/32", + "description": "My IP restriction" + } + ], + "name": "my_rancher", + "networking": { + "egressCidrBlocks": [ + "203.0.113.0/24" + ] + }, + "plan": "OVHCLOUD_EDITION", + "region": "EU_WEST_RBX", + "url": "https://aaaaaa.bbbb.rancher.ovhcloud.example", + "usage": { + "datetime": "2020-12-31T13:00:00Z", + "orchestratedVcpus": 16 + }, + "version": "1.0.0" + }, + "currentTasks": [], + "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", + "resourceStatus": "READY", + "targetSpec": { + "iamAuthEnabled": false, + "ipRestrictions": [ + { + "cidrBlock": "198.51.100.1/32", + "description": "My IP restriction" + } + ], + "name": "my_rancher", + "plan": "OVHCLOUD_EDITION", + "version": "1.0.0" + }, + "updatedAt": "2020-12-31T07:39:19Z" + }, + { + "createdAt": "2020-12-31T13:37:46Z", + "currentState": { + "iamAuthEnabled": false, + "ipRestrictions": [], + "name": "rancher2", + "plan": "STANDARD", + "region": "EU_WEST_RBX", + "url": "https://cccccc.bbbb.rancher.ovhcloud.example", + "version": "1.0.0" + }, + "currentTasks": [ + { + "id": "30017036-ddb2-40a8-ad56-6d765b059aab", + "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/222ce105-a3f7-44c4-a7d3-dbb5983c045d/task/30017036-ddb2-40a8-ad56-6d765b059aab", + "type": "RANCHER_UPDATE" + } + ], + "id": "222ce105-a3f7-44c4-a7d3-dbb5983c045d", + "resourceStatus": "UPDATING", + "targetSpec": { + "iamAuthEnabled": false, + "ipRestrictions": [], + "name": "rancher2", + "plan": "STANDARD", + "version": "1.1.0" + }, + "updatedAt": "2020-12-31T13:40:46Z" + } + ], + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/get", + "required": true + } + ], + "x-response-identifier": "id", + "x-expanded-response": "PublicCloudRancherRancher" + }, + "post": { + "summary": "Create a new managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.rancher.RancherCreation" + }, + "examples": { + "Create a STANDARD managed Rancher on the latest version": { + "value": { + "targetSpec": { + "iamAuthEnabled": false, + "name": "my_rancher", + "plan": "STANDARD" + } + }, + "summary": "Request body for creating a managed Rancher on plan STANDARD" + }, + "Create an OVHCLOUD_EDITION managed Rancher on a specific version": { + "value": { + "targetSpec": { + "iamAuthEnabled": false, + "name": "my_rancher", + "plan": "OVHCLOUD_EDITION", + "version": "1.0.0" + } + }, + "summary": "Request body for creating a managed Rancher on plan OVHCLOUD_EDITION with a specific version" + } + } + } + } + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.rancher.Rancher" + }, + "examples": { + "Example": { + "value": { + "createdAt": "2020-12-31T07:39:19Z", + "currentState": { + "bootstrapPassword": "jL%IctBOu)-$D@wa", + "iamAuthEnabled": false, + "ipRestrictions": [], + "name": "my_rancher", + "plan": "OVHCLOUD_EDITION", + "region": "EU_WEST_RBX", + "version": "1.0.0" + }, + "currentTasks": [ + { + "id": "aad7c39d-ed0e-44c3-9624-096a0ef569f2", + "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/d6b6579e-8d60-4487-bf08-8b4ddf98f7d3/task/aad7c39d-ed0e-44c3-9624-096a0ef569f2", + "type": "RANCHER_CREATE" + } + ], + "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", + "resourceStatus": "CREATING", + "targetSpec": { + "iamAuthEnabled": false, + "ipRestrictions": [], + "name": "my_rancher", + "plan": "OVHCLOUD_EDITION", + "version": "1.0.0" + }, + "updatedAt": "2020-12-31T07:39:19Z" + }, + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/create", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/rancher/{rancherId}": { + "delete": { + "summary": "Delete a managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.rancher.Rancher" + }, + "examples": { + "Example": { + "value": { + "createdAt": "2020-12-31T07:39:19Z", + "currentState": { + "iamAuthEnabled": false, + "ipRestrictions": [], + "name": "my_rancher", + "networking": { + "egressCidrBlocks": [ + "203.0.113.0/24" + ] + }, + "plan": "OVHCLOUD_EDITION", + "region": "EU_WEST_RBX", + "url": "https://aaaaaa.bbbb.rancher.ovhcloud.example", + "usage": { + "datetime": "2020-12-31T09:00:00Z", + "orchestratedVcpus": 16 + }, + "version": "1.0.0" + }, + "currentTasks": [ + { + "id": "aad7c39d-ed0e-44c3-9624-096a0ef569f2", + "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/d6b6579e-8d60-4487-bf08-8b4ddf98f7d3/task/aad7c39d-ed0e-44c3-9624-096a0ef569f2", + "type": "RANCHER_DELETE" + } + ], + "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", + "resourceStatus": "DELETING", + "targetSpec": { + "iamAuthEnabled": false, + "ipRestrictions": [], + "name": "my_rancher", + "plan": "OVHCLOUD_EDITION", + "version": "1.0.0" + }, + "updatedAt": "2020-12-31T09:10:19Z" + }, + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/delete", + "required": true + } + ] + }, + "get": { + "summary": "Get a managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.rancher.Rancher" + }, + "examples": { + "Example": { + "value": { + "createdAt": "2020-12-31T07:39:19Z", + "currentState": { + "iamAuthEnabled": false, + "ipRestrictions": [ + { + "cidrBlock": "198.51.100.1/32", + "description": "My IP restriction" + } + ], + "name": "my_rancher", + "networking": { + "egressCidrBlocks": [ + "203.0.113.0/24" + ] + }, + "plan": "OVHCLOUD_EDITION", + "region": "EU_WEST_RBX", + "url": "https://aaaaaa.bbbb.rancher.ovhcloud.example", + "usage": { + "datetime": "2020-12-31T20:00:00Z", + "orchestratedVcpus": 16 + }, + "version": "1.0.0" + }, + "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", + "resourceStatus": "READY", + "targetSpec": { + "iamAuthEnabled": false, + "ipRestrictions": [ + { + "cidrBlock": "198.51.100.1/32", + "description": "My IP restriction" + } + ], + "name": "my_rancher", + "plan": "OVHCLOUD_EDITION", + "version": "1.0.0" + }, + "updatedAt": "2020-12-31T07:39:19Z" + }, + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/get", + "required": true + } + ], + "x-response-identifier": "id" + }, + "put": { + "summary": "Update an existing managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.rancher.RancherUpdate" + }, + "examples": { + "Update rancher to plan STANDARD": { + "value": { + "targetSpec": { + "iamAuthEnabled": false, + "name": "my_rancher", + "plan": "STANDARD", + "version": "1.0.0" + } + }, + "summary": "Request body when updating plan to STANDARD" + } + } + } + } + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.rancher.Rancher" + }, + "examples": { + "Update the version of a managed Rancher version": { + "value": { + "createdAt": "2020-12-31T07:39:19Z", + "currentState": { + "iamAuthEnabled": false, + "ipRestrictions": [], + "name": "my_rancher", + "networking": { + "egressCidrBlocks": [ + "203.0.113.0/24" + ] + }, + "plan": "OVHCLOUD_EDITION", + "region": "EU_WEST_RBX", + "url": "https://aaaaaa.bbbb.rancher.ovhcloud.example", + "usage": { + "datetime": "2020-12-31T09:00:00Z", + "orchestratedVcpus": 16 + }, + "version": "1.0.0" + }, + "currentTasks": [ + { + "id": "aad7c39d-ed0e-44c3-9624-096a0ef569f2", + "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/d6b6579e-8d60-4487-bf08-8b4ddf98f7d3/task/aad7c39d-ed0e-44c3-9624-096a0ef569f2", + "type": "RANCHER_UPDATE" + } + ], + "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", + "resourceStatus": "UPDATING", + "targetSpec": { + "iamAuthEnabled": false, + "ipRestrictions": [], + "name": "my_rancher", + "plan": "OVHCLOUD_EDITION", + "version": "1.1.0" + }, + "updatedAt": "2020-12-31T09:14:19Z" + }, + "summary": "Response body when updating the version of a managed Rancher" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/edit", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/rancher/{rancherId}/adminCredentials": { + "post": { + "summary": "Reset the admin password", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.rancher.Credentials" + }, + "examples": { + "Example": { + "value": { + "password": "u}m.ZBA'>g?!D3DD", + "username": "admin" + }, + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/adminCredentials/reset", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/rancher/{rancherId}/capabilities/plan": { + "get": { + "summary": "List available and current plans for the given managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.rancher.PlanCapability" + } + }, + "examples": { + "Get plans - can switch to another plan": { + "value": [ + { + "name": "OVHCLOUD_EDITION", + "status": "CURRENT" + }, + { + "name": "STANDARD", + "status": "AVAILABLE" + } + ], + "summary": "Response body when listing plans for a specific rancher that can switch to another plan" + }, + "Get plans - cannot switch to another plan": { + "value": [ + { + "cause": "CANNOT_DOWNGRADE_USING_HIGHER_FEATURES", + "message": "You are currently using STANDARD plan features and cannot downgrade to OVHCLOUD_EDITION plan.", + "name": "OVHCLOUD_EDITION", + "status": "UNAVAILABLE" + }, + { + "name": "STANDARD", + "status": "CURRENT" + } + ], + "summary": "Response body when listing plans for a specific rancher that cannot switch to another plan" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/capabilities/plan/get", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/rancher/{rancherId}/capabilities/version": { + "get": { + "summary": "List available and current versions for the given managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.rancher.VersionCapability" + } + }, + "examples": { + "Example": { + "value": [ + { + "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.0.0", + "name": "1.0.0", + "status": "AVAILABLE" + }, + { + "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.1.0", + "name": "1.1.0", + "status": "AVAILABLE" + }, + { + "cause": "CANNOT_UPGRADE_MULTIPLE_VERSIONS", + "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.2.0", + "message": "You cannot upgrade directly to this version, please upgrade to the next minor first.", + "name": "1.2.0", + "status": "UNAVAILABLE" + } + ], + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/capabilities/version/get", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/rancher/{rancherId}/event": { + "get": { + "summary": "List all events related to the managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/common.Event" + } + }, + "examples": { + "Example": { + "value": [ + { + "createdAt": "2020-12-31T20:10:01Z", + "kind": "RANCHER_UPDATE", + "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/132645az-9c16-4021-b920-dfd22d8848c4/task/8e2478fa-af3b-4576-b344-af3546f52b5b", + "message": "Task started to update Rancher", + "type": "TASK_START" + }, + { + "createdAt": "2020-12-01T20:10:00Z", + "kind": "RANCHER_UPDATE", + "message": "Rancher target spec updated", + "type": "TARGET_SPEC_UPDATE" + } + ], + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/event/get", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/rancher/{rancherId}/task": { + "get": { + "summary": "List all asynchronous operations related to the managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/common.Task" + } + }, + "examples": { + "Example": { + "value": [ + { + "createdAt": "2020-12-01T20:00:00Z", + "errors": [], + "id": "6ffe3c08-3b65-4ede-a0e6-8b137e333e54", + "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/132645az-9c16-4021-b920-dfd22d8848c4", + "message": "Cloud project a755273a123456788da6d6fcc71a95f3: update rancher 132645az-9c16-4021-b920-dfd22d8848c4", + "progress": [ + { + "name": "test", + "status": "RUNNING" + }, + { + "name": "another step", + "status": "DONE" + }, + { + "name": "yet another step", + "status": "PENDING" + } + ], + "startedAt": "2020-12-01T20:01:00Z", + "status": "RUNNING", + "type": "PlanUpdate", + "updatedAt": "2020-12-01T20:02:00Z" + } + ], + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/task/get", + "required": true + } + ], + "x-response-identifier": "id", + "x-expanded-response": "CommonTask" + } + }, + "/publicCloud/project/{projectId}/rancher/{rancherId}/task/{taskId}": { + "get": { + "summary": "Get a specific task related to the managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "rancherId", + "description": "Rancher ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "in": "path", + "name": "taskId", + "description": "Task ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/common.Task" + }, + "examples": { + "Example": { + "value": { + "createdAt": "2020-12-01T20:00:00Z", + "errors": [], + "id": "6ffe3c08-3b65-4ede-a0e6-8b137e333e54", + "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/132645az-9c16-4021-b920-dfd22d8848c4", + "message": "Cloud project a755273a123456788da6d6fcc71a95f3: update rancher 132645az-9c16-4021-b920-dfd22d8848c4", + "progress": [ + { + "name": "test", + "status": "RUNNING" + }, + { + "name": "another step", + "status": "DONE" + }, + { + "name": "yet another step", + "status": "PENDING" + } + ], + "startedAt": "2020-12-01T20:01:00Z", + "status": "RUNNING", + "type": "RANCHER_UPDATE", + "updatedAt": "2020-12-01T20:02:00Z" + }, + "summary": "Example" + } + } + } + } + }, + "500": { + "description": "Error 500 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Server::InternalServerError::Maintenance": { + "value": { + "class": "Server::InternalServerError::Maintenance", + "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + } + } + } + } + } + } + }, + "tags": [ + "Rancher" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:rancher/task/get", + "required": true + } + ], + "x-response-identifier": "id" + } + }, + "/publicCloud/project/{projectId}/reference/rancher/plan": { + "get": { + "summary": "List available plans for creating a managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.rancher.PlanReference" + } + }, + "examples": { + "Example": { + "value": [ + { + "name": "OVHCLOUD_EDITION", + "status": "AVAILABLE" + }, + { + "name": "STANDARD", + "status": "AVAILABLE" + } + ], + "summary": "Example" + } + } + } + } + } + }, + "tags": [ + "Rancher", + "Reference" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:reference/rancher/plan/get", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/reference/rancher/version": { + "get": { + "summary": "List available versions for creating a managed Rancher service", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.rancher.VersionReference" + } + }, + "examples": { + "Example": { + "value": [ + { + "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.0.0", + "name": "1.0.0", + "status": "AVAILABLE" + }, + { + "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.1.0", + "name": "1.1.0", + "status": "AVAILABLE" + } + ], + "summary": "Example" + } + } + } + } + } + }, + "tags": [ + "Rancher", + "Reference" + ], + "x-badges": [ + { + "color": "green", + "label": "Stable production version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:reference/rancher/version/get", + "required": true + } + ] } }, - "securitySchemes": { - "oAuth2AuthCode": { - "type": "oauth2", - "description": "Oauth2", - "x-client-id": "1bb9c7df371741c0", - "x-client-secret": "a5b4de870aca620d10fbf63cd18d205b", - "flows": { - "authorizationCode": { - "authorizationUrl": "https://www.ovh.com/auth/oauth2/authorize", - "tokenUrl": "https://www.ovh.com/auth/oauth2/token", - "scopes": { - "account/all": "Manage your account", - "all": "Manage your whole account and all your services", - "services/all": "Manage your services lifecycle and billing" + "/publicCloud/reference/rancher/plan": { + "get": { + "summary": "List available plans for creating a managed Rancher service", + "deprecated": true, + "x-deprecation-date": "2024-05-20T00:00:00Z", + "x-deletion-date": "2024-09-01T00:00:00Z", + "x-replacement-route": "/v2/publicCloud/project/{projectId}/reference/rancher", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" } } - } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.rancher.PlanReference" + } + }, + "examples": { + "Example": { + "value": [ + { + "name": "OVHCLOUD_EDITION", + "status": "AVAILABLE" + }, + { + "name": "STANDARD", + "status": "AVAILABLE" + } + ], + "summary": "Example" + } + } + } + } + } + }, + "tags": [ + "Reference" + ], + "x-badges": [ + { + "color": "red", + "label": "Deprecated, will be removed" + } + ] } - } - }, - "paths": { - "/publicCloud/project": { + }, + "/publicCloud/reference/rancher/version": { "get": { - "summary": "List all Public Cloud projects", + "summary": "List available versions for creating a managed Rancher service", + "deprecated": true, + "x-deprecation-date": "2024-05-20T00:00:00Z", + "x-deletion-date": "2024-09-01T00:00:00Z", + "x-replacement-route": "/v2/publicCloud/project/{projectId}/reference/rancher", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.rancher.VersionReference" + } + }, + "examples": { + "Example": { + "value": [ + { + "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.0.0", + "name": "1.0.0", + "status": "AVAILABLE" + }, + { + "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.1.0", + "name": "1.1.0", + "status": "AVAILABLE" + } + ], + "summary": "Example" + } + } + } + } + } + }, + "tags": [ + "Reference" + ], + "x-badges": [ + { + "color": "red", + "label": "Deprecated, will be removed" + } + ] + } + }, + "/publicCloud/project/{projectId}/keyManager/container": { + "get": { + "summary": "List Public Cloud key manager containers", "security": [ { "oAuth2AuthCode": [] @@ -1206,17 +4038,12 @@ } }, { - "in": "query", - "name": "iamTags", - "description": "Filter resources on IAM tags", + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, "schema": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "$ref": "#/components/schemas/iam.resource.TagFilter" - } - } + "type": "string" } } ], @@ -1228,40 +4055,55 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/publicCloud.project.ProjectAsyncWithIAM" + "$ref": "#/components/schemas/publicCloud.keyManager.Container" } } } } } }, + "tags": [ + "Key Manager" + ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:get", + "name": "publicCloudProject:apiovh:keyManager/container/get", "required": true } ], - "x-expanded-response": "PublicCloudProjectProjectAsyncWithIAM" + "x-response-identifier": "id", + "x-expanded-response": "PublicCloudKeyManagerContainer" }, "post": { - "summary": "Create a new cloud project", + "summary": "Create a new Public Cloud key manager container", "security": [ { "oAuth2AuthCode": [] } ], + "parameters": [ + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.project.ProjectCreation" + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerCreation" } } } @@ -1272,39 +4114,106 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.project.ProjectAsync" + "$ref": "#/components/schemas/publicCloud.keyManager.Container" + } + } + } + }, + "400": { + "description": "Error 400 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::BadRequest::ServiceNotAvailableInRegion": { + "value": { + "class": "Client::BadRequest::ServiceNotAvailableInRegion", + "message": "This service is not available in the selected region" + } + } + } + } + } + }, + "409": { + "description": "Error 409 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::Conflict::RegionInMaintenance": { + "value": { + "class": "Client::Conflict::RegionInMaintenance", + "message": "This region is currently in maintenance" + } + } } } } } }, + "tags": [ + "Key Manager" + ], "x-badges": [ { - "color": "orange", - "label": "Internal use only" + "color": "blue", + "label": "Alpha version" } - ], - "x-iam-actions": [ - { - "name": "publicCloudProject:apiovh:create", - "required": true - }, + ], + "x-iam-actions": [ { - "name": "billingAccount:apiovh:subscription/publicCloudProject/create", + "name": "publicCloudProject:apiovh:keyManager/container/create", "required": true } ] } }, - "/publicCloud/project/{projectId}": { - "get": { - "summary": "Get details on a Public Cloud project", + "/publicCloud/project/{projectId}/keyManager/container/{containerId}": { + "delete": { + "summary": "Delete a Public Cloud key manager container", "security": [ { "oAuth2AuthCode": [] } ], "parameters": [ + { + "in": "path", + "name": "containerId", + "description": "Container ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, { "in": "path", "name": "projectId", @@ -1321,33 +4230,110 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.project.ProjectAsyncWithIAM" + "$ref": "#/components/schemas/publicCloud.keyManager.Container" + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::NotFound::ContainerDoesNotExist": { + "value": { + "class": "Client::NotFound::ContainerDoesNotExist", + "message": "Container not found" + } + } + } + } + } + }, + "409": { + "description": "Error 409 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::Conflict::ResourceAlreadyBeingDeleted": { + "value": { + "class": "Client::Conflict::ResourceAlreadyBeingDeleted", + "message": "Resource is already being deleted" + } + }, + "Client::Conflict::ResourceInInvalidState": { + "value": { + "class": "Client::Conflict::ResourceInInvalidState", + "message": "Resource cannot be modified in its current state" + } + } } } } } }, + "tags": [ + "Key Manager" + ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:get", + "name": "publicCloudProject:apiovh:keyManager/container/delete", "required": true } ] }, - "put": { - "summary": "Update an existing cloud project", + "get": { + "summary": "Get a Public Cloud key manager container", "security": [ { "oAuth2AuthCode": [] } ], "parameters": [ + { + "in": "path", + "name": "containerId", + "description": "Container ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, { "in": "path", "name": "projectId", @@ -1358,45 +4344,66 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/publicCloud.project.ProjectCreation" - } - } - } - }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.project.ProjectAsync" + "$ref": "#/components/schemas/publicCloud.keyManager.Container" + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::NotFound::ContainerDoesNotExist": { + "value": { + "class": "Client::NotFound::ContainerDoesNotExist", + "message": "Container not found" + } + } } } } } }, + "tags": [ + "Key Manager" + ], "x-badges": [ { - "color": "orange", - "label": "Internal use only" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:edit", + "name": "publicCloudProject:apiovh:keyManager/container/get", "required": true } - ] - } - }, - "/publicCloud/project/{projectId}/rancher": { - "get": { - "summary": "List managed Rancher services", + ], + "x-response-identifier": "id" + }, + "put": { + "summary": "Update a Public Cloud key manager container", "security": [ { "oAuth2AuthCode": [] @@ -1404,19 +4411,13 @@ ], "parameters": [ { - "in": "header", - "name": "X-Pagination-Cursor", - "description": "Pagination cursor", - "schema": { - "type": "string" - } - }, - { - "in": "header", - "name": "X-Pagination-Size", - "description": "Pagination size", + "in": "path", + "name": "containerId", + "description": "Container ID", + "required": true, "schema": { - "type": "integer" + "type": "string", + "format": "uuid" } }, { @@ -1429,100 +4430,58 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerUpdate" + } + } + } + }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/publicCloud.rancher.Rancher" + "$ref": "#/components/schemas/publicCloud.keyManager.Container" + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } } }, "examples": { - "Example": { - "value": [ - { - "createdAt": "2020-12-31T07:39:19Z", - "currentState": { - "iamAuthEnabled": false, - "ipRestrictions": [ - { - "cidrBlock": "198.51.100.1/32", - "description": "My IP restriction" - } - ], - "name": "my_rancher", - "networking": { - "egressCidrBlocks": [ - "203.0.113.0/24" - ] - }, - "plan": "OVHCLOUD_EDITION", - "region": "EU_WEST_RBX", - "url": "https://aaaaaa.bbbb.rancher.ovhcloud.example", - "usage": { - "datetime": "2020-12-31T13:00:00Z", - "orchestratedVcpus": 16 - }, - "version": "1.0.0" - }, - "currentTasks": [], - "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", - "resourceStatus": "READY", - "targetSpec": { - "iamAuthEnabled": false, - "ipRestrictions": [ - { - "cidrBlock": "198.51.100.1/32", - "description": "My IP restriction" - } - ], - "name": "my_rancher", - "plan": "OVHCLOUD_EDITION", - "version": "1.0.0" - }, - "updatedAt": "2020-12-31T07:39:19Z" - }, - { - "createdAt": "2020-12-31T13:37:46Z", - "currentState": { - "iamAuthEnabled": false, - "ipRestrictions": [], - "name": "rancher2", - "plan": "STANDARD", - "region": "EU_WEST_RBX", - "url": "https://cccccc.bbbb.rancher.ovhcloud.example", - "version": "1.0.0" - }, - "currentTasks": [ - { - "id": "30017036-ddb2-40a8-ad56-6d765b059aab", - "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/222ce105-a3f7-44c4-a7d3-dbb5983c045d/task/30017036-ddb2-40a8-ad56-6d765b059aab", - "type": "RANCHER_UPDATE" - } - ], - "id": "222ce105-a3f7-44c4-a7d3-dbb5983c045d", - "resourceStatus": "UPDATING", - "targetSpec": { - "iamAuthEnabled": false, - "ipRestrictions": [], - "name": "rancher2", - "plan": "STANDARD", - "version": "1.1.0" - }, - "updatedAt": "2020-12-31T13:40:46Z" - } - ], - "summary": "Example" + "Client::NotFound::ContainerDoesNotExist": { + "value": { + "class": "Client::NotFound::ContainerDoesNotExist", + "message": "Container not found" + } } } } } }, - "500": { - "description": "Error 500 response", + "409": { + "description": "Error 409 response", "content": { "application/json": { "schema": { @@ -1540,10 +4499,16 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::Conflict::ChecksumMismatch": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::Conflict::ChecksumMismatch", + "message": "Checksum mismatch — a concurrent update was detected. Refresh the resource and retry" + } + }, + "Client::Conflict::ResourceInInvalidState": { + "value": { + "class": "Client::Conflict::ResourceInInvalidState", + "message": "Resource cannot be modified in its current state" } } } @@ -1552,31 +4517,118 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/get", + "name": "publicCloudProject:apiovh:keyManager/container/edit", + "required": true + } + ] + } + }, + "/publicCloud/project/{projectId}/keyManager/container/{containerId}/consumer": { + "get": { + "summary": "List consumers of a Key Manager container", + "security": [ + { + "oAuth2AuthCode": [] + } + ], + "parameters": [ + { + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", + "schema": { + "type": "string" + } + }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, + { + "in": "path", + "name": "containerId", + "description": "Container ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerConsumer" + } + } + } + } + } + }, + "tags": [ + "Key Manager" + ], + "x-badges": [ + { + "color": "blue", + "label": "Alpha version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:keyManager/container/consumer/get", "required": true } ], "x-response-identifier": "id", - "x-expanded-response": "PublicCloudRancherRancher" + "x-expanded-response": "PublicCloudKeyManagerContainerConsumer" }, "post": { - "summary": "Create a new managed Rancher service", + "summary": "Register a consumer for a Key Manager container", "security": [ { "oAuth2AuthCode": [] } ], "parameters": [ + { + "in": "path", + "name": "containerId", + "description": "Container ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" + } + }, { "in": "path", "name": "projectId", @@ -1592,30 +4644,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.rancher.RancherCreation" - }, - "examples": { - "Create a STANDARD managed Rancher on the latest version": { - "value": { - "targetSpec": { - "iamAuthEnabled": false, - "name": "my_rancher", - "plan": "STANDARD" - } - }, - "summary": "Request body for creating a managed Rancher on plan STANDARD" - }, - "Create an OVHCLOUD_EDITION managed Rancher on a specific version": { - "value": { - "targetSpec": { - "iamAuthEnabled": false, - "name": "my_rancher", - "plan": "OVHCLOUD_EDITION", - "version": "1.0.0" - } - }, - "summary": "Request body for creating a managed Rancher on plan OVHCLOUD_EDITION with a specific version" - } + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerConsumerInput" } } } @@ -1626,47 +4655,71 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.rancher.Rancher" + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerConsumer" + } + } + } + }, + "400": { + "description": "Error 400 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } }, "examples": { - "Example": { + "Client::BadRequest::InvalidParameter": { "value": { - "createdAt": "2020-12-31T07:39:19Z", - "currentState": { - "bootstrapPassword": "jL%IctBOu)-$D@wa", - "iamAuthEnabled": false, - "ipRestrictions": [], - "name": "my_rancher", - "plan": "OVHCLOUD_EDITION", - "region": "EU_WEST_RBX", - "version": "1.0.0" - }, - "currentTasks": [ - { - "id": "aad7c39d-ed0e-44c3-9624-096a0ef569f2", - "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/d6b6579e-8d60-4487-bf08-8b4ddf98f7d3/task/aad7c39d-ed0e-44c3-9624-096a0ef569f2", - "type": "RANCHER_CREATE" - } - ], - "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", - "resourceStatus": "CREATING", - "targetSpec": { - "iamAuthEnabled": false, - "ipRestrictions": [], - "name": "my_rancher", - "plan": "OVHCLOUD_EDITION", - "version": "1.0.0" - }, - "updatedAt": "2020-12-31T07:39:19Z" + "class": "Client::BadRequest::InvalidParameter", + "message": "Invalid parameter in the request" + } + } + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" }, - "summary": "Example" + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::NotFound::ContainerDoesNotExist": { + "value": { + "class": "Client::NotFound::ContainerDoesNotExist", + "message": "Container not found" + } } } } } }, - "500": { - "description": "Error 500 response", + "409": { + "description": "Error 409 response", "content": { "application/json": { "schema": { @@ -1684,10 +4737,10 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::Conflict::RegionInMaintenance": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::Conflict::RegionInMaintenance", + "message": "This region is currently in maintenance" } } } @@ -1696,25 +4749,25 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/create", + "name": "publicCloudProject:apiovh:keyManager/container/consumer/create", "required": true } ] } }, - "/publicCloud/project/{projectId}/rancher/{rancherId}": { + "/publicCloud/project/{projectId}/keyManager/container/{containerId}/consumer/{consumerId}": { "delete": { - "summary": "Delete a managed Rancher service", + "summary": "Delete a consumer from a Key Manager container", "security": [ { "oAuth2AuthCode": [] @@ -1723,8 +4776,8 @@ "parameters": [ { "in": "path", - "name": "projectId", - "description": "Project ID", + "name": "consumerId", + "description": "Consumer ID", "required": true, "schema": { "type": "string" @@ -1732,13 +4785,22 @@ }, { "in": "path", - "name": "rancherId", - "description": "Rancher ID", + "name": "containerId", + "description": "Container ID", "required": true, "schema": { "type": "string", "format": "uuid" } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } } ], "responses": { @@ -1746,57 +4808,14 @@ "description": "successful operation", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/publicCloud.rancher.Rancher" - }, - "examples": { - "Example": { - "value": { - "createdAt": "2020-12-31T07:39:19Z", - "currentState": { - "iamAuthEnabled": false, - "ipRestrictions": [], - "name": "my_rancher", - "networking": { - "egressCidrBlocks": [ - "203.0.113.0/24" - ] - }, - "plan": "OVHCLOUD_EDITION", - "region": "EU_WEST_RBX", - "url": "https://aaaaaa.bbbb.rancher.ovhcloud.example", - "usage": { - "datetime": "2020-12-31T09:00:00Z", - "orchestratedVcpus": 16 - }, - "version": "1.0.0" - }, - "currentTasks": [ - { - "id": "aad7c39d-ed0e-44c3-9624-096a0ef569f2", - "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/d6b6579e-8d60-4487-bf08-8b4ddf98f7d3/task/aad7c39d-ed0e-44c3-9624-096a0ef569f2", - "type": "RANCHER_DELETE" - } - ], - "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", - "resourceStatus": "DELETING", - "targetSpec": { - "iamAuthEnabled": false, - "ipRestrictions": [], - "name": "my_rancher", - "plan": "OVHCLOUD_EDITION", - "version": "1.0.0" - }, - "updatedAt": "2020-12-31T09:10:19Z" - }, - "summary": "Example" - } + "schema": { + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerConsumer" } } } }, - "500": { - "description": "Error 500 response", + "404": { + "description": "Error 404 response", "content": { "application/json": { "schema": { @@ -1814,10 +4833,16 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::NotFound::ConsumerDoesNotExist": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::NotFound::ConsumerDoesNotExist", + "message": "Consumer not found" + } + }, + "Client::NotFound::ContainerDoesNotExist": { + "value": { + "class": "Client::NotFound::ContainerDoesNotExist", + "message": "Container not found" } } } @@ -1826,23 +4851,23 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/delete", + "name": "publicCloudProject:apiovh:keyManager/container/consumer/delete", "required": true } ] }, "get": { - "summary": "Get a managed Rancher service", + "summary": "Get a consumer of a Key Manager container", "security": [ { "oAuth2AuthCode": [] @@ -1851,8 +4876,8 @@ "parameters": [ { "in": "path", - "name": "projectId", - "description": "Project ID", + "name": "consumerId", + "description": "Consumer ID", "required": true, "schema": { "type": "string" @@ -1860,13 +4885,22 @@ }, { "in": "path", - "name": "rancherId", - "description": "Rancher ID", + "name": "containerId", + "description": "Container ID", "required": true, "schema": { "type": "string", "format": "uuid" } + }, + { + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, + "schema": { + "type": "string" + } } ], "responses": { @@ -1875,59 +4909,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.rancher.Rancher" - }, - "examples": { - "Example": { - "value": { - "createdAt": "2020-12-31T07:39:19Z", - "currentState": { - "iamAuthEnabled": false, - "ipRestrictions": [ - { - "cidrBlock": "198.51.100.1/32", - "description": "My IP restriction" - } - ], - "name": "my_rancher", - "networking": { - "egressCidrBlocks": [ - "203.0.113.0/24" - ] - }, - "plan": "OVHCLOUD_EDITION", - "region": "EU_WEST_RBX", - "url": "https://aaaaaa.bbbb.rancher.ovhcloud.example", - "usage": { - "datetime": "2020-12-31T20:00:00Z", - "orchestratedVcpus": 16 - }, - "version": "1.0.0" - }, - "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", - "resourceStatus": "READY", - "targetSpec": { - "iamAuthEnabled": false, - "ipRestrictions": [ - { - "cidrBlock": "198.51.100.1/32", - "description": "My IP restriction" - } - ], - "name": "my_rancher", - "plan": "OVHCLOUD_EDITION", - "version": "1.0.0" - }, - "updatedAt": "2020-12-31T07:39:19Z" - }, - "summary": "Example" - } + "$ref": "#/components/schemas/publicCloud.keyManager.ContainerConsumer" } } } }, - "500": { - "description": "Error 500 response", + "404": { + "description": "Error 404 response", "content": { "application/json": { "schema": { @@ -1945,10 +4933,16 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::NotFound::ConsumerDoesNotExist": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::NotFound::ConsumerDoesNotExist", + "message": "Consumer not found" + } + }, + "Client::NotFound::ContainerDoesNotExist": { + "value": { + "class": "Client::NotFound::ContainerDoesNotExist", + "message": "Container not found" } } } @@ -1957,24 +4951,26 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/get", + "name": "publicCloudProject:apiovh:keyManager/container/consumer/get", "required": true } ], "x-response-identifier": "id" - }, - "put": { - "summary": "Update an existing managed Rancher service", + } + }, + "/publicCloud/project/{projectId}/keyManager/secret": { + "get": { + "summary": "List Public Cloud Key Manager secrets", "security": [ { "oAuth2AuthCode": [] @@ -1982,126 +4978,40 @@ ], "parameters": [ { - "in": "path", - "name": "projectId", - "description": "Project ID", - "required": true, + "in": "header", + "name": "X-Pagination-Cursor", + "description": "Pagination cursor", "schema": { "type": "string" } }, + { + "in": "header", + "name": "X-Pagination-Size", + "description": "Pagination size", + "schema": { + "type": "integer" + } + }, { "in": "path", - "name": "rancherId", - "description": "Rancher ID", + "name": "projectId", + "description": "Project ID", "required": true, "schema": { - "type": "string", - "format": "uuid" + "type": "string" } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/publicCloud.rancher.RancherUpdate" - }, - "examples": { - "Update rancher to plan STANDARD": { - "value": { - "targetSpec": { - "iamAuthEnabled": false, - "name": "my_rancher", - "plan": "STANDARD", - "version": "1.0.0" - } - }, - "summary": "Request body when updating plan to STANDARD" - } - } - } - } - }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.rancher.Rancher" - }, - "examples": { - "Update the version of a managed Rancher version": { - "value": { - "createdAt": "2020-12-31T07:39:19Z", - "currentState": { - "iamAuthEnabled": false, - "ipRestrictions": [], - "name": "my_rancher", - "networking": { - "egressCidrBlocks": [ - "203.0.113.0/24" - ] - }, - "plan": "OVHCLOUD_EDITION", - "region": "EU_WEST_RBX", - "url": "https://aaaaaa.bbbb.rancher.ovhcloud.example", - "usage": { - "datetime": "2020-12-31T09:00:00Z", - "orchestratedVcpus": 16 - }, - "version": "1.0.0" - }, - "currentTasks": [ - { - "id": "aad7c39d-ed0e-44c3-9624-096a0ef569f2", - "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/d6b6579e-8d60-4487-bf08-8b4ddf98f7d3/task/aad7c39d-ed0e-44c3-9624-096a0ef569f2", - "type": "RANCHER_UPDATE" - } - ], - "id": "d6b6579e-8d60-4487-bf08-8b4ddf98f7d3", - "resourceStatus": "UPDATING", - "targetSpec": { - "iamAuthEnabled": false, - "ipRestrictions": [], - "name": "my_rancher", - "plan": "OVHCLOUD_EDITION", - "version": "1.1.0" - }, - "updatedAt": "2020-12-31T09:14:19Z" - }, - "summary": "Response body when updating the version of a managed Rancher" - } - } - } - } - }, - "500": { - "description": "Error 500 response", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Common error model", - "properties": { - "class": { - "type": "string", - "description": "Class of the error" - }, - "message": { - "type": "string", - "description": "Error message" - } - } - }, - "examples": { - "Server::InternalServerError::Maintenance": { - "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." - } + "type": "array", + "items": { + "$ref": "#/components/schemas/publicCloud.keyManager.Secret" } } } @@ -2109,25 +5019,25 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/edit", + "name": "publicCloudProject:apiovh:keyManager/secret/get", "required": true } - ] - } - }, - "/publicCloud/project/{projectId}/rancher/{rancherId}/adminCredentials": { + ], + "x-response-identifier": "id", + "x-expanded-response": "PublicCloudKeyManagerSecret" + }, "post": { - "summary": "Reset the admin password", + "summary": "Create a new Public Cloud Key Manager secret", "security": [ { "oAuth2AuthCode": [] @@ -2142,40 +5052,66 @@ "schema": { "type": "string" } - }, - { - "in": "path", - "name": "rancherId", - "description": "Rancher ID", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretCreation" + } + } + } + }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/publicCloud.rancher.Credentials" + "$ref": "#/components/schemas/publicCloud.keyManager.Secret" + } + } + } + }, + "400": { + "description": "Error 400 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } }, "examples": { - "Example": { + "Client::BadRequest::InvalidParameter": { "value": { - "password": "u}m.ZBA'>g?!D3DD", - "username": "admin" - }, - "summary": "Example" + "class": "Client::BadRequest::InvalidParameter", + "message": "Invalid parameter in the request" + } + }, + "Client::BadRequest::ServiceNotAvailableInRegion": { + "value": { + "class": "Client::BadRequest::ServiceNotAvailableInRegion", + "message": "This service is not available in the selected region" + } } } } } }, - "500": { - "description": "Error 500 response", + "409": { + "description": "Error 409 response", "content": { "application/json": { "schema": { @@ -2193,10 +5129,10 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::Conflict::RegionInMaintenance": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::Conflict::RegionInMaintenance", + "message": "This region is currently in maintenance" } } } @@ -2205,47 +5141,31 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/adminCredentials/reset", + "name": "publicCloudProject:apiovh:keyManager/secret/create", "required": true } ] } }, - "/publicCloud/project/{projectId}/rancher/{rancherId}/capabilities/plan": { - "get": { - "summary": "List available and current plans for the given managed Rancher service", + "/publicCloud/project/{projectId}/keyManager/secret/{secretId}": { + "delete": { + "summary": "Delete a Public Cloud Key Manager secret", "security": [ { "oAuth2AuthCode": [] } ], "parameters": [ - { - "in": "header", - "name": "X-Pagination-Cursor", - "description": "Pagination cursor", - "schema": { - "type": "string" - } - }, - { - "in": "header", - "name": "X-Pagination-Size", - "description": "Pagination size", - "schema": { - "type": "integer" - } - }, { "in": "path", "name": "projectId", @@ -2257,8 +5177,8 @@ }, { "in": "path", - "name": "rancherId", - "description": "Rancher ID", + "name": "secretId", + "description": "Secret ID", "required": true, "schema": { "type": "string", @@ -2272,46 +5192,42 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/publicCloud.rancher.PlanCapability" + "$ref": "#/components/schemas/publicCloud.keyManager.Secret" + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } } }, "examples": { - "Get plans - can switch to another plan": { - "value": [ - { - "name": "OVHCLOUD_EDITION", - "status": "CURRENT" - }, - { - "name": "STANDARD", - "status": "AVAILABLE" - } - ], - "summary": "Response body when listing plans for a specific rancher that can switch to another plan" - }, - "Get plans - cannot switch to another plan": { - "value": [ - { - "cause": "CANNOT_DOWNGRADE_USING_HIGHER_FEATURES", - "message": "You are currently using STANDARD plan features and cannot downgrade to OVHCLOUD_EDITION plan.", - "name": "OVHCLOUD_EDITION", - "status": "UNAVAILABLE" - }, - { - "name": "STANDARD", - "status": "CURRENT" - } - ], - "summary": "Response body when listing plans for a specific rancher that cannot switch to another plan" + "Client::NotFound::SecretDoesNotExist": { + "value": { + "class": "Client::NotFound::SecretDoesNotExist", + "message": "Secret not found" + } } } } } }, - "500": { - "description": "Error 500 response", + "409": { + "description": "Error 409 response", "content": { "application/json": { "schema": { @@ -2329,10 +5245,16 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::Conflict::ResourceAlreadyBeingDeleted": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::Conflict::ResourceAlreadyBeingDeleted", + "message": "Resource is already being deleted" + } + }, + "Client::Conflict::ResourceInInvalidState": { + "value": { + "class": "Client::Conflict::ResourceInInvalidState", + "message": "Resource cannot be modified in its current state" } } } @@ -2341,47 +5263,29 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/capabilities/plan/get", + "name": "publicCloudProject:apiovh:keyManager/secret/delete", "required": true } ] - } - }, - "/publicCloud/project/{projectId}/rancher/{rancherId}/capabilities/version": { + }, "get": { - "summary": "List available and current versions for the given managed Rancher service", + "summary": "Get a Public Cloud Key Manager secret", "security": [ { "oAuth2AuthCode": [] } ], "parameters": [ - { - "in": "header", - "name": "X-Pagination-Cursor", - "description": "Pagination cursor", - "schema": { - "type": "string" - } - }, - { - "in": "header", - "name": "X-Pagination-Size", - "description": "Pagination size", - "schema": { - "type": "integer" - } - }, { "in": "path", "name": "projectId", @@ -2393,8 +5297,8 @@ }, { "in": "path", - "name": "rancherId", - "description": "Rancher ID", + "name": "secretId", + "description": "Secret ID", "required": true, "schema": { "type": "string", @@ -2408,40 +5312,13 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/publicCloud.rancher.VersionCapability" - } - }, - "examples": { - "Example": { - "value": [ - { - "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.0.0", - "name": "1.0.0", - "status": "AVAILABLE" - }, - { - "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.1.0", - "name": "1.1.0", - "status": "AVAILABLE" - }, - { - "cause": "CANNOT_UPGRADE_MULTIPLE_VERSIONS", - "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.2.0", - "message": "You cannot upgrade directly to this version, please upgrade to the next minor first.", - "name": "1.2.0", - "status": "UNAVAILABLE" - } - ], - "summary": "Example" - } + "$ref": "#/components/schemas/publicCloud.keyManager.Secret" } } } }, - "500": { - "description": "Error 500 response", + "404": { + "description": "Error 404 response", "content": { "application/json": { "schema": { @@ -2459,10 +5336,10 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::NotFound::SecretDoesNotExist": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::NotFound::SecretDoesNotExist", + "message": "Secret not found" } } } @@ -2471,47 +5348,30 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/capabilities/version/get", + "name": "publicCloudProject:apiovh:keyManager/secret/get", "required": true } - ] - } - }, - "/publicCloud/project/{projectId}/rancher/{rancherId}/event": { - "get": { - "summary": "List all events related to the managed Rancher service", + ], + "x-response-identifier": "id" + }, + "put": { + "summary": "Update a Public Cloud Key Manager secret", "security": [ { "oAuth2AuthCode": [] } ], "parameters": [ - { - "in": "header", - "name": "X-Pagination-Cursor", - "description": "Pagination cursor", - "schema": { - "type": "string" - } - }, - { - "in": "header", - "name": "X-Pagination-Size", - "description": "Pagination size", - "schema": { - "type": "integer" - } - }, { "in": "path", "name": "projectId", @@ -2523,8 +5383,8 @@ }, { "in": "path", - "name": "rancherId", - "description": "Rancher ID", + "name": "secretId", + "description": "Secret ID", "required": true, "schema": { "type": "string", @@ -2532,42 +5392,87 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretUpdate" + } + } + } + }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/common.Event" + "$ref": "#/components/schemas/publicCloud.keyManager.Secret" + } + } + } + }, + "400": { + "description": "Error 400 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } } }, "examples": { - "Example": { - "value": [ - { - "createdAt": "2020-12-31T20:10:01Z", - "kind": "RANCHER_UPDATE", - "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/132645az-9c16-4021-b920-dfd22d8848c4/task/8e2478fa-af3b-4576-b344-af3546f52b5b", - "message": "Task started to update Rancher", - "type": "TASK_START" - }, - { - "createdAt": "2020-12-01T20:10:00Z", - "kind": "RANCHER_UPDATE", - "message": "Rancher target spec updated", - "type": "TARGET_SPEC_UPDATE" - } - ], - "summary": "Example" + "Client::BadRequest::InvalidParameter": { + "value": { + "class": "Client::BadRequest::InvalidParameter", + "message": "Invalid parameter in the request" + } + } + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::NotFound::SecretDoesNotExist": { + "value": { + "class": "Client::NotFound::SecretDoesNotExist", + "message": "Secret not found" + } } } } } }, - "500": { - "description": "Error 500 response", + "409": { + "description": "Error 409 response", "content": { "application/json": { "schema": { @@ -2585,10 +5490,16 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::Conflict::ChecksumMismatch": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::Conflict::ChecksumMismatch", + "message": "Checksum mismatch — a concurrent update was detected. Refresh the resource and retry" + } + }, + "Client::Conflict::ResourceInInvalidState": { + "value": { + "class": "Client::Conflict::ResourceInInvalidState", + "message": "Resource cannot be modified in its current state" } } } @@ -2597,25 +5508,25 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/event/get", + "name": "publicCloudProject:apiovh:keyManager/secret/edit", "required": true } ] } }, - "/publicCloud/project/{projectId}/rancher/{rancherId}/task": { + "/publicCloud/project/{projectId}/keyManager/secret/{secretId}/consumer": { "get": { - "summary": "List all asynchronous operations related to the managed Rancher service", + "summary": "List consumers of a Key Manager secret", "security": [ { "oAuth2AuthCode": [] @@ -2649,8 +5560,8 @@ }, { "in": "path", - "name": "rancherId", - "description": "Rancher ID", + "name": "secretId", + "description": "Secret ID", "required": true, "schema": { "type": "string", @@ -2666,68 +5577,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/common.Task" - } - }, - "examples": { - "Example": { - "value": [ - { - "createdAt": "2020-12-01T20:00:00Z", - "errors": [], - "id": "6ffe3c08-3b65-4ede-a0e6-8b137e333e54", - "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/132645az-9c16-4021-b920-dfd22d8848c4", - "message": "Cloud project a755273a123456788da6d6fcc71a95f3: update rancher 132645az-9c16-4021-b920-dfd22d8848c4", - "progress": [ - { - "name": "test", - "status": "RUNNING" - }, - { - "name": "another step", - "status": "DONE" - }, - { - "name": "yet another step", - "status": "PENDING" - } - ], - "startedAt": "2020-12-01T20:01:00Z", - "status": "RUNNING", - "type": "PlanUpdate", - "updatedAt": "2020-12-01T20:02:00Z" - } - ], - "summary": "Example" - } - } - } - } - }, - "500": { - "description": "Error 500 response", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Common error model", - "properties": { - "class": { - "type": "string", - "description": "Class of the error" - }, - "message": { - "type": "string", - "description": "Error message" - } - } - }, - "examples": { - "Server::InternalServerError::Maintenance": { - "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." - } + "$ref": "#/components/schemas/publicCloud.keyManager.SecretConsumer" } } } @@ -2735,27 +5585,25 @@ } }, "tags": [ - "Rancher" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:rancher/task/get", + "name": "publicCloudProject:apiovh:keyManager/secret/consumer/get", "required": true } ], "x-response-identifier": "id", - "x-expanded-response": "CommonTask" - } - }, - "/publicCloud/project/{projectId}/rancher/{rancherId}/task/{taskId}": { - "get": { - "summary": "Get a specific task related to the managed Rancher service", + "x-expanded-response": "PublicCloudKeyManagerSecretConsumer" + }, + "post": { + "summary": "Register a consumer for a Key Manager secret", "security": [ { "oAuth2AuthCode": [] @@ -2773,18 +5621,8 @@ }, { "in": "path", - "name": "rancherId", - "description": "Rancher ID", - "required": true, - "schema": { - "type": "string", - "format": "uuid" - } - }, - { - "in": "path", - "name": "taskId", - "description": "Task ID", + "name": "secretId", + "description": "Secret ID", "required": true, "schema": { "type": "string", @@ -2792,49 +5630,58 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/publicCloud.keyManager.SecretConsumerInput" + } + } + } + }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/common.Task" + "$ref": "#/components/schemas/publicCloud.keyManager.SecretConsumer" + } + } + } + }, + "400": { + "description": "Error 400 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } }, "examples": { - "Example": { + "Client::BadRequest::InvalidParameter": { "value": { - "createdAt": "2020-12-01T20:00:00Z", - "errors": [], - "id": "6ffe3c08-3b65-4ede-a0e6-8b137e333e54", - "link": "/v2/publicCloud/project/a755273a123456788da6d6fcc71a95f3/rancher/132645az-9c16-4021-b920-dfd22d8848c4", - "message": "Cloud project a755273a123456788da6d6fcc71a95f3: update rancher 132645az-9c16-4021-b920-dfd22d8848c4", - "progress": [ - { - "name": "test", - "status": "RUNNING" - }, - { - "name": "another step", - "status": "DONE" - }, - { - "name": "yet another step", - "status": "PENDING" - } - ], - "startedAt": "2020-12-01T20:01:00Z", - "status": "RUNNING", - "type": "RANCHER_UPDATE", - "updatedAt": "2020-12-01T20:02:00Z" - }, - "summary": "Example" + "class": "Client::BadRequest::InvalidParameter", + "message": "Invalid parameter in the request" + } } } } } }, - "500": { - "description": "Error 500 response", + "404": { + "description": "Error 404 response", "content": { "application/json": { "schema": { @@ -2852,94 +5699,40 @@ } }, "examples": { - "Server::InternalServerError::Maintenance": { + "Client::NotFound::SecretDoesNotExist": { "value": { - "class": "Server::InternalServerError::Maintenance", - "message": "The Managed Rancher Service API is in maintenance mode. Only GET endpoints are available." + "class": "Client::NotFound::SecretDoesNotExist", + "message": "Secret not found" } } } } } - } - }, - "tags": [ - "Rancher" - ], - "x-badges": [ - { - "color": "green", - "label": "Stable production version" - } - ], - "x-iam-actions": [ - { - "name": "publicCloudProject:apiovh:rancher/task/get", - "required": true - } - ], - "x-response-identifier": "id" - } - }, - "/publicCloud/project/{projectId}/reference/rancher/plan": { - "get": { - "summary": "List available plans for creating a managed Rancher service", - "security": [ - { - "oAuth2AuthCode": [] - } - ], - "parameters": [ - { - "in": "header", - "name": "X-Pagination-Cursor", - "description": "Pagination cursor", - "schema": { - "type": "string" - } - }, - { - "in": "header", - "name": "X-Pagination-Size", - "description": "Pagination size", - "schema": { - "type": "integer" - } }, - { - "in": "path", - "name": "projectId", - "description": "Project ID", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "successful operation", + "409": { + "description": "Error 409 response", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/publicCloud.rancher.PlanReference" - } - }, - "examples": { - "Example": { - "value": [ - { - "name": "OVHCLOUD_EDITION", - "status": "AVAILABLE" - }, - { - "name": "STANDARD", - "status": "AVAILABLE" - } - ], - "summary": "Example" + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::Conflict::RegionInMaintenance": { + "value": { + "class": "Client::Conflict::RegionInMaintenance", + "message": "This region is currently in maintenance" + } } } } @@ -2947,26 +5740,25 @@ } }, "tags": [ - "Rancher", - "Reference" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:reference/rancher/plan/get", + "name": "publicCloudProject:apiovh:keyManager/secret/consumer/create", "required": true } ] } }, - "/publicCloud/project/{projectId}/reference/rancher/version": { - "get": { - "summary": "List available versions for creating a managed Rancher service", + "/publicCloud/project/{projectId}/keyManager/secret/{secretId}/consumer/{consumerId}": { + "delete": { + "summary": "Delete a consumer from a Key Manager secret", "security": [ { "oAuth2AuthCode": [] @@ -2974,28 +5766,31 @@ ], "parameters": [ { - "in": "header", - "name": "X-Pagination-Cursor", - "description": "Pagination cursor", + "in": "path", + "name": "consumerId", + "description": "Consumer ID", + "required": true, "schema": { "type": "string" } }, { - "in": "header", - "name": "X-Pagination-Size", - "description": "Pagination size", + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, "schema": { - "type": "integer" + "type": "string" } }, { "in": "path", - "name": "projectId", - "description": "Project ID", + "name": "secretId", + "description": "Secret ID", "required": true, "schema": { - "type": "string" + "type": "string", + "format": "uuid" } } ], @@ -3005,26 +5800,41 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/publicCloud.rancher.VersionReference" + "$ref": "#/components/schemas/publicCloud.keyManager.SecretConsumer" + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } } }, "examples": { - "Example": { - "value": [ - { - "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.0.0", - "name": "1.0.0", - "status": "AVAILABLE" - }, - { - "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.1.0", - "name": "1.1.0", - "status": "AVAILABLE" - } - ], - "summary": "Example" + "Client::NotFound::ConsumerDoesNotExist": { + "value": { + "class": "Client::NotFound::ConsumerDoesNotExist", + "message": "Consumer not found" + } + }, + "Client::NotFound::SecretDoesNotExist": { + "value": { + "class": "Client::NotFound::SecretDoesNotExist", + "message": "Secret not found" + } } } } @@ -3032,30 +5842,23 @@ } }, "tags": [ - "Rancher", - "Reference" + "Key Manager" ], "x-badges": [ { - "color": "green", - "label": "Stable production version" + "color": "blue", + "label": "Alpha version" } ], "x-iam-actions": [ { - "name": "publicCloudProject:apiovh:reference/rancher/version/get", + "name": "publicCloudProject:apiovh:keyManager/secret/consumer/delete", "required": true } ] - } - }, - "/publicCloud/reference/rancher/plan": { + }, "get": { - "summary": "List available plans for creating a managed Rancher service", - "deprecated": true, - "x-deprecation-date": "2024-05-20T00:00:00Z", - "x-deletion-date": "2024-09-01T00:00:00Z", - "x-replacement-route": "/v2/publicCloud/project/{projectId}/reference/rancher", + "summary": "Get a consumer of a Key Manager secret", "security": [ { "oAuth2AuthCode": [] @@ -3063,19 +5866,31 @@ ], "parameters": [ { - "in": "header", - "name": "X-Pagination-Cursor", - "description": "Pagination cursor", + "in": "path", + "name": "consumerId", + "description": "Consumer ID", + "required": true, "schema": { "type": "string" } }, { - "in": "header", - "name": "X-Pagination-Size", - "description": "Pagination size", + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, "schema": { - "type": "integer" + "type": "string" + } + }, + { + "in": "path", + "name": "secretId", + "description": "Secret ID", + "required": true, + "schema": { + "type": "string", + "format": "uuid" } } ], @@ -3085,24 +5900,41 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/publicCloud.rancher.PlanReference" + "$ref": "#/components/schemas/publicCloud.keyManager.SecretConsumer" + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } } }, "examples": { - "Example": { - "value": [ - { - "name": "OVHCLOUD_EDITION", - "status": "AVAILABLE" - }, - { - "name": "STANDARD", - "status": "AVAILABLE" - } - ], - "summary": "Example" + "Client::NotFound::ConsumerDoesNotExist": { + "value": { + "class": "Client::NotFound::ConsumerDoesNotExist", + "message": "Consumer not found" + } + }, + "Client::NotFound::SecretDoesNotExist": { + "value": { + "class": "Client::NotFound::SecretDoesNotExist", + "message": "Secret not found" + } } } } @@ -3110,23 +5942,26 @@ } }, "tags": [ - "Reference" + "Key Manager" ], "x-badges": [ { - "color": "red", - "label": "Deprecated, will be removed" + "color": "blue", + "label": "Alpha version" } - ] + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:keyManager/secret/consumer/get", + "required": true + } + ], + "x-response-identifier": "id" } }, - "/publicCloud/reference/rancher/version": { - "get": { - "summary": "List available versions for creating a managed Rancher service", - "deprecated": true, - "x-deprecation-date": "2024-05-20T00:00:00Z", - "x-deletion-date": "2024-09-01T00:00:00Z", - "x-replacement-route": "/v2/publicCloud/project/{projectId}/reference/rancher", + "/publicCloud/project/{projectId}/keyManager/secret/{secretId}/payload": { + "post": { + "summary": "Fetch the payload of a Key Manager secret", "security": [ { "oAuth2AuthCode": [] @@ -3134,19 +5969,22 @@ ], "parameters": [ { - "in": "header", - "name": "X-Pagination-Cursor", - "description": "Pagination cursor", + "in": "path", + "name": "projectId", + "description": "Project ID", + "required": true, "schema": { "type": "string" } }, { - "in": "header", - "name": "X-Pagination-Size", - "description": "Pagination size", + "in": "path", + "name": "secretId", + "description": "Secret ID", + "required": true, "schema": { - "type": "integer" + "type": "string", + "format": "uuid" } } ], @@ -3156,26 +5994,64 @@ "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/publicCloud.rancher.VersionReference" + "$ref": "#/components/schemas/publicCloud.keyManager.SecretPayload" + } + } + } + }, + "404": { + "description": "Error 404 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } } }, "examples": { - "Example": { - "value": [ - { - "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.0.0", - "name": "1.0.0", - "status": "AVAILABLE" - }, - { - "changelogUrl": "https://github.com/rancher/rancher/releases/tag/v1.1.0", - "name": "1.1.0", - "status": "AVAILABLE" - } - ], - "summary": "Example" + "Client::NotFound::SecretDoesNotExist": { + "value": { + "class": "Client::NotFound::SecretDoesNotExist", + "message": "Secret not found" + } + } + } + } + } + }, + "409": { + "description": "Error 409 response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Common error model", + "properties": { + "class": { + "type": "string", + "description": "Class of the error" + }, + "message": { + "type": "string", + "description": "Error message" + } + } + }, + "examples": { + "Client::Conflict::RegionInMaintenance": { + "value": { + "class": "Client::Conflict::RegionInMaintenance", + "message": "This region is currently in maintenance" + } } } } @@ -3183,12 +6059,18 @@ } }, "tags": [ - "Reference" + "Key Manager" ], "x-badges": [ { - "color": "red", - "label": "Deprecated, will be removed" + "color": "blue", + "label": "Alpha version" + } + ], + "x-iam-actions": [ + { + "name": "publicCloudProject:apiovh:keyManager/secret/payload/get", + "required": true } ] } diff --git a/internal/cmd/cloud_key_manager.go b/internal/cmd/cloud_key_manager.go new file mode 100644 index 00000000..77766281 --- /dev/null +++ b/internal/cmd/cloud_key_manager.go @@ -0,0 +1,273 @@ +// SPDX-FileCopyrightText: 2025 OVH SAS +// +// SPDX-License-Identifier: Apache-2.0 + +package cmd + +import ( + "github.com/ovh/ovhcloud-cli/internal/assets" + "github.com/ovh/ovhcloud-cli/internal/flags" + "github.com/ovh/ovhcloud-cli/internal/services/cloud" + "github.com/spf13/cobra" +) + +func initCloudKeyManagerCommand(cloudCmd *cobra.Command) { + keyManagerCmd := &cobra.Command{ + Use: "key-manager", + Aliases: []string{"kms"}, + Short: "Manage Key Management Service (KMS) resources in the given cloud project", + } + keyManagerCmd.PersistentFlags().StringVar(&cloud.CloudProject, "cloud-project", "", "Cloud project ID") + + keyManagerCmd.AddCommand(getKeyManagerSecretCmd()) + keyManagerCmd.AddCommand(getKeyManagerContainerCmd()) + + cloudCmd.AddCommand(keyManagerCmd) +} + +// +// Secret command tree +// + +func getKeyManagerSecretCmd() *cobra.Command { + secretCmd := &cobra.Command{ + Use: "secret", + Short: "Manage Key Manager secrets", + } + + secretListCmd := &cobra.Command{ + Use: "list", + Aliases: []string{"ls"}, + Short: "List Key Manager secrets", + Run: cloud.ListKeyManagerSecrets, + } + secretCmd.AddCommand(withFilterFlag(secretListCmd)) + + secretCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific Key Manager secret", + Run: cloud.GetKeyManagerSecret, + Args: cobra.ExactArgs(1), + }) + + secretCmd.AddCommand(getKeyManagerSecretCreateCmd()) + + secretEditCmd := &cobra.Command{ + Use: "edit ", + Short: "Edit the given Key Manager secret (only metadata is mutable)", + Run: cloud.EditKeyManagerSecret, + Args: cobra.ExactArgs(1), + } + secretEditCmd.Flags().StringToStringVar(&cloud.KeyManagerSecretEditSpec.TargetSpec.Metadata, "metadata", nil, "Metadata key-value pairs (replaces all existing metadata)") + addInteractiveEditorFlag(secretEditCmd) + secretCmd.AddCommand(secretEditCmd) + + secretCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete the given Key Manager secret", + Run: cloud.DeleteKeyManagerSecret, + Args: cobra.ExactArgs(1), + }) + + secretCmd.AddCommand(&cobra.Command{ + Use: "payload ", + Short: "Fetch the payload (sensitive material) of the given Key Manager secret", + Run: cloud.GetKeyManagerSecretPayload, + Args: cobra.ExactArgs(1), + }) + + // Consumer subcommands + secretCmd.AddCommand(getKeyManagerSecretConsumerCmd()) + + return secretCmd +} + +func getKeyManagerSecretCreateCmd() *cobra.Command { + secretCreateCmd := &cobra.Command{ + Use: "create", + Short: "Create a new Key Manager secret", + Run: cloud.CreateKeyManagerSecret, + } + + spec := &cloud.KeyManagerSecretSpec.TargetSpec + secretCreateCmd.Flags().StringVar(&spec.Name, "name", "", "Human-readable name of the secret") + secretCreateCmd.Flags().StringVar(&spec.SecretType, "secret-type", "", "Type of the secret (CERTIFICATE, OPAQUE, PASSPHRASE, PRIVATE, PUBLIC, SYMMETRIC)") + secretCreateCmd.Flags().StringVar(&spec.Algorithm, "algorithm", "", "Algorithm associated with the secret (AES, DH, DSA, EC, RSA)") + secretCreateCmd.Flags().IntVar(&spec.BitLength, "bit-length", 0, "Bit length of the secret (128, 256, 512, 1024, 2048, 4096)") + secretCreateCmd.Flags().StringVar(&spec.Mode, "mode", "", "Mode of the algorithm (CBC, CTR)") + secretCreateCmd.Flags().StringVar(&spec.Expiration, "expiration", "", "Expiration date and time of the secret (RFC3339)") + secretCreateCmd.Flags().StringVar(&spec.Payload, "payload", "", "Secret payload data (base64-encoded, write-only). Requires --payload-content-type") + secretCreateCmd.Flags().StringVar(&spec.PayloadContentType, "payload-content-type", "", "Content type of the payload (APPLICATION_OCTET_STREAM, APPLICATION_PKCS8, APPLICATION_PKIX_CERT, TEXT_PLAIN)") + secretCreateCmd.Flags().StringToStringVar(&spec.Metadata, "metadata", nil, "Metadata key-value pairs for the secret") + secretCreateCmd.Flags().StringVar(&cloud.KeyManagerSecretCreateRegion, "region", "", "Region code where the secret is located") + secretCreateCmd.Flags().StringVar(&cloud.KeyManagerSecretCreateAvailabilityZone, "availability-zone", "", "Availability zone within the region") + secretCreateCmd.Flags().BoolVar(&flags.WaitForTask, "wait", false, "Wait for the secret to be ready before exiting") + + addParameterFileFlags(secretCreateCmd, false, assets.CloudV2OpenapiSchema, "/publicCloud/project/{projectId}/keyManager/secret", "post", cloud.KeyManagerSecretCreateExample, nil) + addInteractiveEditorFlag(secretCreateCmd) + markFlagsMutuallyExclusive(secretCreateCmd, "from-file", "editor") + + return secretCreateCmd +} + +func getKeyManagerSecretConsumerCmd() *cobra.Command { + consumerCmd := &cobra.Command{ + Use: "consumer", + Short: "Manage consumers of a Key Manager secret", + } + + consumerListCmd := &cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List consumers registered for the given secret", + Run: cloud.ListKeyManagerSecretConsumers, + Args: cobra.ExactArgs(1), + } + consumerCmd.AddCommand(withFilterFlag(consumerListCmd)) + + consumerCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific consumer of the given secret", + Run: cloud.GetKeyManagerSecretConsumer, + Args: cobra.ExactArgs(2), + }) + + consumerRegisterCmd := &cobra.Command{ + Use: "register ", + Aliases: []string{"create"}, + Short: "Register a consumer for the given secret", + Run: cloud.RegisterKeyManagerSecretConsumer, + Args: cobra.ExactArgs(1), + } + addKeyManagerConsumerFlags(consumerRegisterCmd) + consumerCmd.AddCommand(consumerRegisterCmd) + + consumerCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a consumer from the given secret", + Run: cloud.DeleteKeyManagerSecretConsumer, + Args: cobra.ExactArgs(2), + }) + + return consumerCmd +} + +// +// Container command tree +// + +func getKeyManagerContainerCmd() *cobra.Command { + containerCmd := &cobra.Command{ + Use: "container", + Short: "Manage Key Manager containers", + } + + containerListCmd := &cobra.Command{ + Use: "list", + Aliases: []string{"ls"}, + Short: "List Key Manager containers", + Run: cloud.ListKeyManagerContainers, + } + containerCmd.AddCommand(withFilterFlag(containerListCmd)) + + containerCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific Key Manager container", + Run: cloud.GetKeyManagerContainer, + Args: cobra.ExactArgs(1), + }) + + containerCmd.AddCommand(getKeyManagerContainerCreateCmd()) + + containerEditCmd := &cobra.Command{ + Use: "edit ", + Short: "Edit the given Key Manager container (only secret references are mutable)", + Run: cloud.EditKeyManagerContainer, + Args: cobra.ExactArgs(1), + } + containerEditCmd.Flags().StringArrayVar(&cloud.KeyManagerContainerSecretRefs, "secret-ref", nil, "Secret reference as '=' (repeatable, replaces all existing references)") + addInteractiveEditorFlag(containerEditCmd) + containerCmd.AddCommand(containerEditCmd) + + containerCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete the given Key Manager container", + Run: cloud.DeleteKeyManagerContainer, + Args: cobra.ExactArgs(1), + }) + + // Consumer subcommands + containerCmd.AddCommand(getKeyManagerContainerConsumerCmd()) + + return containerCmd +} + +func getKeyManagerContainerCreateCmd() *cobra.Command { + containerCreateCmd := &cobra.Command{ + Use: "create", + Short: "Create a new Key Manager container", + Run: cloud.CreateKeyManagerContainer, + } + + spec := &cloud.KeyManagerContainerSpec.TargetSpec + containerCreateCmd.Flags().StringVar(&spec.Name, "name", "", "Desired container name") + containerCreateCmd.Flags().StringVar(&spec.Type, "type", "", "Type of the container (CERTIFICATE, GENERIC, RSA)") + containerCreateCmd.Flags().StringArrayVar(&cloud.KeyManagerContainerSecretRefs, "secret-ref", nil, "Secret reference as '=' (repeatable)") + containerCreateCmd.Flags().StringVar(&cloud.KeyManagerContainerCreateRegion, "region", "", "Region code where the container is located") + containerCreateCmd.Flags().StringVar(&cloud.KeyManagerContainerCreateAvailabilityZone, "availability-zone", "", "Availability zone within the region") + containerCreateCmd.Flags().BoolVar(&flags.WaitForTask, "wait", false, "Wait for the container to be ready before exiting") + + addParameterFileFlags(containerCreateCmd, false, assets.CloudV2OpenapiSchema, "/publicCloud/project/{projectId}/keyManager/container", "post", cloud.KeyManagerContainerCreateExample, nil) + addInteractiveEditorFlag(containerCreateCmd) + markFlagsMutuallyExclusive(containerCreateCmd, "from-file", "editor") + + return containerCreateCmd +} + +func getKeyManagerContainerConsumerCmd() *cobra.Command { + consumerCmd := &cobra.Command{ + Use: "consumer", + Short: "Manage consumers of a Key Manager container", + } + + consumerListCmd := &cobra.Command{ + Use: "list ", + Aliases: []string{"ls"}, + Short: "List consumers registered for the given container", + Run: cloud.ListKeyManagerContainerConsumers, + Args: cobra.ExactArgs(1), + } + consumerCmd.AddCommand(withFilterFlag(consumerListCmd)) + + consumerCmd.AddCommand(&cobra.Command{ + Use: "get ", + Short: "Get a specific consumer of the given container", + Run: cloud.GetKeyManagerContainerConsumer, + Args: cobra.ExactArgs(2), + }) + + consumerRegisterCmd := &cobra.Command{ + Use: "register ", + Aliases: []string{"create"}, + Short: "Register a consumer for the given container", + Run: cloud.RegisterKeyManagerContainerConsumer, + Args: cobra.ExactArgs(1), + } + addKeyManagerConsumerFlags(consumerRegisterCmd) + consumerCmd.AddCommand(consumerRegisterCmd) + + consumerCmd.AddCommand(&cobra.Command{ + Use: "delete ", + Short: "Delete a consumer from the given container", + Run: cloud.DeleteKeyManagerContainerConsumer, + Args: cobra.ExactArgs(2), + }) + + return consumerCmd +} + +func addKeyManagerConsumerFlags(cmd *cobra.Command) { + cmd.Flags().StringVar(&cloud.KeyManagerConsumerSpec.ResourceId, "resource-id", "", "UUID of the resource consuming the secret/container") + cmd.Flags().StringVar(&cloud.KeyManagerConsumerSpec.ResourceType, "resource-type", "", "Type of the consuming resource (IMAGE, INSTANCE, LOADBALANCER)") + cmd.Flags().StringVar(&cloud.KeyManagerConsumerSpec.Service, "service", "", "OpenStack service type of the consumer (COMPUTE, IMAGE, LOADBALANCER, NETWORK)") +} diff --git a/internal/cmd/cloud_key_manager_test.go b/internal/cmd/cloud_key_manager_test.go new file mode 100644 index 00000000..c5bdd87b --- /dev/null +++ b/internal/cmd/cloud_key_manager_test.go @@ -0,0 +1,363 @@ +// 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" +) + +// +// Secret tests +// + +func (ms *MockSuite) TestCloudKeyManagerSecretListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret", + httpmock.NewStringResponder(200, `[ + { + "id": "secret-1", + "resourceStatus": "READY", + "currentState": { + "name": "my-secret", + "secretType": "OPAQUE", + "location": {"region": "GRA"} + } + } + ]`)) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "list", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("secret-1")) + assert.Cmp(out, td.Contains("my-secret")) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret/secret-1", + httpmock.NewStringResponder(200, `{ + "id": "secret-1", + "resourceStatus": "READY", + "currentState": { + "name": "my-secret", + "secretType": "OPAQUE", + "location": {"region": "GRA"} + } + }`)) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "get", "secret-1", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("secret-1")) + assert.Cmp(out, td.Contains("my-secret")) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretCreateCmd(assert, require *td.T) { + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret", + tdhttpmock.JSONBody(td.JSON(` + { + "targetSpec": { + "name": "my-secret", + "secretType": "OPAQUE", + "location": {"region": "GRA"} + } + }`), + ), + httpmock.NewStringResponder(200, `{"id": "secret-123"}`), + ) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "create", "--cloud-project", "fakeProjectID", + "--name", "my-secret", "--secret-type", "OPAQUE", "--region", "GRA") + + require.CmpNoError(err) + assert.String(out, `✅ Key Manager secret created successfully (id: secret-123)`) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretCreateErrorCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret", + httpmock.NewStringResponder(400, `{"message": "invalid secret type"}`), + ) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "create", "--cloud-project", "fakeProjectID", + "--name", "my-secret", "--secret-type", "OPAQUE", "--region", "GRA") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("failed to create Key Manager secret")) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret/secret-1", + httpmock.NewStringResponder(200, ``)) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "delete", "secret-1", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("deleted successfully")) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretPayloadCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret/secret-1/payload", + httpmock.NewStringResponder(200, `{"payload": "super-secret-value"}`)) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "payload", "secret-1", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("super-secret-value")) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretConsumerRegisterCmd(assert, require *td.T) { + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret/secret-1/consumer", + tdhttpmock.JSONBody(td.JSON(` + { + "resourceId": "11111111-1111-1111-1111-111111111111", + "resourceType": "INSTANCE", + "service": "COMPUTE" + }`), + ), + httpmock.NewStringResponder(200, `{"id": "consumer-1"}`), + ) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "consumer", "register", "secret-1", "--cloud-project", "fakeProjectID", + "--resource-id", "11111111-1111-1111-1111-111111111111", "--resource-type", "INSTANCE", "--service", "COMPUTE") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("Consumer registered successfully for secret secret-1 (id: consumer-1)")) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretConsumerListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret/secret-1/consumer", + httpmock.NewStringResponder(200, `[ + { + "id": "consumer-1", + "resourceId": "11111111-1111-1111-1111-111111111111", + "resourceType": "INSTANCE", + "service": "COMPUTE" + } + ]`)) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "consumer", "list", "secret-1", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("consumer-1")) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretConsumerDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret/secret-1/consumer/consumer-1", + httpmock.NewStringResponder(200, ``)) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "consumer", "delete", "secret-1", "consumer-1", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("deleted successfully")) +} + +func (ms *MockSuite) TestCloudKeyManagerSecretEditCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret/secret-1", + httpmock.NewStringResponder(200, `{ + "id": "secret-1", + "checksum": "abc123", + "resourceStatus": "READY", + "targetSpec": { + "name": "my-secret", + "secretType": "OPAQUE", + "location": {"region": "GRA"}, + "metadata": {"old": "value"} + } + }`)) + + httpmock.RegisterMatcherResponder(http.MethodPut, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/secret/secret-1", + tdhttpmock.JSONBody(td.JSON(` + { + "checksum": "abc123", + "targetSpec": { + "metadata": {"old": "value", "env": "prod"} + } + }`), + ), + httpmock.NewStringResponder(200, ``)) + + out, err := cmd.Execute("cloud", "key-manager", "secret", "edit", "secret-1", "--cloud-project", "fakeProjectID", "--metadata", "env=prod") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("updated successfully")) +} + +func (ms *MockSuite) TestCloudKeyManagerContainerEditCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container/container-1", + httpmock.NewStringResponder(200, `{ + "id": "container-1", + "checksum": "def456", + "resourceStatus": "READY", + "targetSpec": { + "name": "my-container", + "type": "GENERIC", + "location": {"region": "GRA"}, + "secretRefs": [] + } + }`)) + + httpmock.RegisterMatcherResponder(http.MethodPut, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container/container-1", + tdhttpmock.JSONBody(td.JSON(` + { + "checksum": "def456", + "targetSpec": { + "secretRefs": [ + {"name": "private_key", "secret": {"id": "secret-9"}} + ] + } + }`), + ), + httpmock.NewStringResponder(200, ``)) + + out, err := cmd.Execute("cloud", "key-manager", "container", "edit", "container-1", "--cloud-project", "fakeProjectID", "--secret-ref", "private_key=secret-9") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("updated successfully")) +} + +// +// Container tests +// + +func (ms *MockSuite) TestCloudKeyManagerContainerListCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container", + httpmock.NewStringResponder(200, `[ + { + "id": "container-1", + "resourceStatus": "READY", + "currentState": { + "name": "my-container", + "type": "GENERIC", + "location": {"region": "GRA"} + } + } + ]`)) + + out, err := cmd.Execute("cloud", "key-manager", "container", "list", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("container-1")) + assert.Cmp(out, td.Contains("my-container")) +} + +func (ms *MockSuite) TestCloudKeyManagerContainerGetCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodGet, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container/container-1", + httpmock.NewStringResponder(200, `{ + "id": "container-1", + "resourceStatus": "READY", + "currentState": { + "name": "my-container", + "type": "GENERIC", + "location": {"region": "GRA"} + } + }`)) + + out, err := cmd.Execute("cloud", "key-manager", "container", "get", "container-1", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("container-1")) + assert.Cmp(out, td.Contains("my-container")) +} + +func (ms *MockSuite) TestCloudKeyManagerContainerCreateCmd(assert, require *td.T) { + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container", + tdhttpmock.JSONBody(td.JSON(` + { + "targetSpec": { + "name": "my-container", + "type": "GENERIC", + "location": {"region": "GRA"}, + "secretRefs": [ + { + "name": "private_key", + "secret": {"id": "secret-1"} + } + ] + } + }`), + ), + httpmock.NewStringResponder(200, `{"id": "container-123"}`), + ) + + out, err := cmd.Execute("cloud", "key-manager", "container", "create", "--cloud-project", "fakeProjectID", + "--name", "my-container", "--type", "GENERIC", "--region", "GRA", "--secret-ref", "private_key=secret-1") + + require.CmpNoError(err) + assert.String(out, `✅ Key Manager container created successfully (id: container-123)`) +} + +func (ms *MockSuite) TestCloudKeyManagerContainerCreateErrorCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodPost, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container", + httpmock.NewStringResponder(400, `{"message": "invalid container type"}`), + ) + + out, err := cmd.Execute("cloud", "key-manager", "container", "create", "--cloud-project", "fakeProjectID", + "--name", "my-container", "--type", "GENERIC", "--region", "GRA") + + assert.CmpError(err) + assert.Cmp(out, td.Contains("failed to create Key Manager container")) +} + +func (ms *MockSuite) TestCloudKeyManagerContainerDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container/container-1", + httpmock.NewStringResponder(200, ``)) + + out, err := cmd.Execute("cloud", "key-manager", "container", "delete", "container-1", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("deleted successfully")) +} + +func (ms *MockSuite) TestCloudKeyManagerContainerConsumerRegisterCmd(assert, require *td.T) { + httpmock.RegisterMatcherResponder(http.MethodPost, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container/container-1/consumer", + tdhttpmock.JSONBody(td.JSON(` + { + "resourceId": "22222222-2222-2222-2222-222222222222", + "resourceType": "LOADBALANCER", + "service": "LOADBALANCER" + }`), + ), + httpmock.NewStringResponder(200, `{"id": "consumer-2"}`), + ) + + out, err := cmd.Execute("cloud", "key-manager", "container", "consumer", "register", "container-1", "--cloud-project", "fakeProjectID", + "--resource-id", "22222222-2222-2222-2222-222222222222", "--resource-type", "LOADBALANCER", "--service", "LOADBALANCER") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("Consumer registered successfully for container container-1 (id: consumer-2)")) +} + +func (ms *MockSuite) TestCloudKeyManagerContainerConsumerDeleteCmd(assert, require *td.T) { + httpmock.RegisterResponder(http.MethodDelete, + "https://eu.api.ovh.com/v2/publicCloud/project/fakeProjectID/keyManager/container/container-1/consumer/consumer-2", + httpmock.NewStringResponder(200, ``)) + + out, err := cmd.Execute("cloud", "key-manager", "container", "consumer", "delete", "container-1", "consumer-2", "--cloud-project", "fakeProjectID") + + require.CmpNoError(err) + assert.Cmp(out, td.Contains("deleted successfully")) +} diff --git a/internal/cmd/cloud_project.go b/internal/cmd/cloud_project.go index 71371f49..1d689c2f 100644 --- a/internal/cmd/cloud_project.go +++ b/internal/cmd/cloud_project.go @@ -116,6 +116,7 @@ func init() { initCloudUserCommand(cloudCmd) initCloudStorageCommand(cloudCmd) initCloudRancherCommand(cloudCmd) + initCloudKeyManagerCommand(cloudCmd) initCloudSavingsPlanCommand(cloudCmd) initCloudIPCommand(cloudCmd) initCloudAlertingCommand(cloudCmd) diff --git a/internal/services/cloud/cloud_key_manager.go b/internal/services/cloud/cloud_key_manager.go new file mode 100644 index 00000000..b6b4ec05 --- /dev/null +++ b/internal/services/cloud/cloud_key_manager.go @@ -0,0 +1,494 @@ +// SPDX-FileCopyrightText: 2025 OVH SAS +// +// SPDX-License-Identifier: Apache-2.0 + +package cloud + +import ( + _ "embed" + "fmt" + "net/url" + "strings" + "time" + + "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 ( + keyManagerSecretColumnsToDisplay = []string{"id", "currentState.name name", "currentState.location.region region", "currentState.secretType type", "resourceStatus"} + keyManagerContainerColumnsToDisplay = []string{"id", "currentState.name name", "currentState.location.region region", "currentState.type type", "resourceStatus"} + keyManagerConsumerColumnsToDisplay = []string{"id", "resourceId", "resourceType", "service"} + + //go:embed templates/cloud_key_manager_secret.tmpl + keyManagerSecretTemplate string + + //go:embed templates/cloud_key_manager_container.tmpl + keyManagerContainerTemplate string + + //go:embed parameter-samples/key-manager-secret-create.json + KeyManagerSecretCreateExample string + + //go:embed parameter-samples/key-manager-container-create.json + KeyManagerContainerCreateExample string + + // Secret creation parameters + KeyManagerSecretSpec struct { + TargetSpec struct { + Algorithm string `json:"algorithm,omitempty"` + BitLength int `json:"bitLength,omitempty"` + Expiration string `json:"expiration,omitempty"` + Location *keyManagerLocation `json:"location,omitempty"` + Metadata map[string]string `json:"metadata,omitempty"` + Mode string `json:"mode,omitempty"` + Name string `json:"name,omitempty"` + Payload string `json:"payload,omitempty"` + PayloadContentType string `json:"payloadContentType,omitempty"` + SecretType string `json:"secretType,omitempty"` + } `json:"targetSpec"` + } + KeyManagerSecretCreateRegion string + KeyManagerSecretCreateAvailabilityZone string + + // Secret edit parameters (only metadata is mutable) + KeyManagerSecretEditSpec struct { + TargetSpec struct { + Metadata map[string]string `json:"metadata,omitempty"` + } `json:"targetSpec"` + } + + // Container creation parameters + KeyManagerContainerSpec struct { + TargetSpec struct { + Location *keyManagerLocation `json:"location,omitempty"` + Name string `json:"name,omitempty"` + SecretRefs []keyManagerSecretRef `json:"secretRefs,omitempty"` + Type string `json:"type,omitempty"` + } `json:"targetSpec"` + } + KeyManagerContainerCreateRegion string + KeyManagerContainerCreateAvailabilityZone string + KeyManagerContainerSecretRefs []string + + // Container edit parameters (only secretRefs are mutable) + KeyManagerContainerEditSpec struct { + TargetSpec struct { + SecretRefs []keyManagerSecretRef `json:"secretRefs"` + } `json:"targetSpec"` + } + + // Consumer register parameters (shared by secret and container) + KeyManagerConsumerSpec struct { + ResourceId string `json:"resourceId,omitempty"` + ResourceType string `json:"resourceType,omitempty"` + Service string `json:"service,omitempty"` + } +) + +type ( + keyManagerLocation struct { + Region string `json:"region,omitempty"` + AvailabilityZone string `json:"availabilityZone,omitempty"` + } + + keyManagerSecretRef struct { + Name string `json:"name"` + Secret struct { + Id string `json:"id"` + } `json:"secret"` + } +) + +// parseSecretRefs converts "role=secretId" (or "role:secretId") strings into +// keyManagerSecretRef structures. +func parseSecretRefs(refs []string) ([]keyManagerSecretRef, error) { + result := make([]keyManagerSecretRef, 0, len(refs)) + for _, ref := range refs { + sep := strings.IndexAny(ref, "=:") + if sep <= 0 || sep == len(ref)-1 { + return nil, fmt.Errorf("invalid secret reference %q, expected format '='", ref) + } + var r keyManagerSecretRef + r.Name = ref[:sep] + r.Secret.Id = ref[sep+1:] + result = append(result, r) + } + return result, nil +} + +// +// Secret commands +// + +func ListKeyManagerSecrets(_ *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageListRequestNoExpand(fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret", projectID), keyManagerSecretColumnsToDisplay, flags.GenericFilters) +} + +func GetKeyManagerSecret(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageObjectRequest(fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret", projectID), args[0], keyManagerSecretTemplate) +} + +func CreateKeyManagerSecret(cmd *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + if KeyManagerSecretCreateRegion != "" || KeyManagerSecretCreateAvailabilityZone != "" { + KeyManagerSecretSpec.TargetSpec.Location = &keyManagerLocation{ + Region: KeyManagerSecretCreateRegion, + AvailabilityZone: KeyManagerSecretCreateAvailabilityZone, + } + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret", projectID) + secret, err := common.CreateResource( + cmd, + "/publicCloud/project/{projectId}/keyManager/secret", + endpoint, + KeyManagerSecretCreateExample, + KeyManagerSecretSpec, + assets.CloudV2OpenapiSchema, + []string{"targetSpec"}, + ) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create Key Manager secret: %s", err) + return + } + + secretID, _ := secret["id"].(string) + + if !flags.WaitForTask { + display.OutputInfo(&flags.OutputFormatConfig, secret, "✅ Key Manager secret created successfully (id: %s)", secretID) + return + } + + if err := waitForCloudResourceReady(fmt.Sprintf("%s/%s", endpoint, url.PathEscape(secretID)), 20*time.Minute); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to wait for Key Manager secret to be ready: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, secret, "✅ Key Manager secret %s is now ready", secretID) +} + +func EditKeyManagerSecret(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + if err := common.EditResource( + cmd, + "/publicCloud/project/{projectId}/keyManager/secret/{secretId}", + fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret/%s", projectID, url.PathEscape(args[0])), + KeyManagerSecretEditSpec, + assets.CloudV2OpenapiSchema, + ); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } +} + +func DeleteKeyManagerSecret(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret/%s", projectID, url.PathEscape(args[0])) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete Key Manager secret: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Key Manager secret %s deleted successfully", args[0]) +} + +// GetKeyManagerSecretPayload fetches the payload (sensitive material) of a secret. +// The API exposes this as a POST that returns the payload in its response body. +func GetKeyManagerSecretPayload(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret/%s/payload", projectID, url.PathEscape(args[0])) + var response map[string]any + if err := httpLib.Client.Post(endpoint, nil, &response); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to fetch Key Manager secret payload: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, response, "%s", response["payload"]) +} + +// +// Secret consumer commands +// + +func ListKeyManagerSecretConsumers(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageListRequestNoExpand( + fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret/%s/consumer", projectID, url.PathEscape(args[0])), + keyManagerConsumerColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetKeyManagerSecretConsumer(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret/%s/consumer", projectID, url.PathEscape(args[0])), + args[1], + "", + ) +} + +func RegisterKeyManagerSecretConsumer(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret/%s/consumer", projectID, url.PathEscape(args[0])) + var response map[string]any + if err := httpLib.Client.Post(endpoint, KeyManagerConsumerSpec, &response); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to register consumer for Key Manager secret: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, response, "✅ Consumer registered successfully for secret %s (id: %s)", args[0], response["id"]) +} + +func DeleteKeyManagerSecretConsumer(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/secret/%s/consumer/%s", projectID, url.PathEscape(args[0]), url.PathEscape(args[1])) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete consumer from Key Manager secret: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Consumer %s deleted successfully from secret %s", args[1], args[0]) +} + +// +// Container commands +// + +func ListKeyManagerContainers(_ *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageListRequestNoExpand(fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container", projectID), keyManagerContainerColumnsToDisplay, flags.GenericFilters) +} + +func GetKeyManagerContainer(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageObjectRequest(fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container", projectID), args[0], keyManagerContainerTemplate) +} + +func CreateKeyManagerContainer(cmd *cobra.Command, _ []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + if KeyManagerContainerCreateRegion != "" || KeyManagerContainerCreateAvailabilityZone != "" { + KeyManagerContainerSpec.TargetSpec.Location = &keyManagerLocation{ + Region: KeyManagerContainerCreateRegion, + AvailabilityZone: KeyManagerContainerCreateAvailabilityZone, + } + } + + if len(KeyManagerContainerSecretRefs) > 0 { + refs, err := parseSecretRefs(KeyManagerContainerSecretRefs) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + KeyManagerContainerSpec.TargetSpec.SecretRefs = refs + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container", projectID) + container, err := common.CreateResource( + cmd, + "/publicCloud/project/{projectId}/keyManager/container", + endpoint, + KeyManagerContainerCreateExample, + KeyManagerContainerSpec, + assets.CloudV2OpenapiSchema, + []string{"targetSpec"}, + ) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to create Key Manager container: %s", err) + return + } + + containerID, _ := container["id"].(string) + + if !flags.WaitForTask { + display.OutputInfo(&flags.OutputFormatConfig, container, "✅ Key Manager container created successfully (id: %s)", containerID) + return + } + + if err := waitForCloudResourceReady(fmt.Sprintf("%s/%s", endpoint, url.PathEscape(containerID)), 20*time.Minute); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to wait for Key Manager container to be ready: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, container, "✅ Key Manager container %s is now ready", containerID) +} + +func EditKeyManagerContainer(cmd *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + if len(KeyManagerContainerSecretRefs) > 0 { + refs, err := parseSecretRefs(KeyManagerContainerSecretRefs) + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + KeyManagerContainerEditSpec.TargetSpec.SecretRefs = refs + } + + if err := common.EditResource( + cmd, + "/publicCloud/project/{projectId}/keyManager/container/{containerId}", + fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container/%s", projectID, url.PathEscape(args[0])), + KeyManagerContainerEditSpec, + assets.CloudV2OpenapiSchema, + ); err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } +} + +func DeleteKeyManagerContainer(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container/%s", projectID, url.PathEscape(args[0])) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete Key Manager container: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Key Manager container %s deleted successfully", args[0]) +} + +// +// Container consumer commands +// + +func ListKeyManagerContainerConsumers(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageListRequestNoExpand( + fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container/%s/consumer", projectID, url.PathEscape(args[0])), + keyManagerConsumerColumnsToDisplay, + flags.GenericFilters, + ) +} + +func GetKeyManagerContainerConsumer(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + common.ManageObjectRequest( + fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container/%s/consumer", projectID, url.PathEscape(args[0])), + args[1], + "", + ) +} + +func RegisterKeyManagerContainerConsumer(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container/%s/consumer", projectID, url.PathEscape(args[0])) + var response map[string]any + if err := httpLib.Client.Post(endpoint, KeyManagerConsumerSpec, &response); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to register consumer for Key Manager container: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, response, "✅ Consumer registered successfully for container %s (id: %s)", args[0], response["id"]) +} + +func DeleteKeyManagerContainerConsumer(_ *cobra.Command, args []string) { + projectID, err := getConfiguredCloudProject() + if err != nil { + display.OutputError(&flags.OutputFormatConfig, "%s", err) + return + } + + endpoint := fmt.Sprintf("/v2/publicCloud/project/%s/keyManager/container/%s/consumer/%s", projectID, url.PathEscape(args[0]), url.PathEscape(args[1])) + if err := httpLib.Client.Delete(endpoint, nil); err != nil { + display.OutputError(&flags.OutputFormatConfig, "failed to delete consumer from Key Manager container: %s", err) + return + } + + display.OutputInfo(&flags.OutputFormatConfig, nil, "✅ Consumer %s deleted successfully from container %s", args[1], args[0]) +} diff --git a/internal/services/cloud/parameter-samples/key-manager-container-create.json b/internal/services/cloud/parameter-samples/key-manager-container-create.json new file mode 100644 index 00000000..03139664 --- /dev/null +++ b/internal/services/cloud/parameter-samples/key-manager-container-create.json @@ -0,0 +1,17 @@ +{ + "targetSpec": { + "name": "my-container", + "type": "GENERIC", + "location": { + "region": "GRA" + }, + "secretRefs": [ + { + "name": "private_key", + "secret": { + "id": "00000000-0000-0000-0000-000000000000" + } + } + ] + } +} diff --git a/internal/services/cloud/parameter-samples/key-manager-secret-create.json b/internal/services/cloud/parameter-samples/key-manager-secret-create.json new file mode 100644 index 00000000..f3431dbb --- /dev/null +++ b/internal/services/cloud/parameter-samples/key-manager-secret-create.json @@ -0,0 +1,11 @@ +{ + "targetSpec": { + "name": "my-secret", + "secretType": "OPAQUE", + "payload": "bXktc2VjcmV0LXBheWxvYWQ=", + "payloadContentType": "APPLICATION_OCTET_STREAM", + "location": { + "region": "GRA" + } + } +} diff --git a/internal/services/cloud/templates/cloud_key_manager_container.tmpl b/internal/services/cloud/templates/cloud_key_manager_container.tmpl new file mode 100644 index 00000000..bf8dbe72 --- /dev/null +++ b/internal/services/cloud/templates/cloud_key_manager_container.tmpl @@ -0,0 +1,29 @@ +📦 Key Manager Container {{.ServiceName}} +======= + +_{{index .Result "currentState" "name"}}_ + +## General information + +**ID**: {{index .Result "id"}} +**Status**: {{index .Result "resourceStatus"}} +**Creation date**: {{index .Result "createdAt"}} +**Update date**: {{index .Result "updatedAt"}} + +## Current state + +**Name**: {{index .Result "currentState" "name"}} +**Type**: {{index .Result "currentState" "type"}} +**Status**: {{index .Result "currentState" "status"}} +{{if index .Result "currentState" "location"}}**Region**: {{index .Result "currentState" "location" "region"}}{{end}} + +{{if index .Result "currentState" "secretRefs"}} +### Secret references + +| Name | Secret ID | +| --- | --- | +{{range index .Result "currentState" "secretRefs"}}| {{.name}} | {{.secret.id}} | +{{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_key_manager_secret.tmpl b/internal/services/cloud/templates/cloud_key_manager_secret.tmpl new file mode 100644 index 00000000..90020c99 --- /dev/null +++ b/internal/services/cloud/templates/cloud_key_manager_secret.tmpl @@ -0,0 +1,24 @@ +🔐 Key Manager Secret {{.ServiceName}} +======= + +_{{index .Result "currentState" "name"}}_ + +## General information + +**ID**: {{index .Result "id"}} +**Status**: {{index .Result "resourceStatus"}} +**Creation date**: {{index .Result "createdAt"}} +**Update date**: {{index .Result "updatedAt"}} + +## Current state + +**Name**: {{index .Result "currentState" "name"}} +**Type**: {{index .Result "currentState" "secretType"}} +**Status**: {{index .Result "currentState" "status"}} +**Algorithm**: {{index .Result "currentState" "algorithm"}} +**Bit length**: {{index .Result "currentState" "bitLength"}} +**Mode**: {{index .Result "currentState" "mode"}} +**Expiration**: {{index .Result "currentState" "expiration"}} +{{if index .Result "currentState" "location"}}**Region**: {{index .Result "currentState" "location" "region"}}{{end}} + +💡 Use option -o json or -o yaml to get the raw output with all information diff --git a/internal/services/cloud/utils.go b/internal/services/cloud/utils.go index 3e376f63..0c3c6399 100644 --- a/internal/services/cloud/utils.go +++ b/internal/services/cloud/utils.go @@ -116,6 +116,53 @@ func runFlavorSelector(projectID string, region string) (string, string, error) return selectedFlavor, selectedID, nil } +// waitForCloudResourceReady polls a Cloud API v2 managed resource until its +// resourceStatus reaches READY. Tasks reported in error are logged but do not +// abort the wait; only a resource-level ERROR status is fatal. It times out +// after retryDuration. +func waitForCloudResourceReady(endpoint string, retryDuration time.Duration) error { + ctx, cancel := context.WithTimeout(context.Background(), retryDuration) + defer cancel() + + ticker := time.NewTicker(5 * time.Second) + defer ticker.Stop() + + for { + var resource struct { + ResourceStatus string `json:"resourceStatus"` + CurrentTasks []struct { + ID string `json:"id"` + Type string `json:"type"` + Status string `json:"status"` + } `json:"currentTasks"` + } + if err := httpLib.Client.Get(endpoint, &resource); err != nil { + return fmt.Errorf("error fetching resource: %w", err) + } + + switch resource.ResourceStatus { + case "READY": + return nil + case "ERROR": + return fmt.Errorf("resource ended in error state") + } + + for _, task := range resource.CurrentTasks { + if task.Status == "ERROR" { + log.Printf("Task %s (%s) is in error, still waiting for resource to recover…", task.ID, task.Type) + } + } + + select { + case <-ctx.Done(): + return errors.New("timeout waiting for resource to be ready") + case <-ticker.C: + log.Printf("Still waiting for resource to be ready (status=%s)…", resource.ResourceStatus) + continue + } + } +} + func waitForCloudOperation(projectID, operationID, action string, retryDuration time.Duration) (string, error) { endpoint := fmt.Sprintf("/v1/cloud/project/%s/operation/%s", url.PathEscape(projectID), url.PathEscape(operationID)) resourceID := ""