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
Syntax (vb)
Public Class CustomResource
Inherits Resource
Implements IResource
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 serviceToken = CustomResourceProvider.GetOrCreate(this, "Custom::MyCustomResourceType", new CustomResourceProviderProps {
CodeDirectory = $"{__dirname}/my-handler",
Runtime = CustomResourceProviderRuntime.NODEJS_18_X,
Description = "Lambda function created by the custom resource provider"
});
new CustomResource(this, "MyResource", new CustomResourceProps {
ResourceType = "Custom::MyCustomResourceType",
ServiceToken = serviceToken
});
Synopsis
Constructors
CustomResource(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CustomResource(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CustomResource(Construct, String, ICustomResourceProps) |
Properties
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(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CustomResource(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CustomResource(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CustomResource(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CustomResource(Construct, String, ICustomResourceProps)
public CustomResource(Construct scope, string id, ICustomResourceProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ICustomResourceProps
Properties
Ref
The physical name of this custom resource.
public virtual string Ref { get; }
Property Value
System.String
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 System.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 System.String
the name of the attribute.
Returns
System.String
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.