| 128 | pk_argument_name = None |
| 129 | |
| 130 | def __init__(self, resource, *args, **kwargs): |
| 131 | |
| 132 | has_token_opt = kwargs.pop("has_token_opt", True) |
| 133 | |
| 134 | super(ResourceCommand, self).__init__(*args, **kwargs) |
| 135 | |
| 136 | self.resource = resource |
| 137 | |
| 138 | if has_token_opt: |
| 139 | self.parser.add_argument( |
| 140 | "-t", |
| 141 | "--token", |
| 142 | dest="token", |
| 143 | help="Access token for user authentication. " |
| 144 | "Get ST2_AUTH_TOKEN from the environment " |
| 145 | "variables by default.", |
| 146 | ) |
| 147 | self.parser.add_argument( |
| 148 | "--api-key", |
| 149 | dest="api_key", |
| 150 | help="Api Key for user authentication. " |
| 151 | "Get ST2_API_KEY from the environment " |
| 152 | "variables by default.", |
| 153 | ) |
| 154 | |
| 155 | # Formatter flags |
| 156 | self.parser.add_argument( |
| 157 | "-j", |
| 158 | "--json", |
| 159 | action="store_true", |
| 160 | dest="json", |
| 161 | help="Print output in JSON format.", |
| 162 | ) |
| 163 | self.parser.add_argument( |
| 164 | "-y", |
| 165 | "--yaml", |
| 166 | action="store_true", |
| 167 | dest="yaml", |
| 168 | help="Print output in YAML format.", |
| 169 | ) |
| 170 | |
| 171 | @property |
| 172 | def manager(self): |