mirror of
https://github.com/jbowdre/phpIPAM-for-vRA8.git
synced 2024-12-03 12:02:17 +00:00
Make 'isPool' filter optional, #3
This commit is contained in:
parent
8861002c96
commit
b1f5dd1aea
2 changed files with 18 additions and 1 deletions
|
@ -55,6 +55,7 @@ def do_get_ip_ranges(self, auth_credentials, cert):
|
|||
password = auth_credentials["privateKey"]
|
||||
hostname = self.inputs["endpoint"]["endpointProperties"]["hostName"]
|
||||
apiAppId = self.inputs["endpoint"]["endpointProperties"]["apiAppId"]
|
||||
filterPool = self.inputs["endpoint"]["endpointProperties"]["filterPool"]
|
||||
uri = f'https://{hostname}/api/{apiAppId}/'
|
||||
auth = (username, password)
|
||||
|
||||
|
@ -63,8 +64,12 @@ def do_get_ip_ranges(self, auth_credentials, cert):
|
|||
|
||||
# Request list of subnets
|
||||
subnet_uri = f'{uri}/subnets/'
|
||||
if filterPool == "true":
|
||||
queryFilter = 'filter_by=isPool&filter_value=1'
|
||||
else:
|
||||
queryFilter = ''
|
||||
ipRanges = []
|
||||
subnets = requests.get(f'{subnet_uri}?filter_by=isPool&filter_value=1', headers=token, verify=cert)
|
||||
subnets = requests.get(f'{subnet_uri}?{queryFilter}', headers=token, verify=cert)
|
||||
subnets = subnets.json()['data']
|
||||
for subnet in subnets:
|
||||
ipRange = {}
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
{
|
||||
"id":"hostName",
|
||||
"display":"textField"
|
||||
},
|
||||
{
|
||||
"id":"filterPool",
|
||||
"display": "checkbox"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -66,6 +70,14 @@
|
|||
"constraints":{
|
||||
"required":true
|
||||
}
|
||||
},
|
||||
"filterPool":{
|
||||
"type":{
|
||||
"dataType":"boolean"
|
||||
},
|
||||
"label":"Only find ranges marked as Pools",
|
||||
"signpost":"If enabled, vRA will only retrieve subnets marked as pools in phpIPAM",
|
||||
"default":true
|
||||
}
|
||||
},
|
||||
"options":{
|
||||
|
|
Loading…
Reference in a new issue