diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt index 7e3403cf..6eaea030 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt @@ -185,6 +185,7 @@ Octopus.Client Octopus.Client.Repositories.Async.IDeploymentProcessRepository DeploymentProcesses { get; } Octopus.Client.Repositories.Async.IDeploymentRepository Deployments { get; } Octopus.Client.Repositories.Async.IDeploymentSettingsRepository DeploymentSettings { get; } + Octopus.Client.Repositories.Async.IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Octopus.Client.Repositories.Async.IEnvironmentRepository Environments { get; } Octopus.Client.Repositories.Async.IFeedRepository Feeds { get; } Octopus.Client.Repositories.Async.IGitCredentialRepository GitCredentials { get; } @@ -230,6 +231,7 @@ Octopus.Client Octopus.Client.Repositories.IDeploymentProcessRepository DeploymentProcesses { get; } Octopus.Client.Repositories.IDeploymentRepository Deployments { get; } Octopus.Client.Repositories.IDeploymentSettingsRepository DeploymentSettings { get; } + Octopus.Client.Repositories.IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Octopus.Client.Repositories.IEnvironmentRepository Environments { get; } Octopus.Client.Repositories.IFeedRepository Feeds { get; } Octopus.Client.Repositories.IInterruptionRepository Interruptions { get; } @@ -394,6 +396,7 @@ Octopus.Client Octopus.Client.Repositories.Async.IDeploymentProcessRepository DeploymentProcesses { get; } Octopus.Client.Repositories.Async.IDeploymentRepository Deployments { get; } Octopus.Client.Repositories.Async.IDeploymentSettingsRepository DeploymentSettings { get; } + Octopus.Client.Repositories.Async.IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Octopus.Client.Repositories.Async.IEnvironmentRepository Environments { get; } Octopus.Client.Repositories.Async.IEventRepository Events { get; } Octopus.Client.Repositories.Async.IFeaturesConfigurationRepository FeaturesConfiguration { get; } @@ -537,6 +540,7 @@ Octopus.Client Octopus.Client.Repositories.IDeploymentProcessRepository DeploymentProcesses { get; } Octopus.Client.Repositories.IDeploymentRepository Deployments { get; } Octopus.Client.Repositories.IDeploymentSettingsRepository DeploymentSettings { get; } + Octopus.Client.Repositories.IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Octopus.Client.Repositories.IEnvironmentRepository Environments { get; } Octopus.Client.Repositories.IEventRepository Events { get; } Octopus.Client.Repositories.IFeaturesConfigurationRepository FeaturesConfiguration { get; } @@ -6673,6 +6677,64 @@ Octopus.Client.Model.DeploymentTargets RunbookRun = 1 } } +Octopus.Client.Model.DeploymentTargetTags +{ + class CreateDeploymentTargetTagCommand + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class CreateDeploymentTargetTagResponse + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class DeleteDeploymentTargetTagCommand + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class DeleteDeploymentTargetTagResponse + { + .ctor() + } + class DeploymentTargetTagResource + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class GetDeploymentTargetTagByTagRequest + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class GetDeploymentTargetTagByTagResponse + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class GetDeploymentTargetTagsRequest + { + .ctor() + IReadOnlyCollection MachineIds { get; set; } + Nullable Skip { get; set; } + String SpaceId { get; set; } + IReadOnlyCollection Tags { get; set; } + Nullable Take { get; set; } + } + class GetDeploymentTargetTagsResponse + { + .ctor() + Int32 Count { get; set; } + IReadOnlyCollection DeploymentTargetTags { get; set; } + } +} Octopus.Client.Model.Endpoints { AzureServiceFabricCredentialType @@ -7794,6 +7856,15 @@ Octopus.Client.Repositories Octopus.Client.Model.DeploymentFreezes.GetDeploymentFreezesResponse Get(Octopus.Client.Model.DeploymentFreezes.GetDeploymentFreezesRequest) Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } + class DeploymentTargetTagsRepository + Octopus.Client.Repositories.IDeploymentTargetTagsRepository + { + .ctor(Octopus.Client.IOctopusClient) + Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagResponse Create(Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagCommand) + Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagResponse Delete(Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagCommand) + Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse) + Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsResponse Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsRequest) + } interface IAccountRepository Octopus.Client.Repositories.IResourceRepository Octopus.Client.Repositories.ICreate @@ -7986,6 +8057,13 @@ Octopus.Client.Repositories Octopus.Client.Model.DeploymentSettingsResource Modify(Octopus.Client.Model.DeploymentSettingsResource) Octopus.Client.Model.DeploymentSettingsResource Modify(Octopus.Client.Model.DeploymentSettingsResource, String) } + interface IDeploymentTargetTagsRepository + { + Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagResponse Create(Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagCommand) + Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagResponse Delete(Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagCommand) + Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse) + Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsResponse Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsRequest) + } interface IEnvironmentRepository Octopus.Client.Repositories.IFindBySlug Octopus.Client.Repositories.IPaginate @@ -8547,6 +8625,15 @@ Octopus.Client.Repositories.Async Task Get(Octopus.Client.Model.DeploymentFreezes.GetDeploymentFreezesRequest, CancellationToken) Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } + class DeploymentTargetTagsRepository + Octopus.Client.Repositories.Async.IDeploymentTargetTagsRepository + { + .ctor(Octopus.Client.IOctopusAsyncClient) + Task Create(Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagCommand, CancellationToken) + Task Delete(Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagCommand, CancellationToken) + Task Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse, CancellationToken) + Task Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsRequest, CancellationToken) + } interface IAccountRepository Octopus.Client.Repositories.Async.IResourceRepository Octopus.Client.Repositories.Async.ICreate @@ -8753,6 +8840,13 @@ Octopus.Client.Repositories.Async Task Modify(Octopus.Client.Model.DeploymentSettingsResource, String) Task Modify(Octopus.Client.Model.DeploymentSettingsResource, String, CancellationToken) } + interface IDeploymentTargetTagsRepository + { + Task Create(Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagCommand, CancellationToken) + Task Delete(Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagCommand, CancellationToken) + Task Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse, CancellationToken) + Task Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsRequest, CancellationToken) + } interface IEnvironmentRepository Octopus.Client.Repositories.Async.IFindBySlug Octopus.Client.Repositories.Async.IPaginate diff --git a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt index 274ccf7b..19d6d6df 100644 --- a/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt +++ b/source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETFramework.approved.txt @@ -185,6 +185,7 @@ Octopus.Client Octopus.Client.Repositories.Async.IDeploymentProcessRepository DeploymentProcesses { get; } Octopus.Client.Repositories.Async.IDeploymentRepository Deployments { get; } Octopus.Client.Repositories.Async.IDeploymentSettingsRepository DeploymentSettings { get; } + Octopus.Client.Repositories.Async.IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Octopus.Client.Repositories.Async.IEnvironmentRepository Environments { get; } Octopus.Client.Repositories.Async.IFeedRepository Feeds { get; } Octopus.Client.Repositories.Async.IGitCredentialRepository GitCredentials { get; } @@ -230,6 +231,7 @@ Octopus.Client Octopus.Client.Repositories.IDeploymentProcessRepository DeploymentProcesses { get; } Octopus.Client.Repositories.IDeploymentRepository Deployments { get; } Octopus.Client.Repositories.IDeploymentSettingsRepository DeploymentSettings { get; } + Octopus.Client.Repositories.IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Octopus.Client.Repositories.IEnvironmentRepository Environments { get; } Octopus.Client.Repositories.IFeedRepository Feeds { get; } Octopus.Client.Repositories.IInterruptionRepository Interruptions { get; } @@ -394,6 +396,7 @@ Octopus.Client Octopus.Client.Repositories.Async.IDeploymentProcessRepository DeploymentProcesses { get; } Octopus.Client.Repositories.Async.IDeploymentRepository Deployments { get; } Octopus.Client.Repositories.Async.IDeploymentSettingsRepository DeploymentSettings { get; } + Octopus.Client.Repositories.Async.IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Octopus.Client.Repositories.Async.IEnvironmentRepository Environments { get; } Octopus.Client.Repositories.Async.IEventRepository Events { get; } Octopus.Client.Repositories.Async.IFeaturesConfigurationRepository FeaturesConfiguration { get; } @@ -535,6 +538,7 @@ Octopus.Client Octopus.Client.Repositories.IDeploymentProcessRepository DeploymentProcesses { get; } Octopus.Client.Repositories.IDeploymentRepository Deployments { get; } Octopus.Client.Repositories.IDeploymentSettingsRepository DeploymentSettings { get; } + Octopus.Client.Repositories.IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Octopus.Client.Repositories.IEnvironmentRepository Environments { get; } Octopus.Client.Repositories.IEventRepository Events { get; } Octopus.Client.Repositories.IFeaturesConfigurationRepository FeaturesConfiguration { get; } @@ -6697,6 +6701,64 @@ Octopus.Client.Model.DeploymentTargets RunbookRun = 1 } } +Octopus.Client.Model.DeploymentTargetTags +{ + class CreateDeploymentTargetTagCommand + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class CreateDeploymentTargetTagResponse + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class DeleteDeploymentTargetTagCommand + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class DeleteDeploymentTargetTagResponse + { + .ctor() + } + class DeploymentTargetTagResource + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class GetDeploymentTargetTagByTagRequest + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class GetDeploymentTargetTagByTagResponse + { + .ctor() + String SpaceId { get; set; } + String Tag { get; set; } + } + class GetDeploymentTargetTagsRequest + { + .ctor() + IReadOnlyCollection MachineIds { get; set; } + Nullable Skip { get; set; } + String SpaceId { get; set; } + IReadOnlyCollection Tags { get; set; } + Nullable Take { get; set; } + } + class GetDeploymentTargetTagsResponse + { + .ctor() + Int32 Count { get; set; } + IReadOnlyCollection DeploymentTargetTags { get; set; } + } +} Octopus.Client.Model.Endpoints { AzureServiceFabricCredentialType @@ -7819,6 +7881,15 @@ Octopus.Client.Repositories Octopus.Client.Model.DeploymentFreezes.GetDeploymentFreezesResponse Get(Octopus.Client.Model.DeploymentFreezes.GetDeploymentFreezesRequest) Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeResponse Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand) } + class DeploymentTargetTagsRepository + Octopus.Client.Repositories.IDeploymentTargetTagsRepository + { + .ctor(Octopus.Client.IOctopusClient) + Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagResponse Create(Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagCommand) + Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagResponse Delete(Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagCommand) + Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse) + Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsResponse Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsRequest) + } interface IAccountRepository Octopus.Client.Repositories.IResourceRepository Octopus.Client.Repositories.ICreate @@ -8011,6 +8082,13 @@ Octopus.Client.Repositories Octopus.Client.Model.DeploymentSettingsResource Modify(Octopus.Client.Model.DeploymentSettingsResource) Octopus.Client.Model.DeploymentSettingsResource Modify(Octopus.Client.Model.DeploymentSettingsResource, String) } + interface IDeploymentTargetTagsRepository + { + Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagResponse Create(Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagCommand) + Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagResponse Delete(Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagCommand) + Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse) + Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsResponse Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsRequest) + } interface IEnvironmentRepository Octopus.Client.Repositories.IFindBySlug Octopus.Client.Repositories.IPaginate @@ -8572,6 +8650,15 @@ Octopus.Client.Repositories.Async Task Get(Octopus.Client.Model.DeploymentFreezes.GetDeploymentFreezesRequest, CancellationToken) Task Modify(Octopus.Client.Model.DeploymentFreezes.ModifyDeploymentFreezeCommand, CancellationToken) } + class DeploymentTargetTagsRepository + Octopus.Client.Repositories.Async.IDeploymentTargetTagsRepository + { + .ctor(Octopus.Client.IOctopusAsyncClient) + Task Create(Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagCommand, CancellationToken) + Task Delete(Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagCommand, CancellationToken) + Task Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse, CancellationToken) + Task Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsRequest, CancellationToken) + } interface IAccountRepository Octopus.Client.Repositories.Async.IResourceRepository Octopus.Client.Repositories.Async.ICreate @@ -8778,6 +8865,13 @@ Octopus.Client.Repositories.Async Task Modify(Octopus.Client.Model.DeploymentSettingsResource, String) Task Modify(Octopus.Client.Model.DeploymentSettingsResource, String, CancellationToken) } + interface IDeploymentTargetTagsRepository + { + Task Create(Octopus.Client.Model.DeploymentTargetTags.CreateDeploymentTargetTagCommand, CancellationToken) + Task Delete(Octopus.Client.Model.DeploymentTargetTags.DeleteDeploymentTargetTagCommand, CancellationToken) + Task Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagByTagResponse, CancellationToken) + Task Get(Octopus.Client.Model.DeploymentTargetTags.GetDeploymentTargetTagsRequest, CancellationToken) + } interface IEnvironmentRepository Octopus.Client.Repositories.Async.IFindBySlug Octopus.Client.Repositories.Async.IPaginate diff --git a/source/Octopus.Server.Client/IOctopusSpaceAsyncRepository.cs b/source/Octopus.Server.Client/IOctopusSpaceAsyncRepository.cs index b432b6c7..0bf496ab 100644 --- a/source/Octopus.Server.Client/IOctopusSpaceAsyncRepository.cs +++ b/source/Octopus.Server.Client/IOctopusSpaceAsyncRepository.cs @@ -50,6 +50,7 @@ public interface IOctopusSpaceAsyncRepository: IOctopusCommonAsyncRepository IVariableSetRepository VariableSets { get; } IWorkerPoolRepository WorkerPools { get; } IWorkerRepository Workers { get; } + IDeploymentTargetTagsRepository DeploymentTargetTags { get; } Task LoadSpaceRootDocument(); } } \ No newline at end of file diff --git a/source/Octopus.Server.Client/IOctopusSpaceRepository.cs b/source/Octopus.Server.Client/IOctopusSpaceRepository.cs index b8272f8f..829bc4f5 100644 --- a/source/Octopus.Server.Client/IOctopusSpaceRepository.cs +++ b/source/Octopus.Server.Client/IOctopusSpaceRepository.cs @@ -49,6 +49,7 @@ public interface IOctopusSpaceRepository: IOctopusCommonRepository IVariableSetRepository VariableSets { get; } IWorkerPoolRepository WorkerPools { get; } IWorkerRepository Workers { get; } + IDeploymentTargetTagsRepository DeploymentTargetTags { get; } SpaceRootResource LoadSpaceRootDocument(); } } diff --git a/source/Octopus.Server.Client/Model/DeploymentTargetTags/CreateDeploymentTargetTagCommand.cs b/source/Octopus.Server.Client/Model/DeploymentTargetTags/CreateDeploymentTargetTagCommand.cs new file mode 100644 index 00000000..1df8d0e5 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentTargetTags/CreateDeploymentTargetTagCommand.cs @@ -0,0 +1,21 @@ +using System.ComponentModel.DataAnnotations; +using Octopus.Client.Extensibility; + +namespace Octopus.Client.Model.DeploymentTargetTags; + +public class CreateDeploymentTargetTagCommand : IHaveSpaceResource +{ + /// + /// The name or tag of the DeploymentTargetTag + /// + [Required(ErrorMessage = "Deployment Target Tag must have a name.")] + [MaxLength(200, ErrorMessage = "Tag must be 200 characters or less.")] + [MinLength(1, ErrorMessage = "Tag must be between 1 and 200 characters.")] + public string Tag { get; set; } + + /// + /// The ID of the space for the DeploymentTargetTag + /// + [Required] + public string SpaceId { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentTargetTags/CreateDeploymentTargetTagResponse.cs b/source/Octopus.Server.Client/Model/DeploymentTargetTags/CreateDeploymentTargetTagResponse.cs new file mode 100644 index 00000000..b0c63496 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentTargetTags/CreateDeploymentTargetTagResponse.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace Octopus.Client.Model.DeploymentTargetTags; + +public class CreateDeploymentTargetTagResponse +{ + [Required] + public string Tag { get; set; } + + [Required] + public string SpaceId { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentTargetTags/DeleteDeploymentTargetTagCommand.cs b/source/Octopus.Server.Client/Model/DeploymentTargetTags/DeleteDeploymentTargetTagCommand.cs new file mode 100644 index 00000000..3832713c --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentTargetTags/DeleteDeploymentTargetTagCommand.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Octopus.Client.Extensibility; + +namespace Octopus.Client.Model.DeploymentTargetTags; + +public class DeleteDeploymentTargetTagCommand : IHaveSpaceResource +{ + /// + /// The ID of the space containing the resource(s). + /// + [Required] + public string SpaceId { get; set; } = null!; + + /// + /// The Tag of the DeploymentTargetTag to delete. + /// + [Required] + public string Tag { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentTargetTags/DeleteDeploymentTargetTagResponse.cs b/source/Octopus.Server.Client/Model/DeploymentTargetTags/DeleteDeploymentTargetTagResponse.cs new file mode 100644 index 00000000..4ddbdab4 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentTargetTags/DeleteDeploymentTargetTagResponse.cs @@ -0,0 +1,6 @@ +namespace Octopus.Client.Model.DeploymentTargetTags; + +public class DeleteDeploymentTargetTagResponse +{ + +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagByTagRequest.cs b/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagByTagRequest.cs new file mode 100644 index 00000000..63006b24 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagByTagRequest.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; +using Octopus.Client.Extensibility; + +namespace Octopus.Client.Model.DeploymentTargetTags; + +public class GetDeploymentTargetTagByTagRequest : IHaveSpaceResource +{ + /// + /// The ID of the space containing the resource(s). + /// + [Required] + public string SpaceId { get; set; } = null!; + + /// + /// ID or Slug of the DeploymentTargetTag + /// + [Required] + public string Tag { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagByTagResponse.cs b/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagByTagResponse.cs new file mode 100644 index 00000000..f64bfb05 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagByTagResponse.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace Octopus.Client.Model.DeploymentTargetTags; + +public class GetDeploymentTargetTagByTagResponse +{ + [Required] + public string Tag { get; set; } + + [Required] + public string SpaceId { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagsRequest.cs b/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagsRequest.cs new file mode 100644 index 00000000..297cee13 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagsRequest.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Octopus.Client.Extensibility; +using Octopus.Server.MessageContracts.Base.Attributes; + +namespace Octopus.Client.Model.DeploymentTargetTags; + +public class GetDeploymentTargetTagsRequest : IHaveSpaceResource +{ + /// + /// The ID of the Space to which the DeploymentTargetTags belong. + /// + [Required] + public string SpaceId { get; set; } + + /// + /// The DeploymentTargetTag IDs to filter by. + /// + [Optional] + public IReadOnlyCollection Tags { get; set; } = Array.Empty(); + + /// + /// The Machine ID to filter by. + /// + [Optional] + public IReadOnlyCollection MachineIds { get; set; } = Array.Empty(); + + [Optional] + public int? Skip { get; set; } + + [Optional] + public int? Take { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagsResponse.cs b/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagsResponse.cs new file mode 100644 index 00000000..f96b21b2 --- /dev/null +++ b/source/Octopus.Server.Client/Model/DeploymentTargetTags/GetDeploymentTargetTagsResponse.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Octopus.Client.Model.DeploymentTargetTags; + +public class GetDeploymentTargetTagsResponse +{ + [Required] + public IReadOnlyCollection DeploymentTargetTags { get; set; } + + [Required] + public int Count { get; set; } +} + +public class DeploymentTargetTagResource +{ + [Required] + public string Tag { get; set; } + + [Required] + public string SpaceId { get; set; } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/OctopusAsyncRepository.cs b/source/Octopus.Server.Client/OctopusAsyncRepository.cs index efc77daf..b77504b9 100644 --- a/source/Octopus.Server.Client/OctopusAsyncRepository.cs +++ b/source/Octopus.Server.Client/OctopusAsyncRepository.cs @@ -123,6 +123,7 @@ public OctopusAsyncRepository(IOctopusAsyncClient client, RepositoryScope reposi loadRootResource = new AsyncLazy(LoadRootDocumentInner); loadSpaceRootResource = new Lazy>(LoadSpaceRootDocumentInner, true); DeploymentFreezes = new DeploymentFreezeRepository(client); + DeploymentTargetTags = new DeploymentTargetTagsRepository(client); } @@ -192,6 +193,7 @@ public OctopusAsyncRepository(IOctopusAsyncClient client, RepositoryScope reposi public IUpgradeConfigurationRepository UpgradeConfiguration { get; } public ITelemetryConfigurationRepository TelemetryConfigurationRepository { get; } public IDeploymentFreezeRepository DeploymentFreezes { get; } + public IDeploymentTargetTagsRepository DeploymentTargetTags { get; } public async Task HasLink(string name) { diff --git a/source/Octopus.Server.Client/OctopusRepository.cs b/source/Octopus.Server.Client/OctopusRepository.cs index 6d011de1..2544410e 100644 --- a/source/Octopus.Server.Client/OctopusRepository.cs +++ b/source/Octopus.Server.Client/OctopusRepository.cs @@ -118,6 +118,7 @@ public OctopusRepository(IOctopusClient client, RepositoryScope repositoryScope loadRootResource = new Lazy(LoadRootDocumentInner, true); loadSpaceRootResource = new Lazy(LoadSpaceRootDocumentInner, true); DeploymentFreezes = new DeploymentFreezeRepository(client); + DeploymentTargetTags = new DeploymentTargetTagsRepository(client); } public IOctopusClient Client { get; } @@ -185,6 +186,7 @@ public OctopusRepository(IOctopusClient client, RepositoryScope repositoryScope public IUpgradeConfigurationRepository UpgradeConfiguration { get; } public ITelemetryConfigurationRepository TelemetryConfigurationRepository { get; } public IDeploymentFreezeRepository DeploymentFreezes { get; } + public IDeploymentTargetTagsRepository DeploymentTargetTags { get; } public bool HasLink(string name) { diff --git a/source/Octopus.Server.Client/Repositories/Async/DeploymentTargetTagsRepository.cs b/source/Octopus.Server.Client/Repositories/Async/DeploymentTargetTagsRepository.cs new file mode 100644 index 00000000..73148e0b --- /dev/null +++ b/source/Octopus.Server.Client/Repositories/Async/DeploymentTargetTagsRepository.cs @@ -0,0 +1,55 @@ +using System.Threading; +using System.Threading.Tasks; +using Octopus.Client.Model.DeploymentTargetTags; + +namespace Octopus.Client.Repositories.Async; + +public interface IDeploymentTargetTagsRepository +{ + Task Create(CreateDeploymentTargetTagCommand command, + CancellationToken cancellationToken); + + Task Delete(DeleteDeploymentTargetTagCommand command, + CancellationToken cancellationToken); + + Task Get(GetDeploymentTargetTagByTagResponse request, + CancellationToken cancellationToken); + + Task Get(GetDeploymentTargetTagsRequest request, + CancellationToken cancellationToken); +} + +public class DeploymentTargetTagsRepository(IOctopusAsyncClient client) : IDeploymentTargetTagsRepository +{ + public async Task Create(CreateDeploymentTargetTagCommand command, + CancellationToken cancellationToken) + { + var link = await client.Repository.Link("DeploymentTargetTags"); + + return await client.Create(link, command, null, cancellationToken); + } + + public async Task Delete(DeleteDeploymentTargetTagCommand command, + CancellationToken cancellationToken) + { + var link = await client.Repository.Link("DeploymentTargetTags"); + + return await client.Delete(link, command, cancellationToken); + } + + public async Task Get(GetDeploymentTargetTagByTagResponse request, + CancellationToken cancellationToken) + { + var link = await client.Repository.Link("DeploymentTargetTags"); + + return await client.Get(link, request, cancellationToken); + } + + public async Task Get(GetDeploymentTargetTagsRequest request, + CancellationToken cancellationToken) + { + var link = await client.Repository.Link("DeploymentTargetTags"); + + return await client.Get(link, request, cancellationToken); + } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Repositories/DeploymentTargetTagsRepository.cs b/source/Octopus.Server.Client/Repositories/DeploymentTargetTagsRepository.cs new file mode 100644 index 00000000..ed2b0f45 --- /dev/null +++ b/source/Octopus.Server.Client/Repositories/DeploymentTargetTagsRepository.cs @@ -0,0 +1,45 @@ +using Octopus.Client.Model.DeploymentTargetTags; + +namespace Octopus.Client.Repositories; + +public interface IDeploymentTargetTagsRepository +{ + CreateDeploymentTargetTagResponse Create(CreateDeploymentTargetTagCommand command); + + DeleteDeploymentTargetTagResponse Delete(DeleteDeploymentTargetTagCommand command); + + GetDeploymentTargetTagByTagResponse Get(GetDeploymentTargetTagByTagResponse request); + + GetDeploymentTargetTagsResponse Get(GetDeploymentTargetTagsRequest request); +} + +public class DeploymentTargetTagsRepository(IOctopusClient client) : IDeploymentTargetTagsRepository +{ + public CreateDeploymentTargetTagResponse Create(CreateDeploymentTargetTagCommand command) + { + var link = client.Repository.Link("DeploymentTargetTags"); + + return client.Create(link, command); + } + + public DeleteDeploymentTargetTagResponse Delete(DeleteDeploymentTargetTagCommand command) + { + var link = client.Repository.Link("DeploymentTargetTags"); + + return client.Delete(link, command); + } + + public GetDeploymentTargetTagByTagResponse Get(GetDeploymentTargetTagByTagResponse request) + { + var link = client.Repository.Link("DeploymentTargetTags"); + + return client.Get(link, request); + } + + public GetDeploymentTargetTagsResponse Get(GetDeploymentTargetTagsRequest request) + { + var link = client.Repository.Link("DeploymentTargetTags"); + + return client.Get(link, request); + } +} \ No newline at end of file