Skip to content

Commit

Permalink
Delete deprecated methods (#885)
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Morhun <[email protected]>
  • Loading branch information
mmorhun authored Sep 25, 2020
1 parent 4b07e3a commit 7df717b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 47 deletions.
40 changes: 0 additions & 40 deletions src/api/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,38 +271,6 @@ export class CheHelper {
return this.kube.namespaceExist(namespace)
}

/**
* DEPRECATED. Use CheApiClient instead.
*/
async getCheServerStatus(cheURL: string, responseTimeoutMs = this.defaultCheResponseTimeoutMs): Promise<string> {
const cheApi = CheApiClient.getInstance(cheURL + '/api')
return cheApi.getCheServerStatus(responseTimeoutMs)
}

/**
* DEPRECATED. Use startCheServerShutdown from CheApiClient instead.
*/
async startShutdown(cheURL: string, accessToken = '', responseTimeoutMs = this.defaultCheResponseTimeoutMs) {
const cheApi = CheApiClient.getInstance(cheURL + '/api')
return cheApi.startCheServerShutdown(accessToken, responseTimeoutMs)
}

/**
* DEPRECATED. Use waitUntilCheServerReadyToShutdown from CheApiClient instead.
*/
async waitUntilReadyToShutdown(cheURL: string, intervalMs = 500, timeoutMs = 60000) {
const cheApi = CheApiClient.getInstance(cheURL + '/api')
return cheApi.waitUntilCheServerReadyToShutdown(intervalMs, timeoutMs)
}

/**
* DEPRECATED. Use CheApiClient instead.
*/
async isCheServerReady(cheURL: string, responseTimeoutMs = this.defaultCheResponseTimeoutMs): Promise<boolean> {
const cheApi = CheApiClient.getInstance(cheURL + '/api')
return cheApi.isCheServerReady(responseTimeoutMs)
}

async createWorkspaceFromDevfile(cheApiEndpoint: string, devfilePath: string, workspaceName?: string, accessToken?: string): Promise<chetypes.workspace.Workspace> {
let devfile: string | undefined
try {
Expand Down Expand Up @@ -331,14 +299,6 @@ export class CheHelper {
}
}

/**
* DEPRECATED. Use CheApiClient instead.
*/
async isAuthenticationEnabled(cheURL: string, responseTimeoutMs = this.defaultCheResponseTimeoutMs): Promise<boolean> {
const cheApi = CheApiClient.getInstance(cheURL + '/api')
return cheApi.isAuthenticationEnabled(responseTimeoutMs)
}

async buildDashboardURL(ideURL: string): Promise<string> {
return ideURL.replace(/\/[^/|.]*\/[^/|.]*$/g, '\/dashboard\/#\/ide$&')
}
Expand Down
21 changes: 14 additions & 7 deletions src/tasks/che.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Command } from '@oclif/command'
import * as Listr from 'listr'

import { CheHelper } from '../api/che'
import { CheApiClient } from '../api/che-api-client'
import { KubeHelper } from '../api/kube'
import { OpenShiftHelper } from '../api/openshift'
import { DOC_LINK_OBTAIN_ACCESS_TOKEN, DOC_LINK_OBTAIN_ACCESS_TOKEN_OAUTH } from '../constants'
Expand Down Expand Up @@ -193,8 +194,9 @@ export class CheTasks {
let cheURL = ''
try {
cheURL = await this.che.cheURL(this.cheNamespace)
const status = await this.che.getCheServerStatus(cheURL)
ctx.isAuthEnabled = await this.che.isAuthenticationEnabled(cheURL)
const cheApi = CheApiClient.getInstance(cheURL + '/api')
const status = await cheApi.getCheServerStatus()
ctx.isAuthEnabled = await cheApi.isAuthenticationEnabled()
const auth = ctx.isAuthEnabled ? '(auth enabled)' : '(auth disabled)'
task.title = `${task.title}...${status} ${auth}`
} catch (error) {
Expand Down Expand Up @@ -259,9 +261,10 @@ export class CheTasks {
task: async (task: any) => {
try {
const cheURL = await this.che.cheURL(this.cheNamespace)
await this.che.startShutdown(cheURL, this.cheAccessToken)
await this.che.waitUntilReadyToShutdown(cheURL)
task.title = await `${task.title}...done`
const cheApi = CheApiClient.getInstance(cheURL + '/api')
await cheApi.startCheServerShutdown(this.cheAccessToken)
await cheApi.waitUntilCheServerReadyToShutdown()
task.title = `${task.title}...done`
} catch (error) {
command.error(`E_SHUTDOWN_CHE_SERVER_FAIL - Failed to shutdown Eclipse Che server. ${error.message}`)
}
Expand Down Expand Up @@ -624,7 +627,10 @@ export class CheTasks {
return [
{
title: 'Eclipse Che status check',
task: async ctx => this.che.isCheServerReady(ctx.cheURL)
task: async ctx => {
const cheApi = CheApiClient.getInstance(ctx.cheURL + '/api')
return cheApi.isCheServerReady()
}
}
]
}
Expand All @@ -634,7 +640,8 @@ export class CheTasks {
{
title: 'Checking authentication',
task: async (ctx: any, task: any) => {
ctx.isAuthEnabled = await this.che.isAuthenticationEnabled(ctx.cheURL)
const cheApi = CheApiClient.getInstance(ctx.cheURL + '/api')
ctx.isAuthEnabled = await cheApi.isAuthenticationEnabled()
if (ctx.isAuthEnabled && !this.cheAccessToken) {
throw new Error('E_AUTH_REQUIRED - Eclipse Che authentication is enabled and an access token is needed to be provided (flag --access-token). ' +
`See the documentation how to obtain token: ${DOC_LINK_OBTAIN_ACCESS_TOKEN} and ${DOC_LINK_OBTAIN_ACCESS_TOKEN_OAUTH}.`)
Expand Down

0 comments on commit 7df717b

Please sign in to comment.