issue #6945: Move instance management API to /management instead of /private
This commit is contained in:
parent
e073f3a793
commit
8dbf127083
@ -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,
|
||||
|
@ -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, []);
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user