Skip to content

Commit d0fd911

Browse files
Jtango18Octobob
authored andcommitted
Adds Communication Style for using Conventional ECS Targets
skip-release-and-release-note: true GitOrigin-RevId: 832a24e08edb3b0c78539e6c910535408efe14b0
1 parent 8024fcd commit d0fd911

File tree

5 files changed

+91
-4
lines changed

5 files changed

+91
-4
lines changed

source/Octopus.Client.Tests/PublicSurfaceAreaFixture.ThePublicSurfaceAreaShouldNotRegress..NETCore.approved.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,6 +2480,7 @@ Octopus.Client.Model
24802480
Kubernetes = 9
24812481
StepPackage = 10
24822482
KubernetesTentacle = 11
2483+
AwsEcsCluster = 12
24832484
}
24842485
class CommunityActionTemplateResource
24852486
Octopus.Client.Extensibility.IResource
@@ -7234,6 +7235,24 @@ Octopus.Client.Model.DeploymentTargets
72347235
}
72357236
Octopus.Client.Model.Endpoints
72367237
{
7238+
class AwsEcsClusterEndpointResource
7239+
Octopus.Client.Extensibility.IResource
7240+
Octopus.Client.Model.IAuditedResource
7241+
Octopus.Client.Model.Endpoints.EndpointResource
7242+
{
7243+
.ctor()
7244+
String AccountId { get; set; }
7245+
String AssumedRoleArn { get; set; }
7246+
String AssumedRoleSession { get; set; }
7247+
Boolean AssumeRole { get; set; }
7248+
String AssumeRoleExternalId { get; set; }
7249+
Nullable<Int32> AssumeRoleSessionDurationSeconds { get; set; }
7250+
String ClusterName { get; set; }
7251+
Octopus.Client.Model.CommunicationStyle CommunicationStyle { get; }
7252+
String DefaultWorkerPoolId { get; set; }
7253+
String Region { get; set; }
7254+
Boolean UseInstanceRole { get; set; }
7255+
}
72377256
AzureServiceFabricCredentialType
72387257
{
72397258
ClientCredential = 0

source/Octopus.Client.Tests/Serialization/EndpointConverterFixture.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,19 @@ private static T Execute<T>(object input)
186186
return JsonConvert.DeserializeObject<EndpointResource>(json, settings)
187187
.Should().BeOfType<T>().Subject;
188188
}
189+
190+
[Test]
191+
public void AwsEcsTarget()
192+
{
193+
var input = new
194+
{
195+
CommunicationStyle = nameof(CommunicationStyle.AwsEcsCluster),
196+
ClusterName = "my-cluster"
197+
};
198+
199+
var result = Execute<AwsEcsClusterEndpointResource>(input);
200+
201+
result.ClusterName.Should().Be(input.ClusterName);
202+
}
189203
}
190204
}

source/Octopus.Server.Client/Model/CommunicationStyle.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ [ScriptConsoleSupported] [SupportedAccountTypes(AccountType.SshKeyPair, AccountT
3333

3434
StepPackage = 10,
3535

36-
[ScriptConsoleSupported] KubernetesTentacle = 11
36+
[ScriptConsoleSupported] KubernetesTentacle = 11,
37+
38+
AwsEcsCluster = 12
3739
}
38-
}
40+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using System.ComponentModel.DataAnnotations;
3+
using Octopus.Client.Extensibility.Attributes;
4+
5+
namespace Octopus.Client.Model.Endpoints
6+
{
7+
public class AwsEcsClusterEndpointResource : EndpointResource
8+
{
9+
public override CommunicationStyle CommunicationStyle => CommunicationStyle.AwsEcsCluster;
10+
11+
[Trim]
12+
[Writeable]
13+
public string DefaultWorkerPoolId { get; set; }
14+
15+
[Trim]
16+
[Writeable]
17+
public string ClusterName { get; set; } = string.Empty;
18+
19+
[Trim]
20+
[Writeable]
21+
public string Region { get; set; } = string.Empty;
22+
23+
[Trim]
24+
[Writeable]
25+
public string AccountId { get; set; } = string.Empty;
26+
27+
[Trim]
28+
[Writeable]
29+
public bool UseInstanceRole { get; set; } = true;
30+
31+
[Trim]
32+
[Writeable]
33+
public bool AssumeRole { get; set; } = false;
34+
35+
[Trim]
36+
[Writeable]
37+
public string AssumedRoleArn { get; set; }
38+
39+
[Trim]
40+
[Writeable]
41+
public string AssumedRoleSession { get; set; }
42+
43+
[Trim]
44+
[Writeable]
45+
public int? AssumeRoleSessionDurationSeconds { get; set; }
46+
47+
[Trim]
48+
[Writeable]
49+
public string AssumeRoleExternalId { get; set; }
50+
}
51+
}

source/Octopus.Server.Client/Serialization/EndpointConverter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ public class EndpointConverter : InheritedClassConverter<EndpointResource, Commu
2323
{CommunicationStyle.Kubernetes, typeof (KubernetesEndpointResource)},
2424
{CommunicationStyle.AzureServiceFabricCluster, typeof(ServiceFabricEndpointResource)},
2525
{CommunicationStyle.StepPackage, typeof(StepPackageEndpointResource)},
26-
{CommunicationStyle.KubernetesTentacle, typeof(KubernetesTentacleEndpointResource)}
26+
{CommunicationStyle.KubernetesTentacle, typeof(KubernetesTentacleEndpointResource)},
27+
{CommunicationStyle.AwsEcsCluster, typeof(AwsEcsClusterEndpointResource) }
2728
};
2829

2930
protected override IDictionary<CommunicationStyle, Type> DerivedTypeMappings => EndpointTypes;
3031
protected override string TypeDesignatingPropertyName => "CommunicationStyle";
3132
}
32-
}
33+
}

0 commit comments

Comments
 (0)