From 908c0535d2f7858627682b1330081f31629bf3ce Mon Sep 17 00:00:00 2001 From: Andrea Angiolillo Date: Wed, 27 Jan 2021 13:03:23 +0000 Subject: [PATCH] INTMDB-173: Update the path of AccessListAPIKeys service (#178) --- mongodbatlas/accesslist_api_keys.go | 2 +- mongodbatlas/accesslist_api_keys_test.go | 36 ++++++++++++------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/mongodbatlas/accesslist_api_keys.go b/mongodbatlas/accesslist_api_keys.go index dd7999348..d35aa92fb 100644 --- a/mongodbatlas/accesslist_api_keys.go +++ b/mongodbatlas/accesslist_api_keys.go @@ -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. diff --git a/mongodbatlas/accesslist_api_keys_test.go b/mongodbatlas/accesslist_api_keys_test.go index 20df4cfc8..66e2b3398 100644 --- a/mongodbatlas/accesslist_api_keys_test.go +++ b/mongodbatlas/accesslist_api_keys_test.go @@ -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" } ], @@ -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" } ] @@ -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" } ] @@ -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", }, }, @@ -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", }, }, @@ -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", }, }, @@ -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) } @@ -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) } } @@ -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" } ], @@ -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" } ] @@ -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" } ] @@ -243,7 +243,7 @@ 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) } @@ -251,7 +251,7 @@ func TestAccessListAPIKeys_Create(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", }, }, @@ -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", }, }, @@ -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", }, }, @@ -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) } }