Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/cloud/entities/universe/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
CloudUniversesFetchRemoteError,
OperatorUniverse,
OperatorUniverseResponse,
OperatorUniverseError
OperatorUniverseError,
OperatorMtUniverse,
OperatorMtUniverseResponse,
OperatorUniverseResponseV2
} from './universe'

export {
Expand All @@ -16,5 +19,8 @@ export {
CloudUniversesFetchRemoteError,
OperatorUniverse,
OperatorUniverseResponse,
OperatorUniverseError
OperatorUniverseError,
OperatorMtUniverse,
OperatorMtUniverseResponse,
OperatorUniverseResponseV2
}
17 changes: 17 additions & 0 deletions src/cloud/entities/universe/universe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export type DeployReleaseResponse = SingleDeployReleaseResponse | [SingleDeployR

export interface OperatorUniverse {
readonly id: string
readonly mt: boolean
readonly name: string
readonly pool: string
readonly organization: string
Expand All @@ -76,6 +77,22 @@ export interface OperatorUniverse {

export type OperatorUniverseResponse = OperatorUniverse | [OperatorUniverse]

export interface OperatorMtUniverse {
readonly id: string
readonly mt: boolean
readonly name: string
readonly organization: string
readonly createdAt: string
// readonly status: string
// readonly applied: boolean
// readonly isLive: boolean
readonly rawCrd: any
}

export type OperatorMtUniverseResponse = OperatorMtUniverse | [OperatorMtUniverse]

export type OperatorUniverseResponseV2 = [OperatorUniverse | OperatorMtUniverse]

export interface ReleaseHistoryResponse {
readonly id: string
readonly universe: string
Expand Down
20 changes: 20 additions & 0 deletions src/cloud/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,26 @@ export class Cloud extends APICarrier {
}
}

public async operatorUniversesV2 (qs?: string): Promise<universe.OperatorUniverseResponseV2> {
try {
const res = await this.http.getClient().get(`${this.cloudBase}/api/v0/universes/operator/v2${qs && typeof qs === 'string' ? `?${qs}` : ''}`)

return res.data?.data
} catch (err) {
throw new universe.OperatorUniverseError()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rethrown error discards the original error context, making debugging harder.

Suggested change
throw new universe.OperatorUniverseError()
throw new universe.OperatorUniverseError(undefined, { error: err })

}
}

public async operatorChurnedUniversesV2 (): Promise<universe.OperatorUniverseResponseV2> {
try {
const res = await this.http.getClient().get(`${this.cloudBase}/api/v0/universes/operator/v2?churned=true`)

return res.data?.data
} catch (err) {
throw new universe.OperatorUniverseError()
}
}

public async configuration (): Promise<any> {
try {
const res = await this.http.getClient().get(`${this.cloudBase}/api/v0/configuration`)
Expand Down
Loading