(subparsers)
| 563 | add_common_options(sub_parser) |
| 564 | |
| 565 | def initialize_blobstore_subcommand(subparsers): |
| 566 | sub_parser = subparsers.add_parser("blobstore", formatter_class=SortingHelpFormatter) |
| 567 | command_help = """ |
| 568 | For example, the following would create a mytopo:data.tgz key using the data |
| 569 | stored in data.tgz. User alice would have full access, bob would have |
| 570 | read/write access and everyone else would have read access. |
| 571 | storm blobstore create mytopo:data.tgz -f data.tgz -a u:alice:rwa,u:bob:rw,o::r |
| 572 | """ |
| 573 | sub_sub_parsers = sub_parser.add_subparsers(help=command_help) |
| 574 | |
| 575 | list_parser = sub_sub_parsers.add_parser( |
| 576 | "list", help="lists blobs currently in the blob store", formatter_class=SortingHelpFormatter |
| 577 | ) |
| 578 | list_parser.add_argument( |
| 579 | "keys", nargs='*') |
| 580 | add_common_options(list_parser, main_args=False) |
| 581 | |
| 582 | cat_parser = sub_sub_parsers.add_parser( |
| 583 | "cat", help="read a blob and then either write it to a file, or STDOUT (requires read access).", formatter_class=SortingHelpFormatter |
| 584 | ) |
| 585 | cat_parser.add_argument("KEY") |
| 586 | cat_parser.add_argument("-f", '--FILE', default=None) |
| 587 | add_common_options(cat_parser) |
| 588 | |
| 589 | create_parser = sub_sub_parsers.add_parser( |
| 590 | "create", help="create a new blob. Contents comes from a FILE or STDIN", formatter_class=SortingHelpFormatter |
| 591 | ) |
| 592 | create_parser.add_argument("KEY") |
| 593 | create_parser.add_argument("-f", '--file', default=None) |
| 594 | create_parser.add_argument( |
| 595 | "-a", '--acl', default=None, |
| 596 | help="ACL is in the form [uo]:[username]:[r-][w-][a-] can be comma separated list." |
| 597 | ) |
| 598 | create_parser.add_argument("-r", "--replication-factor", default=None, type=check_positive) |
| 599 | add_common_options(create_parser) |
| 600 | |
| 601 | update_parser = sub_sub_parsers.add_parser( |
| 602 | "update", help="update the contents of a blob. Contents comes from a FILE or STDIN (requires write access).", formatter_class=SortingHelpFormatter, |
| 603 | ) |
| 604 | update_parser.add_argument("KEY") |
| 605 | update_parser.add_argument("-f", '--FILE', default=None) |
| 606 | add_common_options(update_parser) |
| 607 | |
| 608 | delete_parser = sub_sub_parsers.add_parser( |
| 609 | "delete", help="delete an entry from the blob store (requires write access).", formatter_class=SortingHelpFormatter |
| 610 | ) |
| 611 | delete_parser.add_argument("KEY") |
| 612 | add_common_options(delete_parser) |
| 613 | |
| 614 | set_acl_parser = sub_sub_parsers.add_parser( |
| 615 | "set-acl", help="set acls for the given key", formatter_class=SortingHelpFormatter |
| 616 | ) |
| 617 | set_acl_parser.add_argument("KEY") |
| 618 | set_acl_parser.add_argument( |
| 619 | "-s", '--set', default=None, |
| 620 | help="""ACL is in the form [uo]:[username]:[r-][w-][a-] |
| 621 | can be comma separated list (requires admin access).""" |
| 622 | ) |
no test coverage detected