From 1095f252c6dbaac036dea7f6ec313148d6569f45 Mon Sep 17 00:00:00 2001 From: Shane Date: Tue, 6 Feb 2024 11:51:01 +1000 Subject: [PATCH 1/6] Add deployment freezes permissions --- .../Octopus.Server.Client/Model/Permission.cs | 395 +++++++++++++----- 1 file changed, 282 insertions(+), 113 deletions(-) diff --git a/source/Octopus.Server.Client/Model/Permission.cs b/source/Octopus.Server.Client/Model/Permission.cs index c0194d5c4..8bcc198a2 100644 --- a/source/Octopus.Server.Client/Model/Permission.cs +++ b/source/Octopus.Server.Client/Model/Permission.cs @@ -15,89 +15,161 @@ namespace Octopus.Client.Model [TypeConverter(typeof(PermissionTypeConverter))] public class Permission : IEquatable { - [Description("Perform system-level functions like configuring HTTP web hosting, the public URL, server nodes, maintenance mode, and server diagnostics")]public static readonly Permission AdministerSystem = new Permission("AdministerSystem"); + [Description( + "Perform system-level functions like configuring HTTP web hosting, the public URL, server nodes, maintenance mode, and server diagnostics")] + public static readonly Permission AdministerSystem = new Permission("AdministerSystem"); - [Description("Edit project details")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ProjectEdit = new Permission("ProjectEdit"); + [Description("Edit project details")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] + public static readonly Permission ProjectEdit = new Permission("ProjectEdit"); - [Description("View the details of projects")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ProjectView = new Permission("ProjectView"); + [Description("View the details of projects")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] + public static readonly Permission ProjectView = new Permission("ProjectView"); - [Description("Create projects")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectCreate = new Permission("ProjectCreate"); + [Description("Create projects")] [SupportsRestriction(PermissionScope.ProjectGroups)] + public static readonly Permission ProjectCreate = new Permission("ProjectCreate"); - [Description("Delete projects")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ProjectDelete = new Permission("ProjectDelete"); + [Description("Delete projects")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] + public static readonly Permission ProjectDelete = new Permission("ProjectDelete"); - [Description("View the deployment process and channels associated with a project")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission ProcessView = new Permission("ProcessView"); + [Description("View the deployment process and channels associated with a project")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission ProcessView = new Permission("ProcessView"); - [Description("Edit the deployment process and channels associated with a project")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission ProcessEdit = new Permission("ProcessEdit"); + [Description("Edit the deployment process and channels associated with a project")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission ProcessEdit = new Permission("ProcessEdit"); - [Description("Edit variables belonging to a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments)] public static readonly Permission VariableEdit = new Permission("VariableEdit"); + [Description("Edit variables belonging to a project")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments)] + public static readonly Permission VariableEdit = new Permission("VariableEdit"); - [Description("Edit non-environment scoped variables belonging to a project or library variable set")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission VariableEditUnscoped = new Permission("VariableEditUnscoped"); + [Description("Edit non-environment scoped variables belonging to a project or library variable set")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission VariableEditUnscoped = new Permission("VariableEditUnscoped"); - [Description("View variables belonging to a project or library variable set")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments)] public static readonly Permission VariableView = new Permission("VariableView"); + [Description("View variables belonging to a project or library variable set")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments)] + public static readonly Permission VariableView = new Permission("VariableView"); - [Description("View non-environment scoped variables belonging to a project or library variable set")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission VariableViewUnscoped = new Permission("VariableViewUnscoped"); + [Description("View non-environment scoped variables belonging to a project or library variable set")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission VariableViewUnscoped = new Permission("VariableViewUnscoped"); - [Description("Create a release for a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ReleaseCreate = new Permission("ReleaseCreate"); + [Description("Create a release for a project")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] + public static readonly Permission ReleaseCreate = new Permission("ReleaseCreate"); - [Description("View a release of a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ReleaseView = new Permission("ReleaseView"); + [Description("View a release of a project")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] + public static readonly Permission ReleaseView = new Permission("ReleaseView"); - [Description("Edit a release of a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ReleaseEdit = new Permission("ReleaseEdit"); + [Description("Edit a release of a project")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] + public static readonly Permission ReleaseEdit = new Permission("ReleaseEdit"); - [Description("Delete a release of a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ReleaseDelete = new Permission("ReleaseDelete"); + [Description("Delete a release of a project")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] + public static readonly Permission ReleaseDelete = new Permission("ReleaseDelete"); - [Description("Block a release from progressing to the next lifecycle phase")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission DefectReport = new Permission("DefectReport"); + [Description("Block a release from progressing to the next lifecycle phase")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission DefectReport = new Permission("DefectReport"); - [Description("Unblock a release so it can progress to the next phase")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission DefectResolve = new Permission("DefectResolve"); + [Description("Unblock a release so it can progress to the next phase")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission DefectResolve = new Permission("DefectResolve"); - [Description("Deploy releases to target environments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission DeploymentCreate = new Permission("DeploymentCreate"); + [Description("Deploy releases to target environments")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission DeploymentCreate = new Permission("DeploymentCreate"); - [Description("Delete deployments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission DeploymentDelete = new Permission("DeploymentDelete"); + [Description("Delete deployments")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission DeploymentDelete = new Permission("DeploymentDelete"); - [Description("View deployments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission DeploymentView = new Permission("DeploymentView"); + [Description("View deployments")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission DeploymentView = new Permission("DeploymentView"); - [Description("View environments")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission EnvironmentView = new Permission("EnvironmentView"); + [Description("View environments")] [SupportsRestriction(PermissionScope.Environments)] + public static readonly Permission EnvironmentView = new Permission("EnvironmentView"); - [Description("Create environments")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission EnvironmentCreate = new Permission("EnvironmentCreate"); + [Description("Create environments")] [SupportsRestriction(PermissionScope.Environments)] + public static readonly Permission EnvironmentCreate = new Permission("EnvironmentCreate"); - [Description("Edit environments")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission EnvironmentEdit = new Permission("EnvironmentEdit"); + [Description("Edit environments")] [SupportsRestriction(PermissionScope.Environments)] + public static readonly Permission EnvironmentEdit = new Permission("EnvironmentEdit"); - [Description("Delete environments")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission EnvironmentDelete = new Permission("EnvironmentDelete"); + [Description("Delete environments")] [SupportsRestriction(PermissionScope.Environments)] + public static readonly Permission EnvironmentDelete = new Permission("EnvironmentDelete"); - [Description("Create machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission MachineCreate = new Permission("MachineCreate"); + [Description("Create machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission MachineCreate = new Permission("MachineCreate"); - [Description("Edit machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission MachineEdit = new Permission("MachineEdit"); + [Description("Edit machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission MachineEdit = new Permission("MachineEdit"); - [Description("View machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission MachineView = new Permission("MachineView"); + [Description("View machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission MachineView = new Permission("MachineView"); - [Description("Delete machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission MachineDelete = new Permission("MachineDelete"); + [Description("Delete machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission MachineDelete = new Permission("MachineDelete"); - [Description("View the artifacts created manually and during deployment")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission ArtifactView = new Permission("ArtifactView"); + [Description("View the artifacts created manually and during deployment")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission ArtifactView = new Permission("ArtifactView"); - [Description("Manually create artifacts")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission ArtifactCreate = new Permission("ArtifactCreate"); + [Description("Manually create artifacts")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission ArtifactCreate = new Permission("ArtifactCreate"); - [Description("Edit the details describing artifacts")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission ArtifactEdit = new Permission("ArtifactEdit"); + [Description("Edit the details describing artifacts")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission ArtifactEdit = new Permission("ArtifactEdit"); - [Description("Delete artifacts")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission ArtifactDelete = new Permission("ArtifactDelete"); + [Description("Delete artifacts")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission ArtifactDelete = new Permission("ArtifactDelete"); - [Description("View package feeds and the packages in them")] public static readonly Permission FeedView = new Permission("FeedView"); + [Description("View package feeds and the packages in them")] + public static readonly Permission FeedView = new Permission("FeedView"); - [Description("View release and deployment events")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission EventView = new Permission("EventView"); + [Description("View release and deployment events")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission EventView = new Permission("EventView"); - [Description("View library variable sets")] public static readonly Permission LibraryVariableSetView = new Permission("LibraryVariableSetView"); + [Description("View library variable sets")] + public static readonly Permission LibraryVariableSetView = new Permission("LibraryVariableSetView"); - [Description("Create library variable sets")] public static readonly Permission LibraryVariableSetCreate = new Permission("LibraryVariableSetCreate"); + [Description("Create library variable sets")] + public static readonly Permission LibraryVariableSetCreate = new Permission("LibraryVariableSetCreate"); - [Description("Edit library variable sets")] public static readonly Permission LibraryVariableSetEdit = new Permission("LibraryVariableSetEdit"); + [Description("Edit library variable sets")] + public static readonly Permission LibraryVariableSetEdit = new Permission("LibraryVariableSetEdit"); - [Description("Delete library variable sets")] public static readonly Permission LibraryVariableSetDelete = new Permission("LibraryVariableSetDelete"); + [Description("Delete library variable sets")] + public static readonly Permission LibraryVariableSetDelete = new Permission("LibraryVariableSetDelete"); - [Description("View project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectGroupView = new Permission("ProjectGroupView"); + [Description("View project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] + public static readonly Permission ProjectGroupView = new Permission("ProjectGroupView"); - [Description("Create project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectGroupCreate = new Permission("ProjectGroupCreate"); + [Description("Create project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] + public static readonly Permission ProjectGroupCreate = new Permission("ProjectGroupCreate"); - [Description("Edit project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectGroupEdit = new Permission("ProjectGroupEdit"); + [Description("Edit project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] + public static readonly Permission ProjectGroupEdit = new Permission("ProjectGroupEdit"); - [Description("Delete project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectGroupDelete = new Permission("ProjectGroupDelete"); + [Description("Delete project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] + public static readonly Permission ProjectGroupDelete = new Permission("ProjectGroupDelete"); [Description("Create teams")] public static readonly Permission TeamCreate = new Permission("TeamCreate"); @@ -109,84 +181,139 @@ public class Permission : IEquatable [Description("View users")] public static readonly Permission UserView = new Permission("UserView"); - [Description("Invite users to register accounts")] public static readonly Permission UserInvite = new Permission("UserInvite"); + [Description("Invite users to register accounts")] + public static readonly Permission UserInvite = new Permission("UserInvite"); - [Description("View other user's roles")] public static readonly Permission UserRoleView = new Permission("UserRoleView"); + [Description("View other user's roles")] + public static readonly Permission UserRoleView = new Permission("UserRoleView"); - [Description("Edit user role definitions")] public static readonly Permission UserRoleEdit = new Permission("UserRoleEdit"); + [Description("Edit user role definitions")] + public static readonly Permission UserRoleEdit = new Permission("UserRoleEdit"); - [Description("View summary-level information associated with a task")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskView = new Permission("TaskView"); + [Description("View summary-level information associated with a task")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission TaskView = new Permission("TaskView"); - [Obsolete("TaskViewLog is no longer supported by Octopus Server. Instead use the TaskView permission, which also grants access to Task logs", false)] - [Description("View detailed information about the execution of a task, including the task log output")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskViewLog = new Permission("TaskViewLog"); + [Obsolete( + "TaskViewLog is no longer supported by Octopus Server. Instead use the TaskView permission, which also grants access to Task logs", + false)] + [Description("View detailed information about the execution of a task, including the task log output")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission TaskViewLog = new Permission("TaskViewLog"); - [Description("Explicitly create (run) server tasks")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskCreate = new Permission("TaskCreate"); + [Description("Explicitly create (run) server tasks")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission TaskCreate = new Permission("TaskCreate"); - [Description("Cancel server tasks")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskCancel = new Permission("TaskCancel"); + [Description("Cancel server tasks")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission TaskCancel = new Permission("TaskCancel"); - [Description("Edit server tasks")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskEdit = new Permission("TaskEdit"); + [Description("Edit server tasks")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission TaskEdit = new Permission("TaskEdit"); - [Description("View interruptions generated during deployments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission InterruptionView = new Permission("InterruptionView"); + [Description("View interruptions generated during deployments")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission InterruptionView = new Permission("InterruptionView"); - [Description("Take responsibility for and submit interruptions generated during deployments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission InterruptionSubmit = new Permission("InterruptionSubmit"); + [Description("Take responsibility for and submit interruptions generated during deployments")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission InterruptionSubmit = new Permission("InterruptionSubmit"); - [Description("Take responsibility for and submit interruptions generated during deployments when the user is in a designated responsible team")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission InterruptionViewSubmitResponsible = new Permission("InterruptionViewSubmitResponsible"); + [Description( + "Take responsibility for and submit interruptions generated during deployments when the user is in a designated responsible team")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission InterruptionViewSubmitResponsible = + new Permission("InterruptionViewSubmitResponsible"); - [Description("Push new packages to the built-in package repository")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission BuiltInFeedPush = new Permission("BuiltInFeedPush"); + [Description("Push new packages to the built-in package repository")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission BuiltInFeedPush = new Permission("BuiltInFeedPush"); - [Description("Replace or delete packages in the built-in package repository")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission BuiltInFeedAdminister = new Permission("BuiltInFeedAdminister"); + [Description("Replace or delete packages in the built-in package repository")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission BuiltInFeedAdminister = new Permission("BuiltInFeedAdminister"); - [Description("Retrieve the contents of packages in the built-in package repository")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission BuiltInFeedDownload = new Permission("BuiltInFeedDownload"); + [Description("Retrieve the contents of packages in the built-in package repository")] + [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission BuiltInFeedDownload = new Permission("BuiltInFeedDownload"); - [Description("View step templates")] public static readonly Permission ActionTemplateView = new Permission("ActionTemplateView"); + [Description("View step templates")] + public static readonly Permission ActionTemplateView = new Permission("ActionTemplateView"); - [Description("Create step templates")] public static readonly Permission ActionTemplateCreate = new Permission("ActionTemplateCreate"); + [Description("Create step templates")] + public static readonly Permission ActionTemplateCreate = new Permission("ActionTemplateCreate"); - [Description("Edit step templates")] public static readonly Permission ActionTemplateEdit = new Permission("ActionTemplateEdit"); + [Description("Edit step templates")] + public static readonly Permission ActionTemplateEdit = new Permission("ActionTemplateEdit"); - [Description("Delete step templates")] public static readonly Permission ActionTemplateDelete = new Permission("ActionTemplateDelete"); + [Description("Delete step templates")] + public static readonly Permission ActionTemplateDelete = new Permission("ActionTemplateDelete"); - [Description("Create lifecycles")] public static readonly Permission LifecycleCreate = new Permission("LifecycleCreate"); + [Description("Create lifecycles")] + public static readonly Permission LifecycleCreate = new Permission("LifecycleCreate"); - [Description("View lifecycles")] public static readonly Permission LifecycleView = new Permission("LifecycleView"); + [Description("View lifecycles")] + public static readonly Permission LifecycleView = new Permission("LifecycleView"); - [Description("Edit lifecycles")] public static readonly Permission LifecycleEdit = new Permission("LifecycleEdit"); + [Description("Edit lifecycles")] + public static readonly Permission LifecycleEdit = new Permission("LifecycleEdit"); - [Description("Delete lifecycles")] public static readonly Permission LifecycleDelete = new Permission("LifecycleDelete"); + [Description("Delete lifecycles")] + public static readonly Permission LifecycleDelete = new Permission("LifecycleDelete"); - [Description("View accounts")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission AccountView = new Permission("AccountView"); + [Description("View accounts")] [SupportsRestriction(PermissionScope.Environments)] + public static readonly Permission AccountView = new Permission("AccountView"); - [Description("Edit accounts")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission AccountEdit = new Permission("AccountEdit"); + [Description("Edit accounts")] [SupportsRestriction(PermissionScope.Environments)] + public static readonly Permission AccountEdit = new Permission("AccountEdit"); - [Description("Create accounts")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission AccountCreate = new Permission("AccountCreate"); + [Description("Create accounts")] [SupportsRestriction(PermissionScope.Environments)] + public static readonly Permission AccountCreate = new Permission("AccountCreate"); - [Description("Delete accounts")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission AccountDelete = new Permission("AccountDelete"); + [Description("Delete accounts")] [SupportsRestriction(PermissionScope.Environments)] + public static readonly Permission AccountDelete = new Permission("AccountDelete"); - [Description("Create tenants")] [SupportsRestriction(PermissionScope.Tenants)] public static readonly Permission TenantCreate = new Permission("TenantCreate"); + [Description("Create tenants")] [SupportsRestriction(PermissionScope.Tenants)] + public static readonly Permission TenantCreate = new Permission("TenantCreate"); - [Description("Edit tenants")] [SupportsRestriction(PermissionScope.Tenants)] public static readonly Permission TenantEdit = new Permission("TenantEdit"); + [Description("Edit tenants")] [SupportsRestriction(PermissionScope.Tenants)] + public static readonly Permission TenantEdit = new Permission("TenantEdit"); - [Description("View tenants")] [SupportsRestriction(PermissionScope.Tenants)] public static readonly Permission TenantView = new Permission("TenantView"); + [Description("View tenants")] [SupportsRestriction(PermissionScope.Tenants)] + public static readonly Permission TenantView = new Permission("TenantView"); - [Description("Delete tenants")] [SupportsRestriction(PermissionScope.Tenants)] public static readonly Permission TenantDelete = new Permission("TenantDelete"); + [Description("Delete tenants")] [SupportsRestriction(PermissionScope.Tenants)] + public static readonly Permission TenantDelete = new Permission("TenantDelete"); - [Description("Create tag sets")] public static readonly Permission TagSetCreate = new Permission("TagSetCreate"); + [Description("Create tag sets")] + public static readonly Permission TagSetCreate = new Permission("TagSetCreate"); [Description("Edit tag sets")] public static readonly Permission TagSetEdit = new Permission("TagSetEdit"); - [Description("Delete tag sets")] public static readonly Permission TagSetDelete = new Permission("TagSetDelete"); + [Description("Delete tag sets")] + public static readonly Permission TagSetDelete = new Permission("TagSetDelete"); - [Description("View telemetry data")] public static readonly Permission TelemetryView = new Permission("TelemetryView"); + [Description("View telemetry data")] + public static readonly Permission TelemetryView = new Permission("TelemetryView"); - [Description("Create health check policies")] public static readonly Permission MachinePolicyCreate = new Permission("MachinePolicyCreate"); + [Description("Create health check policies")] + public static readonly Permission MachinePolicyCreate = new Permission("MachinePolicyCreate"); - [Description("View health check policies")] public static readonly Permission MachinePolicyView = new Permission("MachinePolicyView"); + [Description("View health check policies")] + public static readonly Permission MachinePolicyView = new Permission("MachinePolicyView"); - [Description("Edit health check policies")] public static readonly Permission MachinePolicyEdit = new Permission("MachinePolicyEdit"); + [Description("Edit health check policies")] + public static readonly Permission MachinePolicyEdit = new Permission("MachinePolicyEdit"); - [Description("Delete health check policies")] public static readonly Permission MachinePolicyDelete = new Permission("MachinePolicyDelete"); + [Description("Delete health check policies")] + public static readonly Permission MachinePolicyDelete = new Permission("MachinePolicyDelete"); [Description("Create proxies")] public static readonly Permission ProxyCreate = new Permission("ProxyCreate"); @@ -196,41 +323,59 @@ public class Permission : IEquatable [Description("Delete proxies")] public static readonly Permission ProxyDelete = new Permission("ProxyDelete"); - [Description("Create subscriptions")] public static readonly Permission SubscriptionCreate = new Permission("SubscriptionCreate"); + [Description("Create subscriptions")] + public static readonly Permission SubscriptionCreate = new Permission("SubscriptionCreate"); - [Description("View subscriptions")] public static readonly Permission SubscriptionView = new Permission("SubscriptionView"); + [Description("View subscriptions")] + public static readonly Permission SubscriptionView = new Permission("SubscriptionView"); - [Description("Edit subscriptions")] public static readonly Permission SubscriptionEdit = new Permission("SubscriptionEdit"); + [Description("Edit subscriptions")] + public static readonly Permission SubscriptionEdit = new Permission("SubscriptionEdit"); - [Description("Delete subscriptions")] public static readonly Permission SubscriptionDelete = new Permission("SubscriptionDelete"); + [Description("Delete subscriptions")] + public static readonly Permission SubscriptionDelete = new Permission("SubscriptionDelete"); - [Description("Create triggers")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission TriggerCreate = new Permission("TriggerCreate"); + [Description("Create triggers")] [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission TriggerCreate = new Permission("TriggerCreate"); - [Description("View triggers")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission TriggerView = new Permission("TriggerView"); + [Description("View triggers")] [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission TriggerView = new Permission("TriggerView"); - [Description("Edit triggers")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission TriggerEdit = new Permission("TriggerEdit"); + [Description("Edit triggers")] [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission TriggerEdit = new Permission("TriggerEdit"); - [Description("Delete triggers")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission TriggerDelete = new Permission("TriggerDelete"); + [Description("Delete triggers")] [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission TriggerDelete = new Permission("TriggerDelete"); - [Description("View certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission CertificateView = new Permission("CertificateView"); + [Description("View certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission CertificateView = new Permission("CertificateView"); - [Description("Create certificates")] public static readonly Permission CertificateCreate = new Permission("CertificateCreate"); + [Description("Create certificates")] + public static readonly Permission CertificateCreate = new Permission("CertificateCreate"); - [Description("Edit certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission CertificateEdit = new Permission("CertificateEdit"); + [Description("Edit certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission CertificateEdit = new Permission("CertificateEdit"); - [Description("Delete certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission CertificateDelete = new Permission("CertificateDelete"); + [Description("Delete certificates")] + [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission CertificateDelete = new Permission("CertificateDelete"); - [Description("Export certificate private-keys")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission CertificateExportPrivateKey = new Permission("CertificateExportPrivateKey"); + [Description("Export certificate private-keys")] + [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] + public static readonly Permission CertificateExportPrivateKey = new Permission("CertificateExportPrivateKey"); [Description("Edit users")] public static readonly Permission UserEdit = new Permission("UserEdit"); - [Description("Configure server settings like Authentication, SMTP, and HTTP Security Headers")] public static readonly Permission ConfigureServer = new Permission("ConfigureServer"); + [Description("Configure server settings like Authentication, SMTP, and HTTP Security Headers")] + public static readonly Permission ConfigureServer = new Permission("ConfigureServer"); [Description("Edit feeds")] public static readonly Permission FeedEdit = new Permission("FeedEdit"); - [Description("View the workers in worker pools")] public static readonly Permission WorkerView = new Permission("WorkerView"); + [Description("View the workers in worker pools")] + public static readonly Permission WorkerView = new Permission("WorkerView"); - [Description("Edit workers and worker pools")] public static readonly Permission WorkerEdit = new Permission("WorkerEdit"); + [Description("Edit workers and worker pools")] + public static readonly Permission WorkerEdit = new Permission("WorkerEdit"); [Description("Edit spaces")] public static readonly Permission SpaceEdit = new Permission("SpaceEdit"); @@ -240,37 +385,61 @@ public class Permission : IEquatable [Description("Create spaces")] public static readonly Permission SpaceCreate = new Permission("SpaceCreate"); - [Description("Create/update build information")] public static readonly Permission BuildInformationPush = new Permission("BuildInformationPush"); + [Description("Create/update build information")] + public static readonly Permission BuildInformationPush = new Permission("BuildInformationPush"); - [Description("Replace or delete build information")] public static readonly Permission BuildInformationAdminister = new Permission("BuildInformationAdminister"); + [Description("Replace or delete build information")] + public static readonly Permission BuildInformationAdminister = new Permission("BuildInformationAdminister"); - [Description("View runbooks")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission RunbookView = new Permission("RunbookView"); + [Description("View runbooks")] [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission RunbookView = new Permission("RunbookView"); - [Description("Edit runbooks")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission RunbookEdit = new Permission("RunbookEdit"); + [Description("Edit runbooks")] [SupportsRestriction(PermissionScope.Projects)] + public static readonly Permission RunbookEdit = new Permission("RunbookEdit"); - [Description("View runbook runs")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission RunbookRunView = new Permission("RunbookRunView"); + [Description("View runbook runs")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission RunbookRunView = new Permission("RunbookRunView"); - [Description("Delete runbook runs")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission RunbookRunDelete = new Permission("RunbookRunDelete"); + [Description("Delete runbook runs")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission RunbookRunDelete = new Permission("RunbookRunDelete"); - [Description("Create runbook runs")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission RunbookRunCreate = new Permission("RunbookRunCreate"); + [Description("Create runbook runs")] + [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, + ExplicitTenantScopeRequired = true)] + public static readonly Permission RunbookRunCreate = new Permission("RunbookRunCreate"); - [Description("View Git credentials")] public static readonly Permission GitCredentialView = new Permission("GitCredentialView"); + [Description("View Git credentials")] + public static readonly Permission GitCredentialView = new Permission("GitCredentialView"); - [Description("Edit Git credentials")] public static readonly Permission GitCredentialEdit = new Permission("GitCredentialEdit"); + [Description("Edit Git credentials")] + public static readonly Permission GitCredentialEdit = new Permission("GitCredentialEdit"); - [Description("Delete archived event files")] public static readonly Permission EventRetentionDelete = new Permission("EventRetentionDelete"); - - [Description("View/list archived event files")] public static readonly Permission EventRetentionView = new Permission("EventRetentionView"); + [Description("Delete archived event files")] + public static readonly Permission EventRetentionDelete = new Permission("EventRetentionDelete"); - [Description("View Insights reports")] public static readonly Permission InsightsReportView = new ("InsightsReportView"); + [Description("View/list archived event files")] + public static readonly Permission EventRetentionView = new Permission("EventRetentionView"); - [Description("Create Insights reports")] public static readonly Permission InsightsReportCreate = new("InsightsReportCreate"); + [Description("View Insights reports")] + public static readonly Permission InsightsReportView = new("InsightsReportView"); - [Description("Edit Insights reports")] public static readonly Permission InsightsReportEdit = new("InsightsReportEdit"); + [Description("Create Insights reports")] + public static readonly Permission InsightsReportCreate = new("InsightsReportCreate"); - [Description("Delete Insights reports")] public static readonly Permission InsightsReportDelete = new("InsightsReportDelete"); + [Description("Edit Insights reports")] + public static readonly Permission InsightsReportEdit = new("InsightsReportEdit"); - public Permission(string id) + [Description("Delete Insights reports")] + public static readonly Permission InsightsReportDelete = new("InsightsReportDelete"); + + [Description("Administer deployment freezes")] + public static readonly Permission DeploymentFreezeAdminister = new("DeploymentFreezeAdminister"); + + public Permission(string id) { Id = id; } From ad8c3dc0034b4ecd9f8a101da6ad7ca6cd2419e9 Mon Sep 17 00:00:00 2001 From: Shane Date: Tue, 6 Feb 2024 12:03:49 +1000 Subject: [PATCH 2/6] I approve! --- ...re.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt | 1 + ...ePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt index bfb0cc9bb..9a2300d49 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt @@ -4193,6 +4193,7 @@ Octopus.Client.Model static Octopus.Client.Model.Permission DefectResolve static Octopus.Client.Model.Permission DeploymentCreate static Octopus.Client.Model.Permission DeploymentDelete + static Octopus.Client.Model.Permission DeploymentFreezeAdminister static Octopus.Client.Model.Permission DeploymentView static Octopus.Client.Model.Permission EnvironmentCreate static Octopus.Client.Model.Permission EnvironmentDelete diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt index e73f0e443..2d5f0a79b 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt @@ -4213,6 +4213,7 @@ Octopus.Client.Model static Octopus.Client.Model.Permission DefectResolve static Octopus.Client.Model.Permission DeploymentCreate static Octopus.Client.Model.Permission DeploymentDelete + static Octopus.Client.Model.Permission DeploymentFreezeAdminister static Octopus.Client.Model.Permission DeploymentView static Octopus.Client.Model.Permission EnvironmentCreate static Octopus.Client.Model.Permission EnvironmentDelete From f25b728ac61ba6c17432fcc9a9c4c538ff798b11 Mon Sep 17 00:00:00 2001 From: Shane Date: Tue, 6 Feb 2024 15:31:25 +1000 Subject: [PATCH 3/6] Add Modify deployment freeze --- .../IOctopusAsyncClient.cs | 22 +++++++++++++++++- .../Octopus.Server.Client/IOctopusClient.cs | 20 ++++++++++++++++ .../ModifyDeploymentFreezeCommand.cs | 23 +++++++++++++++++++ .../ModifyDeploymentFreezeResponse.cs | 18 +++++++++++++++ .../OctopusAsyncClient.cs | 8 +++++++ source/Octopus.Server.Client/OctopusClient.cs | 9 ++++++++ .../Async/DeploymentFreezeRepository.cs | 11 +++++++++ .../DeploymentFreezeRepository.cs | 8 +++++++ 8 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 source/Octopus.Server.Client/Model/DeploymentFreezes/ModifyDeploymentFreezeCommand.cs create mode 100644 source/Octopus.Server.Client/Model/DeploymentFreezes/ModifyDeploymentFreezeResponse.cs diff --git a/source/Octopus.Server.Client/IOctopusAsyncClient.cs b/source/Octopus.Server.Client/IOctopusAsyncClient.cs index c0cbf9cb0..cc3fe8c50 100644 --- a/source/Octopus.Server.Client/IOctopusAsyncClient.cs +++ b/source/Octopus.Server.Client/IOctopusAsyncClient.cs @@ -688,6 +688,7 @@ Task Create(string path, TCommand command, objec [Obsolete("Please use the overload with cancellation token instead.", false)] Task Update(string path, TResource resource, object pathParameters = null); + /// /// Updates the resource at the given URI on the server using the PUT verb, then performs a fresh GET request to reload /// the data. @@ -728,7 +729,26 @@ Task Create(string path, TCommand command, objec /// The request cancellation token. /// The latest copy of the resource from the server. Task Update(string path, TResource resource, object pathParameters, CancellationToken cancellationToken); - + /// + /// Updates the resource at the given URI on the server using the PUT verb, then performs a fresh GET request to reload + /// the data. + /// + /// + /// HTTP 401 or 403: Thrown when the current user's API key was not valid, their + /// account is disabled, or they don't have permission to perform the specified action. + /// + /// + /// If any other error is successfully returned from the server (e.g., a 500 + /// server error). + /// + /// HTTP 400: If there was a problem with the request provided by the user. + /// HTTP 404: If the specified resource does not exist on the server. + /// The path to the resource to update. + /// The command to update the resource. + /// If the path is a URI template, parameters to use for substitution. + /// The request cancellation token. + /// The response from updating the resource. + Task Update(string path, TCommand command, object pathParameters, CancellationToken cancellationToken); /// /// Deletes the resource at the given URI from the server using a the DELETE verb. Deletes in Octopus happen /// asynchronously via a background task diff --git a/source/Octopus.Server.Client/IOctopusClient.cs b/source/Octopus.Server.Client/IOctopusClient.cs index 0aaf4f2f6..fb2f34f4d 100644 --- a/source/Octopus.Server.Client/IOctopusClient.cs +++ b/source/Octopus.Server.Client/IOctopusClient.cs @@ -311,6 +311,26 @@ public interface IOctopusClient : IDisposable /// If the path is a URI template, parameters to use for substitution. /// The latest copy of the resource from the server. TResource Update(string path, TResource resource, object pathParameters = null); + + /// + /// Updates the resource at the given URI on the server using the PUT verb, then performs a fresh GET request to reload + /// the data. + /// + /// + /// HTTP 401 or 403: Thrown when the current user's API key was not valid, their + /// account is disabled, or they don't have permission to perform the specified action. + /// + /// + /// If any other error is successfully returned from the server (e.g., a 500 + /// server error). + /// + /// HTTP 400: If there was a problem with the request provided by the user. + /// HTTP 404: If the specified resource does not exist on the server. + /// The path to the resource to update. + /// The command to update the resource. + /// If the path is a URI template, parameters to use for substitution. + /// The response from updating the resource. + TResponse Update(string path, TCommand command, object pathParameters = null); /// /// Deletes the resource at the given URI from the server using a the DELETE verb. Deletes in Octopus happen diff --git a/source/Octopus.Server.Client/Model/DeploymentFreezes/ModifyDeploymentFreezeCommand.cs b/source/Octopus.Server.Client/Model/DeploymentFreezes/ModifyDeploymentFreezeCommand.cs new file mode 100644 index 000000000..d779678a0 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentFreezes/ModifyDeploymentFreezeCommand.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Octopus.Client.Model.DeploymentFreezes; + +public class ModifyDeploymentFreezeCommand +{ + [Required] public string Id { get; set; } + + [Required(ErrorMessage = "Please provide a display name.")] + [MinLength(1)] + [MaxLength(200)] + public string Name { get; set; } + + [Required(ErrorMessage = "Please provide a start time.")] + public DateTimeOffset Start { get; set; } + + [Required(ErrorMessage = "Please provide an end time.")] + public DateTimeOffset End { get; set; } + + [Required] public Dictionary ProjectEnvironmentScope { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentFreezes/ModifyDeploymentFreezeResponse.cs b/source/Octopus.Server.Client/Model/DeploymentFreezes/ModifyDeploymentFreezeResponse.cs new file mode 100644 index 000000000..381575988 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentFreezes/ModifyDeploymentFreezeResponse.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Octopus.Client.Model.DeploymentFreezes; + +public class ModifyDeploymentFreezeResponse +{ + [Required] public string Id { get; set; } + + [Required] public string Name { get; set; } + + [Required] public DateTimeOffset Start { get; set; } + + [Required] public DateTimeOffset End { get; set; } + + [Required] public Dictionary ProjectEnvironmentScope { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/OctopusAsyncClient.cs b/source/Octopus.Server.Client/OctopusAsyncClient.cs index 2d453b112..4233bb567 100644 --- a/source/Octopus.Server.Client/OctopusAsyncClient.cs +++ b/source/Octopus.Server.Client/OctopusAsyncClient.cs @@ -547,6 +547,14 @@ public async Task Update(string path, TResource resource, return result; } + + /// + public async Task Update(string path, TCommand resource, object pathParameters, CancellationToken cancellationToken) + { + var uri = QualifyUri(path, pathParameters); + var response = await DispatchRequest(new OctopusRequest("PUT", uri, requestResource: resource), true, cancellationToken).ConfigureAwait(false); + return response.ResponseResource; + } /// public async Task GetContent(string path, object pathParameters = null) diff --git a/source/Octopus.Server.Client/OctopusClient.cs b/source/Octopus.Server.Client/OctopusClient.cs index bf3356299..b3aa3752f 100644 --- a/source/Octopus.Server.Client/OctopusClient.cs +++ b/source/Octopus.Server.Client/OctopusClient.cs @@ -407,6 +407,15 @@ public TResource Update(string path, TResource resource, object pathP var getUrl = resourceSelfLinkExtractor.GetSelfUrlOrNull(response.ResponseResource) ?? path; return Get(getUrl); } + + /// + public TResponse Update(string path, TCommand command, object pathParameters = null) + { + var uri = QualifyUri(path, pathParameters); + + var response = DispatchRequest(new OctopusRequest("PUT", uri, requestResource: command), readResponse: true); + return response.ResponseResource; + } /// /// Fetches raw content from the resource at the specified path, using the GET verb. diff --git a/source/Octopus.Server.Client/Repositories/Async/DeploymentFreezeRepository.cs b/source/Octopus.Server.Client/Repositories/Async/DeploymentFreezeRepository.cs index cdb20f6bb..ae2958c13 100644 --- a/source/Octopus.Server.Client/Repositories/Async/DeploymentFreezeRepository.cs +++ b/source/Octopus.Server.Client/Repositories/Async/DeploymentFreezeRepository.cs @@ -7,6 +7,9 @@ namespace Octopus.Client.Repositories.Async; public interface IDeploymentFreezeRepository { Task Create(CreateDeploymentFreezeCommand command, CancellationToken cancellationToken); + + Task Modify(ModifyDeploymentFreezeCommand command, + CancellationToken cancellationToken); } public class DeploymentFreezeRepository(IOctopusAsyncClient client) : IDeploymentFreezeRepository @@ -18,4 +21,12 @@ public async Task Create(CreateDeploymentFreezeC var response = await client.Create(link, command, null, cancellationToken); return response; } + + public async Task Modify(ModifyDeploymentFreezeCommand command, CancellationToken cancellationToken) + { + var link = await client.Repository.Link("DeploymentFreezes"); + + var response = await client.Update(link, command, null, cancellationToken); + return response; + } } \ No newline at end of file diff --git a/source/Octopus.Server.Client/Repositories/DeploymentFreezeRepository.cs b/source/Octopus.Server.Client/Repositories/DeploymentFreezeRepository.cs index 5737b26e6..894a1b752 100644 --- a/source/Octopus.Server.Client/Repositories/DeploymentFreezeRepository.cs +++ b/source/Octopus.Server.Client/Repositories/DeploymentFreezeRepository.cs @@ -5,6 +5,7 @@ namespace Octopus.Client.Repositories; public interface IDeploymentFreezeRepository { CreateDeploymentFreezeResponse Create(CreateDeploymentFreezeCommand command); + ModifyDeploymentFreezeResponse Modify(ModifyDeploymentFreezeCommand command); } public class DeploymentFreezeRepository(IOctopusClient client) : IDeploymentFreezeRepository @@ -15,4 +16,11 @@ public CreateDeploymentFreezeResponse Create(CreateDeploymentFreezeCommand comma return client.Create(link, command); } + + public ModifyDeploymentFreezeResponse Modify(ModifyDeploymentFreezeCommand command) + { + var link = client.Repository.Link("DeploymentFreezes"); + + return client.Update(link, command); + } } \ No newline at end of file From 1b602b9879fa07a83cae330e37893cbb1bd71cd7 Mon Sep 17 00:00:00 2001 From: Shane Date: Tue, 6 Feb 2024 15:36:25 +1000 Subject: [PATCH 4/6] I Approve! --- ...AreaShouldNotRegress..NETCore.approved.txt | 26 +++++++++++++++++++ ...houldNotRegress..NETFramework.approved.txt | 26 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt index 9a2300d49..ddf1ebaa6 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt @@ -81,6 +81,7 @@ Octopus.Client Task Update(String, Octopus.Client.TResource, Object) Task Update(String, Octopus.Client.TResource, CancellationToken) Task Update(String, Octopus.Client.TResource, Object, CancellationToken) + Task Update(String, Octopus.Client.TCommand, Object, CancellationToken) } interface IOctopusAsyncRepository Octopus.Client.IOctopusSpaceAsyncRepository @@ -120,6 +121,7 @@ Octopus.Client void SignIn(Octopus.Client.Model.LoginCommand) void SignOut() Octopus.Client.TResource Update(String, Octopus.Client.TResource, Object) + Octopus.Client.TResponse Update(String, Octopus.Client.TCommand, Object) } interface IOctopusClientFactory { @@ -360,6 +362,7 @@ Octopus.Client Task Update(String, Octopus.Client.TResource, Object) Task Update(String, Octopus.Client.TResource, CancellationToken) Task Update(String, Octopus.Client.TResource, Object, CancellationToken) + Task Update(String, Octopus.Client.TCommand, Object, CancellationToken) } class OctopusAsyncRepository Octopus.Client.IOctopusAsyncRepository @@ -480,6 +483,7 @@ Octopus.Client void SignIn(Octopus.Client.Model.LoginCommand) void SignOut() Octopus.Client.TResource Update(String, Octopus.Client.TResource, Object) + Octopus.Client.TResponse Update(String, Octopus.Client.TCommand, Object) } class OctopusClientFactory Octopus.Client.IOctopusClientFactory @@ -6398,6 +6402,24 @@ Octopus.Client.Model.DeploymentFreezes { static Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.IOctopusClient, Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) } + class ModifyDeploymentFreezeCommand + { + .ctor() + DateTimeOffset End { get; set; } + String Id { get; set; } + String Name { get; set; } + Dictionary ProjectEnvironmentScope { get; set; } + DateTimeOffset Start { get; set; } + } + class ModifyDeploymentFreezeResponse + { + .ctor() + DateTimeOffset End { get; set; } + String Id { get; set; } + String Name { get; set; } + Dictionary ProjectEnvironmentScope { get; set; } + DateTimeOffset Start { get; set; } + } } Octopus.Client.Model.DeploymentProcess { @@ -7504,6 +7526,7 @@ Octopus.Client.Repositories { .ctor(Octopus.Client.IOctopusClient) Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) + Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } interface IAccountRepository Octopus.Client.Repositories.IResourceRepository @@ -7663,6 +7686,7 @@ Octopus.Client.Repositories interface IDeploymentFreezeRepository { Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) + Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } interface IDeploymentProcessRepository Octopus.Client.Repositories.IGet @@ -8240,6 +8264,7 @@ Octopus.Client.Repositories.Async { .ctor(Octopus.Client.IOctopusAsyncClient) Task Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand, CancellationToken) + Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } interface IAccountRepository Octopus.Client.Repositories.Async.IResourceRepository @@ -8404,6 +8429,7 @@ Octopus.Client.Repositories.Async interface IDeploymentFreezeRepository { Task Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand, CancellationToken) + Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } interface IDeploymentProcessRepository Octopus.Client.Repositories.Async.IGet diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt index 2d5f0a79b..4b4695735 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt @@ -81,6 +81,7 @@ Octopus.Client Task Update(String, Octopus.Client.TResource, Object) Task Update(String, Octopus.Client.TResource, CancellationToken) Task Update(String, Octopus.Client.TResource, Object, CancellationToken) + Task Update(String, Octopus.Client.TCommand, Object, CancellationToken) } interface IOctopusAsyncRepository Octopus.Client.IOctopusSpaceAsyncRepository @@ -120,6 +121,7 @@ Octopus.Client void SignIn(Octopus.Client.Model.LoginCommand) void SignOut() Octopus.Client.TResource Update(String, Octopus.Client.TResource, Object) + Octopus.Client.TResponse Update(String, Octopus.Client.TCommand, Object) } interface IOctopusClientFactory { @@ -360,6 +362,7 @@ Octopus.Client Task Update(String, Octopus.Client.TResource, Object) Task Update(String, Octopus.Client.TResource, CancellationToken) Task Update(String, Octopus.Client.TResource, Object, CancellationToken) + Task Update(String, Octopus.Client.TCommand, Object, CancellationToken) } class OctopusAsyncRepository Octopus.Client.IOctopusAsyncRepository @@ -480,6 +483,7 @@ Octopus.Client void SignIn(Octopus.Client.Model.LoginCommand) void SignOut() Octopus.Client.TResource Update(String, Octopus.Client.TResource, Object) + Octopus.Client.TResponse Update(String, Octopus.Client.TCommand, Object) } class OctopusClientFactory Octopus.Client.IOctopusClientFactory @@ -6422,6 +6426,24 @@ Octopus.Client.Model.DeploymentFreezes { static Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.IOctopusClient, Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) } + class ModifyDeploymentFreezeCommand + { + .ctor() + DateTimeOffset End { get; set; } + String Id { get; set; } + String Name { get; set; } + Dictionary ProjectEnvironmentScope { get; set; } + DateTimeOffset Start { get; set; } + } + class ModifyDeploymentFreezeResponse + { + .ctor() + DateTimeOffset End { get; set; } + String Id { get; set; } + String Name { get; set; } + Dictionary ProjectEnvironmentScope { get; set; } + DateTimeOffset Start { get; set; } + } } Octopus.Client.Model.DeploymentProcess { @@ -7529,6 +7551,7 @@ Octopus.Client.Repositories { .ctor(Octopus.Client.IOctopusClient) Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) + Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } interface IAccountRepository Octopus.Client.Repositories.IResourceRepository @@ -7688,6 +7711,7 @@ Octopus.Client.Repositories interface IDeploymentFreezeRepository { Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) + Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } interface IDeploymentProcessRepository Octopus.Client.Repositories.IGet @@ -8265,6 +8289,7 @@ Octopus.Client.Repositories.Async { .ctor(Octopus.Client.IOctopusAsyncClient) Task Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand, CancellationToken) + Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } interface IAccountRepository Octopus.Client.Repositories.Async.IResourceRepository @@ -8429,6 +8454,7 @@ Octopus.Client.Repositories.Async interface IDeploymentFreezeRepository { Task Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand, CancellationToken) + Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } interface IDeploymentProcessRepository Octopus.Client.Repositories.Async.IGet From e69b4a81ffd30e638bdb1b2c4479ccfe5e810b04 Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 7 Feb 2024 08:59:42 +1000 Subject: [PATCH 5/6] Undo reformatting --- .../Octopus.Server.Client/Model/Permission.cs | 396 +++++------------- 1 file changed, 114 insertions(+), 282 deletions(-) diff --git a/source/Octopus.Server.Client/Model/Permission.cs b/source/Octopus.Server.Client/Model/Permission.cs index 8bcc198a2..e4227e854 100644 --- a/source/Octopus.Server.Client/Model/Permission.cs +++ b/source/Octopus.Server.Client/Model/Permission.cs @@ -15,161 +15,89 @@ namespace Octopus.Client.Model [TypeConverter(typeof(PermissionTypeConverter))] public class Permission : IEquatable { - [Description( - "Perform system-level functions like configuring HTTP web hosting, the public URL, server nodes, maintenance mode, and server diagnostics")] - public static readonly Permission AdministerSystem = new Permission("AdministerSystem"); + [Description("Perform system-level functions like configuring HTTP web hosting, the public URL, server nodes, maintenance mode, and server diagnostics")]public static readonly Permission AdministerSystem = new Permission("AdministerSystem"); - [Description("Edit project details")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] - public static readonly Permission ProjectEdit = new Permission("ProjectEdit"); + [Description("Edit project details")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ProjectEdit = new Permission("ProjectEdit"); - [Description("View the details of projects")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] - public static readonly Permission ProjectView = new Permission("ProjectView"); + [Description("View the details of projects")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ProjectView = new Permission("ProjectView"); - [Description("Create projects")] [SupportsRestriction(PermissionScope.ProjectGroups)] - public static readonly Permission ProjectCreate = new Permission("ProjectCreate"); + [Description("Create projects")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectCreate = new Permission("ProjectCreate"); - [Description("Delete projects")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] - public static readonly Permission ProjectDelete = new Permission("ProjectDelete"); + [Description("Delete projects")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ProjectDelete = new Permission("ProjectDelete"); - [Description("View the deployment process and channels associated with a project")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission ProcessView = new Permission("ProcessView"); + [Description("View the deployment process and channels associated with a project")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission ProcessView = new Permission("ProcessView"); - [Description("Edit the deployment process and channels associated with a project")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission ProcessEdit = new Permission("ProcessEdit"); + [Description("Edit the deployment process and channels associated with a project")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission ProcessEdit = new Permission("ProcessEdit"); - [Description("Edit variables belonging to a project")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments)] - public static readonly Permission VariableEdit = new Permission("VariableEdit"); + [Description("Edit variables belonging to a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments)] public static readonly Permission VariableEdit = new Permission("VariableEdit"); - [Description("Edit non-environment scoped variables belonging to a project or library variable set")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission VariableEditUnscoped = new Permission("VariableEditUnscoped"); + [Description("Edit non-environment scoped variables belonging to a project or library variable set")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission VariableEditUnscoped = new Permission("VariableEditUnscoped"); - [Description("View variables belonging to a project or library variable set")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments)] - public static readonly Permission VariableView = new Permission("VariableView"); + [Description("View variables belonging to a project or library variable set")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments)] public static readonly Permission VariableView = new Permission("VariableView"); - [Description("View non-environment scoped variables belonging to a project or library variable set")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission VariableViewUnscoped = new Permission("VariableViewUnscoped"); + [Description("View non-environment scoped variables belonging to a project or library variable set")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission VariableViewUnscoped = new Permission("VariableViewUnscoped"); - [Description("Create a release for a project")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] - public static readonly Permission ReleaseCreate = new Permission("ReleaseCreate"); + [Description("Create a release for a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ReleaseCreate = new Permission("ReleaseCreate"); - [Description("View a release of a project")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] - public static readonly Permission ReleaseView = new Permission("ReleaseView"); + [Description("View a release of a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ReleaseView = new Permission("ReleaseView"); - [Description("Edit a release of a project")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] - public static readonly Permission ReleaseEdit = new Permission("ReleaseEdit"); + [Description("Edit a release of a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ReleaseEdit = new Permission("ReleaseEdit"); - [Description("Delete a release of a project")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] - public static readonly Permission ReleaseDelete = new Permission("ReleaseDelete"); + [Description("Delete a release of a project")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Tenants)] public static readonly Permission ReleaseDelete = new Permission("ReleaseDelete"); - [Description("Block a release from progressing to the next lifecycle phase")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission DefectReport = new Permission("DefectReport"); + [Description("Block a release from progressing to the next lifecycle phase")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission DefectReport = new Permission("DefectReport"); - [Description("Unblock a release so it can progress to the next phase")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission DefectResolve = new Permission("DefectResolve"); + [Description("Unblock a release so it can progress to the next phase")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission DefectResolve = new Permission("DefectResolve"); - [Description("Deploy releases to target environments")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission DeploymentCreate = new Permission("DeploymentCreate"); + [Description("Deploy releases to target environments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission DeploymentCreate = new Permission("DeploymentCreate"); - [Description("Delete deployments")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission DeploymentDelete = new Permission("DeploymentDelete"); + [Description("Delete deployments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission DeploymentDelete = new Permission("DeploymentDelete"); - [Description("View deployments")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission DeploymentView = new Permission("DeploymentView"); + [Description("View deployments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission DeploymentView = new Permission("DeploymentView"); - [Description("View environments")] [SupportsRestriction(PermissionScope.Environments)] - public static readonly Permission EnvironmentView = new Permission("EnvironmentView"); + [Description("View environments")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission EnvironmentView = new Permission("EnvironmentView"); - [Description("Create environments")] [SupportsRestriction(PermissionScope.Environments)] - public static readonly Permission EnvironmentCreate = new Permission("EnvironmentCreate"); + [Description("Create environments")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission EnvironmentCreate = new Permission("EnvironmentCreate"); - [Description("Edit environments")] [SupportsRestriction(PermissionScope.Environments)] - public static readonly Permission EnvironmentEdit = new Permission("EnvironmentEdit"); + [Description("Edit environments")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission EnvironmentEdit = new Permission("EnvironmentEdit"); - [Description("Delete environments")] [SupportsRestriction(PermissionScope.Environments)] - public static readonly Permission EnvironmentDelete = new Permission("EnvironmentDelete"); + [Description("Delete environments")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission EnvironmentDelete = new Permission("EnvironmentDelete"); - [Description("Create machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission MachineCreate = new Permission("MachineCreate"); + [Description("Create machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission MachineCreate = new Permission("MachineCreate"); - [Description("Edit machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission MachineEdit = new Permission("MachineEdit"); + [Description("Edit machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission MachineEdit = new Permission("MachineEdit"); - [Description("View machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission MachineView = new Permission("MachineView"); + [Description("View machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission MachineView = new Permission("MachineView"); - [Description("Delete machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission MachineDelete = new Permission("MachineDelete"); + [Description("Delete machines")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission MachineDelete = new Permission("MachineDelete"); - [Description("View the artifacts created manually and during deployment")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission ArtifactView = new Permission("ArtifactView"); + [Description("View the artifacts created manually and during deployment")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission ArtifactView = new Permission("ArtifactView"); - [Description("Manually create artifacts")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission ArtifactCreate = new Permission("ArtifactCreate"); + [Description("Manually create artifacts")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission ArtifactCreate = new Permission("ArtifactCreate"); - [Description("Edit the details describing artifacts")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission ArtifactEdit = new Permission("ArtifactEdit"); + [Description("Edit the details describing artifacts")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission ArtifactEdit = new Permission("ArtifactEdit"); - [Description("Delete artifacts")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission ArtifactDelete = new Permission("ArtifactDelete"); + [Description("Delete artifacts")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission ArtifactDelete = new Permission("ArtifactDelete"); - [Description("View package feeds and the packages in them")] - public static readonly Permission FeedView = new Permission("FeedView"); + [Description("View package feeds and the packages in them")] public static readonly Permission FeedView = new Permission("FeedView"); - [Description("View release and deployment events")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission EventView = new Permission("EventView"); + [Description("View release and deployment events")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission EventView = new Permission("EventView"); - [Description("View library variable sets")] - public static readonly Permission LibraryVariableSetView = new Permission("LibraryVariableSetView"); + [Description("View library variable sets")] public static readonly Permission LibraryVariableSetView = new Permission("LibraryVariableSetView"); - [Description("Create library variable sets")] - public static readonly Permission LibraryVariableSetCreate = new Permission("LibraryVariableSetCreate"); + [Description("Create library variable sets")] public static readonly Permission LibraryVariableSetCreate = new Permission("LibraryVariableSetCreate"); - [Description("Edit library variable sets")] - public static readonly Permission LibraryVariableSetEdit = new Permission("LibraryVariableSetEdit"); + [Description("Edit library variable sets")] public static readonly Permission LibraryVariableSetEdit = new Permission("LibraryVariableSetEdit"); - [Description("Delete library variable sets")] - public static readonly Permission LibraryVariableSetDelete = new Permission("LibraryVariableSetDelete"); + [Description("Delete library variable sets")] public static readonly Permission LibraryVariableSetDelete = new Permission("LibraryVariableSetDelete"); - [Description("View project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] - public static readonly Permission ProjectGroupView = new Permission("ProjectGroupView"); + [Description("View project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectGroupView = new Permission("ProjectGroupView"); - [Description("Create project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] - public static readonly Permission ProjectGroupCreate = new Permission("ProjectGroupCreate"); + [Description("Create project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectGroupCreate = new Permission("ProjectGroupCreate"); - [Description("Edit project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] - public static readonly Permission ProjectGroupEdit = new Permission("ProjectGroupEdit"); + [Description("Edit project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectGroupEdit = new Permission("ProjectGroupEdit"); - [Description("Delete project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] - public static readonly Permission ProjectGroupDelete = new Permission("ProjectGroupDelete"); + [Description("Delete project groups")] [SupportsRestriction(PermissionScope.ProjectGroups)] public static readonly Permission ProjectGroupDelete = new Permission("ProjectGroupDelete"); [Description("Create teams")] public static readonly Permission TeamCreate = new Permission("TeamCreate"); @@ -181,139 +109,84 @@ public class Permission : IEquatable [Description("View users")] public static readonly Permission UserView = new Permission("UserView"); - [Description("Invite users to register accounts")] - public static readonly Permission UserInvite = new Permission("UserInvite"); + [Description("Invite users to register accounts")] public static readonly Permission UserInvite = new Permission("UserInvite"); - [Description("View other user's roles")] - public static readonly Permission UserRoleView = new Permission("UserRoleView"); + [Description("View other user's roles")] public static readonly Permission UserRoleView = new Permission("UserRoleView"); - [Description("Edit user role definitions")] - public static readonly Permission UserRoleEdit = new Permission("UserRoleEdit"); + [Description("Edit user role definitions")] public static readonly Permission UserRoleEdit = new Permission("UserRoleEdit"); - [Description("View summary-level information associated with a task")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission TaskView = new Permission("TaskView"); + [Description("View summary-level information associated with a task")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskView = new Permission("TaskView"); - [Obsolete( - "TaskViewLog is no longer supported by Octopus Server. Instead use the TaskView permission, which also grants access to Task logs", - false)] - [Description("View detailed information about the execution of a task, including the task log output")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission TaskViewLog = new Permission("TaskViewLog"); + [Obsolete("TaskViewLog is no longer supported by Octopus Server. Instead use the TaskView permission, which also grants access to Task logs", false)] + [Description("View detailed information about the execution of a task, including the task log output")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskViewLog = new Permission("TaskViewLog"); - [Description("Explicitly create (run) server tasks")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission TaskCreate = new Permission("TaskCreate"); + [Description("Explicitly create (run) server tasks")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskCreate = new Permission("TaskCreate"); - [Description("Cancel server tasks")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission TaskCancel = new Permission("TaskCancel"); + [Description("Cancel server tasks")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskCancel = new Permission("TaskCancel"); - [Description("Edit server tasks")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission TaskEdit = new Permission("TaskEdit"); + [Description("Edit server tasks")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission TaskEdit = new Permission("TaskEdit"); - [Description("View interruptions generated during deployments")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission InterruptionView = new Permission("InterruptionView"); + [Description("View interruptions generated during deployments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission InterruptionView = new Permission("InterruptionView"); - [Description("Take responsibility for and submit interruptions generated during deployments")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission InterruptionSubmit = new Permission("InterruptionSubmit"); + [Description("Take responsibility for and submit interruptions generated during deployments")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission InterruptionSubmit = new Permission("InterruptionSubmit"); - [Description( - "Take responsibility for and submit interruptions generated during deployments when the user is in a designated responsible team")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission InterruptionViewSubmitResponsible = - new Permission("InterruptionViewSubmitResponsible"); + [Description("Take responsibility for and submit interruptions generated during deployments when the user is in a designated responsible team")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission InterruptionViewSubmitResponsible = new Permission("InterruptionViewSubmitResponsible"); - [Description("Push new packages to the built-in package repository")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission BuiltInFeedPush = new Permission("BuiltInFeedPush"); + [Description("Push new packages to the built-in package repository")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission BuiltInFeedPush = new Permission("BuiltInFeedPush"); - [Description("Replace or delete packages in the built-in package repository")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission BuiltInFeedAdminister = new Permission("BuiltInFeedAdminister"); + [Description("Replace or delete packages in the built-in package repository")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission BuiltInFeedAdminister = new Permission("BuiltInFeedAdminister"); - [Description("Retrieve the contents of packages in the built-in package repository")] - [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission BuiltInFeedDownload = new Permission("BuiltInFeedDownload"); + [Description("Retrieve the contents of packages in the built-in package repository")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission BuiltInFeedDownload = new Permission("BuiltInFeedDownload"); - [Description("View step templates")] - public static readonly Permission ActionTemplateView = new Permission("ActionTemplateView"); + [Description("View step templates")] public static readonly Permission ActionTemplateView = new Permission("ActionTemplateView"); - [Description("Create step templates")] - public static readonly Permission ActionTemplateCreate = new Permission("ActionTemplateCreate"); + [Description("Create step templates")] public static readonly Permission ActionTemplateCreate = new Permission("ActionTemplateCreate"); - [Description("Edit step templates")] - public static readonly Permission ActionTemplateEdit = new Permission("ActionTemplateEdit"); + [Description("Edit step templates")] public static readonly Permission ActionTemplateEdit = new Permission("ActionTemplateEdit"); - [Description("Delete step templates")] - public static readonly Permission ActionTemplateDelete = new Permission("ActionTemplateDelete"); + [Description("Delete step templates")] public static readonly Permission ActionTemplateDelete = new Permission("ActionTemplateDelete"); - [Description("Create lifecycles")] - public static readonly Permission LifecycleCreate = new Permission("LifecycleCreate"); + [Description("Create lifecycles")] public static readonly Permission LifecycleCreate = new Permission("LifecycleCreate"); - [Description("View lifecycles")] - public static readonly Permission LifecycleView = new Permission("LifecycleView"); + [Description("View lifecycles")] public static readonly Permission LifecycleView = new Permission("LifecycleView"); - [Description("Edit lifecycles")] - public static readonly Permission LifecycleEdit = new Permission("LifecycleEdit"); + [Description("Edit lifecycles")] public static readonly Permission LifecycleEdit = new Permission("LifecycleEdit"); - [Description("Delete lifecycles")] - public static readonly Permission LifecycleDelete = new Permission("LifecycleDelete"); + [Description("Delete lifecycles")] public static readonly Permission LifecycleDelete = new Permission("LifecycleDelete"); - [Description("View accounts")] [SupportsRestriction(PermissionScope.Environments)] - public static readonly Permission AccountView = new Permission("AccountView"); + [Description("View accounts")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission AccountView = new Permission("AccountView"); - [Description("Edit accounts")] [SupportsRestriction(PermissionScope.Environments)] - public static readonly Permission AccountEdit = new Permission("AccountEdit"); + [Description("Edit accounts")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission AccountEdit = new Permission("AccountEdit"); - [Description("Create accounts")] [SupportsRestriction(PermissionScope.Environments)] - public static readonly Permission AccountCreate = new Permission("AccountCreate"); + [Description("Create accounts")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission AccountCreate = new Permission("AccountCreate"); - [Description("Delete accounts")] [SupportsRestriction(PermissionScope.Environments)] - public static readonly Permission AccountDelete = new Permission("AccountDelete"); + [Description("Delete accounts")] [SupportsRestriction(PermissionScope.Environments)] public static readonly Permission AccountDelete = new Permission("AccountDelete"); - [Description("Create tenants")] [SupportsRestriction(PermissionScope.Tenants)] - public static readonly Permission TenantCreate = new Permission("TenantCreate"); + [Description("Create tenants")] [SupportsRestriction(PermissionScope.Tenants)] public static readonly Permission TenantCreate = new Permission("TenantCreate"); - [Description("Edit tenants")] [SupportsRestriction(PermissionScope.Tenants)] - public static readonly Permission TenantEdit = new Permission("TenantEdit"); + [Description("Edit tenants")] [SupportsRestriction(PermissionScope.Tenants)] public static readonly Permission TenantEdit = new Permission("TenantEdit"); - [Description("View tenants")] [SupportsRestriction(PermissionScope.Tenants)] - public static readonly Permission TenantView = new Permission("TenantView"); + [Description("View tenants")] [SupportsRestriction(PermissionScope.Tenants)] public static readonly Permission TenantView = new Permission("TenantView"); - [Description("Delete tenants")] [SupportsRestriction(PermissionScope.Tenants)] - public static readonly Permission TenantDelete = new Permission("TenantDelete"); + [Description("Delete tenants")] [SupportsRestriction(PermissionScope.Tenants)] public static readonly Permission TenantDelete = new Permission("TenantDelete"); - [Description("Create tag sets")] - public static readonly Permission TagSetCreate = new Permission("TagSetCreate"); + [Description("Create tag sets")] public static readonly Permission TagSetCreate = new Permission("TagSetCreate"); [Description("Edit tag sets")] public static readonly Permission TagSetEdit = new Permission("TagSetEdit"); - [Description("Delete tag sets")] - public static readonly Permission TagSetDelete = new Permission("TagSetDelete"); + [Description("Delete tag sets")] public static readonly Permission TagSetDelete = new Permission("TagSetDelete"); - [Description("View telemetry data")] - public static readonly Permission TelemetryView = new Permission("TelemetryView"); + [Description("View telemetry data")] public static readonly Permission TelemetryView = new Permission("TelemetryView"); - [Description("Create health check policies")] - public static readonly Permission MachinePolicyCreate = new Permission("MachinePolicyCreate"); + [Description("Create health check policies")] public static readonly Permission MachinePolicyCreate = new Permission("MachinePolicyCreate"); - [Description("View health check policies")] - public static readonly Permission MachinePolicyView = new Permission("MachinePolicyView"); + [Description("View health check policies")] public static readonly Permission MachinePolicyView = new Permission("MachinePolicyView"); - [Description("Edit health check policies")] - public static readonly Permission MachinePolicyEdit = new Permission("MachinePolicyEdit"); + [Description("Edit health check policies")] public static readonly Permission MachinePolicyEdit = new Permission("MachinePolicyEdit"); - [Description("Delete health check policies")] - public static readonly Permission MachinePolicyDelete = new Permission("MachinePolicyDelete"); + [Description("Delete health check policies")] public static readonly Permission MachinePolicyDelete = new Permission("MachinePolicyDelete"); [Description("Create proxies")] public static readonly Permission ProxyCreate = new Permission("ProxyCreate"); @@ -323,59 +196,41 @@ public class Permission : IEquatable [Description("Delete proxies")] public static readonly Permission ProxyDelete = new Permission("ProxyDelete"); - [Description("Create subscriptions")] - public static readonly Permission SubscriptionCreate = new Permission("SubscriptionCreate"); + [Description("Create subscriptions")] public static readonly Permission SubscriptionCreate = new Permission("SubscriptionCreate"); - [Description("View subscriptions")] - public static readonly Permission SubscriptionView = new Permission("SubscriptionView"); + [Description("View subscriptions")] public static readonly Permission SubscriptionView = new Permission("SubscriptionView"); - [Description("Edit subscriptions")] - public static readonly Permission SubscriptionEdit = new Permission("SubscriptionEdit"); + [Description("Edit subscriptions")] public static readonly Permission SubscriptionEdit = new Permission("SubscriptionEdit"); - [Description("Delete subscriptions")] - public static readonly Permission SubscriptionDelete = new Permission("SubscriptionDelete"); + [Description("Delete subscriptions")] public static readonly Permission SubscriptionDelete = new Permission("SubscriptionDelete"); - [Description("Create triggers")] [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission TriggerCreate = new Permission("TriggerCreate"); + [Description("Create triggers")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission TriggerCreate = new Permission("TriggerCreate"); - [Description("View triggers")] [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission TriggerView = new Permission("TriggerView"); + [Description("View triggers")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission TriggerView = new Permission("TriggerView"); - [Description("Edit triggers")] [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission TriggerEdit = new Permission("TriggerEdit"); + [Description("Edit triggers")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission TriggerEdit = new Permission("TriggerEdit"); - [Description("Delete triggers")] [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission TriggerDelete = new Permission("TriggerDelete"); + [Description("Delete triggers")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission TriggerDelete = new Permission("TriggerDelete"); - [Description("View certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission CertificateView = new Permission("CertificateView"); + [Description("View certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission CertificateView = new Permission("CertificateView"); - [Description("Create certificates")] - public static readonly Permission CertificateCreate = new Permission("CertificateCreate"); + [Description("Create certificates")] public static readonly Permission CertificateCreate = new Permission("CertificateCreate"); - [Description("Edit certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission CertificateEdit = new Permission("CertificateEdit"); + [Description("Edit certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission CertificateEdit = new Permission("CertificateEdit"); - [Description("Delete certificates")] - [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission CertificateDelete = new Permission("CertificateDelete"); + [Description("Delete certificates")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission CertificateDelete = new Permission("CertificateDelete"); - [Description("Export certificate private-keys")] - [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] - public static readonly Permission CertificateExportPrivateKey = new Permission("CertificateExportPrivateKey"); + [Description("Export certificate private-keys")] [SupportsRestriction(PermissionScope.Environments, PermissionScope.Tenants)] public static readonly Permission CertificateExportPrivateKey = new Permission("CertificateExportPrivateKey"); [Description("Edit users")] public static readonly Permission UserEdit = new Permission("UserEdit"); - [Description("Configure server settings like Authentication, SMTP, and HTTP Security Headers")] - public static readonly Permission ConfigureServer = new Permission("ConfigureServer"); + [Description("Configure server settings like Authentication, SMTP, and HTTP Security Headers")] public static readonly Permission ConfigureServer = new Permission("ConfigureServer"); [Description("Edit feeds")] public static readonly Permission FeedEdit = new Permission("FeedEdit"); - [Description("View the workers in worker pools")] - public static readonly Permission WorkerView = new Permission("WorkerView"); + [Description("View the workers in worker pools")] public static readonly Permission WorkerView = new Permission("WorkerView"); - [Description("Edit workers and worker pools")] - public static readonly Permission WorkerEdit = new Permission("WorkerEdit"); + [Description("Edit workers and worker pools")] public static readonly Permission WorkerEdit = new Permission("WorkerEdit"); [Description("Edit spaces")] public static readonly Permission SpaceEdit = new Permission("SpaceEdit"); @@ -385,61 +240,38 @@ public class Permission : IEquatable [Description("Create spaces")] public static readonly Permission SpaceCreate = new Permission("SpaceCreate"); - [Description("Create/update build information")] - public static readonly Permission BuildInformationPush = new Permission("BuildInformationPush"); + [Description("Create/update build information")] public static readonly Permission BuildInformationPush = new Permission("BuildInformationPush"); - [Description("Replace or delete build information")] - public static readonly Permission BuildInformationAdminister = new Permission("BuildInformationAdminister"); + [Description("Replace or delete build information")] public static readonly Permission BuildInformationAdminister = new Permission("BuildInformationAdminister"); - [Description("View runbooks")] [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission RunbookView = new Permission("RunbookView"); + [Description("View runbooks")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission RunbookView = new Permission("RunbookView"); - [Description("Edit runbooks")] [SupportsRestriction(PermissionScope.Projects)] - public static readonly Permission RunbookEdit = new Permission("RunbookEdit"); + [Description("Edit runbooks")] [SupportsRestriction(PermissionScope.Projects)] public static readonly Permission RunbookEdit = new Permission("RunbookEdit"); - [Description("View runbook runs")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission RunbookRunView = new Permission("RunbookRunView"); + [Description("View runbook runs")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission RunbookRunView = new Permission("RunbookRunView"); - [Description("Delete runbook runs")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission RunbookRunDelete = new Permission("RunbookRunDelete"); + [Description("Delete runbook runs")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission RunbookRunDelete = new Permission("RunbookRunDelete"); - [Description("Create runbook runs")] - [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, - ExplicitTenantScopeRequired = true)] - public static readonly Permission RunbookRunCreate = new Permission("RunbookRunCreate"); + [Description("Create runbook runs")] [SupportsRestriction(PermissionScope.Projects, PermissionScope.Environments, PermissionScope.Tenants, ExplicitTenantScopeRequired = true)] public static readonly Permission RunbookRunCreate = new Permission("RunbookRunCreate"); - [Description("View Git credentials")] - public static readonly Permission GitCredentialView = new Permission("GitCredentialView"); + [Description("View Git credentials")] public static readonly Permission GitCredentialView = new Permission("GitCredentialView"); - [Description("Edit Git credentials")] - public static readonly Permission GitCredentialEdit = new Permission("GitCredentialEdit"); + [Description("Edit Git credentials")] public static readonly Permission GitCredentialEdit = new Permission("GitCredentialEdit"); - [Description("Delete archived event files")] - public static readonly Permission EventRetentionDelete = new Permission("EventRetentionDelete"); + [Description("Delete archived event files")] public static readonly Permission EventRetentionDelete = new Permission("EventRetentionDelete"); + + [Description("View/list archived event files")] public static readonly Permission EventRetentionView = new Permission("EventRetentionView"); - [Description("View/list archived event files")] - public static readonly Permission EventRetentionView = new Permission("EventRetentionView"); + [Description("View Insights reports")] public static readonly Permission InsightsReportView = new ("InsightsReportView"); - [Description("View Insights reports")] - public static readonly Permission InsightsReportView = new("InsightsReportView"); + [Description("Create Insights reports")] public static readonly Permission InsightsReportCreate = new("InsightsReportCreate"); - [Description("Create Insights reports")] - public static readonly Permission InsightsReportCreate = new("InsightsReportCreate"); + [Description("Edit Insights reports")] public static readonly Permission InsightsReportEdit = new("InsightsReportEdit"); - [Description("Edit Insights reports")] - public static readonly Permission InsightsReportEdit = new("InsightsReportEdit"); + [Description("Delete Insights reports")] public static readonly Permission InsightsReportDelete = new("InsightsReportDelete"); - [Description("Delete Insights reports")] - public static readonly Permission InsightsReportDelete = new("InsightsReportDelete"); - - [Description("Administer deployment freezes")] - public static readonly Permission DeploymentFreezeAdminister = new("DeploymentFreezeAdminister"); - - public Permission(string id) + [Description("Create, update, delete and override deployment freezes")] public static readonly Permission DeploymentFreezeAdminister = new("DeploymentFreezeAdminister"); + public Permission(string id) { Id = id; } From 075089a945ab3f821ac2f7fed5ca8da7c9815af3 Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 7 Feb 2024 10:31:32 +1000 Subject: [PATCH 6/6] Implement delete --- ...AreaShouldNotRegress..NETCore.approved.txt | 17 ++++++++++++++ ...houldNotRegress..NETFramework.approved.txt | 17 ++++++++++++++ .../IOctopusAsyncClient.cs | 22 +++++++++++++++++++ .../Octopus.Server.Client/IOctopusClient.cs | 19 ++++++++++++++++ .../DeleteDeploymentFreezeCommand.cs | 8 +++++++ .../DeleteDeploymentFreezeResponse.cs | 6 +++++ .../OctopusAsyncClient.cs | 8 +++++++ source/Octopus.Server.Client/OctopusClient.cs | 9 ++++++++ .../Async/DeploymentFreezeRepository.cs | 14 ++++++++++-- .../DeploymentFreezeRepository.cs | 8 +++++++ 10 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 source/Octopus.Server.Client/Model/DeploymentFreezes/DeleteDeploymentFreezeCommand.cs create mode 100644 source/Octopus.Server.Client/Model/DeploymentFreezes/DeleteDeploymentFreezeResponse.cs diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt index ddf1ebaa6..a1f794792 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt @@ -37,6 +37,7 @@ Octopus.Client Task Delete(String, Object, Object) Task Delete(String, CancellationToken) Task Delete(String, Object, Object, CancellationToken) + Task Delete(String, Octopus.Client.TCommand, CancellationToken) Task Do(Octopus.Server.MessageContracts.Base.ICommand, CancellationToken) Octopus.Client.IOctopusSpaceAsyncRepository ForSpace(Octopus.Client.Model.SpaceResource) Octopus.Client.IOctopusSystemAsyncRepository ForSystem() @@ -100,6 +101,7 @@ Octopus.Client Octopus.Client.TResource Create(String, Octopus.Client.TResource, Object) Octopus.Client.TResponse Create(String, Octopus.Client.TCommand, Object) void Delete(String, Object, Object) + Octopus.Client.TResponse Delete(String, Octopus.Client.TCommand, Object) Octopus.Client.TResponse Do(Octopus.Server.MessageContracts.Base.ICommand, CancellationToken) Octopus.Client.IOctopusSpaceRepository ForSpace(Octopus.Client.Model.SpaceResource) Octopus.Client.IOctopusSystemRepository ForSystem() @@ -317,6 +319,7 @@ Octopus.Client Task Delete(String, Object, Object) Task Delete(String, CancellationToken) Task Delete(String, Object, Object, CancellationToken) + Task Delete(String, Octopus.Client.TCommand, CancellationToken) void Dispose() Task Do(Octopus.Server.MessageContracts.Base.ICommand, CancellationToken) Octopus.Client.IOctopusSpaceAsyncRepository ForSpace(Octopus.Client.Model.SpaceResource) @@ -460,6 +463,7 @@ Octopus.Client Octopus.Client.TResource Create(String, Octopus.Client.TResource, Object) Octopus.Client.TResponse Create(String, Octopus.Client.TCommand, Object) void Delete(String, Object, Object) + Octopus.Client.TResponse Delete(String, Octopus.Client.TCommand, Object) void Dispose() Octopus.Client.TResponse Do(Octopus.Server.MessageContracts.Base.ICommand, CancellationToken) Octopus.Client.IOctopusSpaceRepository ForSpace(Octopus.Client.Model.SpaceResource) @@ -6398,6 +6402,15 @@ Octopus.Client.Model.DeploymentFreezes Dictionary ProjectEnvironmentScope { get; set; } DateTimeOffset Start { get; set; } } + class DeleteDeploymentFreezeCommand + { + .ctor() + String Id { get; set; } + } + class DeleteDeploymentFreezeResponse + { + .ctor() + } abstract class DeploymentFreezeClientExtensions { static Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.IOctopusClient, Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) @@ -7526,6 +7539,7 @@ Octopus.Client.Repositories { .ctor(Octopus.Client.IOctopusClient) Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) + Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeResponse Delete(Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeCommand) Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } interface IAccountRepository @@ -7686,6 +7700,7 @@ Octopus.Client.Repositories interface IDeploymentFreezeRepository { Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) + Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeResponse Delete(Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeCommand) Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } interface IDeploymentProcessRepository @@ -8264,6 +8279,7 @@ Octopus.Client.Repositories.Async { .ctor(Octopus.Client.IOctopusAsyncClient) Task Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand, CancellationToken) + Task Delete(Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeCommand, CancellationToken) Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } interface IAccountRepository @@ -8429,6 +8445,7 @@ Octopus.Client.Repositories.Async interface IDeploymentFreezeRepository { Task Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand, CancellationToken) + Task Delete(Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeCommand, CancellationToken) Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } interface IDeploymentProcessRepository diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt index 4b4695735..6d52f3fe7 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt @@ -37,6 +37,7 @@ Octopus.Client Task Delete(String, Object, Object) Task Delete(String, CancellationToken) Task Delete(String, Object, Object, CancellationToken) + Task Delete(String, Octopus.Client.TCommand, CancellationToken) Task Do(Octopus.Server.MessageContracts.Base.ICommand, CancellationToken) Octopus.Client.IOctopusSpaceAsyncRepository ForSpace(Octopus.Client.Model.SpaceResource) Octopus.Client.IOctopusSystemAsyncRepository ForSystem() @@ -100,6 +101,7 @@ Octopus.Client Octopus.Client.TResource Create(String, Octopus.Client.TResource, Object) Octopus.Client.TResponse Create(String, Octopus.Client.TCommand, Object) void Delete(String, Object, Object) + Octopus.Client.TResponse Delete(String, Octopus.Client.TCommand, Object) Octopus.Client.TResponse Do(Octopus.Server.MessageContracts.Base.ICommand, CancellationToken) Octopus.Client.IOctopusSpaceRepository ForSpace(Octopus.Client.Model.SpaceResource) Octopus.Client.IOctopusSystemRepository ForSystem() @@ -317,6 +319,7 @@ Octopus.Client Task Delete(String, Object, Object) Task Delete(String, CancellationToken) Task Delete(String, Object, Object, CancellationToken) + Task Delete(String, Octopus.Client.TCommand, CancellationToken) void Dispose() Task Do(Octopus.Server.MessageContracts.Base.ICommand, CancellationToken) Octopus.Client.IOctopusSpaceAsyncRepository ForSpace(Octopus.Client.Model.SpaceResource) @@ -460,6 +463,7 @@ Octopus.Client Octopus.Client.TResource Create(String, Octopus.Client.TResource, Object) Octopus.Client.TResponse Create(String, Octopus.Client.TCommand, Object) void Delete(String, Object, Object) + Octopus.Client.TResponse Delete(String, Octopus.Client.TCommand, Object) void Dispose() Octopus.Client.TResponse Do(Octopus.Server.MessageContracts.Base.ICommand, CancellationToken) Octopus.Client.IOctopusSpaceRepository ForSpace(Octopus.Client.Model.SpaceResource) @@ -6422,6 +6426,15 @@ Octopus.Client.Model.DeploymentFreezes Dictionary ProjectEnvironmentScope { get; set; } DateTimeOffset Start { get; set; } } + class DeleteDeploymentFreezeCommand + { + .ctor() + String Id { get; set; } + } + class DeleteDeploymentFreezeResponse + { + .ctor() + } abstract class DeploymentFreezeClientExtensions { static Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.IOctopusClient, Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) @@ -7551,6 +7564,7 @@ Octopus.Client.Repositories { .ctor(Octopus.Client.IOctopusClient) Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) + Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeResponse Delete(Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeCommand) Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } interface IAccountRepository @@ -7711,6 +7725,7 @@ Octopus.Client.Repositories interface IDeploymentFreezeRepository { Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeResponse Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand) + Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeResponse Delete(Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeCommand) Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } interface IDeploymentProcessRepository @@ -8289,6 +8304,7 @@ Octopus.Client.Repositories.Async { .ctor(Octopus.Client.IOctopusAsyncClient) Task Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand, CancellationToken) + Task Delete(Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeCommand, CancellationToken) Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } interface IAccountRepository @@ -8454,6 +8470,7 @@ Octopus.Client.Repositories.Async interface IDeploymentFreezeRepository { Task Create(Octopus.Client.Model.DeploymentFreezes.CreateDeploymentFreezeCommand, CancellationToken) + Task Delete(Octopus.Client.Model.DeploymentFreezes.DeleteDeploymentFreezeCommand, CancellationToken) Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } interface IDeploymentProcessRepository diff --git a/source/Octopus.Server.Client/IOctopusAsyncClient.cs b/source/Octopus.Server.Client/IOctopusAsyncClient.cs index cc3fe8c50..3a1d7e2c6 100644 --- a/source/Octopus.Server.Client/IOctopusAsyncClient.cs +++ b/source/Octopus.Server.Client/IOctopusAsyncClient.cs @@ -816,6 +816,28 @@ Task Create(string path, TCommand command, objec /// A task resource that provides details about the background task that deletes the specified resource. Task Delete(string path, object pathParameters, object resource, CancellationToken cancellationToken); + /// + /// Deletes the resource at the given URI from the server using a the DELETE verb. Deletes in Octopus happen + /// asynchronously via a background task + /// that is executed by the Octopus Server. The payload returned by delete will be the task that was created on the + /// server. + /// + /// + /// HTTP 401 or 403: Thrown when the current user's API key was not valid, their + /// account is disabled, or they don't have permission to perform the specified action. + /// + /// + /// If any other error is successfully returned from the server (e.g., a 500 + /// server error). + /// + /// HTTP 400: If there was a problem with the request provided by the user. + /// HTTP 404: If the specified resource does not exist on the server. + /// The path to the resource to delete. + /// The command to delete the resource. + /// The request cancellation token. + /// The response from deleting the resource. + Task Delete(string path, TCommand command, CancellationToken cancellationToken); + /// /// Fetches raw content from the resource at the specified path, using the GET verb. /// diff --git a/source/Octopus.Server.Client/IOctopusClient.cs b/source/Octopus.Server.Client/IOctopusClient.cs index fb2f34f4d..dcdd222f7 100644 --- a/source/Octopus.Server.Client/IOctopusClient.cs +++ b/source/Octopus.Server.Client/IOctopusClient.cs @@ -353,6 +353,25 @@ public interface IOctopusClient : IDisposable /// An optional resource to pass as the body of the request. /// A task resource that provides details about the background task that deletes the specified resource. void Delete(string path, object pathParameters = null, object resource = null); + + /// + /// Deletes the resource at the given URI from the server using a the DELETE verb. + /// + /// + /// HTTP 401 or 403: Thrown when the current user's API key was not valid, their + /// account is disabled, or they don't have permission to perform the specified action. + /// + /// + /// If any other error is successfully returned from the server (e.g., a 500 + /// server error). + /// + /// HTTP 400: If there was a problem with the request provided by the user. + /// HTTP 404: If the specified resource does not exist on the server. + /// The path to the resource to delete. + /// If the path is a URI template, parameters to use for substitution. + /// The command to delete the resource. + /// The response from deleting the resource. + TResponse Delete(string path, TCommand command, object pathParameters = null); /// /// Fetches raw content from the resource at the specified path, using the GET verb. diff --git a/source/Octopus.Server.Client/Model/DeploymentFreezes/DeleteDeploymentFreezeCommand.cs b/source/Octopus.Server.Client/Model/DeploymentFreezes/DeleteDeploymentFreezeCommand.cs new file mode 100644 index 000000000..392d573c4 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentFreezes/DeleteDeploymentFreezeCommand.cs @@ -0,0 +1,8 @@ +using System.ComponentModel.DataAnnotations; + +namespace Octopus.Client.Model.DeploymentFreezes; + +public class DeleteDeploymentFreezeCommand +{ + [Required] public string Id { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentFreezes/DeleteDeploymentFreezeResponse.cs b/source/Octopus.Server.Client/Model/DeploymentFreezes/DeleteDeploymentFreezeResponse.cs new file mode 100644 index 000000000..7a82c8aae --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentFreezes/DeleteDeploymentFreezeResponse.cs @@ -0,0 +1,6 @@ +namespace Octopus.Client.Model.DeploymentFreezes; + +public class DeleteDeploymentFreezeResponse +{ + +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/OctopusAsyncClient.cs b/source/Octopus.Server.Client/OctopusAsyncClient.cs index 4233bb567..64e2773fb 100644 --- a/source/Octopus.Server.Client/OctopusAsyncClient.cs +++ b/source/Octopus.Server.Client/OctopusAsyncClient.cs @@ -525,6 +525,14 @@ public Task Delete(string path, object pathParameters, object resource, Cancella return DispatchRequest(new OctopusRequest("DELETE", uri, resource), true, cancellationToken); } + /// + public async Task Delete(string path, TCommand command, CancellationToken cancellationToken) + { + var uri = QualifyUri(path); + + var response = await DispatchRequest(new OctopusRequest("DELETE", uri, command), true, cancellationToken); + return response.ResponseResource; + } /// public async Task Update(string path, TResource resource, object pathParameters = null) { diff --git a/source/Octopus.Server.Client/OctopusClient.cs b/source/Octopus.Server.Client/OctopusClient.cs index b3aa3752f..8f61c82b9 100644 --- a/source/Octopus.Server.Client/OctopusClient.cs +++ b/source/Octopus.Server.Client/OctopusClient.cs @@ -386,6 +386,15 @@ public void Delete(string path, object pathParameters = null, object resource = DispatchRequest(new OctopusRequest("DELETE", uri, resource), true); } + + /// + public TResponse Delete(string path, TCommand command, object pathParameters = null) + { + var uri = QualifyUri(path, pathParameters); + + var response = DispatchRequest(new OctopusRequest("DELETE", uri, command), true); + return response.ResponseResource; + } /// /// Updates the resource at the given URI on the server using the PUT verb, then performs a fresh GET request to reload diff --git a/source/Octopus.Server.Client/Repositories/Async/DeploymentFreezeRepository.cs b/source/Octopus.Server.Client/Repositories/Async/DeploymentFreezeRepository.cs index ae2958c13..084ffc0e3 100644 --- a/source/Octopus.Server.Client/Repositories/Async/DeploymentFreezeRepository.cs +++ b/source/Octopus.Server.Client/Repositories/Async/DeploymentFreezeRepository.cs @@ -10,6 +10,9 @@ public interface IDeploymentFreezeRepository Task Modify(ModifyDeploymentFreezeCommand command, CancellationToken cancellationToken); + + Task Delete(DeleteDeploymentFreezeCommand command, + CancellationToken cancellationToken); } public class DeploymentFreezeRepository(IOctopusAsyncClient client) : IDeploymentFreezeRepository @@ -26,7 +29,14 @@ public async Task Modify(ModifyDeploymentFreezeC { var link = await client.Repository.Link("DeploymentFreezes"); - var response = await client.Update(link, command, null, cancellationToken); - return response; + return await client.Update(link, command, null, cancellationToken); + } + + public async Task Delete(DeleteDeploymentFreezeCommand command, CancellationToken cancellationToken) + { + var link = await client.Repository.Link("DeploymentFreezes"); + + return await client.Delete(link, command, + cancellationToken); } } \ No newline at end of file diff --git a/source/Octopus.Server.Client/Repositories/DeploymentFreezeRepository.cs b/source/Octopus.Server.Client/Repositories/DeploymentFreezeRepository.cs index 894a1b752..b94de2604 100644 --- a/source/Octopus.Server.Client/Repositories/DeploymentFreezeRepository.cs +++ b/source/Octopus.Server.Client/Repositories/DeploymentFreezeRepository.cs @@ -6,6 +6,7 @@ public interface IDeploymentFreezeRepository { CreateDeploymentFreezeResponse Create(CreateDeploymentFreezeCommand command); ModifyDeploymentFreezeResponse Modify(ModifyDeploymentFreezeCommand command); + DeleteDeploymentFreezeResponse Delete(DeleteDeploymentFreezeCommand command); } public class DeploymentFreezeRepository(IOctopusClient client) : IDeploymentFreezeRepository @@ -23,4 +24,11 @@ public ModifyDeploymentFreezeResponse Modify(ModifyDeploymentFreezeCommand comma return client.Update(link, command); } + + public DeleteDeploymentFreezeResponse Delete(DeleteDeploymentFreezeCommand command) + { + var link = client.Repository.Link("DeploymentFreezes"); + + return client.Delete(link, command); + } } \ No newline at end of file