Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add owner name to workspace#181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 1 commit intomainfrom9883-owner-name
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
1 change: 1 addition & 0 deletionsdocs/data-sources/workspace.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@ resource "kubernetes_pod" "dev" {
- `owner` (String) Username of the workspace owner.
- `owner_email` (String) Email address of the workspace owner.
- `owner_id` (String) UUID of the workspace owner.
- `owner_name` (String) Name of the workspace owner.
- `owner_oidc_access_token` (String) A valid OpenID Connect access token of the workspace owner. This is only available if the workspace owner authenticated with OpenID Connect. If a valid token cannot be obtained, this value will be an empty string.
- `owner_session_token` (String) Session token for authenticating with a Coder deployment. It is regenerated everytime a workspace is started.
- `start_count` (Number) A computed count based on "transition" state. If "start", count will equal 1.
Expand Down
8 changes: 8 additions & 0 deletionsprovider/workspace.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -36,6 +36,9 @@ func workspaceDataSource() *schema.Resource {
ownerEmail := os.Getenv("CODER_WORKSPACE_OWNER_EMAIL")
_ = rd.Set("owner_email", ownerEmail)

ownerName := os.Getenv("CODER_WORKSPACE_OWNER_NAME")
_ = rd.Set("owner_name", ownerName)

ownerID := os.Getenv("CODER_WORKSPACE_OWNER_ID")
if ownerID == "" {
ownerID = uuid.Nil.String()
Expand DownExpand Up@@ -126,6 +129,11 @@ func workspaceDataSource() *schema.Resource {
Computed: true,
Description: "UUID of the workspace owner.",
},
"owner_name": {
Type: schema.TypeString,
Computed: true,
Description: "Name of the workspace owner.",
},
"owner_oidc_access_token": {
Type: schema.TypeString,
Computed: true,
Expand Down
3 changes: 3 additions & 0 deletionsprovider/workspace_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@ import (

func TestWorkspace(t *testing.T) {
t.Setenv("CODER_WORKSPACE_OWNER", "owner123")
t.Setenv("CODER_WORKSPACE_OWNER_NAME", "Mr Owner")
t.Setenv("CODER_WORKSPACE_OWNER_EMAIL", "owner123@example.com")
t.Setenv("CODER_WORKSPACE_OWNER_SESSION_TOKEN", "abc123")
t.Setenv("CODER_WORKSPACE_TEMPLATE_ID", "templateID")
Expand DownExpand Up@@ -43,6 +44,7 @@ func TestWorkspace(t *testing.T) {
t.Log(value)
require.Equal(t, "8080", attribs["access_port"])
require.Equal(t, "owner123", attribs["owner"])
require.Equal(t, "Mr Owner", attribs["owner_name"])
require.Equal(t, "owner123@example.com", attribs["owner_email"])
require.Equal(t, "abc123", attribs["owner_session_token"])
require.Equal(t, "templateID", attribs["template_id"])
Expand DownExpand Up@@ -76,6 +78,7 @@ func TestWorkspace(t *testing.T) {
t.Log(value)
require.Equal(t, "https://example.com:8080", attribs["access_url"])
require.Equal(t, "owner123", attribs["owner"])
require.Equal(t, "Mr Owner", attribs["owner_name"])
require.Equal(t, "owner123@example.com", attribs["owner_email"])
require.Equal(t, "templateID", attribs["template_id"])
require.Equal(t, "template123", attribs["template_name"])
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp