playground-ls-cli 4.14.1.dev8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. localstack_cli/__init__.py +0 -0
  2. localstack_cli/cli/__init__.py +10 -0
  3. localstack_cli/cli/console.py +11 -0
  4. localstack_cli/cli/core_plugin.py +12 -0
  5. localstack_cli/cli/exceptions.py +19 -0
  6. localstack_cli/cli/localstack.py +951 -0
  7. localstack_cli/cli/lpm.py +138 -0
  8. localstack_cli/cli/main.py +22 -0
  9. localstack_cli/cli/plugin.py +39 -0
  10. localstack_cli/cli/plugins.py +134 -0
  11. localstack_cli/cli/profiles.py +65 -0
  12. localstack_cli/config.py +1689 -0
  13. localstack_cli/constants.py +165 -0
  14. localstack_cli/logging/__init__.py +0 -0
  15. localstack_cli/logging/format.py +194 -0
  16. localstack_cli/logging/setup.py +142 -0
  17. localstack_cli/packages/__init__.py +25 -0
  18. localstack_cli/packages/api.py +418 -0
  19. localstack_cli/packages/core.py +416 -0
  20. localstack_cli/pro/__init__.py +0 -0
  21. localstack_cli/pro/core/__init__.py +0 -0
  22. localstack_cli/pro/core/bootstrap/__init__.py +1 -0
  23. localstack_cli/pro/core/bootstrap/auth.py +213 -0
  24. localstack_cli/pro/core/bootstrap/dns_utils.py +55 -0
  25. localstack_cli/pro/core/bootstrap/entitlements.py +117 -0
  26. localstack_cli/pro/core/bootstrap/extensions/__init__.py +3 -0
  27. localstack_cli/pro/core/bootstrap/extensions/__main__.py +106 -0
  28. localstack_cli/pro/core/bootstrap/extensions/autoinstall.py +63 -0
  29. localstack_cli/pro/core/bootstrap/extensions/bootstrap.py +97 -0
  30. localstack_cli/pro/core/bootstrap/extensions/repository.py +374 -0
  31. localstack_cli/pro/core/bootstrap/licensingv2.py +1259 -0
  32. localstack_cli/pro/core/bootstrap/pods/__init__.py +0 -0
  33. localstack_cli/pro/core/bootstrap/pods/api_types.py +17 -0
  34. localstack_cli/pro/core/bootstrap/pods/constants.py +26 -0
  35. localstack_cli/pro/core/bootstrap/pods/remotes/__init__.py +0 -0
  36. localstack_cli/pro/core/bootstrap/pods/remotes/api.py +75 -0
  37. localstack_cli/pro/core/bootstrap/pods/remotes/configs.py +69 -0
  38. localstack_cli/pro/core/bootstrap/pods/remotes/params.py +86 -0
  39. localstack_cli/pro/core/bootstrap/pods_client.py +834 -0
  40. localstack_cli/pro/core/cli/__init__.py +0 -0
  41. localstack_cli/pro/core/cli/auth.py +226 -0
  42. localstack_cli/pro/core/cli/aws.py +16 -0
  43. localstack_cli/pro/core/cli/cli.py +99 -0
  44. localstack_cli/pro/core/cli/click_utils.py +21 -0
  45. localstack_cli/pro/core/cli/cloud_pods.py +465 -0
  46. localstack_cli/pro/core/cli/diff_view.py +41 -0
  47. localstack_cli/pro/core/cli/ephemeral.py +199 -0
  48. localstack_cli/pro/core/cli/extensions.py +492 -0
  49. localstack_cli/pro/core/cli/iam.py +180 -0
  50. localstack_cli/pro/core/cli/license.py +90 -0
  51. localstack_cli/pro/core/cli/localstack.py +118 -0
  52. localstack_cli/pro/core/cli/replicator.py +378 -0
  53. localstack_cli/pro/core/cli/state.py +183 -0
  54. localstack_cli/pro/core/cli/tree_view.py +235 -0
  55. localstack_cli/pro/core/config.py +556 -0
  56. localstack_cli/pro/core/constants.py +54 -0
  57. localstack_cli/pro/core/plugins.py +169 -0
  58. localstack_cli/runtime/__init__.py +6 -0
  59. localstack_cli/runtime/exceptions.py +7 -0
  60. localstack_cli/runtime/hooks.py +73 -0
  61. localstack_cli/testing/__init__.py +1 -0
  62. localstack_cli/testing/config.py +4 -0
  63. localstack_cli/utils/__init__.py +0 -0
  64. localstack_cli/utils/analytics/__init__.py +12 -0
  65. localstack_cli/utils/analytics/cli.py +67 -0
  66. localstack_cli/utils/analytics/client.py +111 -0
  67. localstack_cli/utils/analytics/events.py +30 -0
  68. localstack_cli/utils/analytics/logger.py +48 -0
  69. localstack_cli/utils/analytics/metadata.py +250 -0
  70. localstack_cli/utils/analytics/publisher.py +160 -0
  71. localstack_cli/utils/analytics/service_request_aggregator.py +133 -0
  72. localstack_cli/utils/archives.py +271 -0
  73. localstack_cli/utils/batching.py +258 -0
  74. localstack_cli/utils/bootstrap.py +1418 -0
  75. localstack_cli/utils/checksum.py +313 -0
  76. localstack_cli/utils/collections.py +554 -0
  77. localstack_cli/utils/common.py +229 -0
  78. localstack_cli/utils/container_networking.py +142 -0
  79. localstack_cli/utils/container_utils/__init__.py +0 -0
  80. localstack_cli/utils/container_utils/container_client.py +1585 -0
  81. localstack_cli/utils/container_utils/docker_cmd_client.py +987 -0
  82. localstack_cli/utils/container_utils/docker_sdk_client.py +1018 -0
  83. localstack_cli/utils/crypto.py +294 -0
  84. localstack_cli/utils/docker_utils.py +272 -0
  85. localstack_cli/utils/files.py +327 -0
  86. localstack_cli/utils/functions.py +92 -0
  87. localstack_cli/utils/http.py +326 -0
  88. localstack_cli/utils/json.py +219 -0
  89. localstack_cli/utils/net.py +516 -0
  90. localstack_cli/utils/no_exit_argument_parser.py +19 -0
  91. localstack_cli/utils/numbers.py +49 -0
  92. localstack_cli/utils/objects.py +235 -0
  93. localstack_cli/utils/patch.py +260 -0
  94. localstack_cli/utils/platform.py +77 -0
  95. localstack_cli/utils/run.py +514 -0
  96. localstack_cli/utils/server/__init__.py +0 -0
  97. localstack_cli/utils/server/tcp_proxy.py +108 -0
  98. localstack_cli/utils/serving.py +187 -0
  99. localstack_cli/utils/ssl.py +71 -0
  100. localstack_cli/utils/strings.py +245 -0
  101. localstack_cli/utils/sync.py +267 -0
  102. localstack_cli/utils/threads.py +163 -0
  103. localstack_cli/utils/time.py +81 -0
  104. localstack_cli/utils/urls.py +21 -0
  105. localstack_cli/utils/venv.py +100 -0
  106. localstack_cli/utils/xml.py +41 -0
  107. localstack_cli/version.py +34 -0
  108. playground_ls_cli-4.14.1.dev8.dist-info/METADATA +95 -0
  109. playground_ls_cli-4.14.1.dev8.dist-info/RECORD +112 -0
  110. playground_ls_cli-4.14.1.dev8.dist-info/WHEEL +5 -0
  111. playground_ls_cli-4.14.1.dev8.dist-info/entry_points.txt +17 -0
  112. playground_ls_cli-4.14.1.dev8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,556 @@
1
+ import os
2
+ from typing import Literal
3
+
4
+ from localstack_cli import config as localstack_config
5
+ from localstack_cli import constants as localstack_constants
6
+ from localstack_cli.config import is_env_true
7
+ from localstack_cli.utils.urls import localstack_host
8
+
9
+ FALSE_STRINGS = localstack_constants.FALSE_STRINGS
10
+
11
+ ROOT_FOLDER = os.path.realpath(
12
+ os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "..")
13
+ )
14
+
15
+ # list of folders (within the localstack.pro.core or localstack.pro.azure module) which are *not* protected
16
+ # i.e., published unencrypted
17
+ UNPROTECTED_FOLDERS = ["aws", "bootstrap", "cli", "packages", "testing"]
18
+ # list of filenames (within the localstack.pro.core module) which are *not* protected (i.e., published unencrypted)
19
+ UNPROTECTED_FILES = [
20
+ "__init__.py",
21
+ "plugins.py",
22
+ "packages.py",
23
+ "localstack-pro-core/localstack/pro/core/runtime/plugin/api.py",
24
+ # the `alembic` folder is used by AppInspector to run migrations, it has a very specific file loading framework
25
+ "*/appinspector/database/alembic/*",
26
+ ]
27
+
28
+ # api server config
29
+ API_URL = localstack_constants.API_ENDPOINT
30
+
31
+ # localhost IP address and hostname
32
+ LOCALHOST_IP = "127.0.0.1"
33
+
34
+ # base domain name used for endpoints of created resources (e.g., CloudFront distributions)
35
+ RESOURCES_BASE_DOMAIN_NAME = (
36
+ os.environ.get("RESOURCES_BASE_DOMAIN_NAME", "").strip() or localstack_host().host
37
+ )
38
+
39
+ # Product Entitlement (ProductInfo) data to consider in the DevLocalstackEnvironment
40
+ # This is useful to check the functionality of non-boolean features (e.g., limit features)
41
+ DEV_PRODUCT_ENTITLEMENTS_LIST = os.environ.get("DEV_PRODUCT_ENTITLEMENTS_LIST", "").strip()
42
+ # Whether to allow all features in the DevLocalstackEnvironment or only the ones listed in DEV_FEATURE_ENTITLEMENT_LIST
43
+ DEV_PRODUCT_ENTITLEMENTS_ALLOW_ALL = localstack_config.is_env_not_false(
44
+ "DEV_PRODUCT_ENTITLEMENTS_ALLOW_ALL"
45
+ )
46
+
47
+ # SMTP settings (required, e.g., for Cognito)
48
+ SMTP_HOST = os.environ.get("SMTP_HOST", "")
49
+ SMTP_USER = os.environ.get("SMTP_USER", "")
50
+ SMTP_PASS = os.environ.get("SMTP_PASS", "")
51
+ SMTP_EMAIL = os.environ.get("SMTP_EMAIL", "")
52
+
53
+ # whether to transparently set the target endpoint (by passing $AWS_ENDPOINT_URL) in
54
+ # AWS SDK clients used in user code (e.g., Lambdas). default: true
55
+ TRANSPARENT_LOCAL_ENDPOINTS = localstack_config.is_env_not_false("TRANSPARENT_LOCAL_ENDPOINTS")
56
+
57
+ # whether to disable transparent endpoint injection or not
58
+ DISABLE_TRANSPARENT_ENDPOINT_INJECTION = localstack_config.is_env_true(
59
+ "DISABLE_TRANSPARENT_ENDPOINT_INJECTION"
60
+ )
61
+
62
+ # custom names to resolve to the LocalStack container
63
+ # Note: we don't expose this in community as people could implement TEI with this method
64
+ DNS_NAMES_RESOLVING_TO_LOCALSTACK = os.environ.get("DNS_NAMES_RESOLVING_TO_LOCALSTACK")
65
+
66
+ # whether to enforce IAM policies when processing requests
67
+ ENFORCE_IAM = localstack_config.is_env_true("ENFORCE_IAM")
68
+ IAM_SOFT_MODE = localstack_config.is_env_true("IAM_SOFT_MODE")
69
+
70
+ # endpoint URL for kube cluster (defaults to https://<docker_bridge_ip>:6443)
71
+ KUBE_ENDPOINT = os.environ.get("KUBE_ENDPOINT", "")
72
+
73
+ # toggle developer mode for extensions
74
+ EXTENSION_DEV_MODE = localstack_config.is_env_true("EXTENSION_DEV_MODE")
75
+
76
+ # List of extensions that should be installed when localstack starts
77
+ EXTENSION_AUTO_INSTALL: list[str] = [
78
+ e.strip() for e in (os.environ.get("EXTENSION_AUTO_INSTALL") or "").split(",") if e.strip()
79
+ ]
80
+
81
+ # ---
82
+ # service-specific configurations
83
+ # ---
84
+
85
+ # the endpoint strategy for AppSync GraphQL endpoints
86
+ GRAPHQL_ENDPOINT_STRATEGY: Literal["legacy", "domain", "path"] = (
87
+ os.environ.get("GRAPHQL_ENDPOINT_STRATEGY", "") or "legacy"
88
+ )
89
+
90
+ # PUBLIC: 1 (default, pro) Only applies to new lambda provider.
91
+ # Whether to download public Lambda layers from AWS through a LocalStack proxy when creating or updating functions.
92
+ LAMBDA_DOWNLOAD_AWS_LAYERS = localstack_config.is_env_not_false("LAMBDA_DOWNLOAD_AWS_LAYERS")
93
+
94
+ # PUBLIC: 0 (default, pro) Only applies to new lambda provider
95
+ # Whether to use java sdk v2 certificate validation disabling java agent
96
+ LAMBDA_DISABLE_JAVA_SDK_V2_CERTIFICATE_VALIDATION = localstack_config.is_env_not_false(
97
+ "LAMBDA_DISABLE_JAVA_SDK_V2_CERTIFICATE_VALIDATION"
98
+ )
99
+
100
+ # Temporary feature flag to enable the latest LDM features:
101
+ # - LDM endpoint
102
+ # - automatic debug-wrapper scripts injection
103
+ # - user-agent based redirects
104
+ LDM_PREVIEW = localstack_config.is_env_not_false("LDM_PREVIEW")
105
+
106
+ # PUBLIC: amazon/aws-lambda- (default, pro)
107
+ # Prefix for images that will be used to execute Lambda functions in Kubernetes.
108
+ LAMBDA_K8S_IMAGE_PREFIX = os.environ.get("LAMBDA_K8S_IMAGE_PREFIX") or "amazon/aws-lambda-"
109
+
110
+ # PUBLIC: localstack (default, pro)
111
+ # Prefix for the Flink image that will be used to run kinesisanalyticsv2
112
+ KINESISANALYTICSV2_IMAGE = os.environ.get("KINESISANALYTICSV2_IMAGE") or "localstack/flink"
113
+
114
+ # Kubernetes pod labels. Will be added to all spawned pods
115
+ LOCALSTACK_K8S_LABELS = os.environ.get("LOCALSTACK_K8S_LABELS") or os.environ.get(
116
+ "LAMBDA_K8S_LABELS"
117
+ )
118
+
119
+ # Kubernetes pod annotations. Will be added to all spawned pods
120
+ LOCALSTACK_K8S_ANNOTATIONS = os.environ.get("LOCALSTACK_K8S_ANNOTATIONS")
121
+
122
+ # Kubernetes container security context. Will be set on all containers in all spawned pods
123
+ K8S_CONTAINER_SECURITY_CONTEXT = os.environ.get("K8S_CONTAINER_SECURITY_CONTEXT") or os.environ.get(
124
+ "LAMBDA_K8S_SECURITY_CONTEXT"
125
+ )
126
+
127
+ # K8S curl init image used to download files from LS into the LS pod, as init container
128
+ K8S_CURL_INIT_IMAGE = os.environ.get("K8S_CURL_INIT_IMAGE") or "curlimages/curl:8.16.0"
129
+
130
+ # Kubernetes init image used for downloading the init binary into the pod when using container lambdas
131
+ LAMBDA_K8S_INIT_IMAGE = os.environ.get("LAMBDA_K8S_INIT_IMAGE") or K8S_CURL_INIT_IMAGE
132
+
133
+ # Kubernetes namespace for Localstack resources
134
+ LOCALSTACK_K8S_NAMESPACE = os.environ.get("LOCALSTACK_K8S_NAMESPACE", "default")
135
+
136
+ # Comma-separated hosts for which pip won't verify SSL while installing packages within MWAA container.
137
+ # Useful for LocalStack sessions inside proxied networks which inject custom SSL certificates.
138
+ # eg. 'pypi.org,pythonhosted.org,files.pythonhosted.org'
139
+ MWAA_PIP_TRUSTED_HOSTS = os.environ.get("MWAA_PIP_TRUSTED_HOSTS")
140
+
141
+ # Frequency with which MWAA polls S3 bucket for DAGs, plugins, requirements file, etc.
142
+ MWAA_S3_POLL_INTERVAL = int(os.environ.get("MWAA_S3_POLL_INTERVAL", 30))
143
+
144
+ # Extra flags to pass in to the MWAA container when creating it
145
+ MWAA_DOCKER_FLAGS = os.environ.get("MWAA_DOCKER_FLAGS")
146
+
147
+ # Experimental feature flag for CloudFront Lambda@Edge
148
+ CLOUDFRONT_LAMBDA_EDGE = is_env_true("CLOUDFRONT_LAMBDA_EDGE")
149
+
150
+ # whether to use static ports and IDs (e.g., cf-<port>) for CloudFormation distributions
151
+ CLOUDFRONT_STATIC_PORTS = localstack_config.is_env_true("CLOUDFRONT_STATIC_PORTS")
152
+
153
+ # support preventing injecting AWS_ENDPOINT_URL into containers
154
+ ECS_DISABLE_AWS_ENDPOINT_URL = localstack_config.is_env_true("ECS_DISABLE_AWS_ENDPOINT_URL")
155
+
156
+ # additional flags passed to Docker engine when creating ECS task containers
157
+ ECS_DOCKER_FLAGS = os.environ.get("ECS_DOCKER_FLAGS", "").strip()
158
+
159
+ # fluentbit image repository used in the public SSM parameters in the path /aws/service/aws-for-fluent-bit
160
+ ECS_FLUENT_BIT_IMAGE_REPOSITORY = os.environ.get(
161
+ "ECS_FLUENT_BIT_IMAGE_REPOSITORY", "amazon/aws-for-fluent-bit"
162
+ ).strip()
163
+
164
+ # whether to remove task containers after execution
165
+ ECS_REMOVE_CONTAINERS = localstack_config.is_env_not_false("ECS_REMOVE_CONTAINERS")
166
+
167
+ # which task executor runtime to use
168
+ ECS_TASK_EXECUTOR = os.environ.get("ECS_TASK_EXECUTOR", localstack_config.CONTAINER_RUNTIME).strip()
169
+
170
+ # additional flags passed to Docker engine when creating Dockerised EC2 instances
171
+ EC2_DOCKER_FLAGS = os.environ.get("EC2_DOCKER_FLAGS", "")
172
+
173
+ # whether default Docker images are downloaded at provider startup which can be used as AMIs (default: True)
174
+ EC2_DOWNLOAD_DEFAULT_IMAGES = localstack_config.is_env_not_false("EC2_DOWNLOAD_DEFAULT_IMAGES")
175
+
176
+ # EC2 VM manager which is a supported hypervisor or container engine
177
+ EC2_VM_MANAGER = (
178
+ os.environ.get("EC2_VM_MANAGER", localstack_config.CONTAINER_RUNTIME).strip() or "docker"
179
+ )
180
+
181
+ # whether containers should be removed when EC2 instances are terminated or when LS shuts down (default: True)
182
+ EC2_REMOVE_CONTAINERS = localstack_config.is_env_not_false("EC2_REMOVE_CONTAINERS")
183
+
184
+ # start EC2 container instances with an init process by passing the `--init` to `docker run` (default: True)
185
+ EC2_DOCKER_INIT = localstack_config.is_env_not_false("EC2_DOCKER_INIT")
186
+
187
+ # Libvirt connection URI to use when hypervisor is remote
188
+ EC2_HYPERVISOR_URI = os.environ.get("EC2_HYPERVISOR_URI", "").strip() or "qemu:///system"
189
+
190
+ # Name of the Libvirt network to use for all domains
191
+ EC2_LIBVIRT_NETWORK = os.environ.get("EC2_LIBVIRT_NETWORK", "default").strip()
192
+
193
+ # Name of the Libvirt storage pool to use for base images
194
+ EC2_LIBVIRT_POOL = os.environ.get("EC2_LIBVIRT_POOL", "default").strip()
195
+
196
+ # Name of a shut-off Libvirt domain whose configuration LocalStack will clone for all instances
197
+ EC2_REFERENCE_DOMAIN = os.environ.get("EC2_REFERENCE_DOMAIN", "").strip()
198
+
199
+ # Flag to enable loading of DMS provider
200
+ ENABLE_DMS = localstack_config.is_env_true("ENABLE_DMS")
201
+
202
+ # simulated delay (in seconds) before the serverless replication config is deprovisioned (will reset the table stats)
203
+ DMS_SERVERLESS_DEPROVISIONING_DELAY = int(
204
+ os.environ.get("DMS_SERVERLESS_DEPROVISIONING_DELAY", "60").strip()
205
+ )
206
+
207
+ # simulated delay (in seconds) for status changes for serverless when calling `start-replication`
208
+ DMS_SERVERLESS_STATUS_CHANGE_WAITING_TIME = int(
209
+ os.environ.get("DMS_SERVERLESS_STATUS_CHANGE_WAITING_TIME", "0").strip()
210
+ )
211
+
212
+ # whether to return repositoryUris in the format `<account>.dkr.ecr.<region>.localhost.localstack.cloud`
213
+ # (if "domain", default) or just `localhost.localstack.cloud` (if "off")
214
+ ECR_ENDPOINT_STRATEGY = os.environ.get("ECR_ENDPOINT_STRATEGY", "") or "domain"
215
+
216
+ # Repository override for starting an K3S EKS cluster. Overrides the repository part of the used k3s image.
217
+ # The tag will either be dependent on the specified K8S version when creating the cluster, or on `EKS_K3S_IMAGE_TAG`
218
+ EKS_K3S_IMAGE_REPOSITORY = os.environ.get("EKS_K3S_IMAGE_REPOSITORY", "rancher/k3s")
219
+
220
+ # Tag override for starting an K3S EKS cluster. Overrides the tag part of the used k3s image.
221
+ EKS_K3S_IMAGE_TAG = os.environ.get("EKS_K3S_IMAGE_TAG", "").strip()
222
+
223
+ # Chosen EKS provider for the k8s implementation. Either "k3s" or "local".
224
+ EKS_K8S_PROVIDER = os.environ.get("EKS_K8S_PROVIDER", "") or "k3s"
225
+
226
+ # simulated delay (in seconds) for creating clusters in EKS mocked mode
227
+ EKS_MOCK_CREATE_CLUSTER_DELAY = int(os.environ.get("EKS_MOCK_CREATE_CLUSTER_DELAY", "0").strip())
228
+
229
+ # startup timeout for an EKS cluster
230
+ EKS_STARTUP_TIMEOUT = int(os.environ.get("EKS_STARTUP_TIMEOUT", "180").strip())
231
+
232
+ # Allow customisation of the k3s cluster
233
+ EKS_K3S_FLAGS = os.environ.get("EKS_K3S_FLAGS")
234
+
235
+ # Set EKS pod identity webhook image
236
+ EKS_POD_IDENTITY_WEBHOOK_IMAGE = (
237
+ os.environ.get("EKS_POD_IDENTITY_WEBHOOK_IMAGE")
238
+ or "localstack/amazon-eks-pod-identity-webhook:v0.6.7"
239
+ )
240
+
241
+ # Set EKS Velero image
242
+ EKS_VELERO_IMAGE = os.environ.get("EKS_VELERO_IMAGE") or "velero/velero:v1.17.0"
243
+
244
+ # Set EKS Velero plugin for aws image
245
+ EKS_VELERO_PLUGIN_AWS_IMAGE = (
246
+ os.environ.get("EKS_VELERO_PLUGIN_AWS_IMAGE") or "velero/velero-plugin-for-aws:v1.13.0"
247
+ )
248
+
249
+ # whether to automatically start Traefik in EKS K3D clusters
250
+ EKS_START_K3D_LB_INGRESS = localstack_config.is_env_true("EKS_START_K3D_LB_INGRESS")
251
+
252
+ # Whether to persist resources and data inside an eks cluster
253
+ EKS_PERSIST_CLUSTER_CONTENTS = localstack_config.is_env_true("EKS_PERSIST_CLUSTER_CONTENTS")
254
+
255
+ # Port where Hive/metastore/Spark are available for EMR/Athena
256
+ PORT_HIVE_METASTORE = int(os.getenv("PORT_HIVE_METASTORE") or 9083)
257
+ PORT_HIVE_SERVER = int(os.getenv("PORT_HIVE_SERVER") or 10000)
258
+ PORT_TRINO_SERVER = int(os.getenv("PORT_TRINO_SERVER") or 41983)
259
+ PORT_SPARK_MASTER = int(os.getenv("PORT_SPARK_MASTER") or 7077)
260
+ PORT_SPARK_UI = int(os.getenv("PORT_SPARK_UI") or 4040)
261
+
262
+ # option to force a hard-coded Spark version to be used for EMR jobs
263
+ EMR_SPARK_VERSION = str(os.getenv("EMR_SPARK_VERSION") or "").strip()
264
+
265
+ # whether to lazily install and spin up custom Postgres versions
266
+ RDS_PG_CUSTOM_VERSIONS = localstack_config.is_env_not_false("RDS_PG_CUSTOM_VERSIONS")
267
+
268
+ # override the default postgres max connections
269
+ RDS_PG_MAX_CONNECTIONS = int(os.getenv("RDS_PG_MAX_CONNECTIONS") or 0)
270
+
271
+ # whether official MySQL is supported, spins up a MySQL docker container
272
+ RDS_MYSQL_DOCKER = localstack_config.is_env_not_false("RDS_MYSQL_DOCKER")
273
+ # User and group id for the spawned RDS containers. Format: uid:gid
274
+ RDS_CONTAINER_USER_GROUP_ID = os.environ.get("RDS_CONTAINER_USER_GROUP_ID") or "1000:1000"
275
+
276
+ # whether Cluster Endpoints should return the hostname only
277
+ RDS_CLUSTER_ENDPOINT_HOST_ONLY = localstack_config.is_env_not_false(
278
+ "RDS_CLUSTER_ENDPOINT_HOST_ONLY"
279
+ )
280
+
281
+ # whether Cluster Endpoints should return the hostname only
282
+ RDS_CLUSTER_ENDPOINT_IP_BASED = localstack_config.is_env_true("RDS_CLUSTER_ENDPOINT_IP_BASED")
283
+
284
+ # whether to start redis instances (ElastiCache/MemoryDB) in separate containers
285
+ REDIS_CONTAINER_MODE = localstack_config.is_env_true("REDIS_CONTAINER_MODE")
286
+
287
+ # whether DocDB should use a proxied docker container for mongodb
288
+ DOCDB_PROXY_CONTAINER = localstack_config.is_env_true("DOCDB_PROXY_CONTAINER")
289
+
290
+ # whether we serve WebSockets through the Gateway with Rolo
291
+ # Beware! This cannot be used in conjunction of `PROVIDER_OVERRIDE_APIGATEWAY=legacy`, otherwise it does not do
292
+ # anything
293
+ APIGW_ENABLE_NEXT_GEN_WEBSOCKETS = localstack_config.is_env_true("APIGW_ENABLE_NEXT_GEN_WEBSOCKETS")
294
+
295
+ # whether to enable the NextGen invocation logic of WebSockets (full rework of the invocation logic)
296
+ # this is internal to enable testing of the ongoing work.
297
+ # needs to be used in conjunction with `APIGW_ENABLE_NEXT_GEN_WEBSOCKETS=1`
298
+ APIGW_ENABLE_NEXT_GEN_WEBSOCKETS_INVOCATION = localstack_config.is_env_true(
299
+ "APIGW_ENABLE_NEXT_GEN_WEBSOCKETS_INVOCATION"
300
+ )
301
+
302
+ # set the wait time of kubernetes for pod startup
303
+ K8S_WAIT_FOR_POD_READY_TIMEOUT = os.environ.get("K8S_WAIT_FOR_POD_READY_TIMEOUT", "")
304
+
305
+ # set the wait time for kubernetes deployment rollout
306
+ K8S_WAIT_FOR_DEPLOYMENT_READY_TIMEOUT = os.environ.get("K8S_WAIT_FOR_DEPLOYMENT_READY_TIMEOUT", "")
307
+
308
+ # set the wait time for kubernetes service to be ready
309
+ K8S_WAIT_FOR_SERVICE_READY_TIMEOUT = os.environ.get("K8S_WAIT_FOR_SERVICE_READY_TIMEOUT", "")
310
+
311
+ # CLI file path to the auth cache populated by `localstack auth`
312
+ AUTH_CACHE_PATH = os.path.join(localstack_config.CONFIG_DIR, "auth.json")
313
+
314
+ # Whether to automatically instrument SSL sockets with authomatically generated certificates
315
+ AUTO_SSL_CERTS = localstack_config.is_env_true("AUTO_SSL_CERTS")
316
+
317
+ # Flag to enable pre-warming the Bedrock engine when Bedrock is enabled
318
+ BEDROCK_PREWARM = localstack_config.is_env_true("BEDROCK_PREWARM")
319
+
320
+ # Default model to use in Ollama
321
+ DEFAULT_BEDROCK_MODEL = os.environ.get("DEFAULT_BEDROCK_MODEL", "smollm2:360m").strip()
322
+
323
+ # Models that get downloaded and cached by the Ollama service
324
+ BEDROCK_PULL_MODELS = {
325
+ model.strip() for model in os.environ.get("BEDROCK_PULL_MODELS", "").split(",") if model.strip()
326
+ } | {DEFAULT_BEDROCK_MODEL}
327
+
328
+ # Glue job executor to use
329
+ GLUE_JOB_EXECUTOR = os.environ.get("GLUE_JOB_EXECUTOR") or localstack_config.CONTAINER_RUNTIME
330
+ GLUE_JOB_EXECUTOR_PROVIDER = os.environ.get("GLUE_JOB_EXECUTOR_PROVIDER", "v2").strip()
331
+
332
+
333
+ def is_auth_token_set_in_cache() -> bool:
334
+ """Whether the LOCALSTACK_AUTH_TOKEN was set via the `localstack auth` method. CLI-specific method."""
335
+ # FIXME: it would probably be better to have some basic abstractions for auth token and credentials that
336
+ # are defined in bootstrap.auth and bootstrap.licensingv2 already in the config, then we could
337
+ # consolidate some of the code. until then, we need to do this "lightweight" parsing of the auth cache
338
+ # file.
339
+
340
+ if not os.path.isfile(AUTH_CACHE_PATH):
341
+ return False
342
+
343
+ try:
344
+ import json
345
+
346
+ with open(AUTH_CACHE_PATH, "rb") as fd:
347
+ if json.load(fd).get("LOCALSTACK_AUTH_TOKEN"):
348
+ return True
349
+ except Exception:
350
+ pass
351
+
352
+ return False
353
+
354
+
355
+ def is_auth_token_configured() -> bool:
356
+ """Whether an API key is set in the environment."""
357
+ # TODO: this method is too general for it's name. needs to be cleaned up with a clean concept for
358
+ # authentication that reconciles API_KEY, AUTH_TOKEN, `localstack auth`, and `localstack login`.
359
+ if os.environ.get("LOCALSTACK_AUTH_TOKEN", "").strip():
360
+ return True
361
+
362
+ if is_env_true("LOCALSTACK_CLI") and is_auth_token_set_in_cache():
363
+ return True
364
+
365
+ if os.environ.get("LOCALSTACK_API_KEY", "").strip():
366
+ return True
367
+
368
+ return False
369
+
370
+
371
+ # pro plugins should always run. If license activation failed this will be set to false to avoid loading
372
+ # pro plugins after that.
373
+ ACTIVATE_PRO = True
374
+
375
+ # a comma-separated list of cloud pods to be automatically loaded at startup
376
+ AUTO_LOAD_POD = os.environ.get("AUTO_LOAD_POD", "")
377
+
378
+ # The strategy that gets applied when a state (currently only via cloudpods) gets loaded into LocalStack.
379
+ MERGE_STRATEGY = (os.environ.get("MERGE_STRATEGY", "") or "account-region-merge").strip()
380
+
381
+ # if true, we encrypt the pod before sending it to the remote. It requires a secret
382
+ POD_ENCRYPTION = is_env_true("POD_ENCRYPTION")
383
+
384
+ # If enabled, we store a JSONified string of resources at pod creation time using the cloud control provider.
385
+ # We released this feature flag with v4.0.
386
+ ENABLE_POD_RESOURCES = is_env_true("ENABLE_POD_RESOURCES")
387
+
388
+ # CLI specific.
389
+ # If set, the CLI will inject the header to authenticate to the platform.
390
+ # The header is built with the auth token in the CLI environment.
391
+ # If not set, the authentication header is built in the runtime with the token used to start the container.
392
+ # If the toke in the CLI environment and the one in the runtime differ, users might have visibility of a different
393
+ # set of Cloud Pods.
394
+ CLI_INJECT_POD_IDENTITY = localstack_config.is_env_not_false("CLI_INJECT_POD_IDENTITY")
395
+
396
+ # backend service ports
397
+ DEFAULT_PORT_LOCAL_DAEMON = 4600
398
+ DEFAULT_PORT_LOCAL_DAEMON_ROOT = 4601
399
+ DISABLE_LOCAL_DAEMON_CONNECTION = localstack_config.is_env_true("DISABLE_LOCAL_DAEMON_CONNECTION")
400
+
401
+ # name of CI project to sync usage events and state with (TODO: deprecate `CI_PROJECT`)
402
+ CI_PROJECT = os.environ.get("LS_CI_PROJECT") or os.environ.get("CI_PROJECT") or ""
403
+
404
+ # PAT GitHub Token needed by CodePipeline to retrieve the source code from a private repository
405
+ CODEPIPELINE_GH_TOKEN = os.environ.get("CODEPIPELINE_GH_TOKEN")
406
+
407
+ # Flag to remove a codebuild container after a build is completed. True by default
408
+ CODEBUILD_REMOVE_CONTAINERS = localstack_config.is_env_not_false("CODEBUILD_REMOVE_CONTAINERS")
409
+
410
+ # Flag that allows CodeBuild to use a user-provided image for the local build
411
+ CODEBUILD_ENABLE_CUSTOM_IMAGES = localstack_config.is_env_true("CODEBUILD_ENABLE_CUSTOM_IMAGES")
412
+
413
+ # Controls the snapshot granularity of the run. The lower the interval, the more snapshot metamodels are created
414
+ COMMIT_INTERVAL_SECS = os.environ.get("COMMIT_INTERVAL_SECS", 10)
415
+
416
+ # Controls the synchronization rate of the run. The lower the rate, the more remote synchronization requests are performed.
417
+ # Note: If the container shuts down gracefully a synchronization request is done at the very end of the run, otherwise
418
+ # all results up until the last synchronization request are lost.
419
+ SYNCHRONIZATION_RATE = os.environ.get("SYNCHRONIZATION_RATE", 1)
420
+
421
+ # Additional flags provided to the batch container
422
+ # only flags for volumes, ports, environment variables and add-hosts are allowed
423
+ BATCH_DOCKER_FLAGS = os.environ.get("BATCH_DOCKER_FLAGS", "")
424
+
425
+ # timeout (in seconds) to wait before returning from load operations on the CLI; 60 by default
426
+ POD_LOAD_CLI_TIMEOUT = int(os.getenv("POD_LOAD_CLI_TIMEOUT", "60"))
427
+
428
+ # whether to enforce explicit provider loading (if not set, by default providers "<x>" will be overridden by "<x>_pro")
429
+ PROVIDER_FORCE_EXPLICIT_LOADING = is_env_true("PROVIDER_FORCE_EXPLICIT_LOADING")
430
+
431
+ # whether to ignore the existing appsync js libs path
432
+ APPSYNC_JS_LIBS_VERSION = os.getenv("APPSYNC_JS_LIBS_VERSION", "")
433
+
434
+ # whether neptune engine should start with SSL configuration enabled
435
+ NEPTUNE_USE_SSL = localstack_config.is_env_true("NEPTUNE_USE_SSL")
436
+
437
+ # Neptune graph graph DB type, valid values: "tinkerpop", "neo4j"
438
+ NEPTUNE_DB_TYPE = (os.environ.get("NEPTUNE_DB_TYPE", "") or "tinkerpop").strip()
439
+
440
+ # whether to enable transaction for all created neptune database.
441
+ NEPTUNE_ENABLE_TRANSACTION = is_env_true("NEPTUNE_ENABLE_TRANSACTION")
442
+
443
+ # user flag to enable Gremlin logs for debugging
444
+ NEPTUNE_GREMLIN_DEBUG = is_env_true("NEPTUNE_GREMLIN_DEBUG")
445
+
446
+ # Instant job completion for MediaConvert
447
+ MEDIACONVERT_DISABLE_JOB_DURATION = is_env_true("MEDIACONVERT_DISABLE_JOB_DURATION")
448
+
449
+ # Kafka provider override
450
+ KAFKA_LEGACY_PROVIDER_OVERRIDE = os.getenv("PROVIDER_OVERRIDE_KAFKA") == "legacy"
451
+
452
+ # Resource Groups Tagging API override
453
+ RESOURCE_GROUPS_TAGGING_API_V2 = (
454
+ os.environ.get("PROVIDER_OVERRIDE_RESOURCEGROUPSTAGGINGAPI", "") == "v2"
455
+ )
456
+
457
+ # AppInspector
458
+ APPINSPECTOR_DEV_ENABLE = is_env_true(
459
+ "APPINSPECTOR_DEV_ENABLE"
460
+ ) # flag to hide AppInspector before official release
461
+ APPINSPECTOR_ENABLE = is_env_true("APPINSPECTOR_ENABLE")
462
+
463
+ # update variable names that need to be passed as arguments to Docker
464
+ localstack_config.CONFIG_ENV_VARS += [
465
+ "APPSYNC_JS_LIBS_VERSION",
466
+ "ACKNOWLEDGE_ACCOUNT_REQUIREMENT",
467
+ "APIGW_ENABLE_NEXT_GEN_WEBSOCKETS",
468
+ "APIGW_ENABLE_NEXT_GEN_WEBSOCKETS_INVOCATION",
469
+ "AUTO_LOAD_POD",
470
+ "AUTO_SSL_CERTS",
471
+ "AUTOSTART_UTIL_CONTAINERS",
472
+ "CI_PROJECT",
473
+ "CODEBUILD_ENABLE_CUSTOM_IMAGES",
474
+ "CODEBUILD_REMOVE_CONTAINERS",
475
+ "CODEPIPELINE_GH_TOKEN",
476
+ "CLOUDFRONT_STATIC_PORTS",
477
+ "CLOUDFRONT_LAMBDA_EDGE",
478
+ "DISABLE_LOCAL_DAEMON_CONNECTION",
479
+ "DOCDB_PROXY_CONTAINER",
480
+ "ECS_DISABLE_AWS_ENDPOINT_URL",
481
+ "ECS_DOCKER_FLAGS",
482
+ "ECS_FLUENT_BIT_IMAGE_REPOSITORY",
483
+ "ECS_REMOVE_CONTAINERS",
484
+ "ECS_TASK_EXECUTOR",
485
+ "EC2_DOCKER_FLAGS",
486
+ "EC2_DOCKER_INIT",
487
+ "EC2_DOWNLOAD_DEFAULT_IMAGES",
488
+ "EC2_HYPERVISOR_URI",
489
+ "EC2_LIBVIRT_NETWORK",
490
+ "EC2_LIBVIRT_POOL",
491
+ "EC2_REFERENCE_DOMAIN",
492
+ "EC2_REMOVE_CONTAINERS",
493
+ "EC2_VM_MANAGER",
494
+ "EKS_K3S_IMAGE_REPOSITORY",
495
+ "EKS_K3S_IMAGE_TAG",
496
+ "EKS_K8S_PROVIDER",
497
+ "EKS_MOCK_CREATE_CLUSTER_DELAY",
498
+ "EKS_PERSIST_CLUSTER_CONTENTS",
499
+ "EKS_STARTUP_TIMEOUT",
500
+ "EKS_K3S_FLAGS",
501
+ "EKS_POD_IDENTITY_WEBHOOK_IMAGE",
502
+ "EKS_VELERO_IMAGE",
503
+ "EKS_VELERO_PLUGIN_AWS_IMAGE",
504
+ "ENABLE_DMS",
505
+ "ENABLE_POD_RESOURCES",
506
+ "DMS_SERVERLESS_DEPROVISIONING_DELAY",
507
+ "DMS_SERVERLESS_STATUS_CHANGE_WAITING_TIME",
508
+ "POD_ENCRYPTION",
509
+ "ENFORCE_IAM",
510
+ "EXTENSION_DEV_MODE",
511
+ "EXTENSION_AUTO_INSTALL",
512
+ "GRAPHQL_ENDPOINT_STRATEGY",
513
+ "IAM_SOFT_MODE",
514
+ "KUBE_ENDPOINT",
515
+ "LAMBDA_DOWNLOAD_AWS_LAYERS",
516
+ "LDM_PREVIEW",
517
+ "LOCALSTACK_K8S_NAMESPACE",
518
+ "LOCALSTACK_K8S_LABELS",
519
+ "LOCALSTACK_K8S_ANNOTATIONS",
520
+ "KINESISANALYTICSV2_IMAGE",
521
+ "LOG_LICENSE_ISSUES",
522
+ "LS_CI_PROJECT",
523
+ "LS_CI_LOGS",
524
+ "MEDIACONVERT_DISABLE_JOB_DURATION",
525
+ "MSSQL_ACCEPT_EULA",
526
+ "MWAA_PIP_TRUSTED_HOSTS",
527
+ "MWAA_S3_POLL_INTERVAL",
528
+ "MWAA_DOCKER_FLAGS",
529
+ "PERSIST_ALL",
530
+ "SMTP_EMAIL",
531
+ "SMTP_HOST",
532
+ "SMTP_PASS",
533
+ "SMTP_USER",
534
+ "SSL_NO_VERIFY",
535
+ "SYNC_POD_NAME",
536
+ "TRANSPARENT_LOCAL_ENDPOINTS",
537
+ "DISABLE_TRANSPARENT_ENDPOINT_INJECTION",
538
+ "PERSIST_FLUSH_STRATEGY",
539
+ "PROVIDER_FORCE_EXPLICIT_LOADING",
540
+ "RDS_MYSQL_DOCKER",
541
+ "RDS_CLUSTER_ENDPOINT_HOST_ONLY",
542
+ "RDS_CLUSTER_ENDPOINT_IP_BASED",
543
+ "REDIS_CONTAINER_MODE",
544
+ "POD_LOAD_CLI_TIMEOUT",
545
+ "NEPTUNE_DB_TYPE",
546
+ "NEPTUNE_ENABLE_TRANSACTION",
547
+ "NEPTUNE_GREMLIN_DEBUG",
548
+ "NEPTUNE_USE_SSL",
549
+ # Removed in 3.0.0
550
+ "LAMBDA_XRAY_INIT", # deprecated since 2.0.0
551
+ "GLUE_JOB_EXECUTOR",
552
+ "GLUE_JOB_EXECUTOR_PROVIDER",
553
+ ]
554
+
555
+ # re-initialize configs in localstack
556
+ localstack_config.populate_config_env_var_names()
@@ -0,0 +1,54 @@
1
+ try:
2
+ from localstack_cli.version import __version__
3
+ except ImportError:
4
+ # Fallback if version not generated yet
5
+ __version__ = "0.0.0.dev"
6
+
7
+ VERSION = __version__
8
+
9
+ # default expiry seconds for Cognito access tokens (1h by default in AWS)
10
+ TOKEN_EXPIRY_SECONDS = 60 * 60
11
+
12
+ # name of Docker registry for Lambda images
13
+ DEFAULT_LAMBDA_DOCKER_REGISTRY = "localstack/lambda"
14
+
15
+ # request path for local pod management API
16
+ API_PATH_PODS = "/_localstack/pods"
17
+
18
+ # name and URL of S3 bucket containing assets that are downloaded at build or runtime
19
+ S3_ASSETS_BUCKET = "localstack-assets"
20
+ S3_ASSETS_BUCKET_URL = f"https://{S3_ASSETS_BUCKET}.s3.amazonaws.com"
21
+
22
+ # Root directory for pickled (persisted) states
23
+ API_STATES_DIRECTORY = "api_states"
24
+ # Root directory for the persisted assets
25
+ ASSETS_DIRECTORY = "assets"
26
+
27
+ # Filename for pickled (persisted) Moto BackendDict
28
+ MOTO_BACKEND_STATE_FILE = "backend.state"
29
+
30
+ # Filename for persisted BaseBackend with Avro
31
+ MOTO_BACKEND_AVRO_FILE = "backend.state.avro"
32
+
33
+ # Filename for pickled (persisted) provider AccountRegionBundle
34
+ STORE_STATE_FILE = "store.state"
35
+
36
+ # Filename for persisted BaseStore with Avro
37
+ STORE_AVRO_FILE = "store.state.avro"
38
+
39
+ # Metadata file for pods that are locally stored and not updated to the platform
40
+ CLOUDPODS_METADATA_FILE = "metadata.yaml"
41
+
42
+ # Namespace for all PlatformPlugins to use
43
+ PLATFORM_PLUGIN_NAMESPACE = "localstack.platform.plugin"
44
+
45
+ # active MQ download URL
46
+ ACTIVE_MQ_URL = "https://dlcdn.apache.org/activemq/5.16.6/apache-activemq-5.16.6-bin.tar.gz"
47
+
48
+ UPDATE_HTTP_METHODS = ["POST", "PUT", "DELETE", "PATCH"]
49
+
50
+ # This file holds a list of services that are stored in the snapshot.
51
+ API_STATES_JSON = "api_states.json"
52
+
53
+ # Secret used to encrypt Cloud Pod content
54
+ HEADER_POD_SECRET = "x-localstack-state-secret"