Skip to content

Commit

Permalink
Add runbook resource usage changes accounts and library variablesets (#…
Browse files Browse the repository at this point in the history
…485)

* Add runbook resource usage changes for accounts and library variable sets

* Update surface area approval files

* Add RunbookSnapshotUsageEntry ProjectVariableSetUsage for account usages
  • Loading branch information
shaunmarx authored Dec 2, 2019
1 parent 9c1425a commit e56d478
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3017,6 +3017,7 @@ Octopus.Client.Model
String ProjectName { get; set; }
String ProjectSlug { get; set; }
ICollection<LibraryVariableSetReleaseUsageEntry> Releases { get; set; }
List<LibraryVariableSetRunbookSnapshotUsageEntry> RunbookSnapshots { get; set; }
}
class LibraryVariableSetReleaseUsageEntry
{
Expand Down Expand Up @@ -3052,6 +3053,12 @@ Octopus.Client.Model
Octopus.Client.Model.LibraryVariableSetResource AddOrUpdateVariableTemplate(String, String, IDictionary<String, String>, String, String)
Octopus.Client.Model.LibraryVariableSetResource Clear()
}
class LibraryVariableSetRunbookSnapshotUsageEntry
{
.ctor()
String SnapshotId { get; set; }
String SnapshotName { get; set; }
}
class LibraryVariableSetUsageResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Expand All @@ -3060,6 +3067,7 @@ Octopus.Client.Model
.ctor()
Int32 CountOfProjectsUserCannotSee { get; set; }
Int32 CountOfReleasesUserCannotSee { get; set; }
Int32 CountOfRunbookSnapshotsUserCannotSee { get; set; }
ICollection<LibraryVariableSetProjectUsage> Projects { get; set; }
}
abstract class LicenseKinds
Expand Down Expand Up @@ -5364,6 +5372,8 @@ Octopus.Client.Model.Accounts.Usages
ICollection<LibraryVariableSetUsageEntry> LibraryVariableSets { get; set; }
ICollection<ProjectVariableSetUsage> ProjectVariableSets { get; set; }
ICollection<ReleaseUsage> Releases { get; set; }
ICollection<RunbookStepUsage> RunbookProcesses { get; set; }
ICollection<RunbookSnapshotUsage> RunbookSnapshots { get; set; }
ICollection<TargetUsageEntry> Targets { get; set; }
}
class LibraryVariableSetUsageEntry
Expand All @@ -5380,6 +5390,7 @@ Octopus.Client.Model.Accounts.Usages
String ProjectName { get; set; }
String ProjectSlug { get; set; }
ICollection<ReleaseUsageEntry> Releases { get; set; }
List<RunbookSnapshotUsageEntry> RunbookSnapshots { get; set; }
}
class ReleaseUsage
{
Expand All @@ -5394,7 +5405,35 @@ Octopus.Client.Model.Accounts.Usages
String ReleaseId { get; set; }
String ReleaseVersion { get; set; }
}
class RunbookSnapshotUsage
{
.ctor()
String ProjectId { get; set; }
String ProjectName { get; set; }
String RunbookId { get; set; }
String RunbookName { get; set; }
ICollection<RunbookSnapshotUsageEntry> Snapshots { get; set; }
}
class RunbookSnapshotUsageEntry
{
.ctor()
String SnapshotId { get; set; }
String SnapshotName { get; set; }
}
class RunbookStepUsage
Octopus.Client.Model.Accounts.Usages.StepUsageBase
{
.ctor()
String ProcessId { get; set; }
String RunbookId { get; set; }
String RunbookName { get; set; }
}
class StepUsage
Octopus.Client.Model.Accounts.Usages.StepUsageBase
{
.ctor()
}
class StepUsageBase
{
.ctor()
String ProjectId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3033,6 +3033,7 @@ Octopus.Client.Model
String ProjectName { get; set; }
String ProjectSlug { get; set; }
ICollection<LibraryVariableSetReleaseUsageEntry> Releases { get; set; }
List<LibraryVariableSetRunbookSnapshotUsageEntry> RunbookSnapshots { get; set; }
}
class LibraryVariableSetReleaseUsageEntry
{
Expand Down Expand Up @@ -3068,6 +3069,12 @@ Octopus.Client.Model
Octopus.Client.Model.LibraryVariableSetResource AddOrUpdateVariableTemplate(String, String, IDictionary<String, String>, String, String)
Octopus.Client.Model.LibraryVariableSetResource Clear()
}
class LibraryVariableSetRunbookSnapshotUsageEntry
{
.ctor()
String SnapshotId { get; set; }
String SnapshotName { get; set; }
}
class LibraryVariableSetUsageResource
Octopus.Client.Extensibility.IResource
Octopus.Client.Model.IAuditedResource
Expand All @@ -3076,6 +3083,7 @@ Octopus.Client.Model
.ctor()
Int32 CountOfProjectsUserCannotSee { get; set; }
Int32 CountOfReleasesUserCannotSee { get; set; }
Int32 CountOfRunbookSnapshotsUserCannotSee { get; set; }
ICollection<LibraryVariableSetProjectUsage> Projects { get; set; }
}
abstract class LicenseKinds
Expand Down Expand Up @@ -5389,6 +5397,8 @@ Octopus.Client.Model.Accounts.Usages
ICollection<LibraryVariableSetUsageEntry> LibraryVariableSets { get; set; }
ICollection<ProjectVariableSetUsage> ProjectVariableSets { get; set; }
ICollection<ReleaseUsage> Releases { get; set; }
ICollection<RunbookStepUsage> RunbookProcesses { get; set; }
ICollection<RunbookSnapshotUsage> RunbookSnapshots { get; set; }
ICollection<TargetUsageEntry> Targets { get; set; }
}
class LibraryVariableSetUsageEntry
Expand All @@ -5405,6 +5415,7 @@ Octopus.Client.Model.Accounts.Usages
String ProjectName { get; set; }
String ProjectSlug { get; set; }
ICollection<ReleaseUsageEntry> Releases { get; set; }
List<RunbookSnapshotUsageEntry> RunbookSnapshots { get; set; }
}
class ReleaseUsage
{
Expand All @@ -5419,7 +5430,35 @@ Octopus.Client.Model.Accounts.Usages
String ReleaseId { get; set; }
String ReleaseVersion { get; set; }
}
class RunbookSnapshotUsage
{
.ctor()
String ProjectId { get; set; }
String ProjectName { get; set; }
String RunbookId { get; set; }
String RunbookName { get; set; }
ICollection<RunbookSnapshotUsageEntry> Snapshots { get; set; }
}
class RunbookSnapshotUsageEntry
{
.ctor()
String SnapshotId { get; set; }
String SnapshotName { get; set; }
}
class RunbookStepUsage
Octopus.Client.Model.Accounts.Usages.StepUsageBase
{
.ctor()
String ProcessId { get; set; }
String RunbookId { get; set; }
String RunbookName { get; set; }
}
class StepUsage
Octopus.Client.Model.Accounts.Usages.StepUsageBase
{
.ctor()
}
class StepUsageBase
{
.ctor()
String ProjectId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,38 @@ public AccountUsageResource()
Releases = new List<ReleaseUsage>();
ProjectVariableSets = new List<ProjectVariableSetUsage>();
LibraryVariableSets = new List<LibraryVariableSetUsageEntry>();
RunbookProcesses = new List<RunbookStepUsage>();
RunbookSnapshots = new List<RunbookSnapshotUsage>();
}

public ICollection<TargetUsageEntry> Targets { get; set; }
public ICollection<StepUsage> DeploymentProcesses { get; set; }
public ICollection<ReleaseUsage> Releases { get; set; }
public ICollection<ProjectVariableSetUsage> ProjectVariableSets { get; set; }
public ICollection<LibraryVariableSetUsageEntry> LibraryVariableSets { get; set; }
public ICollection<RunbookStepUsage> RunbookProcesses { get; set; }
public ICollection<RunbookSnapshotUsage> RunbookSnapshots { get; set; }
}

public class StepUsageBase
{
public StepUsageBase()
{
Steps = new List<StepUsageEntry>();
}

public string ProjectName { get; set; }
public string ProjectId { get; set; }
public string ProjectSlug { get; set; }

public ICollection<StepUsageEntry> Steps { get; set; }
}

public class RunbookStepUsage: StepUsageBase
{
public string ProcessId { get; set; }
public string RunbookId { get; set; }
public string RunbookName { get; set; }
}

public class TargetUsageEntry
Expand All @@ -32,12 +57,14 @@ public class ProjectVariableSetUsage
public ProjectVariableSetUsage()
{
Releases = new List<ReleaseUsageEntry>();
RunbookSnapshots = new List<RunbookSnapshotUsageEntry>();
}

public string ProjectSlug { get; set; }
public string ProjectName { get; set; }
public string ProjectId { get; set; }
public ICollection<ReleaseUsageEntry> Releases { get; set; }
public List<RunbookSnapshotUsageEntry> RunbookSnapshots { get; set; }
public bool IsCurrentlyBeingUsedInProject { get; set; }
}

Expand Down Expand Up @@ -65,23 +92,31 @@ public class ReleaseUsageEntry
public string ReleaseVersion { get; set; }
}

public class StepUsage
public class StepUsage: StepUsageBase { }

public class StepUsageEntry
{
public string StepName { get; set; }
public string StepId { get; set; }
}

public class RunbookSnapshotUsage
{
public StepUsage()
public RunbookSnapshotUsage()
{
Steps = new List<StepUsageEntry>();
Snapshots = new List<RunbookSnapshotUsageEntry>();
}

public string RunbookId { get; set; }
public string RunbookName { get; set; }
public string ProjectName { get; set; }
public string ProjectSlug { get; set; }
public string ProjectId { get; set; }

public ICollection<StepUsageEntry> Steps { get; set; }
public ICollection<RunbookSnapshotUsageEntry> Snapshots { get; set; }
}

public class StepUsageEntry
public class RunbookSnapshotUsageEntry
{
public string StepName { get; set; }
public string StepId { get; set; }
public string SnapshotId { get; set; }
public string SnapshotName { get; set; }
}
}
14 changes: 11 additions & 3 deletions source/Octopus.Client/Model/LibraryVariableSetResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public LibraryVariableSetResource AddOrUpdateSelectTemplate(string name, string

public string SpaceId { get; set; }
}

public class LibraryVariableSetUsageResource : Resource
{
public LibraryVariableSetUsageResource()
Expand All @@ -117,22 +117,30 @@ public LibraryVariableSetUsageResource()
public ICollection<LibraryVariableSetProjectUsage> Projects { get; set; }
public int CountOfProjectsUserCannotSee { get; set; }
public int CountOfReleasesUserCannotSee { get; set; }
public int CountOfRunbookSnapshotsUserCannotSee { get; set; }
}

public class LibraryVariableSetProjectUsage
{
public LibraryVariableSetProjectUsage()
{
Releases = new List<LibraryVariableSetReleaseUsageEntry>();
RunbookSnapshots = new List<LibraryVariableSetRunbookSnapshotUsageEntry>();
}

public string ProjectSlug { get; set; }
public string ProjectName { get; set; }
public string ProjectId { get; set; }
public List<LibraryVariableSetRunbookSnapshotUsageEntry> RunbookSnapshots { get; set; }
public ICollection<LibraryVariableSetReleaseUsageEntry> Releases { get; set; }
public bool IsCurrentlyBeingUsedInProject { get; set; }
}

public class LibraryVariableSetRunbookSnapshotUsageEntry
{
public string SnapshotId { get; set; }
public string SnapshotName { get; set; }
}

public class LibraryVariableSetReleaseUsageEntry
{
public string ReleaseId { get; set; }
Expand Down
2 changes: 0 additions & 2 deletions source/Octopus.Client/Repositories/Async/BasicRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ private void AssertSpaceIdMatchesResource(TResource resource)
protected async void ThrowIfServerVersionIsNotCompatible()
{
if (!hasMinimumRequiredVersion) return;

var currentServerVersion = SemanticVersion.Parse((await Repository.LoadRootDocument()).Version);

if (currentServerVersion < minimumRequiredVersion)
{
throw new NotSupportedException(
Expand Down
1 change: 1 addition & 0 deletions source/Octopus.Client/Repositories/BasicRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ protected void ThrowIfServerVersionIsNotCompatible()
if (!hasMinimumRequiredVersion) return;

var currentServerVersion = SemanticVersion.Parse(Repository.LoadRootDocument().Version);

if (currentServerVersion < minimumRequiredVersion)
{
throw new NotSupportedException(
Expand Down

0 comments on commit e56d478

Please sign in to comment.