简体   繁体   English

多项操作 - AwsCustomResource.on.. 可能吗?

[英]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:我的问题是:

  1. Is it possible to override this deprecation?是否可以覆盖此弃用?
  2. If not, Is it possible to do multiple AwsSdkCalls without writing my own lambda functions?如果没有,是否可以在不编写我自己的 lambda 函数的情况下执行多个 AwsSdkCalls?
  3. If none from above, then maybe someone has an idea how can I use this simple solution of 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.

相关问题 Docker 推送(GitHub 操作)到 GCR 创建多个图像 - Docker push in (GitHub actions) to GCR creates multiple images 是否可以在没有任何用户操作的情况下动态更改 Alexa 技能显示的内容? - Is it possible to change contents dynamically which Alexa skill shows without any user actions? 是否可以一次将多个文件上传到gcp服务器 - Is it possible to upload multiple files into gcp server at a time 如何从 AwsCustomResource(服务:'SecretsManager',操作:'getSecretValue')返回的 SecretString 中获取值作为纯文本? - How to get a value from SecretString returned from AwsCustomResource (service: 'SecretsManager', action: 'getSecretValue') as plain text? Terraform:如何在部署期间对同一资源运行多个操作? - Terraform: how to run multiple actions on same resource during deployment? 是否可以通过多个条件/值查询 firebase-firestore 数据 - Is it possible to query firebase-firestore data by multiple criteria/values 是否可以在 Azure kube.netes 服务中实现多个接口 pod? - Is it possible to implement multiple interface pods in Azure kubernetes service? 可以创建策略并将策略共享到跨多个帐户的角色 - Possible to create a policy and share the policy to role across multiple accounts 是否可以生成允许上传多个唯一对象的单个预签名 URL? - Is it possible to generate a single presigned URL which can allow MULTIPLE unique objects to be uploaded? firebase 云 function 对文档执行多项操作时如何正确使用'return' - How to properly use 'return' in a firebase cloud function when performing multiple actions against documents
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM