Skip to content

Commit

Permalink
NFV-23888: introduce keyType field for public key POST and GET APIs (#21
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rling-equinix authored Apr 11, 2023
1 parent a006e59 commit 2d067fd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ type SSHPublicKey struct {
UUID *string
Name *string
Value *string
Type *string
}

//ACLTemplate describes Network Edge device ACL template
Expand Down
1 change: 1 addition & 0 deletions internal/api/sshkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ type SSHPublicKey struct {
UUID *string `json:"uuid,omitempty"`
KeyName *string `json:"keyName,omitempty"`
KeyValue *string `json:"keyValue,omitempty"`
KeyType *string `json:"keyType,omitempty"`
}
2 changes: 2 additions & 0 deletions rest_sshkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func mapSSHPublicKeyAPIToDomain(apiKey api.SSHPublicKey) SSHPublicKey {
UUID: apiKey.UUID,
Name: apiKey.KeyName,
Value: apiKey.KeyValue,
Type: apiKey.KeyType,
}
}

Expand All @@ -76,5 +77,6 @@ func mapSSHPublicKeyDomainToAPI(key SSHPublicKey) api.SSHPublicKey {
UUID: key.UUID,
KeyName: key.Name,
KeyValue: key.Value,
KeyType: key.Type,
}
}
2 changes: 2 additions & 0 deletions rest_sshkey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
var testSSHPublicKey = SSHPublicKey{
Name: String("testKey"),
Value: String("keyyyyyyyyyyyyyyyyyyyyyyyyy"),
Type: String("RSA"),
}

func TestGetSSHPublicKeys(t *testing.T) {
Expand Down Expand Up @@ -109,4 +110,5 @@ func verifySSHPublicKey(t *testing.T, apiKey api.SSHPublicKey, key SSHPublicKey)
assert.Equal(t, apiKey.UUID, key.UUID, "UUID matches")
assert.Equal(t, apiKey.KeyName, key.Name, "Name matches")
assert.Equal(t, apiKey.KeyValue, key.Value, "Value matches")
assert.Equal(t, apiKey.KeyType, key.Type, "Type matches")
}
1 change: 1 addition & 0 deletions test-fixtures/ne_sshpubkey_get.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"uuid": "71c35a94-edf7-4537-9b96-57cdfeaf7a2f",
"keyName": "mik-test",
"keyValue": "keyyyyyyyyyyyyyyyyyyyyyyyyy",
"keyType": "RSA",
"custOrgId": 86108
}
3 changes: 3 additions & 0 deletions test-fixtures/ne_sshpubkeys_get.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@
"uuid": "288e87ff-9ad3-4f50-aab8-58a0b7b1bdd2",
"keyName": "keyN828A",
"keyValue": "keyyyyyyyyyyyyyyyyyyyyyyyyy",
"keyType": "RSA",
"custOrgId": 86108
},
{
"uuid": "50d64c3c-e2e6-48b8-95bb-cd2cbc4df34a",
"keyName": "keyDqACq",
"keyValue": "keyyyyyyyyyyyyyyyyyyyyyyyyy",
"keyType": "RSA",
"custOrgId": 86108
},
{
"uuid": "d74a548c-623d-4cd2-b4ab-cb6f7cb5e443",
"keyName": "keyTyVDJ",
"keyValue": "keyyyyyyyyyyyyyyyyyyyyyyyyy",
"keyType": "DSA",
"custOrgId": 86108
}
]

0 comments on commit 2d067fd

Please sign in to comment.