From 0b6d60ead3e8e1c4c9ec09291dcc59be3c2c6c9b Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Fri, 10 Apr 2026 13:31:55 -0700 Subject: [PATCH] refactor: fix soak time typo --- docs/resources/policy.md | 2 +- internal/api/client.gen.go | 89 ++++++++++++++-------------- internal/provider/policy_resource.go | 16 ++--- 3 files changed, 54 insertions(+), 53 deletions(-) diff --git a/docs/resources/policy.md b/docs/resources/policy.md index af214f6..0ddcf26 100644 --- a/docs/resources/policy.md +++ b/docs/resources/policy.md @@ -97,7 +97,7 @@ Required: Optional: - `maximum_age_hours` (Number) Maximum age in hours of dependency deployment before blocking progression -- `minimum_sock_time_minutes` (Number) Minimum time in minutes to wait after the dependency environment is in a success state +- `minimum_soak_time_minutes` (Number) Minimum time in minutes to wait after the dependency environment is in a success state - `minimum_success_percentage` (Number) Minimum percentage of successful deployments required Read-Only: diff --git a/internal/api/client.gen.go b/internal/api/client.gen.go index 21d136f..73e0873 100644 --- a/internal/api/client.gen.go +++ b/internal/api/client.gen.go @@ -55,12 +55,12 @@ const ( DeploymentPlanStatusFailed DeploymentPlanStatus = "failed" ) -// Defines values for DeploymentPlanTargetStatus. +// Defines values for DeploymentPlanTargetResultStatus. const ( - DeploymentPlanTargetStatusCompleted DeploymentPlanTargetStatus = "completed" - DeploymentPlanTargetStatusComputing DeploymentPlanTargetStatus = "computing" - DeploymentPlanTargetStatusErrored DeploymentPlanTargetStatus = "errored" - DeploymentPlanTargetStatusUnsupported DeploymentPlanTargetStatus = "unsupported" + DeploymentPlanTargetResultStatusCompleted DeploymentPlanTargetResultStatus = "completed" + DeploymentPlanTargetResultStatusComputing DeploymentPlanTargetResultStatus = "computing" + DeploymentPlanTargetResultStatusErrored DeploymentPlanTargetResultStatus = "errored" + DeploymentPlanTargetResultStatusUnsupported DeploymentPlanTargetResultStatus = "unsupported" ) // Defines values for DeploymentVersionStatus. @@ -235,13 +235,11 @@ type CreateDeploymentPlanRequest struct { type CreateDeploymentRequest struct { Description *string `json:"description,omitempty"` JobAgentConfig *map[string]interface{} `json:"jobAgentConfig,omitempty"` - JobAgentId *string `json:"jobAgentId,omitempty"` - // JobAgentSelector CEL expression to match job agents. Defaults to jobAgent.id == "" if not provided. - JobAgentSelector *string `json:"jobAgentSelector,omitempty"` - JobAgents *[]DeploymentJobAgent `json:"jobAgents,omitempty"` - Metadata *map[string]string `json:"metadata,omitempty"` - Name string `json:"name"` + // JobAgentSelector CEL expression to match job agents + JobAgentSelector *string `json:"jobAgentSelector,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + Name string `json:"name"` // ResourceSelector CEL expression to determine if the deployment should be used ResourceSelector *string `json:"resourceSelector,omitempty"` @@ -390,13 +388,11 @@ type Deployment struct { Description *string `json:"description,omitempty"` Id string `json:"id"` JobAgentConfig map[string]interface{} `json:"jobAgentConfig"` - JobAgentId *string `json:"jobAgentId,omitempty"` // JobAgentSelector CEL expression to match job agents - JobAgentSelector *string `json:"jobAgentSelector,omitempty"` - JobAgents *[]DeploymentJobAgent `json:"jobAgents,omitempty"` - Metadata *map[string]string `json:"metadata,omitempty"` - Name string `json:"name"` + JobAgentSelector string `json:"jobAgentSelector"` + Metadata *map[string]string `json:"metadata,omitempty"` + Name string `json:"name"` // ResourceSelector CEL expression to determine if the deployment should be used ResourceSelector *string `json:"resourceSelector,omitempty"` @@ -411,19 +407,10 @@ type DeploymentAndSystems struct { // DeploymentDependencyRule defines model for DeploymentDependencyRule. type DeploymentDependencyRule struct { - // DependsOn CEL expression to match upstream deployment(s) that must have a successful release before this deployment can proceed. + // DependsOn CEL expression to match upstream deployment(s) that must have a successful release before this deployment can proceed. The expression can reference both deployment properties (deployment.id, deployment.name, deployment.slug, deployment.metadata) and the currently deployed version properties (version.id, version.tag, version.name, version.status, version.metadata, version.createdAt). For example: deployment.name == 'db-migration' && version.tag.startsWith('v2.'). DependsOn string `json:"dependsOn"` } -// DeploymentJobAgent defines model for DeploymentJobAgent. -type DeploymentJobAgent struct { - Config JobAgentConfig `json:"config"` - Ref string `json:"ref"` - - // Selector CEL expression to determine if the job agent should be used - Selector string `json:"selector"` -} - // DeploymentPlan defines model for DeploymentPlan. type DeploymentPlan struct { Id string `json:"id"` @@ -446,24 +433,36 @@ type DeploymentPlanSummary struct { // DeploymentPlanTarget defines model for DeploymentPlanTarget. type DeploymentPlanTarget struct { + EnvironmentId string `json:"environmentId"` + EnvironmentName string `json:"environmentName"` + + // HasChanges True if any result for this target has changes + HasChanges bool `json:"hasChanges"` + ResourceId string `json:"resourceId"` + ResourceName string `json:"resourceName"` + Results []DeploymentPlanTargetResult `json:"results"` +} + +// DeploymentPlanTargetResult defines model for DeploymentPlanTargetResult. +type DeploymentPlanTargetResult struct { // ContentHash Hash of the rendered output for change detection - ContentHash *string `json:"contentHash,omitempty"` + ContentHash string `json:"contentHash"` // Current Full rendered output of the currently deployed state - Current *string `json:"current,omitempty"` - EnvironmentId string `json:"environmentId"` - EnvironmentName string `json:"environmentName"` - HasChanges *bool `json:"hasChanges"` + Current string `json:"current"` + HasChanges bool `json:"hasChanges"` + Id string `json:"id"` + + // Message Agent message (e.g. error explanation or summary) + Message string `json:"message"` // Proposed Full rendered output of the proposed version - Proposed *string `json:"proposed,omitempty"` - ResourceId string `json:"resourceId"` - ResourceName string `json:"resourceName"` - Status DeploymentPlanTargetStatus `json:"status"` + Proposed string `json:"proposed"` + Status DeploymentPlanTargetResultStatus `json:"status"` } -// DeploymentPlanTargetStatus defines model for DeploymentPlanTarget.Status. -type DeploymentPlanTargetStatus string +// DeploymentPlanTargetResultStatus defines model for DeploymentPlanTargetResult.Status. +type DeploymentPlanTargetResultStatus string // DeploymentPlanVersion defines model for DeploymentPlanVersion. type DeploymentPlanVersion struct { @@ -596,7 +595,11 @@ type EnvironmentProgressionRule struct { // MaximumAgeHours Maximum age of dependency deployment before blocking progression (prevents stale promotions) MaximumAgeHours *int32 `json:"maximumAgeHours,omitempty"` - // MinimumSockTimeMinutes Minimum time to wait after the depends on environment is in a success state before the current environment can be deployed + // MinimumSoakTimeMinutes Minimum time to wait after the depends on environment is in a success state before the current environment can be deployed. Defaults to 0 if not provided. + MinimumSoakTimeMinutes *int32 `json:"minimumSoakTimeMinutes,omitempty"` + + // MinimumSockTimeMinutes Use minimumSoakTimeMinutes instead. Minimum time to wait after the depends on environment is in a success state before the current environment can be deployed + // Deprecated: this property has been marked as deprecated upstream, but no `x-deprecated-reason` was set MinimumSockTimeMinutes *int32 `json:"minimumSockTimeMinutes,omitempty"` MinimumSuccessPercentage *float32 `json:"minimumSuccessPercentage,omitempty"` SuccessStatuses *[]JobStatus `json:"successStatuses,omitempty"` @@ -1155,13 +1158,11 @@ type UpdateWorkspaceRequest struct { type UpsertDeploymentRequest struct { Description *string `json:"description,omitempty"` JobAgentConfig *map[string]interface{} `json:"jobAgentConfig,omitempty"` - JobAgentId *string `json:"jobAgentId,omitempty"` - // JobAgentSelector CEL expression to match job agents. Defaults to jobAgent.id == "" if not provided. - JobAgentSelector *string `json:"jobAgentSelector,omitempty"` - JobAgents *[]DeploymentJobAgent `json:"jobAgents,omitempty"` - Metadata *map[string]string `json:"metadata,omitempty"` - Name string `json:"name"` + // JobAgentSelector CEL expression to match job agents + JobAgentSelector *string `json:"jobAgentSelector,omitempty"` + Metadata *map[string]string `json:"metadata,omitempty"` + Name string `json:"name"` // ResourceSelector CEL expression to determine if the deployment should be used ResourceSelector *string `json:"resourceSelector,omitempty"` diff --git a/internal/provider/policy_resource.go b/internal/provider/policy_resource.go index b8e75c8..932a309 100644 --- a/internal/provider/policy_resource.go +++ b/internal/provider/policy_resource.go @@ -429,7 +429,7 @@ func (r *PolicyResource) Schema(ctx context.Context, req resource.SchemaRequest, Optional: true, Description: "Minimum percentage of successful deployments required", }, - "minimum_sock_time_minutes": schema.Int64Attribute{ + "minimum_soak_time_minutes": schema.Int64Attribute{ Optional: true, Computed: true, Description: "Minimum time in minutes to wait after the dependency environment is in a success state", @@ -815,7 +815,7 @@ type PolicyEnvironmentProgression struct { ID types.String `tfsdk:"id"` DependsOnEnvironmentSelector types.String `tfsdk:"depends_on_environment_selector"` MinimumSuccessPercentage types.Float64 `tfsdk:"minimum_success_percentage"` - MinimumSockTimeMinutes types.Int64 `tfsdk:"minimum_sock_time_minutes"` + MinimumSoakTimeMinutes types.Int64 `tfsdk:"minimum_soak_time_minutes"` MaximumAgeHours types.Int64 `tfsdk:"maximum_age_hours"` } @@ -1065,9 +1065,9 @@ func policyRulesFromModel(data PolicyResourceModel) ([]policyRequestRule, diag.D val := float32(progression.MinimumSuccessPercentage.ValueFloat64()) rule.MinimumSuccessPercentage = &val } - if int64ValueSet(progression.MinimumSockTimeMinutes) { - val := int32(progression.MinimumSockTimeMinutes.ValueInt64()) - rule.MinimumSockTimeMinutes = &val + if int64ValueSet(progression.MinimumSoakTimeMinutes) { + val := int32(progression.MinimumSoakTimeMinutes.ValueInt64()) + rule.MinimumSoakTimeMinutes = &val } if int64ValueSet(progression.MaximumAgeHours) { val := int32(progression.MaximumAgeHours.ValueInt64()) @@ -1320,14 +1320,14 @@ func policyRulesToModel(rules []api.PolicyRule) (policyRulesModel, diag.Diagnost ID: types.StringValue(rule.Id), DependsOnEnvironmentSelector: types.StringValue(rule.EnvironmentProgression.DependsOnEnvironmentSelector), MinimumSuccessPercentage: types.Float64Null(), - MinimumSockTimeMinutes: types.Int64Null(), + MinimumSoakTimeMinutes: types.Int64Null(), MaximumAgeHours: types.Int64Null(), } if rule.EnvironmentProgression.MinimumSuccessPercentage != nil { model.MinimumSuccessPercentage = types.Float64Value(float64(*rule.EnvironmentProgression.MinimumSuccessPercentage)) } - if rule.EnvironmentProgression.MinimumSockTimeMinutes != nil { - model.MinimumSockTimeMinutes = types.Int64Value(int64(*rule.EnvironmentProgression.MinimumSockTimeMinutes)) + if rule.EnvironmentProgression.MinimumSoakTimeMinutes != nil { + model.MinimumSoakTimeMinutes = types.Int64Value(int64(*rule.EnvironmentProgression.MinimumSoakTimeMinutes)) } if rule.EnvironmentProgression.MaximumAgeHours != nil { model.MaximumAgeHours = types.Int64Value(int64(*rule.EnvironmentProgression.MaximumAgeHours))