Skip to content

Commit

Permalink
Merge pull request #332 from hashicorp/update-sshkey-ID
Browse files Browse the repository at this point in the history
change ID to type
  • Loading branch information
sebasslash committed Feb 25, 2022
2 parents 9b2ac88 + 9fc1df4 commit bda4931
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ssh_key.go
Expand Up @@ -147,8 +147,11 @@ func (s *sshKeys) Read(ctx context.Context, sshKeyID string) (*SSHKey, error) {

// SSHKeyUpdateOptions represents the options for updating an SSH key.
type SSHKeyUpdateOptions struct {
// For internal use only!
ID string `jsonapi:"primary,ssh-keys"`
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,ssh-keys"`

// A new name to identify the SSH key.
Name *string `jsonapi:"attr,name,omitempty"`
Expand All @@ -160,9 +163,6 @@ func (s *sshKeys) Update(ctx context.Context, sshKeyID string, options SSHKeyUpd
return nil, ErrInvalidSHHKeyID
}

// Make sure we don't send a user provided ID.
options.ID = ""

u := fmt.Sprintf("ssh-keys/%s", url.QueryEscape(sshKeyID))
req, err := s.client.newRequest("PATCH", u, &options)
if err != nil {
Expand Down

0 comments on commit bda4931

Please sign in to comment.