2af895e8b9c45293be80f5112c55f4834a1614b9
[csit.git] / terraform-ci-infra / 1n_nmd / tools / artifacts_download.py
1 #!/usr/bin/python3
2
3 # Copyright (c) 2021 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 """Storage utilities library."""
17
18 from boto3 import resource
19 from botocore.client import Config
20
21
22 ENDPOINT_URL = u"http://storage.service.consul:9000"
23 AWS_ACCESS_KEY_ID = u"storage"
24 AWS_SECRET_ACCESS_KEY = u"Storage1234"
25 REGION_NAME = u"yul1"
26 LOGS_BUCKET = f"logs.fd.io"
27
28
29 if __name__ == u"__main__":
30     """Main function for storage manipulation."""
31
32     # Create main storage resource.
33     storage = resource(
34         u"s3",
35         endpoint_url=ENDPOINT_URL,
36         aws_access_key_id=AWS_ACCESS_KEY_ID,
37         aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
38         config=Config(
39             signature_version=u"s3v4"
40         ),
41         region_name=REGION_NAME
42     )
43
44     storage.Bucket(LOGS_BUCKET).download_file(
45         "/vex-yul-rot-jenkins-1/csit-vpp-perf-report-iterative-2101-3n-skx/47/archives/output_info.xml.gz",
46         "output.xml.gz"
47     )