Class CustomResource
Instantiation of a custom resource, whose implementation is provided a Provider.
Inherited Members
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CustomResource : Resource, IResource, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class CustomResource Inherits Resource Implements IResource, IConstruct, IDependable, IEnvironmentAware
Remarks
This class is intended to be used by construct library authors. Application builder should not be able to tell whether or not a construct is backed by a custom resource, and so the use of this class should be invisible.
Instead, construct library authors declare a custom construct that hides the choice of provider, and accepts a strongly-typed properties object with the properties your provider accepts.
Your custom resource provider (identified by the serviceToken property)
can be one of 4 constructs:
Resource: AWS::CloudFormation::CustomResource
ExampleMetadata: infused
Examples
var stack = new Stack();
var durToken = new CfnParameter(stack, "MyParameter", new CfnParameterProps {
Type = "Number",
Default = 60
});
new CustomResource(stack, "MyCustomResource", new CustomResourceProps {
ServiceToken = "MyServiceToken",
ServiceTimeout = Duration.Seconds(durToken.ValueAsNumber)
});
Synopsis
Constructors
| CustomResource(Construct, string, ICustomResourceProps) | Instantiation of a custom resource, whose implementation is provided a Provider. |
Properties
| PROPERTY_INJECTION_ID | Uniquely identifies this class. |
| Ref | The physical name of this custom resource. |
Methods
| GetAtt(string) | Returns the value of an attribute of the custom resource of an arbitrary type. |
| GetAttString(string) | Returns the value of an attribute of the custom resource of type string. |
Constructors
CustomResource(Construct, string, ICustomResourceProps)
Instantiation of a custom resource, whose implementation is provided a Provider.
public CustomResource(Construct scope, string id, ICustomResourceProps props)
Parameters
- scope Construct
- id string
- props ICustomResourceProps
Remarks
This class is intended to be used by construct library authors. Application builder should not be able to tell whether or not a construct is backed by a custom resource, and so the use of this class should be invisible.
Instead, construct library authors declare a custom construct that hides the choice of provider, and accepts a strongly-typed properties object with the properties your provider accepts.
Your custom resource provider (identified by the serviceToken property)
can be one of 4 constructs:
Resource: AWS::CloudFormation::CustomResource
ExampleMetadata: infused
Examples
var stack = new Stack();
var durToken = new CfnParameter(stack, "MyParameter", new CfnParameterProps {
Type = "Number",
Default = 60
});
new CustomResource(stack, "MyCustomResource", new CustomResourceProps {
ServiceToken = "MyServiceToken",
ServiceTimeout = Duration.Seconds(durToken.ValueAsNumber)
});
Properties
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
This class is intended to be used by construct library authors. Application builder should not be able to tell whether or not a construct is backed by a custom resource, and so the use of this class should be invisible.
Instead, construct library authors declare a custom construct that hides the choice of provider, and accepts a strongly-typed properties object with the properties your provider accepts.
Your custom resource provider (identified by the serviceToken property)
can be one of 4 constructs:
Resource: AWS::CloudFormation::CustomResource
ExampleMetadata: infused
Ref
The physical name of this custom resource.
public virtual string Ref { get; }
Property Value
Remarks
This class is intended to be used by construct library authors. Application builder should not be able to tell whether or not a construct is backed by a custom resource, and so the use of this class should be invisible.
Instead, construct library authors declare a custom construct that hides the choice of provider, and accepts a strongly-typed properties object with the properties your provider accepts.
Your custom resource provider (identified by the serviceToken property)
can be one of 4 constructs:
Resource: AWS::CloudFormation::CustomResource
ExampleMetadata: infused
Methods
GetAtt(string)
Returns the value of an attribute of the custom resource of an arbitrary type.
public virtual Reference GetAtt(string attributeName)
Parameters
- attributeName string
the name of the attribute.
Returns
a token for Fn::GetAtt. Use Token.asXxx to encode the returned Reference as a specific type or
use the convenience getAttString for string attributes.
Remarks
Attributes are returned from the custom resource provider through the
Data map where the key is the attribute name.
GetAttString(string)
Returns the value of an attribute of the custom resource of type string.
public virtual string GetAttString(string attributeName)
Parameters
- attributeName string
the name of the attribute.
Returns
a token for Fn::GetAtt encoded as a string.
Remarks
Attributes are returned from the custom resource provider through the
Data map where the key is the attribute name.