Change schema endpoints (#447)
* fix resource bug (id is a method) * change schema endpoints * fix test Co-authored-by: REDMOND\gaausfel <gaausfel@microsoft.com>
This commit is contained in:
parent
8629bcbe2d
commit
864d9393f2
|
@ -69,11 +69,13 @@ describe("Add Schema", () => {
|
||||||
subscriptionId: userContext.subscriptionId,
|
subscriptionId: userContext.subscriptionId,
|
||||||
resourceGroup: userContext.resourceGroup,
|
resourceGroup: userContext.resourceGroup,
|
||||||
accountName: userContext.databaseAccount.name,
|
accountName: userContext.databaseAccount.name,
|
||||||
resource: `dbs/${database.id}/colls/${collection.id}`,
|
resource: `dbs/${database.id()}/colls/${collection.id}`,
|
||||||
status: "new",
|
status: "new",
|
||||||
});
|
});
|
||||||
expect(checkForSchema).not.toBeNull();
|
expect(checkForSchema).not.toBeNull();
|
||||||
expect(database.junoClient.getSchema).toBeCalledWith(
|
expect(database.junoClient.getSchema).toBeCalledWith(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
userContext.databaseAccount.name,
|
userContext.databaseAccount.name,
|
||||||
database.id(),
|
database.id(),
|
||||||
collection.id
|
collection.id
|
||||||
|
|
|
@ -329,11 +329,13 @@ export default class Database implements ViewModels.Database {
|
||||||
subscriptionId: userContext.subscriptionId,
|
subscriptionId: userContext.subscriptionId,
|
||||||
resourceGroup: userContext.resourceGroup,
|
resourceGroup: userContext.resourceGroup,
|
||||||
accountName: userContext.databaseAccount.name,
|
accountName: userContext.databaseAccount.name,
|
||||||
resource: `dbs/${this.id}/colls/${collection.id}`,
|
resource: `dbs/${this.id()}/colls/${collection.id}`,
|
||||||
status: "new",
|
status: "new",
|
||||||
});
|
});
|
||||||
checkForSchema = setInterval(async () => {
|
checkForSchema = setInterval(async () => {
|
||||||
const response: IJunoResponse<DataModels.ISchema> = await this.junoClient.getSchema(
|
const response: IJunoResponse<DataModels.ISchema> = await this.junoClient.getSchema(
|
||||||
|
userContext.subscriptionId,
|
||||||
|
userContext.resourceGroup,
|
||||||
userContext.databaseAccount.name,
|
userContext.databaseAccount.name,
|
||||||
this.id(),
|
this.id(),
|
||||||
collection.id
|
collection.id
|
||||||
|
|
|
@ -427,7 +427,7 @@ export class JunoClient {
|
||||||
public async requestSchema(
|
public async requestSchema(
|
||||||
schemaRequest: DataModels.ISchemaRequest
|
schemaRequest: DataModels.ISchemaRequest
|
||||||
): Promise<IJunoResponse<DataModels.ISchemaRequest>> {
|
): Promise<IJunoResponse<DataModels.ISchemaRequest>> {
|
||||||
const response = await window.fetch(`${this.getAnalyticsUrl()}/${schemaRequest.accountName}/schema/request`, {
|
const response = await window.fetch(`${this.getAnalyticsUrl()}/schema/request`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(schemaRequest),
|
body: JSON.stringify(schemaRequest),
|
||||||
headers: JunoClient.getHeaders(),
|
headers: JunoClient.getHeaders(),
|
||||||
|
@ -445,12 +445,14 @@ export class JunoClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getSchema(
|
public async getSchema(
|
||||||
|
subscriptionId: string,
|
||||||
|
resourceGroup: string,
|
||||||
accountName: string,
|
accountName: string,
|
||||||
databaseName: string,
|
databaseName: string,
|
||||||
containerName: string
|
containerName: string
|
||||||
): Promise<IJunoResponse<DataModels.ISchema>> {
|
): Promise<IJunoResponse<DataModels.ISchema>> {
|
||||||
const response = await window.fetch(
|
const response = await window.fetch(
|
||||||
`${this.getAnalyticsUrl()}/${accountName}/schema/${databaseName}/${containerName}`,
|
`${this.getAnalyticsUrl()}/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/databaseAccounts/${accountName}/schema/${databaseName}/${containerName}`,
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: JunoClient.getHeaders(),
|
headers: JunoClient.getHeaders(),
|
||||||
|
|
Loading…
Reference in New Issue