Skip to content

Commit

Permalink
Merge pull request #895 from OctopusDeploy/isaac/make-tenant-isDisabl…
Browse files Browse the repository at this point in the history
…ed-writeable

Add IsDisabled to tenant editor/repository
  • Loading branch information
IsaacCalligeros95 authored Nov 19, 2024
2 parents 42bc730 + 746d633 commit b19a796
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ Octopus.Client.Editors
Octopus.Client.Editors.TenantEditor ClearTags()
Octopus.Client.Editors.TenantEditor ConnectToProjectAndEnvironments(Octopus.Client.Model.ProjectResource, Octopus.Client.Model.EnvironmentResource[])
Octopus.Client.Editors.TenantEditor CreateOrModify(String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String, Boolean)
Octopus.Client.Editors.TenantEditor Customize(Action<TenantResource>)
Octopus.Client.Editors.TenantEditor Save()
Octopus.Client.Editors.TenantEditor SetLogo(String)
Expand Down Expand Up @@ -8474,6 +8474,7 @@ Octopus.Client.Repositories
Octopus.Client.Editors.TenantEditor CreateOrModify(String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String, Boolean)
List<TenantResource> FindAll(String, String[], Int32)
List<TenantsMissingVariablesResource> GetMissingVariables(String, String, String)
Octopus.Client.Model.TenantVariableResource GetVariables(Octopus.Client.Model.TenantResource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ Octopus.Client.Editors
Octopus.Client.Editors.TenantEditor ClearTags()
Octopus.Client.Editors.TenantEditor ConnectToProjectAndEnvironments(Octopus.Client.Model.ProjectResource, Octopus.Client.Model.EnvironmentResource[])
Octopus.Client.Editors.TenantEditor CreateOrModify(String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String, Boolean)
Octopus.Client.Editors.TenantEditor Customize(Action<TenantResource>)
Octopus.Client.Editors.TenantEditor Save()
Octopus.Client.Editors.TenantEditor SetLogo(String)
Expand Down Expand Up @@ -8499,6 +8499,7 @@ Octopus.Client.Repositories
Octopus.Client.Editors.TenantEditor CreateOrModify(String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String)
Octopus.Client.Editors.TenantEditor CreateOrModify(String, String, String, Boolean)
List<TenantResource> FindAll(String, String[], Int32)
List<TenantsMissingVariablesResource> GetMissingVariables(String, String, String)
Octopus.Client.Model.TenantVariableResource GetVariables(Octopus.Client.Model.TenantResource)
Expand Down
5 changes: 4 additions & 1 deletion source/Octopus.Server.Client/Editors/TenantEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ public TenantEditor CreateOrModify(string name)
/// <param name="name">The Tenant's name</param>
/// <param name="description">The Tenant's description</param>
/// <param name="cloneId">If provided, the Id of the Tenant that you want to clone</param>
/// <param name="isDisabled">The Tenant's enabled/disabled state</param>
/// <returns></returns>
public TenantEditor CreateOrModify(string name, string description, string cloneId = null)
public TenantEditor CreateOrModify(string name, string description, string cloneId = null, bool isDisabled = false)
{
if (!(repository as TenantRepository).Repository.HasLinkParameter("Tenants", "clone"))
throw new OperationNotSupportedByOctopusServerException(cloneId == null
Expand All @@ -62,12 +63,14 @@ public TenantEditor CreateOrModify(string name, string description, string clone
{
Name = name,
Description = description,
IsDisabled = isDisabled,
}, new { clone = cloneId });
}
else
{
existing.Name = name;
existing.Description = description;
existing.IsDisabled = isDisabled;
Instance = repository.Modify(existing);
}

Expand Down
1 change: 1 addition & 0 deletions source/Octopus.Server.Client/Model/TenantResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public TenantResource ClearProjects()

public string Slug { get; set; }

[Writeable]
public bool IsDisabled { get; set; }

public IconResource Icon { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions source/Octopus.Server.Client/Repositories/TenantRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public interface ITenantRepository : IFindBySlug<TenantResource>, ICreate<Tenant
TenantEditor CreateOrModify(string name);
TenantEditor CreateOrModify(string name, string description);
TenantEditor CreateOrModify(string name, string description, string cloneId);
TenantEditor CreateOrModify(string name, string description, string cloneId, bool isDisabled);
}

class TenantRepository : BasicRepository<TenantResource>, ITenantRepository
Expand Down Expand Up @@ -82,5 +83,10 @@ public TenantEditor CreateOrModify(string name, string description, string clone
{
return new TenantEditor(this).CreateOrModify(name, description, cloneId);
}

public TenantEditor CreateOrModify(string name, string description, string cloneId, bool isDisabled)
{
return new TenantEditor(this).CreateOrModify(name, description, cloneId, isDisabled);
}
}
}

0 comments on commit b19a796

Please sign in to comment.