-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vincent Lesierse
committed
Mar 27, 2024
1 parent
832d206
commit 6b49f82
Showing
20 changed files
with
346 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Amazon.CDK; | ||
using Constructs; | ||
using Resource = Aspire.Hosting.ApplicationModel.Resource; | ||
|
||
namespace Aspire.Hosting.AWS.CDK; | ||
|
||
internal sealed class AppResource() : Resource("AWSCDK"), IAppResource | ||
{ | ||
public App App { get; } = new(); | ||
|
||
public Construct Construct => App; | ||
} |
4 changes: 2 additions & 2 deletions
4
...re.Hosting.AWS.CDK/StackOutputDelegate.cs → ...sting.AWS.CDK/ConstructBuilderDelegate.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Amazon.CDK; | ||
using Constructs; | ||
|
||
namespace Aspire.Hosting.AWS.CDK; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
public delegate string StackOutputDelegate<in T>(T stack) where T : Stack; | ||
public delegate T ConstructBuilderDelegate<out T>(Construct app) where T : Construct; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Amazon.CDK; | ||
using Constructs; | ||
|
||
namespace Aspire.Hosting.AWS.CDK; | ||
|
||
internal sealed class ConstructOutputAnnotation<T>(string name, ConstructOutputDelegate<T> output) | ||
: IConstructModifierAnnotation | ||
where T : Construct | ||
{ | ||
public string Name { get; } = name; | ||
|
||
public string? ExportName { get; set; } | ||
|
||
public string? Description { get; set; } | ||
|
||
public void ChangeConstruct(Construct construct) | ||
{ | ||
var target = (T)construct; | ||
_ = new CfnOutput(construct, Name, new CfnOutputProps | ||
{ | ||
Value = output(target), | ||
Description = Description, | ||
ExportName = ExportName ?? $"{construct.Node.Id}::{Name}" | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
using Constructs; | ||
|
||
namespace Aspire.Hosting.AWS.CDK; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
public delegate string ConstructOutputDelegate<in T>(T construct) where T : Construct; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Aspire.Hosting.ApplicationModel; | ||
using Constructs; | ||
|
||
namespace Aspire.Hosting.AWS.CDK; | ||
|
||
internal class ConstructResource(string name, Construct construct, IResourceWithConstruct parent) : Resource(name), IConstructResource | ||
{ | ||
public Construct Construct { get; } = construct; | ||
|
||
public IResourceWithConstruct Parent { get; } = parent; | ||
|
||
} | ||
|
||
internal sealed class ConstructResource<T>(string name, T construct, IResourceWithConstruct parent) : ConstructResource(name, construct, parent), IConstructResource<T> | ||
where T : Construct | ||
{ | ||
public new T Construct { get; } = construct; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Amazon.CDK; | ||
|
||
namespace Aspire.Hosting.AWS.CDK; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public interface IAppResource : IResourceWithConstruct | ||
{ | ||
/// <summary> | ||
/// AWS CKD App | ||
/// </summary> | ||
App App { get; } | ||
} |
Oops, something went wrong.