Skip to content

Commit 7477fcf

Browse files
committed
Fix: support for the new Coder auth cookie
- cookie was renamed from seesion_token to coder_session_token - resolves #86
1 parent e858ab0 commit 7477fcf

File tree

5 files changed

+37
-15
lines changed

5 files changed

+37
-15
lines changed

CHANGELOG.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@
33
# coder-gateway Changelog
44

55
## [Unreleased]
6+
### Added
7+
8+
- upgraded API models
9+
10+
### Fixed
11+
12+
- support for the new Coder auth cookies
613

714
## [2.1.1]
8-
### Added
9-
- support for remembering last opened Coder session
1015

11-
### Changed
12-
- minimum supported Gateway build is now 222.3739.54
16+
### Added
17+
18+
- support for remembering last opened Coder session
19+
20+
### Changed
21+
22+
- minimum supported Gateway build is now 222.3739.54
1323
- some dialog titles
1424

1525
## [2.1.0]

src/main/kotlin/com/coder/gateway/models/WorkspaceAgentStatus.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.coder.gateway.models
22

33
import com.coder.gateway.sdk.v2.models.ProvisionerJobStatus
44
import com.coder.gateway.sdk.v2.models.Workspace
5-
import com.coder.gateway.sdk.v2.models.WorkspaceBuildTransition
5+
import com.coder.gateway.sdk.v2.models.WorkspaceTransition
66

77
enum class WorkspaceAgentStatus(val label: String) {
88
QUEUED("◍ Queued"), STARTING("⦿ Starting"), STOPPING("◍ Stopping"), DELETING("⦸ Deleting"),
@@ -12,16 +12,16 @@ enum class WorkspaceAgentStatus(val label: String) {
1212
companion object {
1313
fun from(workspace: Workspace) = when (workspace.latestBuild.job.status) {
1414
ProvisionerJobStatus.PENDING -> QUEUED
15-
ProvisionerJobStatus.RUNNING -> when (workspace.latestBuild.workspaceTransition) {
16-
WorkspaceBuildTransition.START -> STARTING
17-
WorkspaceBuildTransition.STOP -> STOPPING
18-
WorkspaceBuildTransition.DELETE -> DELETING
15+
ProvisionerJobStatus.RUNNING -> when (workspace.latestBuild.transition) {
16+
WorkspaceTransition.START -> STARTING
17+
WorkspaceTransition.STOP -> STOPPING
18+
WorkspaceTransition.DELETE -> DELETING
1919
}
2020

21-
ProvisionerJobStatus.SUCCEEDED -> when (workspace.latestBuild.workspaceTransition) {
22-
WorkspaceBuildTransition.START -> RUNNING
23-
WorkspaceBuildTransition.STOP -> STOPPED
24-
WorkspaceBuildTransition.DELETE -> DELETED
21+
ProvisionerJobStatus.SUCCEEDED -> when (workspace.latestBuild.transition) {
22+
WorkspaceTransition.START -> RUNNING
23+
WorkspaceTransition.STOP -> STOPPED
24+
WorkspaceTransition.DELETE -> DELETED
2525
}
2626

2727
ProvisionerJobStatus.CANCELING -> CANCELING

src/main/kotlin/com/coder/gateway/sdk/CoderRestClientService.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CoderRestClientService {
4646
val cookieJar = JavaNetCookieJar(CookieManager()).apply {
4747
saveFromResponse(
4848
cookieUrl,
49-
listOf(Cookie.parse(cookieUrl, "session_token=$token")!!)
49+
listOf(Cookie.parse(cookieUrl, "coder_session_token=$token")!!)
5050
)
5151
}
5252
val gson: Gson = GsonBuilder()
@@ -55,7 +55,7 @@ class CoderRestClientService {
5555
.create()
5656

5757
val interceptor = HttpLoggingInterceptor()
58-
interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC)
58+
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY)
5959
retroRestClient = Retrofit.Builder()
6060
.baseUrl(url.toString())
6161
.client(

src/main/kotlin/com/coder/gateway/sdk/v2/models/ProvisionerJob.kt

+3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ data class ProvisionerJob(
99
@SerializedName("created_at") val createdAt: Instant,
1010
@SerializedName("started_at") val startedAt: Instant,
1111
@SerializedName("completed_at") val completedAt: Instant,
12+
@SerializedName("canceled_at") val canceledAt: Instant,
1213
@SerializedName("error") val error: String,
1314
@SerializedName("status") val status: ProvisionerJobStatus,
1415
@SerializedName("worker_id") val workerID: UUID,
16+
@SerializedName("file_id") val fileID: UUID,
17+
@SerializedName("tags") val tags: Map<String, String>,
1518
)
1619

1720
enum class ProvisionerJobStatus {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.coder.gateway.sdk.v2.models
2+
3+
import com.google.gson.annotations.SerializedName
4+
5+
data class WorkspaceResourceMetadata(
6+
@SerializedName("key") val key: String,
7+
@SerializedName("value") val value: String,
8+
@SerializedName("sensitive") val sensitive: Boolean
9+
)

0 commit comments

Comments
 (0)