Skip to content

Commit

Permalink
INTMDB-173: Update the path of AccessListAPIKeys service (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaangiolillo committed Jan 27, 2021
1 parent 0c9dbf6 commit 908c053
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion mongodbatlas/accesslist_api_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"net/http"
)

const accessListAPIKeysPath = "orgs/%s/apiKeys/%s/accesslist"
const accessListAPIKeysPath = "orgs/%s/apiKeys/%s/accessList"

// AccessListAPIKeysService is an interface for interfacing with the AccessList API Keys
// endpoints of the MongoDB Atlas API.
Expand Down
36 changes: 18 additions & 18 deletions mongodbatlas/accesslist_api_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestAccessListAPIKeys_List(t *testing.T) {
fmt.Fprint(w, `{
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/599c510c80eef518f3b63fe1/apiKeys/5c49e72980eef544a218f8f8/accesslist/?pretty=true&pageNum=1&itemsPerPage=100",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/599c510c80eef518f3b63fe1/apiKeys/5c49e72980eef544a218f8f8/accessList/?pretty=true&pageNum=1&itemsPerPage=100",
"rel": "self"
}
],
Expand All @@ -49,7 +49,7 @@ func TestAccessListAPIKeys_List(t *testing.T) {
"lastUsedAddress": "147.58.184.16",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/147.58.184.16",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/147.58.184.16",
"rel": "self"
}
]
Expand All @@ -63,7 +63,7 @@ func TestAccessListAPIKeys_List(t *testing.T) {
"lastUsedAddress": "84.255.48.125",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/206.252.195.126",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/206.252.195.126",
"rel": "self"
}
]
Expand All @@ -81,7 +81,7 @@ func TestAccessListAPIKeys_List(t *testing.T) {
expected := &AccessListAPIKeys{
Links: []*Link{
{
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/599c510c80eef518f3b63fe1/apiKeys/5c49e72980eef544a218f8f8/accesslist/?pretty=true&pageNum=1&itemsPerPage=100",
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/599c510c80eef518f3b63fe1/apiKeys/5c49e72980eef544a218f8f8/accessList/?pretty=true&pageNum=1&itemsPerPage=100",
Rel: "self",
},
},
Expand All @@ -95,7 +95,7 @@ func TestAccessListAPIKeys_List(t *testing.T) {
LastUsedAddress: "147.58.184.16",
Links: []*Link{
{
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/147.58.184.16",
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/147.58.184.16",
Rel: "self",
},
},
Expand All @@ -109,7 +109,7 @@ func TestAccessListAPIKeys_List(t *testing.T) {
LastUsedAddress: "84.255.48.125",
Links: []*Link{
{
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/206.252.195.126",
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/206.252.195.126",
Rel: "self",
},
},
Expand Down Expand Up @@ -140,14 +140,14 @@ func TestAccessListAPIKeys_Get(t *testing.T) {
"ipAddress": "147.58.184.16",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/147.58.184.16",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/147.58.184.16",
"rel": "self"
}
]
}`)
})

accesslistAPIKey, _, err := client.AccessListAPIKeys.Get(ctx, orgID, apiKeyID, ipAddress)
accessListAPIKey, _, err := client.AccessListAPIKeys.Get(ctx, orgID, apiKeyID, ipAddress)
if err != nil {
t.Fatalf("AccessListAPIKeys.Get returned error: %v", err)
}
Expand All @@ -159,13 +159,13 @@ func TestAccessListAPIKeys_Get(t *testing.T) {
IPAddress: "147.58.184.16",
Links: []*Link{
{
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/147.58.184.16",
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/147.58.184.16",
Rel: "self",
},
},
}

if diff := deep.Equal(accesslistAPIKey, expected); diff != nil {
if diff := deep.Equal(accessListAPIKey, expected); diff != nil {
t.Error(diff)
}
}
Expand Down Expand Up @@ -205,7 +205,7 @@ func TestAccessListAPIKeys_Create(t *testing.T) {
fmt.Fprint(w, `{
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/599c510c80eef518f3b63fe1/apiKeys/5c49e72980eef544a218f8f8/accesslist/?pretty=true&pageNum=1&itemsPerPage=100",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/599c510c80eef518f3b63fe1/apiKeys/5c49e72980eef544a218f8f8/accessList/?pretty=true&pageNum=1&itemsPerPage=100",
"rel": "self"
}
],
Expand All @@ -219,7 +219,7 @@ func TestAccessListAPIKeys_Create(t *testing.T) {
"lastUsedAddress": "147.58.184.16",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/147.58.184.16",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/147.58.184.16",
"rel": "self"
}
]
Expand All @@ -233,7 +233,7 @@ func TestAccessListAPIKeys_Create(t *testing.T) {
"lastUsedAddress": "77.54.32.11",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/77.54.32.11",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/77.54.32.11",
"rel": "self"
}
]
Expand All @@ -243,15 +243,15 @@ func TestAccessListAPIKeys_Create(t *testing.T) {
}`)
})

accesslistAPIKey, _, err := client.AccessListAPIKeys.Create(ctx, orgID, apiKeyID, createRequest)
accessListAPIKey, _, err := client.AccessListAPIKeys.Create(ctx, orgID, apiKeyID, createRequest)
if err != nil {
t.Fatalf("AccessListAPIKeys.Create returned error: %v", err)
}

expected := &AccessListAPIKeys{
Links: []*Link{
{
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/599c510c80eef518f3b63fe1/apiKeys/5c49e72980eef544a218f8f8/accesslist/?pretty=true&pageNum=1&itemsPerPage=100",
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/599c510c80eef518f3b63fe1/apiKeys/5c49e72980eef544a218f8f8/accessList/?pretty=true&pageNum=1&itemsPerPage=100",
Rel: "self",
},
},
Expand All @@ -265,7 +265,7 @@ func TestAccessListAPIKeys_Create(t *testing.T) {
LastUsedAddress: "147.58.184.16",
Links: []*Link{
{
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/147.58.184.16",
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/147.58.184.16",
Rel: "self",
},
},
Expand All @@ -279,7 +279,7 @@ func TestAccessListAPIKeys_Create(t *testing.T) {
LastUsedAddress: "77.54.32.11",
Links: []*Link{
{
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accesslist/77.54.32.11",
Href: "https://cloud.mongodb.com/api/atlas/v1.0/orgs/{ORG-ID}/apiKeys/{API-KEY-ID}/accessList/77.54.32.11",
Rel: "self",
},
},
Expand All @@ -288,7 +288,7 @@ func TestAccessListAPIKeys_Create(t *testing.T) {
TotalCount: 2,
}

if diff := deep.Equal(accesslistAPIKey, expected); diff != nil {
if diff := deep.Equal(accessListAPIKey, expected); diff != nil {
t.Error(diff)
}
}
Expand Down

0 comments on commit 908c053

Please sign in to comment.