Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IsDisabled to tenant editor/repository #895

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}