Skip to content

Commit

Permalink
VAULT-31803 - Updates secret_name to secret (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
mercedesbh authored Oct 17, 2024
1 parent 51c432c commit dd4b1c4
Show file tree
Hide file tree
Showing 11 changed files with 1,240 additions and 53 deletions.
3 changes: 3 additions & 0 deletions .changelog/184.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
vault-secrets: Update vault-secrets rotating secrets from `secret_name` to `name` usage
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hcl/v2 v2.22.0
github.com/hashicorp/hcp-sdk-go v0.115.0
github.com/hashicorp/hcp-sdk-go v0.117.0
github.com/lithammer/dedent v1.1.0
github.com/manifoldco/promptui v0.9.0
github.com/mitchellh/cli v1.1.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mO
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/hcl/v2 v2.22.0 h1:hkZ3nCtqeJsDhPRFz5EA9iwcG1hNWGePOTw6oyul12M=
github.com/hashicorp/hcl/v2 v2.22.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA=
github.com/hashicorp/hcp-sdk-go v0.115.0 h1:q6viFNFPd4H4cHm/B9KGYvkpkT5ZSBQASh9KR/zYHEI=
github.com/hashicorp/hcp-sdk-go v0.115.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk=
github.com/hashicorp/hcp-sdk-go v0.117.0 h1:7lJpkinpWdsXtejC+X7MdaE/3zhFMweB9Ym3uJ7qFJw=
github.com/hashicorp/hcp-sdk-go v0.117.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk=
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/vaultsecrets/secrets/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func createRun(opts *CreateOpts) error {
return fmt.Errorf("error marshaling details config: %w", err)
}

twilioBody.SecretName = opts.SecretName
twilioBody.Name = opts.SecretName
req.Body = &twilioBody

resp, err := opts.PreviewClient.CreateTwilioRotatingSecret(req, nil)
Expand Down Expand Up @@ -303,7 +303,7 @@ func createRun(opts *CreateOpts) error {
return fmt.Errorf("error marshaling details config: %w", err)
}

mongoDBBody.SecretName = opts.SecretName
mongoDBBody.Name = opts.SecretName
req.Body = &mongoDBBody

resp, err := opts.PreviewClient.CreateMongoDBAtlasRotatingSecret(req, nil)
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/vaultsecrets/secrets/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ details = {
ProjectID: testProfile(t).ProjectID,
AppName: testProfile(t).VaultSecrets.AppName,
Body: &preview_models.SecretServiceCreateMongoDBAtlasRotatingSecretBody{
SecretName: opts.SecretName,
Name: opts.SecretName,
IntegrationName: "mongo-db-integration",
RotationPolicyName: "built-in:60-days-2-active",
SecretDetails: &preview_models.Secrets20231128MongoDBAtlasSecretDetails{
Expand All @@ -345,7 +345,7 @@ details = {
CreatedAt: dt,
IntegrationName: "mongo-db-integration",
RotationPolicyName: "built-in:60-days-2-active",
SecretName: opts.SecretName,
Name: opts.SecretName,
},
},
}, nil).Once()
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/vaultsecrets/secrets/displayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (r *rotatingSecretsDisplayer) FieldTemplates() []format.Field {
return []format.Field{
{
Name: "Secret Name",
ValueFormat: "{{ .SecretName }}",
ValueFormat: "{{ .Name }}",
},
{
Name: " Integration Name",
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/vaultsecrets/secrets/rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func rotateRun(opts *RotateOpts) error {
OrganizationID: opts.Profile.OrganizationID,
ProjectID: opts.Profile.ProjectID,
AppName: opts.AppName,
SecretName: opts.SecretName,
Name: opts.SecretName,
}

_, err := opts.PreviewClient.RotateSecret(params, nil)
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/vaultsecrets/secrets/rotate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestRotateRun(t *testing.T) {
OrganizationID: testProfile(t).OrganizationID,
ProjectID: testProfile(t).ProjectID,
AppName: testProfile(t).VaultSecrets.AppName,
SecretName: opts.SecretName,
Name: opts.SecretName,
Context: opts.Ctx,
}, mock.Anything).Return(&preview_secret_service.RotateSecretOK{}, nil).Once()
}
Expand Down
4 changes: 2 additions & 2 deletions internal/commands/vaultsecrets/secrets/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func updateRun(opts *UpdateOpts) error {
req.OrganizationID = opts.Profile.OrganizationID
req.ProjectID = opts.Profile.ProjectID
req.AppName = opts.AppName
req.SecretName = opts.SecretName
req.Name = opts.SecretName

var twilioBody preview_models.SecretServiceUpdateTwilioRotatingSecretBody
detailBytes, err := json.Marshal(internalConfig.Details)
Expand Down Expand Up @@ -163,7 +163,7 @@ func updateRun(opts *UpdateOpts) error {
req.OrganizationID = opts.Profile.OrganizationID
req.ProjectID = opts.Profile.ProjectID
req.AppName = opts.AppName
req.SecretName = opts.SecretName
req.Name = opts.SecretName

var mongoDBBody preview_models.SecretServiceUpdateMongoDBAtlasRotatingSecretBody
detailBytes, err := json.Marshal(internalConfig.Details)
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/vaultsecrets/secrets/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ details = {
OrganizationID: testProfile(t).OrganizationID,
ProjectID: testProfile(t).ProjectID,
AppName: testProfile(t).VaultSecrets.AppName,
SecretName: "test_secret",
Name: "test_secret",
Body: &preview_models.SecretServiceUpdateMongoDBAtlasRotatingSecretBody{
RotateOnUpdate: true,
RotationPolicyName: "built-in:60-days-2-active",
Expand Down
Loading

0 comments on commit dd4b1c4

Please sign in to comment.