diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb1465e9..4b31753b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.8 - name: Install packages run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index ec431ba7..d4e01351 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed +- Added 'SecretBrinary' suport to `AwsSecret` block - [#274](https://github.com/PrefectHQ/prefect-aws/pull/274) ### Fixed @@ -17,6 +18,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +## 0.4.2 + +Released November 6th, 2023. + +### Fixed + +- Fixed use_ssl default for s3 client. + ## 0.4.1 Released October 13th, 2023. diff --git a/prefect_aws/deployments/steps.py b/prefect_aws/deployments/steps.py index 77930465..7525a5e2 100644 --- a/prefect_aws/deployments/steps.py +++ b/prefect_aws/deployments/steps.py @@ -220,7 +220,7 @@ def get_s3_client( aws_client_parameters = credentials.get("aws_client_parameters", client_parameters) api_version = aws_client_parameters.get("api_version", None) endpoint_url = aws_client_parameters.get("endpoint_url", None) - use_ssl = aws_client_parameters.get("use_ssl", None) + use_ssl = aws_client_parameters.get("use_ssl", True) verify = aws_client_parameters.get("verify", None) config_params = aws_client_parameters.get("config", {}) config = Config(**config_params) diff --git a/prefect_aws/secrets_manager.py b/prefect_aws/secrets_manager.py index 9b93e867..c043f28c 100644 --- a/prefect_aws/secrets_manager.py +++ b/prefect_aws/secrets_manager.py @@ -411,7 +411,10 @@ async def read_secret( response = await run_sync_in_worker_thread( client.get_secret_value, SecretId=self.secret_name, **read_kwargs ) - secret = response["SecretBinary"] + if "SecretBinary" in response: + secret = response["SecretBinary"] + elif "SecretString" in response: + secret = response["SecretString"] arn = response["ARN"] self.logger.info(f"The secret {arn!r} data was successfully read.") return secret diff --git a/requirements.txt b/requirements.txt index 40b6007d..919ce567 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ boto3>=1.24.53 botocore>=1.27.53 mypy_boto3_s3>=1.24.94 mypy_boto3_secretsmanager>=1.26.49 -prefect>=2.10.11 +prefect>=2.13.5 tenacity>=8.0.0 \ No newline at end of file diff --git a/tests/deploments/test_steps.py b/tests/deploments/test_steps.py index c78c3578..22608bd7 100644 --- a/tests/deploments/test_steps.py +++ b/tests/deploments/test_steps.py @@ -228,7 +228,7 @@ def test_s3_session_with_params(): assert { "api_version": "v1", "endpoint_url": None, - "use_ssl": None, + "use_ssl": True, "verify": None, }.items() <= all_calls[1].kwargs.items() assert all_calls[1].kwargs.get("config").connect_timeout == 300 @@ -244,7 +244,7 @@ def test_s3_session_with_params(): assert { "api_version": None, "endpoint_url": None, - "use_ssl": None, + "use_ssl": True, "verify": None, }.items() <= all_calls[3].kwargs.items() assert all_calls[3].kwargs.get("config").connect_timeout == 60 diff --git a/tests/test_secrets_manager.py b/tests/test_secrets_manager.py index 03d0a08b..654f0576 100644 --- a/tests/test_secrets_manager.py +++ b/tests/test_secrets_manager.py @@ -199,3 +199,10 @@ def test_delete_secret_recovery_window(self, aws_secret: AwsSecret): ValueError, match="Recovery window must be between 7 and 30 days" ): aws_secret.delete_secret(recovery_window_in_days=42) + + async def test_read_secret(self, secret_under_test, aws_credentials): + secret = AwsSecret( + aws_credentials=aws_credentials, + secret_name=secret_under_test["secret_name"], + ) + assert await secret.read_secret() == secret_under_test["expected_value"]