Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cor-653): handle variable description #402

Merged
merged 7 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The acceptance tests require a `QOVERY_API_TOKEN` environment variable to be set
It corresponds to your JWT token on the Qovery's console and can be acquired using the [qovery-cli](https://github.com/Qovery/qovery-cli) with the following command (needs [jq](https://stedolan.github.io/jq/download/)):

```shell
qovery auth ; cat ~/.qovery/context.json | jq .access_token | cut -d '"' -f2 | sed 's/.*Authorization: Bearer \(*\)/\1/' | tr -d '\n'
qovery auth ; cat ~/.qovery/context.json | jq -r .access_token | sed 's/.*Authorization: Bearer \(*\)/\1/' | tr -d '\n'
```

This JWT needs to be put inside a `.env` file at the root of the repository.
Expand Down
40 changes: 32 additions & 8 deletions client/application_environment_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ func (c *Client) updateApplicationEnvironmentVariableAliases(
aliasedVariableId := environmentVariablesByName[*(variable.Value)].Id
_, res, err = c.api.ApplicationEnvironmentVariableAPI.
CreateApplicationEnvironmentVariableAlias(ctx, applicationID, aliasedVariableId).
Key(qovery.Key{Key: variable.Key}).
Key(qovery.Key{
Key: variable.Key,
Description: variable.Description,
}).
Execute()
if err != nil || res.StatusCode >= 400 {
return apierrors.NewCreateError(apierrors.APIResourceApplicationEnvironmentAliasVariable, variable.Key, res, err)
Expand All @@ -95,7 +98,10 @@ func (c *Client) updateApplicationEnvironmentVariableAliases(
aliasedVariableId := environmentVariablesByName[*(variable.Value)].Id
_, res, err := c.api.ApplicationEnvironmentVariableAPI.
CreateApplicationEnvironmentVariableAlias(ctx, applicationID, aliasedVariableId).
Key(qovery.Key{Key: variable.Key}).
Key(qovery.Key{
Key: variable.Key,
Description: variable.Description,
}).
Execute()
if err != nil || res.StatusCode >= 400 {
return apierrors.NewCreateError(apierrors.APIResourceApplicationEnvironmentAliasVariable, variable.Key, res, err)
Expand Down Expand Up @@ -136,7 +142,10 @@ func (c *Client) updateApplicationEnvironmentVariableOverrides(
overriddenVariableId := environmentVariablesByName[variable.Key].Id
_, res, err = c.api.ApplicationEnvironmentVariableAPI.
CreateApplicationEnvironmentVariableOverride(ctx, applicationID, overriddenVariableId).
Value(qovery.Value{Value: variable.Value}).
Value(qovery.Value{
Value: variable.Value,
Description: variable.Description,
}).
Execute()
if err != nil || res.StatusCode >= 400 {
return apierrors.NewCreateError(apierrors.APIResourceApplicationEnvironmentOverrideVariable, variable.Key, res, err)
Expand All @@ -149,7 +158,10 @@ func (c *Client) updateApplicationEnvironmentVariableOverrides(
overriddenVariableId := environmentVariablesByName[variable.Key].Id
_, res, err := c.api.ApplicationEnvironmentVariableAPI.
CreateApplicationEnvironmentVariableOverride(ctx, applicationID, overriddenVariableId).
Value(qovery.Value{Value: variable.Value}).
Value(qovery.Value{
Value: variable.Value,
Description: variable.Description,
}).
Execute()
if err != nil || res.StatusCode >= 400 {
return apierrors.NewCreateError(apierrors.APIResourceApplicationEnvironmentOverrideVariable, variable.Key, res, err)
Expand Down Expand Up @@ -191,7 +203,10 @@ func (c *Client) updateApplicationSecretAliases(
aliasedSecretId := secretsByName[*(secret.Value)].Id
_, res, err := c.api.ApplicationSecretAPI.
CreateApplicationSecretAlias(ctx, applicationID, aliasedSecretId).
Key(qovery.Key{Key: secret.Key}).
Key(qovery.Key{
Key: secret.Key,
Description: secret.Description,
}).
Execute()
if err != nil || res.StatusCode >= 400 {
return apierrors.NewCreateError(apierrors.APIResourceApplicationSecretAlias, secret.Key, res, err)
Expand All @@ -204,7 +219,10 @@ func (c *Client) updateApplicationSecretAliases(
aliasedSecretId := secretsByName[*(secret.Value)].Id
_, res, err := c.api.ApplicationSecretAPI.
CreateApplicationSecretAlias(ctx, applicationID, aliasedSecretId).
Key(qovery.Key{Key: secret.Key}).
Key(qovery.Key{
Key: secret.Key,
Description: secret.Description,
}).
Execute()
if err != nil || res.StatusCode >= 400 {
return apierrors.NewCreateError(apierrors.APIResourceApplicationSecretAlias, secret.Key, res, err)
Expand Down Expand Up @@ -246,7 +264,10 @@ func (c *Client) updateApplicationSecretOverrides(
overriddenSecretId := secretsByName[secret.Key].Id
_, res, err := c.api.ApplicationSecretAPI.
CreateApplicationSecretOverride(ctx, applicationID, overriddenSecretId).
Value(qovery.Value{Value: secret.Value}).
Value(qovery.Value{
Value: secret.Value,
Description: secret.Description,
}).
Execute()
if err != nil || res.StatusCode >= 400 {
return apierrors.NewCreateError(apierrors.APIResourceApplicationSecretOverride, secret.Key, res, err)
Expand All @@ -259,7 +280,10 @@ func (c *Client) updateApplicationSecretOverrides(
overriddenSecretId := secretsByName[secret.Key].Id
_, res, err := c.api.ApplicationSecretAPI.
CreateApplicationSecretOverride(ctx, applicationID, overriddenSecretId).
Value(qovery.Value{Value: secret.Value}).
Value(qovery.Value{
Value: secret.Value,
Description: secret.Description,
}).
Execute()
if err != nil || res.StatusCode >= 400 {
return apierrors.NewCreateError(apierrors.APIResourceApplicationSecretOverride, secret.Key, res, err)
Expand Down
7 changes: 7 additions & 0 deletions docs/data-sources/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable alias.
- `id` (String) Id of the environment variable alias.
- `key` (String) Name of the environment variable alias.
- `value` (String) Name of the variable to alias.
Expand All @@ -108,6 +109,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable override.
- `id` (String) Id of the environment variable override.
- `key` (String) Name of the environment variable override.
- `value` (String) Value of the environment variable override.
Expand All @@ -118,6 +120,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand Down Expand Up @@ -275,6 +278,7 @@ Optional:

Read-Only:

- `description` (String) Description of the secret alias.
- `id` (String) Id of the secret alias.
- `key` (String) Name of the secret alias.
- `value` (String) Name of the secret to alias.
Expand All @@ -285,6 +289,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the secret override.
- `id` (String) Id of the secret override.
- `key` (String) Name of the secret override.
- `value` (String, Sensitive) Value of the secret override.
Expand All @@ -295,6 +300,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the secret.
- `id` (String) Id of the secret.
- `key` (String) Key of the secret.
- `value` (String, Sensitive) Value of the secret.
Expand All @@ -318,6 +324,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand Down
7 changes: 7 additions & 0 deletions docs/data-sources/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable alias.
- `id` (String) Id of the environment variable alias.
- `key` (String) Name of the environment variable alias.
- `value` (String) Name of the variable to alias.
Expand All @@ -89,6 +90,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable override.
- `id` (String) Id of the environment variable override.
- `key` (String) Name of the environment variable override.
- `value` (String) Value of the environment variable override.
Expand All @@ -99,6 +101,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand Down Expand Up @@ -278,6 +281,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the secret alias.
- `id` (String) Id of the secret alias.
- `key` (String) Name of the secret alias.
- `value` (String) Name of the secret to alias.
Expand All @@ -288,6 +292,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the secret override.
- `id` (String) Id of the secret override.
- `key` (String) Name of the secret override.
- `value` (String, Sensitive) Value of the secret override.
Expand All @@ -298,6 +303,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the secret.
- `id` (String) Id of the secret.
- `key` (String) Key of the secret.
- `value` (String, Sensitive) Value of the secret.
Expand All @@ -321,6 +327,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand Down
7 changes: 7 additions & 0 deletions docs/data-sources/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ data "qovery_environment" "my_environment" {

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable alias.
- `key` (String) Name of the environment variable alias.
- `value` (String) Name of the variable to alias.
Expand All @@ -49,6 +50,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable override.
- `key` (String) Name of the environment variable override.
- `value` (String) Value of the environment variable override.
Expand All @@ -59,6 +61,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand All @@ -69,6 +72,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret alias.
- `key` (String) Name of the secret alias.
- `value` (String) Name of the secret to alias.
Expand All @@ -79,6 +83,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret override.
- `key` (String) Name of the secret override.
- `value` (String, Sensitive) Value of the secret override.
Expand All @@ -89,6 +94,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret.
- `key` (String) Key of the secret.
- `value` (String, Sensitive) Value of the secret.
Expand All @@ -99,6 +105,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand Down
7 changes: 7 additions & 0 deletions docs/data-sources/helm.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable alias.
- `key` (String) Name of the environment variable alias.
- `value` (String) Name of the variable to alias.
Expand All @@ -61,6 +62,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable override.
- `key` (String) Name of the environment variable override.
- `value` (String) Value of the environment variable override.
Expand All @@ -71,6 +73,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand All @@ -81,6 +84,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret alias.
- `key` (String) Name of the secret alias.
- `value` (String) Name of the secret to alias.
Expand All @@ -91,6 +95,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret override.
- `key` (String) Name of the secret override.
- `value` (String, Sensitive) Value of the secret override.
Expand All @@ -101,6 +106,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret.
- `key` (String) Key of the secret.
- `value` (String, Sensitive) Value of the secret.
Expand All @@ -111,6 +117,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand Down
7 changes: 7 additions & 0 deletions docs/data-sources/job.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable alias.
- `key` (String) Name of the environment variable alias.
- `value` (String) Name of the variable to alias.
Expand All @@ -82,6 +83,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable override.
- `key` (String) Name of the environment variable override.
- `value` (String) Value of the environment variable override.
Expand All @@ -92,6 +94,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand Down Expand Up @@ -249,6 +252,7 @@ Optional:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret alias.
- `key` (String) Name of the secret alias.
- `value` (String) Name of the secret to alias.
Expand All @@ -259,6 +263,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret override.
- `key` (String) Name of the secret override.
- `value` (String, Sensitive) Value of the secret override.
Expand All @@ -269,6 +274,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the secret.
- `key` (String) Key of the secret.
- `value` (String, Sensitive) Value of the secret.
Expand Down Expand Up @@ -324,6 +330,7 @@ Read-Only:

Read-Only:

- `description` (String) Description of the environment variable.
- `id` (String) Id of the environment variable.
- `key` (String) Key of the environment variable.
- `value` (String) Value of the environment variable.
Expand Down
Loading
Loading