Class AwsCustomResource
Defines a custom resource that is materialized using specific AWS API calls.
Inheritance
Implements
Namespace: Amazon.CDK.CustomResources
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class AwsCustomResource : Construct, IGrantable
Syntax (vb)
Public Class AwsCustomResource
Inherits Construct
Implements IGrantable
Remarks
These calls are created using a singleton Lambda function.
Use this to bridge any gap that might exist in the CloudFormation Coverage. You can specify exactly which calls are invoked for the 'CREATE', 'UPDATE' and 'DELETE' life cycle events.
ExampleMetadata: infused
Examples
var getParameter = new AwsCustomResource(this, "GetParameter", new AwsCustomResourceProps {
OnUpdate = new AwsSdkCall { // will also be called for a CREATE event
Service = "SSM",
Action = "GetParameter",
Parameters = new Dictionary<string, object> {
{ "Name", "my-parameter" },
{ "WithDecryption", true }
},
PhysicalResourceId = PhysicalResourceId.Of(Date.Now().ToString()) },
Policy = AwsCustomResourcePolicy.FromSdkCalls(new SdkCallsPolicyOptions {
Resources = AwsCustomResourcePolicy.ANY_RESOURCE
})
});
// Use the value in another construct with
getParameter.GetResponseField("Parameter.Value");
Synopsis
Constructors
AwsCustomResource(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
AwsCustomResource(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
AwsCustomResource(Construct, String, IAwsCustomResourceProps) |
Properties
GrantPrincipal | The principal to grant permissions to. |
PROVIDER_FUNCTION_UUID | The uuid of the custom resource provider singleton lambda function. |
Methods
GetResponseField(String) | Returns response data for the AWS SDK call as string. |
GetResponseFieldReference(String) | Returns response data for the AWS SDK call. |
Constructors
AwsCustomResource(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected AwsCustomResource(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
AwsCustomResource(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected AwsCustomResource(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
AwsCustomResource(Construct, String, IAwsCustomResourceProps)
public AwsCustomResource(Construct scope, string id, IAwsCustomResourceProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IAwsCustomResourceProps
Properties
GrantPrincipal
The principal to grant permissions to.
public virtual IPrincipal GrantPrincipal { get; }
Property Value
PROVIDER_FUNCTION_UUID
The uuid of the custom resource provider singleton lambda function.
public static string PROVIDER_FUNCTION_UUID { get; }
Property Value
System.String
Methods
GetResponseField(String)
Returns response data for the AWS SDK call as string.
public virtual string GetResponseField(string dataPath)
Parameters
- dataPath System.String
the path to the data.
Returns
System.String
Remarks
Example for S3 / listBucket : 'Buckets.0.Name'
Note that you cannot use this method if ignoreErrorCodesMatching
is configured for any of the SDK calls. This is because in such a case,
the response data might not exist, and will cause a CloudFormation deploy time error.
GetResponseFieldReference(String)
Returns response data for the AWS SDK call.
public virtual Reference GetResponseFieldReference(string dataPath)
Parameters
- dataPath System.String
the path to the data.
Returns
Remarks
Example for S3 / listBucket : 'Buckets.0.Name'
Use Token.asXxx
to encode the returned Reference
as a specific type or
use the convenience getDataString
for string attributes.
Note that you cannot use this method if ignoreErrorCodesMatching
is configured for any of the SDK calls. This is because in such a case,
the response data might not exist, and will cause a CloudFormation deploy time error.