in src/integ_test_resources/ios/sdk/integration/cdk/cdk_integration_tests_ios/iot_stack.py [0:0]
def setup_iot_endpoint_provider(self):
describe_endpoint_policy = aws_iam.PolicyStatement(
effect=aws_iam.Effect.ALLOW,
actions=["iot:DescribeEndpoint"],
resources=["*"],
)
provider_lambda = aws_lambda.SingletonFunction(
self,
"iot_data_ats_endpoint_provider_lambda",
uuid="iot_data_ats_endpoint_provider_lambda_20200507150213",
runtime=aws_lambda.Runtime.PYTHON_3_7,
code=aws_lambda.Code.asset("custom_resources/iot_endpoint"),
handler="iot_endpoint_provider.on_event",
description="Returns iot:Data-ATS endpoint for this account",
current_version_options=aws_lambda.VersionOptions(
removal_policy=core.RemovalPolicy.DESTROY
),
initial_policy=[describe_endpoint_policy],
)
provider = custom_resources.Provider(
self, "iot_data_ats_endpoint_provider", on_event_handler=provider_lambda
)
iot_endpoint = core.CustomResource(
self,
"iot_data_ats_endpoint",
resource_type="Custom::IotDataAtsEndpoint",
service_token=provider.service_token,
)
endpoint_address = iot_endpoint.get_att("EndpointAddress").to_string()
self._parameters_to_save["iot_endpoint_address"] = endpoint_address