From c05d07b506e4244cf5f9b34339c06441fd2f57ed Mon Sep 17 00:00:00 2001 From: srinivasreddych Date: Tue, 22 Aug 2023 10:28:10 -0500 Subject: [PATCH] license headers and exception handling --- modules/storage/buckets/app.py | 9 ++++++--- modules/storage/buckets/stack.py | 15 ++------------- modules/storage/buckets/tests/test_app.py | 15 ++------------- modules/storage/buckets/tests/test_stack.py | 15 ++------------- 4 files changed, 12 insertions(+), 42 deletions(-) diff --git a/modules/storage/buckets/app.py b/modules/storage/buckets/app.py index 3ce76354..3976df16 100644 --- a/modules/storage/buckets/app.py +++ b/modules/storage/buckets/app.py @@ -1,3 +1,6 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + import os import aws_cdk @@ -18,14 +21,14 @@ app = App() if len(f"{project_name}-{deployment_name}") > 36: - raise Exception("This module cannot support a project+deployment name character length greater than 35") + raise ValueError("This module cannot support a project+deployment name character length greater than 35") if buckets_retention not in ["DESTROY", "RETAIN"]: - raise Exception("The only RETENTION_TYPE values accepted are 'DESTROY' and 'RETAIN' ") + raise ValueError("The only RETENTION_TYPE values accepted are 'DESTROY' and 'RETAIN' ") if buckets_encryption_type not in ["SSE", "KMS"]: - raise Exception("The only ENCRYPTION_TYPE values accepted are 'SSE' and 'KMS' ") + raise ValueError("The only ENCRYPTION_TYPE values accepted are 'SSE' and 'KMS' ") stack = BucketsStack( scope=app, diff --git a/modules/storage/buckets/stack.py b/modules/storage/buckets/stack.py index a0f64b01..e30e96ef 100755 --- a/modules/storage/buckets/stack.py +++ b/modules/storage/buckets/stack.py @@ -1,16 +1,5 @@ -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License 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. +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 import hashlib import logging diff --git a/modules/storage/buckets/tests/test_app.py b/modules/storage/buckets/tests/test_app.py index d4da179c..926d8605 100644 --- a/modules/storage/buckets/tests/test_app.py +++ b/modules/storage/buckets/tests/test_app.py @@ -1,16 +1,5 @@ -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License 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. +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 import os import sys diff --git a/modules/storage/buckets/tests/test_stack.py b/modules/storage/buckets/tests/test_stack.py index ca3424f5..019cb093 100644 --- a/modules/storage/buckets/tests/test_stack.py +++ b/modules/storage/buckets/tests/test_stack.py @@ -1,16 +1,5 @@ -# 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. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License 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. +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 import os import sys