Skip to content

Run task request & Workspace Run_task#159

Closed
NimishaShrivastava-dev wants to merge 11 commits into
hashicorp:next-1.0.0from
NimishaShrivastava-dev:run-task-request
Closed

Run task request & Workspace Run_task#159
NimishaShrivastava-dev wants to merge 11 commits into
hashicorp:next-1.0.0from
NimishaShrivastava-dev:run-task-request

Conversation

@NimishaShrivastava-dev

@NimishaShrivastava-dev NimishaShrivastava-dev commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Added support for RunTaskRequest models and implemented workspace run task lifecycle operations.

Changes Made

  • Added RunTaskRequest related models

  • Implemented workspace run task operations:

    • create
    • list
    • read
    • update
    • delete
  • Added handling for existing workspace run task associations

  • Added update handling for enforcement and stage changes

  • Improved error handling for duplicate task attachments and organization limits

  • Added example usage for workspace run task management

Testing

Tested:

  • successful workspace run task creation
  • duplicate association handling
  • list/read/update/delete operations
  • enforcement update scenarios
  • organization mandatory task limit validation
image image image

@NimishaShrivastava-dev NimishaShrivastava-dev requested a review from a team as a code owner May 19, 2026 07:19
Comment thread src/pytfe/models/workspace_run_task.py Outdated
type: str = Field(default="workspace-tasks")
enforcement_level: str = Field(..., alias="enforcement-level")
run_task: WorkspaceRunTaskRunTask = Field(..., alias="run-task")
stage: str | None = Field(default=None, alias="stage")

@isivaselvan isivaselvan May 22, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Comment thread src/pytfe/models/workspace_run_task.py Outdated

model_config = ConfigDict(extra="forbid", populate_by_name=True)

page_number: int | None = Field(default=None, alias="page[number]")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Remove the page_number attribute for the listOptions

Comment thread src/pytfe/models/workspace_run_task.py Outdated
enforcement_level: str | None = Field(
default=None, validation_alias="enforcement-level"
)
stage: str | None = Field(default=None, validation_alias="stage")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Stage is deprecated! Use Stages

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

stage is removed

Comment thread src/pytfe/models/workspace_run_task.py Outdated
class WorkspaceRunTaskRunTask(BaseModel):
"""Relationship model for run task references."""

model_config = ConfigDict(extra="forbid")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why extra="forbid" was added to the ConfigDict instead of populate/validate?

Comment thread src/pytfe/models/workspace_run_task.py Outdated

type: str = Field(default="workspace-tasks")
enforcement_level: str = Field(..., alias="enforcement-level")
run_task: WorkspaceRunTaskRunTask = Field(..., alias="run-task")

@isivaselvan isivaselvan May 22, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

WorkspaceRuntaskRunTask model was mapped to run_task attribute instead of RunTask model?

Comment thread src/pytfe/models/workspace_run_task.py Outdated
run_task: WorkspaceRunTaskRunTask | None = Field(
default=None, validation_alias="run-task"
)
workspace: WorkspaceRunTaskWorkspace | None = Field(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

WorkspaceRunTaskWorkspace?

Comment thread src/pytfe/models/workspace_run_task.py Outdated
)
stage: str | None = Field(default=None, validation_alias="stage")
stages: list[str] = Field(default_factory=list, validation_alias="stages")
run_task: WorkspaceRunTaskRunTask | None = Field(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

WorkspaceRunTaskRunTask? instead of RunTask?

Comment thread src/pytfe/models/workspace_run_task.py Outdated
model_config = ConfigDict(extra="forbid", populate_by_name=True)

id: str
enforcement_level: str | None = Field(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Need to create Enum for enforcement_level either "advisory" or "mandatory"

@iam404

iam404 commented May 23, 2026

Copy link
Copy Markdown
Member

@NimishaShrivastava-dev is this open to merge ? or else we can close it

This task was pulled from my PR, and the implementation has already been completed by Siva and merged through his PR. Since this one now has merge conflicts and is no longer needed, we can close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants