-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
list-deleting-volumes: new helper for case reporting
- Loading branch information
Showing
4 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
List all IBM Cloud volumes that are in Deleting state. This helps with | ||
support-case reporting to IBM folks. | ||
""" | ||
|
||
from resalloc_ibm_cloud.helpers import get_service | ||
from resalloc_ibm_cloud.argparsers import list_deleting_volumes_parser | ||
from resalloc_ibm_cloud.constants import LIMIT | ||
|
||
|
||
def main(): | ||
""" | ||
Print ID:name pairs. | ||
""" | ||
|
||
opts = list_deleting_volumes_parser().parse_args() | ||
# TODO: fix get_service | ||
Check warning Code scanning / vcs-diff-lint TODO: fix get_service Warning
TODO: fix get_service
|
||
cmd = f"source {opts.token_file} ; echo $IBMCLOUD_API_KEY" | ||
service = get_service(cmd, opts) | ||
|
||
volumes = service.list_volumes(limit=LIMIT).result["volumes"] | ||
for volume in volumes: | ||
if volume["status"] in ["available"]: | ||
continue | ||
print(f"{volume['id']}({volume['name']}) -> {volume['status']}") | ||
|
||
if __name__ == "__main__": | ||
main() |