[英]Multiple actions - AwsCustomResource.on.. Is it possible?
I've created a custom resource for creating a ThingType which is not yet implemented by AWS as simple CfnObjects.我创建了一个自定义资源,用于创建 AWS 尚未将其作为简单 CfnObject 实施的 ThingType。 My code looks like this:我的代码如下所示:
String physicalResIdThingType = "ThisISMyThing";
AwsCustomResource.Builder.create(this, "myThingType")
.onCreate(AwsSdkCall.builder()
.service("Iot")
.action("createThingType")
.physicalResourceId(PhysicalResourceId.of(physicalResIdThingType))
.parameters(new HashMap() {{
put("thingTypeName", "myThingType");
}})
.build())
.onDelete(AwsSdkCall.builder()
.service("Iot")
.action("deleteThingType")
.physicalResourceId(PhysicalResourceId.of(physicalResIdThingType))
.parameters(new HashMap() {{
put("thingTypeName", "myThingType");
}}).build()) .policy(AwsCustomResourcePolicy.fromSdkCalls(SdkCallsPolicyOptions.builder()
.resources(AwsCustomResourcePolicy.ANY_RESOURCE)
.build()))
.installLatestAwsSdk(false)
.resourceType(Consts.CUSTOM_RESOURCE_THING_TYPE)
.build();
It is creating well.它创造得很好。 but not allowing me to delete the thing type because I need first to deprecate it and then delete it.. In the console we need to wait even 5 minutes after deprecation for complete deletion.但不允许我删除事物类型,因为我需要先弃用它,然后再删除它。在控制台中,我们甚至需要在弃用后等待 5 分钟才能完全删除。
My questions are:我的问题是:
AwsCustomResource
to delete my thing type?如果上面没有,那么也许有人知道我如何使用AwsCustomResource
的这个简单解决方案来删除我的事物类型?I can only see one way to do it if you want the thing type to be deleted via cloudformation.如果您希望通过 cloudformation 删除事物类型,我只能看到一种方法。
You can configure the timeout-in-minutes
when call cloudformation crate-stack .您可以在调用cloudformation crate-stack时配置timeout-in-minutes
。 This value should be above than 5 minutes + extra buffer for the other resources to be deleted.此值应大于 5 分钟 + 用于删除其他资源的额外缓冲区。
When you receive a DELETE event in your custom resource, you can deprecate the thing type, wait 5min and call delete thing type.当您在自定义资源中收到 DELETE 事件时,您可以弃用该事物类型,等待 5 分钟并调用删除事物类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.