(self, resource, *args, **kwargs)
| 358 | |
| 359 | class ApiKeyCreateCommand(resource.ResourceCommand): |
| 360 | def __init__(self, resource, *args, **kwargs): |
| 361 | super(ApiKeyCreateCommand, self).__init__( |
| 362 | resource, |
| 363 | "create", |
| 364 | "Create a new %s." % resource.get_display_name().lower(), |
| 365 | *args, |
| 366 | **kwargs, |
| 367 | ) |
| 368 | |
| 369 | self.parser.add_argument( |
| 370 | "-u", |
| 371 | "--user", |
| 372 | type=str, |
| 373 | help="User for which to create API Keys.", |
| 374 | default="", |
| 375 | ) |
| 376 | self.parser.add_argument( |
| 377 | "-m", |
| 378 | "--metadata", |
| 379 | type=json.loads, |
| 380 | help="Optional metadata to associate with the API Keys.", |
| 381 | default={}, |
| 382 | ) |
| 383 | self.parser.add_argument( |
| 384 | "-k", |
| 385 | "--only-key", |
| 386 | action="store_true", |
| 387 | dest="only_key", |
| 388 | default=False, |
| 389 | help="Only print API Key to the console on creation.", |
| 390 | ) |
| 391 | |
| 392 | @resource.add_auth_token_to_kwargs_from_cli |
| 393 | def run(self, args, **kwargs): |
nothing calls this directly
no test coverage detected