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:
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 """S3 Storage Backend."""
18 from json import dumps
20 from argparse import ArgumentParser, RawDescriptionHelpFormatter
22 from .storage import Storage
27 Main entry function when called from CLI.
29 parser = ArgumentParser(
30 description=u"S3 Storage Backend Operation.",
31 formatter_class=RawDescriptionHelpFormatter
34 u"-e", u"--expression", required=False, type=str,
35 default=u"select * from s3object s",
36 help=u"S3 compatible SQL query."
39 args = parser.parse_args()
41 json_iterator = Storage(
42 endpoint_url=u"http://storage.service.consul:9000",
44 profile_name=u"nomad-s3"
46 prefix=u"", expression=args.expression
48 for item in json_iterator:
49 print(dumps(item, indent=4, sort_keys=False))
52 if __name__ == u"__main__":