MCPcopy Index your code
hub / github.com/aws/aws-cli / ServiceAliasCommand

Class ServiceAliasCommand

awscli/alias.py:313–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311
312
313class ServiceAliasCommand(BaseInternalAliasCommand):
314 def __init__(
315 self,
316 alias_name,
317 alias_value,
318 session,
319 command_table,
320 parser,
321 shadow_proxy_command=None,
322 ):
323 """Command for a `toplevel` subcommand alias
324
325 :type alias_name: string
326 :param alias_name: The name of the alias
327
328 :type alias_value: string
329 :param alias_value: The parsed value of the alias. This can be
330 retrieved from `AliasLoader.get_aliases()[alias_name]`
331
332 :type session: botocore.session.Session
333 :param session: The botocore session
334
335 :type command_table: dict
336 :param command_table: The command table containing all of the
337 possible service command objects that a particular alias could
338 redirect to.
339
340 :type parser: awscli.argparser.MainArgParser
341 :param parser: The parser to parse commands provided at the top level
342 of a CLI command which includes service commands and global
343 parameters. This is used to parse the service command and any
344 global parameters from the alias's value.
345
346 :type shadow_proxy_command: CLICommand
347 :param shadow_proxy_command: A built-in command that
348 potentially shadows the alias in name. If the alias
349 references this command in its value, the alias should proxy
350 to this command as opposed to proxy to itself in the command
351 table
352 """
353 super(ServiceAliasCommand, self).__init__(
354 alias_name, alias_value, session
355 )
356 self._command_table = command_table
357 self._parser = parser
358 self._shadow_proxy_command = shadow_proxy_command
359
360 def __call__(self, args, parsed_globals):
361 alias_args = self._get_alias_args()
362 parsed_alias_args, remaining = self._parser.parse_known_args(
363 alias_args
364 )
365 self._update_parsed_globals(
366 self._parser, parsed_alias_args, parsed_globals
367 )
368 # Take any of the remaining arguments that were not parsed out and
369 # prepend them to the remaining args provided to the alias.
370 remaining.extend(args)

Calls

no outgoing calls