Class CfnOutput
Inherited Members
Namespace: Amazon.CDK
Assembly: Amazon.CDK.dll
Syntax (csharp)
public class CfnOutput : CfnElement, IConstruct, IDependable
Syntax (vb)
Public Class CfnOutput
Inherits CfnElement
Implements IConstruct, IDependable
Remarks
ExampleMetadata: infused
Examples
Cluster cluster;
// add service account
var serviceAccount = cluster.AddServiceAccount("MyServiceAccount");
var bucket = new Bucket(this, "Bucket");
bucket.GrantReadWrite(serviceAccount);
var mypod = cluster.AddManifest("mypod", new Dictionary<string, object> {
{ "apiVersion", "v1" },
{ "kind", "Pod" },
{ "metadata", new Dictionary<string, string> { { "name", "mypod" } } },
{ "spec", new Dictionary<string, object> {
{ "serviceAccountName", serviceAccount.ServiceAccountName },
{ "containers", new [] { new Struct {
Name = "hello",
Image = "paulbouwer/hello-kubernetes:1.5",
Ports = new [] { new Struct { ContainerPort = 8080 } }
} } }
} }
});
// create the resource after the service account.
mypod.Node.AddDependency(serviceAccount);
// print the IAM role arn for this service account
// print the IAM role arn for this service account
new CfnOutput(this, "ServiceAccountIamRole", new CfnOutputProps { Value = serviceAccount.Role.RoleArn });
Synopsis
Constructors
CfnOutput(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnOutput(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CfnOutput(Construct, String, ICfnOutputProps) | Creates an CfnOutput value for this stack. |
Properties
Condition | A condition to associate with this output value. |
Description | A String type that describes the output value. |
ExportName | The name used to export the value of this output across stacks. |
ImportValue | Return the |
Value | The value of the property returned by the aws cloudformation describe-stacks command. |
Methods
Validate() | Validate the current construct. |
Constructors
CfnOutput(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnOutput(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnOutput(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnOutput(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CfnOutput(Construct, String, ICfnOutputProps)
Creates an CfnOutput value for this stack.
public CfnOutput(Construct scope, string id, ICfnOutputProps props)
Parameters
- scope Constructs.Construct
The parent construct.
- id System.String
The parent construct.
- props ICfnOutputProps
CfnOutput properties.
Properties
Condition
A condition to associate with this output value.
public virtual CfnCondition Condition { get; set; }
Property Value
Remarks
If the condition evaluates
to false
, this output value will not be included in the stack.
Default: - No condition is associated with the output.
Description
A String type that describes the output value.
public virtual string Description { get; set; }
Property Value
System.String
Remarks
The description can be a maximum of 4 K in length.
Default: - No description.
ExportName
The name used to export the value of this output across stacks.
public virtual string ExportName { get; set; }
Property Value
System.String
Remarks
To use the value in another stack, pass the value of
output.importValue
to it.
Default: - the output is not exported
ImportValue
Return the Fn.importValue
expression to import this value into another stack.
public virtual string ImportValue { get; }
Property Value
System.String
Remarks
The returned value should not be used in the same stack, but in a different one. It must be deployed to the same environment, as CloudFormation exports can only be imported in the same Region and account.
The is no automatic registration of dependencies between stacks when using this mechanism, so you should make sure to deploy them in the right order yourself.
You can use this mechanism to share values across Stacks in different Stages. If you intend to share the value to another Stack inside the same Stage, the automatic cross-stack referencing mechanism is more convenient.
Value
The value of the property returned by the aws cloudformation describe-stacks command.
public virtual object Value { get; set; }
Property Value
System.Object
Remarks
The value of an output can include literals, parameter references, pseudo-parameters, a mapping value, or intrinsic functions.
Methods
Validate()
Validate the current construct.
protected override string[] Validate()
Returns
System.String[]
Overrides
Remarks
This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.