Skip to content

Commit

Permalink
feat: Add isDisabled field to tenant (#284)
Browse files Browse the repository at this point in the history
* feat: Add isDisabled field to tenant

* feat: Add isDisabled to tenant query
  • Loading branch information
grace-rehn authored Nov 18, 2024
1 parent b041a8f commit 2b00f2b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/tenants/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Tenant struct {
ProjectEnvironments map[string][]string `json:"ProjectEnvironments,omitempty"`
SpaceID string `json:"SpaceId"`
TenantTags []string `json:"TenantTags,omitempty"`
IsDisabled bool `json:"IsDisabled"`

resources.Resource
}
Expand All @@ -29,3 +30,7 @@ func NewTenant(name string) *Tenant {
func (t Tenant) Validate() error {
return validator.New().Struct(t)
}

func (t *Tenant) GetName() string {
return t.Name
}
2 changes: 1 addition & 1 deletion pkg/tenants/tenant_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func (s *TenantService) UpdateVariables(tenant *Tenant, tenantVariables *variabl

// --- new ---

const template = "/api/{spaceId}/tenants{/id}{?skip,projectId,name,tags,take,ids,clone,partialName,clonedFromTenantId}"
const template = "/api/{spaceId}/tenants{/id}{?skip,projectId,name,tags,take,ids,clone,partialName,isDisabled,clonedFromTenantId}"

// Get returns a collection of tenants based on the criteria defined by its
// input query parameter.
Expand Down
1 change: 1 addition & 0 deletions pkg/tenants/tenants_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type TenantsQuery struct {
ClonedFromTenantID string `uri:"clonedFromTenantId,omitempty" url:"clonedFromTenantId,omitempty"`
IDs []string `uri:"ids,omitempty" url:"ids,omitempty"`
IsClone bool `uri:"clone,omitempty" url:"clone,omitempty"`
IsDisabled bool `uri:"isDisabled,omitempty" url:"isDisabled,omitempty"`
Name string `uri:"name,omitempty" url:"name,omitempty"`
PartialName string `uri:"partialName,omitempty" url:"partialName,omitempty"`
ProjectID string `uri:"projectId,omitempty" url:"projectId,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/tenant_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func AssertEqualTenants(t *testing.T, expected *tenants.Tenant, actual *tenants.
assert.Equal(t, expected.ProjectEnvironments, actual.ProjectEnvironments)
assert.Equal(t, expected.SpaceID, actual.SpaceID)
assert.Equal(t, expected.TenantTags, actual.TenantTags)
assert.Equal(t, expected.IsDisabled, actual.IsDisabled)
}

func CreateTestTenant(t *testing.T, octopusClient *client.Client, project *projects.Project, environment *environments.Environment) *tenants.Tenant {
Expand Down Expand Up @@ -191,6 +192,7 @@ func TestTenantUpdate(t *testing.T) {

expected.Name = internal.GetRandomName()
expected.Description = internal.GetRandomName()
expected.IsDisabled = true

actual, err := octopusClient.Tenants.Update(expected)
assert.NoError(t, err)
Expand Down

0 comments on commit 2b00f2b

Please sign in to comment.