# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License"). You3# may not use this file except in compliance with the License. A copy of4# the License is located at5#6# http://aws.amazon.com/apache2.0/7#8# or in the "license" file accompanying this file. This file is9# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF10# ANY KIND, either express or implied. See the License for the specific11# language governing permissions and limitations under the License.121314class CLICommand:15"""Interface for a CLI command.1617This class represents a top level CLI command18(``aws ec2``, ``aws s3``, ``aws config``).1920"""2122@property23def name(self):24# Subclasses must implement a name.25raise NotImplementedError("name")2627@name.setter28def name(self, value):29# Subclasses must implement setting/changing the cmd name.30raise NotImplementedError("name")3132@property33def lineage(self):34# Represents how to get to a specific command using the CLI.35# It includes all commands that came before it and itself in36# a list.37return [self]3839@property40def lineage_names(self):41# Represents the lineage of a command in terms of command ``name``42return [cmd.name for cmd in self.lineage]4344def __call__(self, args, parsed_globals):45"""Invoke CLI operation.4647:type args: str48:param args: The remaining command line args.4950:type parsed_globals: ``argparse.Namespace``51:param parsed_globals: The parsed arguments so far.5253:rtype: int54:return: The return code of the operation. This will be used55as the RC code for the ``aws`` process.5657"""58# Subclasses are expected to implement this method.59pass6061def create_help_command(self):62# Subclasses are expected to implement this method if they want63# help docs.64return None6566@property67def arg_table(self):68return {}697071