boto3-assist 0.24.0__tar.gz → 0.26.0__tar.gz
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.
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/.vscode/settings.json +3 -1
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/PKG-INFO +1 -1
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/order_example/main.py +1 -1
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/pyproject.toml +1 -1
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/requirements-dev.txt +4 -2
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb.py +1 -1
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_index.py +1 -6
- boto3_assist-0.26.0/src/boto3_assist/erc/__init__.py +64 -0
- boto3_assist-0.26.0/src/boto3_assist/erc/ecr_connection.py +57 -0
- boto3_assist-0.26.0/src/boto3_assist/version.py +1 -0
- boto3_assist-0.26.0/tests/unit/dynamodb_tests/dynamodb_primary_key_get_test.py +76 -0
- boto3_assist-0.24.0/src/boto3_assist/version.py +0 -1
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/.env.docker +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/.env.docker.001 +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/.env.docker.nosql.workbench +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/.env.unittest +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/.gitignore +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/.vscode/launch.json +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/.vscode/tasks.json +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/LICENSE-EXPLAINED.txt +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/LICENSE.txt +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/README.md +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/aws_regions_with_status.csv +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/aws_regions_with_status.json +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/devops/build.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/devops/readme.md +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/cloudwatch/log_report.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/models/order_item_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/models/order_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/models/product_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/models/user_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/models/user_post_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/order_example/products.json +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/order_item_service.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/order_service.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/product_service.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/table_service.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/user_post_service.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/user_service.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/user_service_client_example.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/user_service_resource_example.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/user_post_example/main.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/ec2/regions_report.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/module-headers.txt +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/mypy.ini +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/requirements.txt +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/run-checks.sh +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/run_unit_tests.sh +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/setup.sh +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/aws_config.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/aws_lambda/event_info.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/aws_lambda/mock_context.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/boto3session.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cloudwatch/cloudwatch_connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cloudwatch/cloudwatch_connection_tracker.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cloudwatch/cloudwatch_log_connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cloudwatch/cloudwatch_logs.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cloudwatch/cloudwatch_query.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cognito/cognito_authorizer.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cognito/cognito_connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cognito/cognito_utility.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cognito/jwks_cache.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cognito/user.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/connection_tracker.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_helpers.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_importer.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_iservice.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_key.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_model_base.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_model_base_interfaces.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_re_indexer.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_reindexer.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_reserved_words.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_reserved_words.txt +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/readme.md +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/troubleshooting.md +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/ec2/ec2_connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/environment_services/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/environment_services/environment_loader.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/environment_services/environment_variables.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/errors/custom_exceptions.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/http_status_codes.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/models/serializable_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/role_assumption_mixin.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/s3/s3.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/s3/s3_bucket.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/s3/s3_connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/s3/s3_event_data.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/s3/s3_object.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/securityhub/securityhub.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/securityhub/securityhub_connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/session_setup_mixin.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/ssm/connection.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/ssm/parameter_store/parameter_store.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/datetime_utility.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/dictionary_utility.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/file_operations.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/http_utility.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/logging_utility.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/numbers_utility.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/serialization_utility.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/string_utility.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/integration/cross_account_connection_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/integration/tenant.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/integration/tenant_services.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/aws_config_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/common/db_test_helpers.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/cms/base.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/cms/content_block.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/cms/page.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/cms/template.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/simple_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/task.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/user_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/user_required_fields_model.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_fail_if_exists_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_model_base_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_model_projections_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_model_serializtion_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_moto_sorting_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_primary_key_sort_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_query_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_reindex_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/examples_test/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/examples_test/user_service_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/lambda_tests/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/lambda_tests/event_info_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/models_tests/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/models_tests/models/person.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/models_tests/models/user.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/models_tests/serializable_model_person_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/models_tests/serializable_model_user_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/models_tests/serializable_model_wide_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/parameter_store/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/parameter_store/parameter_store_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/s3/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/s3/files/test.txt +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/s3/s3_event_data_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/s3/s3_file_delete_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/s3/s3_file_upload_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/session_tests/test_boto3_session_manager.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/utilities/__init__.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/utilities/serialization_utility_test.py +0 -0
- {boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/utilities/string_utility_test.py +0 -0
|
@@ -20,7 +20,7 @@ from examples.dynamodb.services.table_service import DynamoDBTableService
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class DynamoDBExample:
|
|
23
|
-
"""An example of using and
|
|
23
|
+
"""An example of using and debugging DynamoDB"""
|
|
24
24
|
|
|
25
25
|
def __init__(self, table_name: str) -> None:
|
|
26
26
|
self.db: DynamoDB = DynamoDB()
|
|
@@ -171,12 +171,7 @@ class DynamoDBIndex:
|
|
|
171
171
|
)
|
|
172
172
|
return key
|
|
173
173
|
|
|
174
|
-
elif
|
|
175
|
-
self.name == DynamoDBIndexes.PRIMARY_INDEX
|
|
176
|
-
and include_sort_key
|
|
177
|
-
# if it ends with a # we are assuming that we are doing a wild card mapping
|
|
178
|
-
and not str(self.sort_key.value).endswith("#")
|
|
179
|
-
):
|
|
174
|
+
elif self.name == DynamoDBIndexes.PRIMARY_INDEX and include_sort_key:
|
|
180
175
|
# this is a direct primary key which is used in a get call
|
|
181
176
|
# this is different than query keys
|
|
182
177
|
key = {}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import boto3
|
|
2
|
+
from botocore.exceptions import ClientError
|
|
3
|
+
from .ecr_connection import ECRConnection
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ECR(ECRConnection):
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
def retag_image(self, repository_name: str, source_tag: str, target_tag: str):
|
|
10
|
+
"""
|
|
11
|
+
ReTag an ECR Image without the overhead of pulling it down, tagging and pushing.
|
|
12
|
+
Simply retags by getting the manifest, and pushing up changes.
|
|
13
|
+
Args:
|
|
14
|
+
repository_name (str):
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
ecr = self.client
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
# 1) Get the manifest for the source tag
|
|
21
|
+
resp = ecr.batch_get_image(
|
|
22
|
+
repositoryName=repository_name,
|
|
23
|
+
imageIds=[{"imageTag": source_tag}],
|
|
24
|
+
# optional, but helps ensure you get the right manifest type:
|
|
25
|
+
acceptedMediaTypes=[
|
|
26
|
+
"application/vnd.docker.distribution.manifest.v2+json",
|
|
27
|
+
"application/vnd.oci.image.manifest.v1+json",
|
|
28
|
+
],
|
|
29
|
+
)
|
|
30
|
+
images = resp.get("images", [])
|
|
31
|
+
if not images:
|
|
32
|
+
raise RuntimeError(f"No image found with tag {source_tag!r}")
|
|
33
|
+
|
|
34
|
+
manifest = images[0]["imageManifest"]
|
|
35
|
+
|
|
36
|
+
# 2) Push the same manifest under the new tag
|
|
37
|
+
put_resp = ecr.put_image(
|
|
38
|
+
repositoryName=repository_name,
|
|
39
|
+
imageManifest=manifest,
|
|
40
|
+
imageTag=target_tag,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
failures = put_resp.get("failures")
|
|
44
|
+
|
|
45
|
+
if failures and len(failures) > 0:
|
|
46
|
+
raise RuntimeError(
|
|
47
|
+
f"Failed to tag {repository_name}:{target_tag} - {failures}"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
print(f"Successfully tagged {repository_name}:{target_tag}")
|
|
51
|
+
return put_resp
|
|
52
|
+
|
|
53
|
+
except ClientError as e:
|
|
54
|
+
print(
|
|
55
|
+
f"ECR error: {e.response.get('Error', {}).get('Code', 'NA')} "
|
|
56
|
+
f"- {e.response.get('Error', {}).get('Message', 'NA')}"
|
|
57
|
+
)
|
|
58
|
+
raise
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if __name__ == "__main__":
|
|
62
|
+
# Example: retag version 1.16.54 → dev
|
|
63
|
+
ecr: ECR = ECR(aws_profile="geek-cafe", aws_region="us-east-1")
|
|
64
|
+
ecr.retag_image("my-repo", "1.16.54", "dev")
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Geek Cafe, LLC
|
|
3
|
+
Maintainers: Eric Wilson
|
|
4
|
+
MIT License. See Project Root for the license information.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Optional
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from aws_lambda_powertools import Logger
|
|
11
|
+
|
|
12
|
+
from boto3_assist.connection import Connection
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from mypy_boto3_ecr import Client
|
|
16
|
+
else:
|
|
17
|
+
Client = object
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
logger = Logger()
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ECRConnection(Connection):
|
|
24
|
+
"""Connection"""
|
|
25
|
+
|
|
26
|
+
def __init__(
|
|
27
|
+
self,
|
|
28
|
+
*,
|
|
29
|
+
aws_profile: Optional[str] = None,
|
|
30
|
+
aws_region: Optional[str] = None,
|
|
31
|
+
aws_end_point_url: Optional[str] = None,
|
|
32
|
+
aws_access_key_id: Optional[str] = None,
|
|
33
|
+
aws_secret_access_key: Optional[str] = None,
|
|
34
|
+
) -> None:
|
|
35
|
+
super().__init__(
|
|
36
|
+
service_name="ecr",
|
|
37
|
+
aws_profile=aws_profile,
|
|
38
|
+
aws_region=aws_region,
|
|
39
|
+
aws_access_key_id=aws_access_key_id,
|
|
40
|
+
aws_secret_access_key=aws_secret_access_key,
|
|
41
|
+
aws_end_point_url=aws_end_point_url,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
self.__client: Client | None = None
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def client(self) -> Client:
|
|
48
|
+
"""Client Connection"""
|
|
49
|
+
if self.__client is None:
|
|
50
|
+
self.__client = self.session.client
|
|
51
|
+
|
|
52
|
+
return self.__client
|
|
53
|
+
|
|
54
|
+
@client.setter
|
|
55
|
+
def client(self, value: Client):
|
|
56
|
+
logger.info("Setting Client")
|
|
57
|
+
self.__client = value
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.26.0'
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Geek Cafe, LLC
|
|
3
|
+
Maintainers: Eric Wilson
|
|
4
|
+
MIT License. See Project Root for the license information.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import unittest
|
|
8
|
+
import moto
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from tests.unit.dynamodb_tests.db_models.user_model import User
|
|
11
|
+
from boto3_assist.environment_services.environment_loader import EnvironmentLoader
|
|
12
|
+
from boto3_assist.dynamodb.dynamodb import DynamoDB
|
|
13
|
+
from tests.unit.common.db_test_helpers import DbTestHelper
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@moto.mock_aws
|
|
17
|
+
class DbQueryTest(unittest.TestCase):
|
|
18
|
+
"Serialization Tests"
|
|
19
|
+
|
|
20
|
+
def __init__(self, methodName="runTest"):
|
|
21
|
+
super().__init__(methodName)
|
|
22
|
+
|
|
23
|
+
ev: EnvironmentLoader = EnvironmentLoader()
|
|
24
|
+
# NOTE: you need to make sure the the env file below exists or you will get an error
|
|
25
|
+
ev.load_environment_file(file_name=".env.unittest")
|
|
26
|
+
self.__table_name = "mock_test_table"
|
|
27
|
+
|
|
28
|
+
self.db: DynamoDB = DynamoDB()
|
|
29
|
+
|
|
30
|
+
def setUp(self):
|
|
31
|
+
# load our test environment file to make sure we override any default AWS Environment Vars setup
|
|
32
|
+
# we don't want to accidentally connect to live environments
|
|
33
|
+
# https://docs.getmoto.org/en/latest/docs/getting_started.html
|
|
34
|
+
|
|
35
|
+
self.db: DynamoDB = self.db or DynamoDB()
|
|
36
|
+
DbTestHelper().helper_create_mock_table(self.__table_name, self.db.client)
|
|
37
|
+
print("Setup Complete")
|
|
38
|
+
|
|
39
|
+
def create_user(
|
|
40
|
+
self,
|
|
41
|
+
id: str,
|
|
42
|
+
first_name: str,
|
|
43
|
+
last_name: str,
|
|
44
|
+
email: str,
|
|
45
|
+
) -> User:
|
|
46
|
+
user = User()
|
|
47
|
+
|
|
48
|
+
user.id = id
|
|
49
|
+
user.first_name = first_name
|
|
50
|
+
user.last_name = last_name
|
|
51
|
+
user.email = email
|
|
52
|
+
|
|
53
|
+
response = self.db.save(
|
|
54
|
+
table_name=self.__table_name, item=user, fail_if_exists=True
|
|
55
|
+
)
|
|
56
|
+
assert response["ResponseMetadata"]["HTTPStatusCode"] == 200
|
|
57
|
+
return user
|
|
58
|
+
|
|
59
|
+
def test_primary_key_get(self):
|
|
60
|
+
user: User = self.create_user(
|
|
61
|
+
id="id1",
|
|
62
|
+
first_name="first",
|
|
63
|
+
last_name="last",
|
|
64
|
+
email="email@example.com",
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
get_model: User = User()
|
|
68
|
+
get_model.id = user.id
|
|
69
|
+
|
|
70
|
+
get_response = self.db.get(table_name=self.__table_name, model=get_model)
|
|
71
|
+
|
|
72
|
+
assert get_response["Item"]["id"] == f"{user.id}"
|
|
73
|
+
|
|
74
|
+
user = User()
|
|
75
|
+
get_response = self.db.get(table_name=self.__table_name, model=user)
|
|
76
|
+
assert "Item" not in get_response
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '0.24.0'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/examples/dynamodb/services/order_item_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cloudwatch/cloudwatch_connection.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/cloudwatch/cloudwatch_log_connection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_connection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_model_base.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_re_indexer.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_reserved_words.py
RENAMED
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/dynamodb/dynamodb_reserved_words.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/environment_services/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/securityhub/securityhub_connection.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/ssm/parameter_store/parameter_store.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/dictionary_utility.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/src/boto3_assist/utilities/serialization_utility.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/integration/cross_account_connection_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/cms/content_block.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/cms/template.py
RENAMED
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/simple_model.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/db_models/user_model.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_model_base_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_moto_sorting_test.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_query_test.py
RENAMED
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/dynamodb_tests/dynamodb_reindex_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/models_tests/serializable_model_user_test.py
RENAMED
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/models_tests/serializable_model_wide_test.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/parameter_store/parameter_store_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/session_tests/test_boto3_session_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
{boto3_assist-0.24.0 → boto3_assist-0.26.0}/tests/unit/utilities/serialization_utility_test.py
RENAMED
|
File without changes
|
|
File without changes
|