-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbootstrap_resources.py
47 lines (40 loc) · 1.58 KB
/
bootstrap_resources.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may
# not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is distributed
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
"""Declares the structure of the bootstrapped resources and provides a loader
for them.
"""
from dataclasses import dataclass
from acktest.bootstrapping import Resources
from acktest.bootstrapping.s3 import Bucket
from acktest.bootstrapping.dynamodb import Table
from acktest.bootstrapping.signer import SigningProfile
from acktest.bootstrapping.sqs import Queue
from acktest.bootstrapping.iam import Role
from e2e import bootstrap_directory
@dataclass
class BootstrapResources(Resources):
FunctionsBucket: Bucket
SigningProfile: SigningProfile
BasicRole: Role
ESMRole: Role
ESMTable: Table
ESMQueue: Queue
EICRole: Role
EICQueueOnSuccess: Queue
EICQueueOnFailure: Queue
_bootstrap_resources = None
def get_bootstrap_resources(bootstrap_file_name: str = "bootstrap.pkl") -> BootstrapResources:
global _bootstrap_resources
if _bootstrap_resources is None:
_bootstrap_resources = BootstrapResources.deserialize(bootstrap_directory, bootstrap_file_name=bootstrap_file_name)
return _bootstrap_resources