Share via


CDKExtensions.AddOutput Method

Definition

Overloads

AddOutput<T>(IResourceBuilder<IConstructResource<T>>, String, ConstructOutputDelegate<T>)

Adds a construct reference to an output from the CloudFormation stack.

AddOutput<TStack>(IResourceBuilder<IStackResource<TStack>>, String, ConstructOutputDelegate<TStack>)

Adds a stack reference to an output from the CloudFormation stack.

AddOutput<T>(IResourceBuilder<IConstructResource<T>>, String, ConstructOutputDelegate<T>)

Source:
CDKExtensions.cs

Adds a construct reference to an output from the CloudFormation stack.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.AWS.CDK.IConstructResource<T>> AddOutput<T> (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.AWS.CDK.IConstructResource<T>> builder, string name, Aspire.Hosting.AWS.CDK.ConstructOutputDelegate<T> output) where T : Constructs.Construct;
static member AddOutput : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.AWS.CDK.IConstructResource<'T>> * string * Aspire.Hosting.AWS.CDK.ConstructOutputDelegate<'T (requires 'T :> Constructs.Construct)> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.AWS.CDK.IConstructResource<'T>> (requires 'T :> Constructs.Construct)
<Extension()>
Public Function AddOutput(Of T As Construct) (builder As IResourceBuilder(Of IConstructResource(Of T)), name As String, output As ConstructOutputDelegate(Of T)) As IResourceBuilder(Of IConstructResource(Of T))

Type Parameters

T

Parameters

builder
IResourceBuilder<IConstructResource<T>>

The construct resource builder.

name
String

The name of the output.

output
ConstructOutputDelegate<T>

The construct output delegate.

Returns

Examples

The following example shows creating a custom construct and reference the exposed ServiceUrl property in a project.

var service = stack
    .AddConstruct("service", scope => new Service(scope, "service")
    .AddOutput("ServiceUrl", construct => construct.ServiceUrl);
var api = builder.AddProject<Projects.Api>("api")
    .AddReference(service);

Applies to

AddOutput<TStack>(IResourceBuilder<IStackResource<TStack>>, String, ConstructOutputDelegate<TStack>)

Source:
CDKExtensions.cs

Adds a stack reference to an output from the CloudFormation stack.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.AWS.CDK.IStackResource<TStack>> AddOutput<TStack> (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.AWS.CDK.IStackResource<TStack>> builder, string name, Aspire.Hosting.AWS.CDK.ConstructOutputDelegate<TStack> output) where TStack : Amazon.CDK.Stack;
static member AddOutput : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.AWS.CDK.IStackResource<'Stack>> * string * Aspire.Hosting.AWS.CDK.ConstructOutputDelegate<'Stack (requires 'Stack :> Amazon.CDK.Stack)> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.AWS.CDK.IStackResource<'Stack>> (requires 'Stack :> Amazon.CDK.Stack)
<Extension()>
Public Function AddOutput(Of TStack As Stack) (builder As IResourceBuilder(Of IStackResource(Of TStack)), name As String, output As ConstructOutputDelegate(Of TStack)) As IResourceBuilder(Of IStackResource(Of TStack))

Type Parameters

TStack

Parameters

builder
IResourceBuilder<IStackResource<TStack>>

The stack resource builder.

name
String

The name of the output.

output
ConstructOutputDelegate<TStack>

The construct output delegate.

Returns

Examples

The following example shows creating a custom stack and reference the exposed ServiceUrl property in a project.

var service = builder
    .AddStack("service", scope => new ServiceStack(scope, "ServiceStack")
    .AddOutput("ServiceUrl", stack => stack.Service.ServiceUrl);
var api = builder.AddProject<Projects.Api>("api")
    .AddReference(service);

Applies to