Documentation
¶
Index ¶
- func AwsCustomResourcePolicy_ANY_RESOURCE() *[]*string
- func AwsCustomResource_IsConstruct(x interface{}) *bool
- func AwsCustomResource_PROVIDER_FUNCTION_UUID() *string
- func NewAwsCustomResource_Override(a AwsCustomResource, scope constructs.Construct, id *string, ...)
- func NewPhysicalResourceIdReference_Override(p PhysicalResourceIdReference)
- func NewProvider_Override(p Provider, scope constructs.Construct, id *string, props *ProviderProps)
- func Provider_IsConstruct(x interface{}) *bool
- type AwsCustomResource
- type AwsCustomResourcePolicy
- type AwsCustomResourceProps
- type AwsSdkCall
- type PhysicalResourceId
- type PhysicalResourceIdReference
- type Provider
- type ProviderProps
- type SdkCallsPolicyOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AwsCustomResourcePolicy_ANY_RESOURCE ¶
func AwsCustomResourcePolicy_ANY_RESOURCE() *[]*string
func AwsCustomResource_IsConstruct ¶
func AwsCustomResource_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func AwsCustomResource_PROVIDER_FUNCTION_UUID ¶ added in v2.65.0
func AwsCustomResource_PROVIDER_FUNCTION_UUID() *string
func NewAwsCustomResource_Override ¶
func NewAwsCustomResource_Override(a AwsCustomResource, scope constructs.Construct, id *string, props *AwsCustomResourceProps)
func NewPhysicalResourceIdReference_Override ¶
func NewPhysicalResourceIdReference_Override(p PhysicalResourceIdReference)
func NewProvider_Override ¶
func NewProvider_Override(p Provider, scope constructs.Construct, id *string, props *ProviderProps)
func Provider_IsConstruct ¶
func Provider_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
Types ¶
type AwsCustomResource ¶
type AwsCustomResource interface {
constructs.Construct
awsiam.IGrantable
// The principal to grant permissions to.
GrantPrincipal() awsiam.IPrincipal
// The tree node.
Node() constructs.Node
// Returns response data for the AWS SDK call as string.
//
// 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.
GetResponseField(dataPath *string) *string
// Returns response data for the AWS SDK call.
//
// 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.
GetResponseFieldReference(dataPath *string) awscdk.Reference
// Returns a string representation of this construct.
ToString() *string
}
Defines a custom resource that is materialized using specific AWS API calls.
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.
Example:
getParameter := cr.NewAwsCustomResource(this, jsii.String("AssociateVPCWithHostedZone"), &AwsCustomResourceProps{
OnCreate: &AwsSdkCall{
AssumedRoleArn: jsii.String("arn:aws:iam::OTHERACCOUNT:role/CrossAccount/ManageHostedZoneConnections"),
Service: jsii.String("Route53"),
Action: jsii.String("AssociateVPCWithHostedZone"),
Parameters: map[string]interface{}{
"HostedZoneId": jsii.String("hz-123"),
"VPC": map[string]*string{
"VPCId": jsii.String("vpc-123"),
"VPCRegion": jsii.String("region-for-vpc"),
},
},
PhysicalResourceId: cr.PhysicalResourceId_Of(jsii.String("${vpcStack.SharedVpc.VpcId}-${vpcStack.Region}-${PrivateHostedZone.HostedZoneId}")),
},
//Will ignore any resource and use the assumedRoleArn as resource and 'sts:AssumeRole' for service:action
Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
}),
})
func NewAwsCustomResource ¶
func NewAwsCustomResource(scope constructs.Construct, id *string, props *AwsCustomResourceProps) AwsCustomResource
type AwsCustomResourcePolicy ¶
type AwsCustomResourcePolicy interface {
// resources for auto-generated from SDK calls.
Resources() *[]*string
// statements for explicit policy.
Statements() *[]awsiam.PolicyStatement
}
The IAM Policy that will be applied to the different calls.
Example:
getParameter := cr.NewAwsCustomResource(this, jsii.String("GetParameter"), &AwsCustomResourceProps{
OnUpdate: &AwsSdkCall{
// will also be called for a CREATE event
Service: jsii.String("SSM"),
Action: jsii.String("GetParameter"),
Parameters: map[string]interface{}{
"Name": jsii.String("my-parameter"),
"WithDecryption": jsii.Boolean(true),
},
PhysicalResourceId: cr.PhysicalResourceId_Of(date.now().toString()),
},
Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
}),
})
// Use the value in another construct with
getParameter.GetResponseField(jsii.String("Parameter.Value"))
func AwsCustomResourcePolicy_FromSdkCalls ¶
func AwsCustomResourcePolicy_FromSdkCalls(options *SdkCallsPolicyOptions) AwsCustomResourcePolicy
Generate IAM Policy Statements from the configured SDK calls.
Each SDK call with be translated to an IAM Policy Statement in the form of: `call.service:call.action` (e.g `s3:PutObject`).
This policy generator assumes the IAM policy name has the same name as the API call. This is true in 99% of cases, but there are exceptions (for example, S3's `PutBucketLifecycleConfiguration` requires `s3:PutLifecycleConfiguration` permissions, Lambda's `Invoke` requires `lambda:InvokeFunction` permissions). Use `fromStatements` if you want to do a call that requires different IAM action names.
func AwsCustomResourcePolicy_FromStatements ¶
func AwsCustomResourcePolicy_FromStatements(statements *[]awsiam.PolicyStatement) AwsCustomResourcePolicy
Explicit IAM Policy Statements.
type AwsCustomResourceProps ¶
type AwsCustomResourceProps struct {
// A name for the singleton Lambda function implementing this custom resource.
//
// The function name will remain the same after the first AwsCustomResource is created in a stack.
// Default: - AWS CloudFormation generates a unique physical ID and uses that
// ID for the function's name. For more information, see Name Type.
//
FunctionName *string `field:"optional" json:"functionName" yaml:"functionName"`
// Whether to install the latest AWS SDK v2.
//
// If not specified, this uses whatever JavaScript SDK version is the default in
// AWS Lambda at the time of execution.
//
// Otherwise, installs the latest version from 'npmjs.com'. The installation takes
// around 60 seconds and requires internet connectivity.
//
// The default can be controlled using the context key
// `@aws-cdk/customresources:installLatestAwsSdkDefault` is.
// Default: - The value of `@aws-cdk/customresources:installLatestAwsSdkDefault`, otherwise `true`.
//
InstallLatestAwsSdk *bool `field:"optional" json:"installLatestAwsSdk" yaml:"installLatestAwsSdk"`
// The number of days log events of the singleton Lambda function implementing this custom resource are kept in CloudWatch Logs.
// Default: logs.RetentionDays.INFINITE
//
LogRetention awslogs.RetentionDays `field:"optional" json:"logRetention" yaml:"logRetention"`
// The AWS SDK call to make when the resource is created.
// Default: - the call when the resource is updated.
//
OnCreate *AwsSdkCall `field:"optional" json:"onCreate" yaml:"onCreate"`
// The AWS SDK call to make when the resource is deleted.
// Default: - no call.
//
OnDelete *AwsSdkCall `field:"optional" json:"onDelete" yaml:"onDelete"`
// The AWS SDK call to make when the resource is updated.
// Default: - no call.
//
OnUpdate *AwsSdkCall `field:"optional" json:"onUpdate" yaml:"onUpdate"`
// The policy that will be added to the execution role of the Lambda function implementing this custom resource provider.
//
// The custom resource also implements `iam.IGrantable`, making it possible
// to use the `grantXxx()` methods.
//
// As this custom resource uses a singleton Lambda function, it's important
// to note the that function's role will eventually accumulate the
// permissions/grants from all resources.
//
// Note that a policy must be specified if `role` is not provided, as
// by default a new role is created which requires policy changes to access
// resources.
// See: Policy.fromSdkCalls
//
// Default: - no policy added.
//
Policy AwsCustomResourcePolicy `field:"optional" json:"policy" yaml:"policy"`
// The policy to apply when this resource is removed from the application.
// Default: cdk.RemovalPolicy.Destroy
//
RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"`
// Cloudformation Resource type.
// Default: - Custom::AWS.
//
ResourceType *string `field:"optional" json:"resourceType" yaml:"resourceType"`
// The execution role for the singleton Lambda function implementing this custom resource provider.
//
// This role will apply to all `AwsCustomResource`
// instances in the stack. The role must be assumable by the
// `lambda.amazonaws.com` service principal.
// Default: - a new role is created.
//
Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
// The timeout for the singleton Lambda function implementing this custom resource.
// Default: Duration.minutes(2)
//
Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
// The vpc to provision the lambda function in.
// Default: - the function is not provisioned inside a vpc.
//
Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"`
// Which subnets from the VPC to place the lambda function in.
//
// Only used if 'vpc' is supplied. Note: internet access for Lambdas
// requires a NAT gateway, so picking Public subnets is not allowed.
// Default: - the Vpc default strategy if not specified.
//
VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"`
}
Properties for AwsCustomResource.
Note that at least onCreate, onUpdate or onDelete must be specified.
Example:
getParameter := cr.NewAwsCustomResource(this, jsii.String("AssociateVPCWithHostedZone"), &AwsCustomResourceProps{
OnCreate: &AwsSdkCall{
AssumedRoleArn: jsii.String("arn:aws:iam::OTHERACCOUNT:role/CrossAccount/ManageHostedZoneConnections"),
Service: jsii.String("Route53"),
Action: jsii.String("AssociateVPCWithHostedZone"),
Parameters: map[string]interface{}{
"HostedZoneId": jsii.String("hz-123"),
"VPC": map[string]*string{
"VPCId": jsii.String("vpc-123"),
"VPCRegion": jsii.String("region-for-vpc"),
},
},
PhysicalResourceId: cr.PhysicalResourceId_Of(jsii.String("${vpcStack.SharedVpc.VpcId}-${vpcStack.Region}-${PrivateHostedZone.HostedZoneId}")),
},
//Will ignore any resource and use the assumedRoleArn as resource and 'sts:AssumeRole' for service:action
Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
}),
})
type AwsSdkCall ¶
type AwsSdkCall struct {
// The service action to call.
//
// This is the name of an AWS API call, in one of the following forms:
//
// - An API call name as found in the API Reference documentation (`GetObject`)
// - The API call name starting with a lowercase letter (`getObject`)
// - The AWS SDK for JavaScript v3 command class name (`GetObjectCommand`).
// See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html
//
Action *string `field:"required" json:"action" yaml:"action"`
// The service to call.
//
// This is the name of an AWS service, in one of the following forms:
//
// - An AWS SDK for JavaScript v3 package name (`@aws-sdk/client-api-gateway`)
// - An AWS SDK for JavaScript v3 client name (`api-gateway`)
// - An AWS SDK for JavaScript v2 constructor name (`APIGateway`)
// - A lowercase AWS SDK for JavaScript v2 constructor name (`apigateway`).
// See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html
//
Service *string `field:"required" json:"service" yaml:"service"`
// API version to use for the service.
// See: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/locking-api-versions.html
//
// Default: - use latest available API version.
//
ApiVersion *string `field:"optional" json:"apiVersion" yaml:"apiVersion"`
// Used for running the SDK calls in underlying lambda with a different role.
//
// Can be used primarily for cross-account requests to for example connect
// hostedzone with a shared vpc.
// Region controls where assumeRole call is made.
//
// Example for Route53 / associateVPCWithHostedZone.
// Default: - run without assuming role.
//
AssumedRoleArn *string `field:"optional" json:"assumedRoleArn" yaml:"assumedRoleArn"`
// The regex pattern to use to catch API errors.
//
// The `code` property of the
// `Error` object will be tested against this pattern. If there is a match an
// error will not be thrown.
// Default: - do not catch errors.
//
IgnoreErrorCodesMatching *string `field:"optional" json:"ignoreErrorCodesMatching" yaml:"ignoreErrorCodesMatching"`
// Restrict the data returned by the custom resource to specific paths in the API response.
//
// Use this to limit the data returned by the custom
// resource if working with API calls that could potentially result in custom
// response objects exceeding the hard limit of 4096 bytes.
//
// Example for ECS / updateService: ['service.deploymentConfiguration.maximumPercent']
// Default: - return all data.
//
OutputPaths *[]*string `field:"optional" json:"outputPaths" yaml:"outputPaths"`
// The parameters for the service action.
// See: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html
//
// Default: - no parameters.
//
Parameters interface{} `field:"optional" json:"parameters" yaml:"parameters"`
// The physical resource id of the custom resource for this call.
//
// Mandatory for onCreate call.
// In onUpdate, you can omit this to passthrough it from request.
// Default: - no physical resource id.
//
PhysicalResourceId PhysicalResourceId `field:"optional" json:"physicalResourceId" yaml:"physicalResourceId"`
// The region to send service requests to.
//
// **Note: Cross-region operations are generally considered an anti-pattern.**
// **Consider first deploying a stack in that region.**
// Default: - the region where this custom resource is deployed.
//
Region *string `field:"optional" json:"region" yaml:"region"`
}
An AWS SDK call.
Example:
cr.NewAwsCustomResource(this, jsii.String("GetParameterCustomResource"), &AwsCustomResourceProps{
OnUpdate: &AwsSdkCall{
// will also be called for a CREATE event
Service: jsii.String("SSM"),
Action: jsii.String("getParameter"),
Parameters: map[string]interface{}{
"Name": jsii.String("my-parameter"),
"WithDecryption": jsii.Boolean(true),
},
PhysicalResourceId: cr.PhysicalResourceId_FromResponse(jsii.String("Parameter.ARN")),
},
Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
}),
})
type PhysicalResourceId ¶
type PhysicalResourceId interface {
// Literal string to be used as the physical id.
Id() *string
// Path to a response data element to be used as the physical id.
ResponsePath() *string
}
Physical ID of the custom resource.
Example:
getParameter := cr.NewAwsCustomResource(this, jsii.String("AssociateVPCWithHostedZone"), &AwsCustomResourceProps{
OnCreate: &AwsSdkCall{
AssumedRoleArn: jsii.String("arn:aws:iam::OTHERACCOUNT:role/CrossAccount/ManageHostedZoneConnections"),
Service: jsii.String("Route53"),
Action: jsii.String("AssociateVPCWithHostedZone"),
Parameters: map[string]interface{}{
"HostedZoneId": jsii.String("hz-123"),
"VPC": map[string]*string{
"VPCId": jsii.String("vpc-123"),
"VPCRegion": jsii.String("region-for-vpc"),
},
},
PhysicalResourceId: cr.PhysicalResourceId_Of(jsii.String("${vpcStack.SharedVpc.VpcId}-${vpcStack.Region}-${PrivateHostedZone.HostedZoneId}")),
},
//Will ignore any resource and use the assumedRoleArn as resource and 'sts:AssumeRole' for service:action
Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
}),
})
func PhysicalResourceId_FromResponse ¶
func PhysicalResourceId_FromResponse(responsePath *string) PhysicalResourceId
Extract the physical resource id from the path (dot notation) to the data in the API call response.
func PhysicalResourceId_Of ¶
func PhysicalResourceId_Of(id *string) PhysicalResourceId
Explicit physical resource id.
type PhysicalResourceIdReference ¶
type PhysicalResourceIdReference interface {
awscdk.IResolvable
// The creation stack of this resolvable which will be appended to errors thrown during resolution.
//
// This may return an array with a single informational element indicating how
// to get this property populated, if it was skipped for performance reasons.
CreationStack() *[]*string
// Produce the Token's value at resolution time.
Resolve(_context awscdk.IResolveContext) interface{}
// toJSON serialization to replace `PhysicalResourceIdReference` with a magic string.
ToJSON() *string
// Return a string representation of this resolvable object.
//
// Returns a reversible string representation.
ToString() *string
}
Reference to the physical resource id that can be passed to the AWS operation as a parameter.
Example:
awsCustom := cr.NewAwsCustomResource(this, jsii.String("aws-custom"), &AwsCustomResourceProps{
OnCreate: &AwsSdkCall{
Service: jsii.String("..."),
Action: jsii.String("..."),
Parameters: map[string]*string{
"text": jsii.String("..."),
},
PhysicalResourceId: cr.PhysicalResourceId_Of(jsii.String("...")),
},
OnUpdate: &AwsSdkCall{
Service: jsii.String("..."),
Action: jsii.String("..."),
Parameters: map[string]interface{}{
"text": jsii.String("..."),
"resourceId": cr.NewPhysicalResourceIdReference(),
},
},
Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
}),
})
func NewPhysicalResourceIdReference ¶
func NewPhysicalResourceIdReference() PhysicalResourceIdReference
type Provider ¶
type Provider interface {
constructs.Construct
// The user-defined AWS Lambda function which is invoked asynchronously in order to determine if the operation is complete.
IsCompleteHandler() awslambda.IFunction
// The tree node.
Node() constructs.Node
// The user-defined AWS Lambda function which is invoked for all resource lifecycle operations (CREATE/UPDATE/DELETE).
OnEventHandler() awslambda.IFunction
// The service token to use in order to define custom resources that are backed by this provider.
ServiceToken() *string
// Returns a string representation of this construct.
ToString() *string
}
Defines an AWS CloudFormation custom resource provider.
Example:
var onEvent function
var isComplete function
var myRole role
myProvider := cr.NewProvider(this, jsii.String("MyProvider"), &ProviderProps{
OnEventHandler: onEvent,
IsCompleteHandler: isComplete,
LogRetention: logs.RetentionDays_ONE_DAY,
Role: myRole,
ProviderFunctionName: jsii.String("the-lambda-name"),
})
func NewProvider ¶
func NewProvider(scope constructs.Construct, id *string, props *ProviderProps) Provider
type ProviderProps ¶
type ProviderProps struct {
// The AWS Lambda function to invoke for all resource lifecycle operations (CREATE/UPDATE/DELETE).
//
// This function is responsible to begin the requested resource operation
// (CREATE/UPDATE/DELETE) and return any additional properties to add to the
// event, which will later be passed to `isComplete`. The `PhysicalResourceId`
// property must be included in the response.
OnEventHandler awslambda.IFunction `field:"required" json:"onEventHandler" yaml:"onEventHandler"`
// The AWS Lambda function to invoke in order to determine if the operation is complete.
//
// This function will be called immediately after `onEvent` and then
// periodically based on the configured query interval as long as it returns
// `false`. If the function still returns `false` and the alloted timeout has
// passed, the operation will fail.
// Default: - provider is synchronous. This means that the `onEvent` handler
// is expected to finish all lifecycle operations within the initial invocation.
//
IsCompleteHandler awslambda.IFunction `field:"optional" json:"isCompleteHandler" yaml:"isCompleteHandler"`
// The number of days framework log events are kept in CloudWatch Logs.
//
// When
// updating this property, unsetting it doesn't remove the log retention policy.
// To remove the retention policy, set the value to `INFINITE`.
// Default: logs.RetentionDays.INFINITE
//
LogRetention awslogs.RetentionDays `field:"optional" json:"logRetention" yaml:"logRetention"`
// AWS KMS key used to encrypt provider lambda's environment variables.
// Default: - AWS Lambda creates and uses an AWS managed customer master key (CMK).
//
ProviderFunctionEnvEncryption awskms.IKey `field:"optional" json:"providerFunctionEnvEncryption" yaml:"providerFunctionEnvEncryption"`
// Provider Lambda name.
//
// The provider lambda function name.
// Default: - CloudFormation default name from unique physical ID.
//
ProviderFunctionName *string `field:"optional" json:"providerFunctionName" yaml:"providerFunctionName"`
// Time between calls to the `isComplete` handler which determines if the resource has been stabilized.
//
// The first `isComplete` will be called immediately after `handler` and then
// every `queryInterval` seconds, and until `timeout` has been reached or until
// `isComplete` returns `true`.
// Default: Duration.seconds(5)
//
QueryInterval awscdk.Duration `field:"optional" json:"queryInterval" yaml:"queryInterval"`
// AWS Lambda execution role.
//
// The role that will be assumed by the AWS Lambda.
// Must be assumable by the 'lambda.amazonaws.com' service principal.
// Default: - A default role will be created.
//
Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
// Security groups to attach to the provider functions.
//
// Only used if 'vpc' is supplied.
// Default: - If `vpc` is not supplied, no security groups are attached. Otherwise, a dedicated security
// group is created for each function.
//
SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"`
// Total timeout for the entire operation.
//
// The maximum timeout is 1 hour (yes, it can exceed the AWS Lambda 15 minutes).
// Default: Duration.minutes(30)
//
TotalTimeout awscdk.Duration `field:"optional" json:"totalTimeout" yaml:"totalTimeout"`
// The vpc to provision the lambda functions in.
// Default: - functions are not provisioned inside a vpc.
//
Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"`
// Which subnets from the VPC to place the lambda functions in.
//
// Only used if 'vpc' is supplied. Note: internet access for Lambdas
// requires a NAT gateway, so picking Public subnets is not allowed.
// Default: - the Vpc default strategy if not specified.
//
VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"`
}
Initialization properties for the `Provider` construct.
Example:
var onEvent function
var isComplete function
var myRole role
myProvider := cr.NewProvider(this, jsii.String("MyProvider"), &ProviderProps{
OnEventHandler: onEvent,
IsCompleteHandler: isComplete,
LogRetention: logs.RetentionDays_ONE_DAY,
Role: myRole,
ProviderFunctionName: jsii.String("the-lambda-name"),
})
type SdkCallsPolicyOptions ¶
type SdkCallsPolicyOptions struct {
// The resources that the calls will have access to.
//
// It is best to use specific resource ARN's when possible. However, you can also use `AwsCustomResourcePolicy.ANY_RESOURCE`
// to allow access to all resources. For example, when `onCreate` is used to create a resource which you don't
// know the physical name of in advance.
//
// Note that will apply to ALL SDK calls.
Resources *[]*string `field:"required" json:"resources" yaml:"resources"`
}
Options for the auto-generation of policies based on the configured SDK calls.
Example:
getParameter := cr.NewAwsCustomResource(this, jsii.String("GetParameter"), &AwsCustomResourceProps{
OnUpdate: &AwsSdkCall{
// will also be called for a CREATE event
Service: jsii.String("SSM"),
Action: jsii.String("GetParameter"),
Parameters: map[string]interface{}{
"Name": jsii.String("my-parameter"),
"WithDecryption": jsii.Boolean(true),
},
PhysicalResourceId: cr.PhysicalResourceId_Of(date.now().toString()),
},
Policy: cr.AwsCustomResourcePolicy_FromSdkCalls(&SdkCallsPolicyOptions{
Resources: cr.AwsCustomResourcePolicy_ANY_RESOURCE(),
}),
})
// Use the value in another construct with
getParameter.GetResponseField(jsii.String("Parameter.Value"))
Source Files
¶
- AwsCustomResource.go
- AwsCustomResourcePolicy.go
- AwsCustomResourcePolicy__checks.go
- AwsCustomResourceProps.go
- AwsCustomResource__checks.go
- AwsSdkCall.go
- PhysicalResourceId.go
- PhysicalResourceIdReference.go
- PhysicalResourceIdReference__checks.go
- PhysicalResourceId__checks.go
- Provider.go
- ProviderProps.go
- Provider__checks.go
- SdkCallsPolicyOptions.go
- main.go