Skip to content

Commit 2cfec98

Browse files
committed
added get folder resource details
1 parent a9ae56e commit 2cfec98

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
iterate over a target folder and print out reserved resources
3+
"""
4+
from cloudshell.api.cloudshell_api import CloudShellAPISession
5+
import json
6+
7+
# add credentials for session
8+
user = "admin"
9+
password = "admin"
10+
server = "localhost"
11+
domain = "Global"
12+
13+
TARGET_FOLDER = "mocks/DUT"
14+
# start session
15+
api = CloudShellAPISession(host=server, username=user, password=password, domain=domain)
16+
# resources = api.GetFolderContent(fullPath="mocks/DUT", showAllDomains=True)
17+
contents = api.GetFolderContent(fullPath=TARGET_FOLDER).ContentArray
18+
19+
20+
for content in contents:
21+
if content.Type == "Resource":
22+
root_resource_name = content.Name
23+
print(f"root name: {root_resource_name}")
24+
reserved_resource = {root_resource_name: []}
25+
availability_resources = api.GetResourceAvailability(resourcesNames=[content.Name]).Resources
26+
for resource in availability_resources:
27+
print(f"Resource: {resource.FullName}, Status: {resource.ReservedStatus}")
28+
print("===========")

0 commit comments

Comments
 (0)