Run task request & Workspace Run_task#159
Conversation
| 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") |
There was a problem hiding this comment.
Stage is deprecated! Utilize Stages, for the parameter
https://developer.hashicorp.com/terraform/cloud-docs/api-docs/run-tasks/run-tasks#associate-a-run-task-to-a-workspace
|
|
||
| model_config = ConfigDict(extra="forbid", populate_by_name=True) | ||
|
|
||
| page_number: int | None = Field(default=None, alias="page[number]") |
There was a problem hiding this comment.
Remove the page_number attribute for the listOptions
| enforcement_level: str | None = Field( | ||
| default=None, validation_alias="enforcement-level" | ||
| ) | ||
| stage: str | None = Field(default=None, validation_alias="stage") |
There was a problem hiding this comment.
Stage is deprecated! Use Stages
There was a problem hiding this comment.
stage is removed
| class WorkspaceRunTaskRunTask(BaseModel): | ||
| """Relationship model for run task references.""" | ||
|
|
||
| model_config = ConfigDict(extra="forbid") |
There was a problem hiding this comment.
Why extra="forbid" was added to the ConfigDict instead of populate/validate?
|
|
||
| type: str = Field(default="workspace-tasks") | ||
| enforcement_level: str = Field(..., alias="enforcement-level") | ||
| run_task: WorkspaceRunTaskRunTask = Field(..., alias="run-task") |
There was a problem hiding this comment.
WorkspaceRuntaskRunTask model was mapped to run_task attribute instead of RunTask model?
| run_task: WorkspaceRunTaskRunTask | None = Field( | ||
| default=None, validation_alias="run-task" | ||
| ) | ||
| workspace: WorkspaceRunTaskWorkspace | None = Field( |
There was a problem hiding this comment.
WorkspaceRunTaskWorkspace?
| ) | ||
| stage: str | None = Field(default=None, validation_alias="stage") | ||
| stages: list[str] = Field(default_factory=list, validation_alias="stages") | ||
| run_task: WorkspaceRunTaskRunTask | None = Field( |
There was a problem hiding this comment.
WorkspaceRunTaskRunTask? instead of RunTask?
| model_config = ConfigDict(extra="forbid", populate_by_name=True) | ||
|
|
||
| id: str | ||
| enforcement_level: str | None = Field( |
There was a problem hiding this comment.
Need to create Enum for enforcement_level either "advisory" or "mandatory"
|
@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. |
Summary
Added support for
RunTaskRequestmodels and implemented workspace run task lifecycle operations.Changes Made
Added
RunTaskRequestrelated modelsImplemented workspace run task operations:
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: