A service command for the CLI. For example, ``aws ec2 ...`` we'd create a ServiceCommand object that represents the ec2 service.
| 659 | |
| 660 | |
| 661 | class ServiceCommand(CLICommand): |
| 662 | """A service command for the CLI. |
| 663 | |
| 664 | For example, ``aws ec2 ...`` we'd create a ServiceCommand |
| 665 | object that represents the ec2 service. |
| 666 | |
| 667 | """ |
| 668 | |
| 669 | def __init__(self, cli_name, session, service_name=None): |
| 670 | # The cli_name is the name the user types, the name we show |
| 671 | # in doc, etc. |
| 672 | # The service_name is the name we used internally with botocore. |
| 673 | # For example, we have the 's3api' as the cli_name for the service |
| 674 | # but this is actually bound to the 's3' service name in botocore, |
| 675 | # i.e. we load s3.json from the botocore data dir. Most of |
| 676 | # the time these are the same thing but in the case of renames, |
| 677 | # we want users/external things to be able to rename the cli name |
| 678 | # but *not* the service name, as this has to be exactly what |
| 679 | # botocore expects. |
| 680 | self._name = cli_name |
| 681 | self.session = session |
| 682 | self._command_table = None |
| 683 | if service_name is None: |
| 684 | # Then default to using the cli name. |
| 685 | self._service_name = cli_name |
| 686 | else: |
| 687 | self._service_name = service_name |
| 688 | self._lineage = [self] |
| 689 | self._service_model = None |
| 690 | |
| 691 | @property |
| 692 | def name(self): |
| 693 | return self._name |
| 694 | |
| 695 | @name.setter |
| 696 | def name(self, value): |
| 697 | self._name = value |
| 698 | |
| 699 | @property |
| 700 | def service_model(self): |
| 701 | return self._get_service_model() |
| 702 | |
| 703 | @property |
| 704 | def lineage(self): |
| 705 | return self._lineage |
| 706 | |
| 707 | @lineage.setter |
| 708 | def lineage(self, value): |
| 709 | self._lineage = value |
| 710 | |
| 711 | @property |
| 712 | def subcommand_table(self): |
| 713 | return self._get_command_table() |
| 714 | |
| 715 | @property |
| 716 | def arg_table(self): |
| 717 | # No service level arguments so we just return an empty |
| 718 | # dictionary. |
no outgoing calls