Skip to content

Commit e518ccd

Browse files
authored
Merge pull request #984 from hashicorp/ignatius-j/TF-20627_waypoint_entitlement
TF-20627: Add Waypoint entitlements for organizations
2 parents f3328da + 1593b8e commit e518ccd

File tree

4 files changed

+39
-18
lines changed

4 files changed

+39
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Enhancements
22

33
* Add support for reading a no-code module's variables by @paladin-devops [#979](https://github.com/hashicorp/go-tfe/pull/979)
4+
* Add Waypoint entitlements (the `waypoint-actions` and `waypoint-templates-and-addons` attributes) to `Entitlements` by @ignatius-j [#984](https://github.com/hashicorp/go-tfe/pull/984)
45

56
# v1.67.1
67

organization.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,21 @@ type Capacity struct {
157157

158158
// Entitlements represents the entitlements of an organization.
159159
type Entitlements struct {
160-
ID string `jsonapi:"primary,entitlement-sets"`
161-
Agents bool `jsonapi:"attr,agents"`
162-
AuditLogging bool `jsonapi:"attr,audit-logging"`
163-
CostEstimation bool `jsonapi:"attr,cost-estimation"`
164-
GlobalRunTasks bool `jsonapi:"attr,global-run-tasks"`
165-
Operations bool `jsonapi:"attr,operations"`
166-
PrivateModuleRegistry bool `jsonapi:"attr,private-module-registry"`
167-
RunTasks bool `jsonapi:"attr,run-tasks"`
168-
SSO bool `jsonapi:"attr,sso"`
169-
Sentinel bool `jsonapi:"attr,sentinel"`
170-
StateStorage bool `jsonapi:"attr,state-storage"`
171-
Teams bool `jsonapi:"attr,teams"`
172-
VCSIntegrations bool `jsonapi:"attr,vcs-integrations"`
160+
ID string `jsonapi:"primary,entitlement-sets"`
161+
Agents bool `jsonapi:"attr,agents"`
162+
AuditLogging bool `jsonapi:"attr,audit-logging"`
163+
CostEstimation bool `jsonapi:"attr,cost-estimation"`
164+
GlobalRunTasks bool `jsonapi:"attr,global-run-tasks"`
165+
Operations bool `jsonapi:"attr,operations"`
166+
PrivateModuleRegistry bool `jsonapi:"attr,private-module-registry"`
167+
RunTasks bool `jsonapi:"attr,run-tasks"`
168+
SSO bool `jsonapi:"attr,sso"`
169+
Sentinel bool `jsonapi:"attr,sentinel"`
170+
StateStorage bool `jsonapi:"attr,state-storage"`
171+
Teams bool `jsonapi:"attr,teams"`
172+
VCSIntegrations bool `jsonapi:"attr,vcs-integrations"`
173+
WaypointActions bool `jsonapi:"attr,waypoint-actions"`
174+
WaypointTemplatesAndAddons bool `jsonapi:"attr,waypoint-templates-and-addons"`
173175
}
174176

175177
// RunQueue represents the current run queue of an organization.

organization_integration_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ func TestOrganizationsReadEntitlements(t *testing.T) {
458458
orgTest, orgTestCleanup := createOrganization(t, client)
459459
t.Cleanup(orgTestCleanup)
460460

461+
newSubscriptionUpdater(orgTest).WithPlusEntitlementPlan().Update(t)
462+
461463
t.Run("when the org exists", func(t *testing.T) {
462464
entitlements, err := client.Organizations.ReadEntitlements(ctx, orgTest.Name)
463465
require.NoError(t, err)
@@ -473,6 +475,8 @@ func TestOrganizationsReadEntitlements(t *testing.T) {
473475
assert.True(t, entitlements.StateStorage)
474476
assert.True(t, entitlements.Teams)
475477
assert.True(t, entitlements.VCSIntegrations)
478+
assert.True(t, entitlements.WaypointActions)
479+
assert.True(t, entitlements.WaypointTemplatesAndAddons)
476480
})
477481

478482
t.Run("with invalid name", func(t *testing.T) {

subscription_updater_test.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ type featureSetListOptions struct {
2727
type retryableFn func() (interface{}, error)
2828

2929
type updateFeatureSetOptions struct {
30-
Type string `jsonapi:"primary,subscription"`
31-
RunsCeiling *int `jsonapi:"attr,runs-ceiling,omitempty"`
32-
ContractStartAt *time.Time `jsonapi:"attr,contract-start-at,iso8601,omitempty"`
33-
ContractUserLimit *int `jsonapi:"attr,contract-user-limit,omitempty"`
34-
ContractApplyLimit *int `jsonapi:"attr,contract-apply-limit,omitempty"`
30+
Type string `jsonapi:"primary,subscription"`
31+
RunsCeiling *int `jsonapi:"attr,runs-ceiling,omitempty"`
32+
ContractStartAt *time.Time `jsonapi:"attr,contract-start-at,iso8601,omitempty"`
33+
ContractUserLimit *int `jsonapi:"attr,contract-user-limit,omitempty"`
34+
ContractApplyLimit *int `jsonapi:"attr,contract-apply-limit,omitempty"`
35+
ContractManagedResourcesLimit *int `jsonapi:"attr,contract-managed-resources-limit,omitempty"`
3536

3637
FeatureSet *featureSet `jsonapi:"relation,feature-set"`
3738
}
@@ -71,6 +72,19 @@ func (b *organizationSubscriptionUpdater) WithTrialPlan() *organizationSubscript
7172
return b
7273
}
7374

75+
func (b *organizationSubscriptionUpdater) WithPlusEntitlementPlan() *organizationSubscriptionUpdater {
76+
b.planName = "Plus (entitlement)"
77+
78+
start := time.Now()
79+
ceiling := 1
80+
managedResourcesLimit := 1000
81+
82+
b.updateOpts.ContractStartAt = &start
83+
b.updateOpts.RunsCeiling = &ceiling
84+
b.updateOpts.ContractManagedResourcesLimit = &managedResourcesLimit
85+
return b
86+
}
87+
7488
// Attempts to change an organization's subscription to a different plan. Requires a user token with admin access.
7589
func (b *organizationSubscriptionUpdater) Update(t *testing.T) {
7690
if enterpriseEnabled() {

0 commit comments

Comments
 (0)