Commit 0e32d090 authored by Yunhua Koglin's avatar Yunhua Koglin
Browse files

add copyright

parent de3e8dd4
......@@ -39,7 +39,8 @@ phases:
- pytest tests --junitxml=report.xml
# publish new artifact to code artifact
- aws codeartifact login --tool twine --domain osdu-dev --domain-owner 888733619319 --repository osdu-python --region us-east-1
- export AWS_ACCOUNT_ID=`aws sts get-caller-identity | grep Account | cut -d':' -f 2 | cut -d'"' -f 2`
- aws codeartifact login --tool twine --domain osdu-dev --domain-owner $AWS_ACCOUNT_ID --repository osdu-python --region $AWS_REGION
- python setup.py sdist bdist_wheel
- twine upload --skip-existing --repository codeartifact dist/osdu-core-lib*.tar.gz
......
# Copyright 2021 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.
__version__ = '0.0.56'
# TODO: this needs to be reviewed
# MUSE NOT BE CHANGED MANUALLY
# The patch number (the last one) should only be updated by the build/deploy script, if changed manually
# To increase the minor or major version:
# $> pip install -U bumpversion
# $> bumpversion major | minor
# then $> git push --tag
# may fail on windows try without commit: bumpversion part --no-commit
# Copyright 2021 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.
\ No newline at end of file
# Copyright 2021 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.
import io
import os
from typing import Any, Optional, Tuple, List
......@@ -25,14 +39,13 @@ class AwsStorage(BlobStorageBase):
self._session = session
if(service_account_file):
self._region, self._aws_env = service_account_file.split("$$")
os.environ["AWS_REGION"]=self._region
else:
self._region = os.getenv("AWS_REGION", "us-east-1")
self._aws_env = os.getenv("ENVIRONMENT", "")
self._access_key = os.getenv("AWS_ACCESS_KEY", "NA")
self._secret_key = os.getenv("AWS_SECRET_KEY", "NA")
self._session_token = os.getenv("AWS_SESSION_TOKEN", "NA")
self._access_key = ""
self._secret_key = ""
self._session_token = ""
self._bucket_name =""
def getPolicy(self, bucket: str, keypath:str):
......
# Copyright 2021 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.
import os
import re
from setuptools import setup, find_packages
......
# Copyright 2021 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.
\ No newline at end of file
# Copyright 2021 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.
from .test_utils import from_env
......
# Copyright 2021 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.
\ No newline at end of file
# Copyright 2021 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.
from tests.conftest import *
import tempfile
import shutil
......@@ -20,50 +34,3 @@ TEST_DATA = {
def test_dummy():
assert(True)
# import asyncio
# async def storage_client():
# client = AwsStorage(session=None, service_account_file=None)
# tenant = Tenant(project_id="opendes", bucket_name="bucket", data_partition_id="id1")
# # await client.upload(tenant, "fileTest", "file1")
# bulkblob = Blob(identifier="fileTest", bucket="none", name="file1", content_type="text/html", metadata={'a': 'b', 'c': 'd'})
# await client.delete(
# tenant, bulkblob.identifier)
# await client.download_metadata(
# tenant, bulkblob.identifier)
# await client.download(
# tenant, bulkblob.identifier)
# await client.list_objects(
# tenant)
# await client.upload(
# tenant,
# bulkblob.identifier,
# bulkblob.name)
# ,
# content_type=bulkblob.content_type,
# metadata=bulkblob.metadata)
# # Making the object public
# transfer.upload_file('/tmp/myfile', 'bucket', 'key',
# extra_args={'ACL': 'public-read'})
# # Setting metadata
# transfer.upload_file('/tmp/myfile', 'bucket', 'key',
# extra_args={'Metadata': {'a': 'b', 'c': 'd'}})
# # Setting content type
# transfer.upload_file('/tmp/myfile.json', 'bucket', 'key',
# extra_args={'ContentType': "application/json"})
# async def main():
# await asyncio.gather(storage_client())
# if __name__ == "__main__":
# asyncio.run(main())
\ No newline at end of file
# Copyright 2021 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.
def from_env(key, default=None):
import os
result = os.environ.get(key, default)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment