issue #6945: Move instance management API to /management instead of /private

This commit is contained in:
Sebastian 2021-08-05 15:02:52 -03:00
parent e073f3a793
commit 8dbf127083
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
3 changed files with 10 additions and 10 deletions

View File

@ -1162,7 +1162,7 @@ export class MerchantApiClient {
async changeAuth(auth: MerchantAuthConfiguration): Promise<void> {
const baseUrl = this.baseUrl;
const url = new URL("private/auth", baseUrl);
const url = new URL("management/auth", baseUrl);
await axios.post(url.href, auth, {
headers: this.makeAuthHeader(),
});
@ -1170,7 +1170,7 @@ export class MerchantApiClient {
async deleteInstance(instanceId: string) {
const baseUrl = this.baseUrl;
const url = new URL(`private/instances/${instanceId}`, this.baseUrl);
const url = new URL(`management/instances/${instanceId}`, this.baseUrl);
await axios.delete(url.href, {
headers: this.makeAuthHeader(),
});
@ -1178,14 +1178,14 @@ export class MerchantApiClient {
async createInstance(req: MerchantInstanceConfig): Promise<void> {
const baseUrl = this.baseUrl;
const url = new URL("private/instances", baseUrl);
const url = new URL("management/instances", baseUrl);
await axios.post(url.href, req, {
headers: this.makeAuthHeader(),
});
}
async getInstances(): Promise<MerchantInstancesResponse> {
const url = new URL("private/instances", this.baseUrl);
const url = new URL("management/instances", this.baseUrl);
const resp = await axios.get(url.href, {
headers: this.makeAuthHeader(),
});
@ -1193,7 +1193,7 @@ export class MerchantApiClient {
}
async getInstanceFullDetails(instanceId: string): Promise<any> {
const url = new URL(`private/instances/${instanceId}`, this.baseUrl);
const url = new URL(`management/instances/${instanceId}`, this.baseUrl);
try {
const resp = await axios.get(url.href, {
headers: this.makeAuthHeader(),
@ -1471,7 +1471,7 @@ export class MerchantService implements MerchantServiceInterface {
throw Error("merchant must be running to add instance");
}
console.log("adding instance");
const url = `http://localhost:${this.merchantConfig.httpPort}/private/instances`;
const url = `http://localhost:${this.merchantConfig.httpPort}/management/instances`;
const auth = instanceConfig.auth ?? { method: "external" };
await axios.post(url, {
auth,

View File

@ -66,7 +66,7 @@ export async function runMerchantInstancesDeleteTest(t: GlobalTestState) {
// Instances should initially be empty
{
const r = await axios.get(new URL("private/instances", baseUrl).href);
const r = await axios.get(new URL("management/instances", baseUrl).href);
t.assertDeepEqual(r.data.instances, []);
}

View File

@ -66,7 +66,7 @@ export async function runMerchantInstancesTest(t: GlobalTestState) {
// Instances should initially be empty
{
const r = await axios.get(new URL("private/instances", baseUrl).href);
const r = await axios.get(new URL("management/instances", baseUrl).href);
t.assertDeepEqual(r.data.instances, []);
}
@ -102,7 +102,7 @@ export async function runMerchantInstancesTest(t: GlobalTestState) {
// Check that a "malformed" bearer Authorization header gets ignored
{
const url = merchant.makeInstanceBaseUrl();
const resp = await axios.get(new URL("private/instances", url).href, {
const resp = await axios.get(new URL("management/instances", url).href, {
headers: {
Authorization: "foo bar-baz",
},
@ -143,7 +143,7 @@ export async function runMerchantInstancesTest(t: GlobalTestState) {
// Now, try some variations.
{
const url = merchant.makeInstanceBaseUrl();
const resp = await axios.get(new URL("private/instances", url).href, {
const resp = await axios.get(new URL("management/instances", url).href, {
headers: {
// Note the spaces
Authorization: "Bearer secret-token:foobar",