• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 - The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14r"""Powerwash args.
15
16Defines the powerwash arg parser that holds powerwash specific args.
17"""
18import argparse
19
20
21CMD_POWERWASH = "powerwash"
22
23
24def GetPowerwashArgParser(subparser):
25    """Return the powerwash arg parser.
26
27    Args:
28       subparser: argparse.ArgumentParser that is attached to main acloud cmd.
29
30    Returns:
31        argparse.ArgumentParser with powerwash options defined.
32    """
33    powerwash_parser = subparser.add_parser(CMD_POWERWASH)
34    powerwash_parser.required = False
35    powerwash_parser.set_defaults(which=CMD_POWERWASH)
36    powerwash_group = powerwash_parser.add_mutually_exclusive_group()
37    powerwash_group.add_argument(
38        "--instance-name",
39        dest="instance_name",
40        type=str,
41        required=False,
42        help="The name of the remote instance that need to reset the AVDs.")
43    # TODO(b/118439885): Old arg formats to support transition, delete when
44    # transistion is done.
45    powerwash_group.add_argument(
46        "--instance_name",
47        dest="instance_name",
48        type=str,
49        required=False,
50        help=argparse.SUPPRESS)
51    powerwash_parser.add_argument(
52        "--instance-id",
53        dest="instance_id",
54        type=int,
55        required=False,
56        default=1,
57        help="The instance id of the remote instance that need to be reset.")
58
59    return powerwash_parser
60