github.com/kubeshop/testkube@v1.17.23/pkg/tcl/checktcl/organization_plan.go (about) 1 // Copyright 2024 Testkube. 2 // 3 // Licensed as a Testkube Pro file under the Testkube Community 4 // License (the "License"); you may not use this file except in compliance with 5 // the License. You may obtain a copy of the License at 6 // 7 // https://github.com/kubeshop/testkube/blob/main/licenses/TCL.txt 8 9 package checktcl 10 11 // Enterprise / Pro mode. 12 type OrganizationPlanTestkubeMode string 13 14 const ( 15 OrganizationPlanTestkubeModeEnterprise OrganizationPlanTestkubeMode = "enterprise" 16 // TODO: Use "pro" in the future when refactoring TK Pro API server to use "pro" instead of "cloud" 17 OrganizationPlanTestkubeModePro OrganizationPlanTestkubeMode = "cloud" 18 ) 19 20 // Ref: #/components/schemas/PlanStatus 21 type PlanStatus string 22 23 const ( 24 PlanStatusActive PlanStatus = "Active" 25 PlanStatusCanceled PlanStatus = "Canceled" 26 PlanStatusIncomplete PlanStatus = "Incomplete" 27 PlanStatusIncompleteExpired PlanStatus = "IncompleteExpired" 28 PlanStatusPastDue PlanStatus = "PastDue" 29 PlanStatusTrailing PlanStatus = "Trailing" 30 PlanStatusUnpaid PlanStatus = "Unpaid" 31 PlanStatusDeleted PlanStatus = "Deleted" 32 PlanStatusLocked PlanStatus = "Locked" 33 PlanStatusBlocked PlanStatus = "Blocked" 34 ) 35 36 // Ref: #/components/schemas/OrganizationPlan 37 type OrganizationPlan struct { 38 // Enterprise / Pro mode. 39 TestkubeMode OrganizationPlanTestkubeMode `json:"testkubeMode"` 40 // Is current plan trial. 41 IsTrial bool `json:"isTrial"` 42 PlanStatus PlanStatus `json:"planStatus"` 43 } 44 45 func (p OrganizationPlan) IsEnterprise() bool { 46 return p.TestkubeMode == OrganizationPlanTestkubeModeEnterprise 47 } 48 49 func (p OrganizationPlan) IsPro() bool { 50 return p.TestkubeMode == OrganizationPlanTestkubeModePro 51 } 52 53 func (p OrganizationPlan) IsActive() bool { 54 return p.PlanStatus == PlanStatusActive 55 } 56 57 func (p OrganizationPlan) IsEmpty() bool { 58 return p.PlanStatus == "" && p.TestkubeMode == "" && !p.IsTrial 59 } 60 61 type GetOrganizationPlanRequest struct{} 62 type GetOrganizationPlanResponse struct { 63 TestkubeMode string 64 IsTrial bool 65 PlanStatus string 66 }