-
Notifications
You must be signed in to change notification settings - Fork 92
Description
Hello Team,
I have a requirement to read Available subnets from IPAM and use that subnet range to create gcp subnet to share it with newly created project. I am not able to figure it out, i could able to list subnets but the description.
Example:
My Dashboard > IP Addresses > Manage Subnets & IP Addresses --> Google Cloud Networks --> GCP Supernet for Service Projects --> List of subnets.
I am able to list overall subnets using below python code but not able to filter with description as well. For all the subnets description is none but i have description written for few subnets.
==========
import orionsdk
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
swis = orionsdk.SwisClient("xxxxx", "xxxx", "xxxxxx")
try:
query_result = swis.query("SELECT SubnetId, CIDR, Description FROM IPAM.Subnet")
if query_result and 'results' in query_result:
for subnet in query_result['results']:
print(f"Subnet ID: {subnet['SubnetId']}")
print(f"CIDR: {subnet['CIDR']}")
print(f"Description: {subnet['Description']}")
print("-" * 20)
else:
print("No subnets found or an error occurred.")
except Exception as e:
print(f"An error occurred: {e}")
====
It would be great if i get support on this.
Regards,
Jagadeeswar Reddy K