Class CustomResourceProvider
An AWS-Lambda backed custom resource provider, for CDK Construct Library constructs.
Inherited Members
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CustomResourceProvider : CustomResourceProviderBase
Syntax (vb)
Public Class CustomResourceProvider
Inherits CustomResourceProviderBase
Remarks
This is a provider for CustomResource
constructs, backed by an AWS Lambda
Function. It only supports NodeJS runtimes.
Application builders do not need to use this provider type. This is not
a generic custom resource provider class. It is specifically
intended to be used only by constructs in the AWS CDK Construct Library, and
only exists here because of reverse dependency issues (for example, it cannot
use iam.PolicyStatement
objects, since the iam
library already depends on
the CDK core
library and we cannot have cyclic dependencies).
If you are not writing constructs for the AWS Construct Library, you should
use the Provider
class in the custom-resources
module instead, which has
a better API and supports all Lambda runtimes, not just Node.
N.B.: When you are writing Custom Resource Providers, there are a number of
lifecycle events you have to pay attention to. These are documented in the
README of the custom-resources
module. Be sure to give the documentation
in that module a read, regardless of whether you end up using the Provider
class in there or this one.
ExampleMetadata: infused
Examples
var provider = CustomResourceProvider.GetOrCreateProvider(this, "Custom::MyCustomResourceType", new CustomResourceProviderProps {
CodeDirectory = $"{__dirname}/my-handler",
Runtime = CustomResourceProviderRuntime.NODEJS_18_X
});
provider.AddToRolePolicy(new Dictionary<string, string> {
{ "Effect", "Allow" },
{ "Action", "s3:GetObject" },
{ "Resource", "*" }
});
Synopsis
Constructors
CustomResourceProvider(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CustomResourceProvider(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CustomResourceProvider(Construct, String, ICustomResourceProviderProps) |
Methods
GetOrCreate(Construct, String, ICustomResourceProviderProps) | Returns a stack-level singleton ARN (service token) for the custom resource provider. |
GetOrCreateProvider(Construct, String, ICustomResourceProviderProps) | Returns a stack-level singleton for the custom resource provider. |
Constructors
CustomResourceProvider(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CustomResourceProvider(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CustomResourceProvider(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CustomResourceProvider(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CustomResourceProvider(Construct, String, ICustomResourceProviderProps)
public CustomResourceProvider(Construct scope, string id, ICustomResourceProviderProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ICustomResourceProviderProps
Methods
GetOrCreate(Construct, String, ICustomResourceProviderProps)
Returns a stack-level singleton ARN (service token) for the custom resource provider.
public static string GetOrCreate(Construct scope, string uniqueid, ICustomResourceProviderProps props)
Parameters
- scope Constructs.Construct
Construct scope.
- uniqueid System.String
A globally unique id that will be used for the stack-level construct.
- props ICustomResourceProviderProps
Provider properties which will only be applied when the provider is first created.
Returns
System.String
the service token of the custom resource provider, which should be
used when defining a CustomResource
.
GetOrCreateProvider(Construct, String, ICustomResourceProviderProps)
Returns a stack-level singleton for the custom resource provider.
public static CustomResourceProvider GetOrCreateProvider(Construct scope, string uniqueid, ICustomResourceProviderProps props)
Parameters
- scope Constructs.Construct
Construct scope.
- uniqueid System.String
A globally unique id that will be used for the stack-level construct.
- props ICustomResourceProviderProps
Provider properties which will only be applied when the provider is first created.
Returns
the service token of the custom resource provider, which should be
used when defining a CustomResource
.