-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* handle case with no webui * made region generci for china * added PR number * fix backwards compatibility for CR * fixed redeploy-containers to work with china * incremented version number * remove use of grep due to difference in OS version * updated python to 3.9 * improved name of function * added explanation * added negative test * fix syntax error * rule to check region supports Cognito * fixed typo Co-authored-by: Matteo Figus <matteofigus@gmail.com>
- Loading branch information
1 parent
e0d9478
commit 3e9d797
Showing
22 changed files
with
462 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
############################################################# | ||
# This Custom Resource is required since VPC Endpoint names # | ||
# and subnets are not consistant in the China region # | ||
############################################################# | ||
|
||
import boto3 | ||
from crhelper import CfnResource | ||
from decorators import with_logging | ||
|
||
helper = CfnResource(json_logging=False, log_level="DEBUG", boto_level="CRITICAL") | ||
|
||
ec2_client = boto3.client("ec2") | ||
|
||
|
||
@with_logging | ||
@helper.create | ||
@helper.update | ||
def create(event, context): | ||
props = event.get("ResourceProperties", None) | ||
service_name = props.get("ServiceName") | ||
subnet_ids = props.get("SubnetIds") | ||
vpc_endpoint_type = props.get("VpcEndpointType") | ||
describe_subnets = ec2_client.describe_subnets(SubnetIds=subnet_ids) | ||
subnet_dict = { | ||
s["AvailabilityZone"]: s["SubnetId"] for s in describe_subnets["Subnets"] | ||
} | ||
endpoint_service = ec2_client.describe_vpc_endpoint_services( | ||
Filters=[ | ||
{"Name": "service-name", "Values": [f"cn.{service_name}", service_name]}, | ||
{"Name": "service-type", "Values": [vpc_endpoint_type]}, | ||
] | ||
) | ||
service_details = endpoint_service["ServiceDetails"][0] | ||
helper.Data["ServiceName"] = service_details["ServiceName"] | ||
return ",".join([subnet_dict[s] for s in service_details["AvailabilityZones"]]) | ||
|
||
|
||
@with_logging | ||
@helper.delete | ||
def delete(event, context): | ||
return None | ||
|
||
|
||
def handler(event, context): | ||
helper(event, context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.