def listStorageVolumeSnapshots(endpoint, resourcename, cookie): basepath = '/storage/snapshot/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'GET', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def updateSecurityIpList(endpoint, resourcename, cookie, name, secipentries): basepath = '/seciplist/' params = None data = {"name": name, "secipentries": str(secipentries)} response = callRESTApi(endpoint, basepath, resourcename, data, 'PUT', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def createMachineImage(endpoint, resourcename, cookie, name, fileurl, account, noupload=True, attributes=None, size=0, **kwargs): basepath = '/machineimage/' params = None data = { "name": str(name), "file": str(fileurl), "account": str(account), "no_upload": noupload } if attributes is not None: data['attributes'] = attributes data['sizes'] = {"total": size} response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def listShapes(endpoint, resourcename, cookie): basepath = '/shape/' params = None data = None response = callRESTApi(endpoint, basepath, '', data, 'GET', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def createSecurityApplication(endpoint, resourcename, cookie, name, protocol, description=None, dport=None, imcptype=None, imcpcode=None, **kwargs): basepath = '/secapplication/' params = None data = {"name": name, "protocol": str(protocol)} if description is not None: data['description'] = description if dport is not None: data['dport'] = dport if imcptype is not None: data['imcptype'] = imcptype if imcpcode is not None: data['imcpcode'] = imcpcode response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def stopOrchestration(endpoint, resourcename, cookie): basepath = '/orchestration/' params = {"action": "STOP"} data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'PUT', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def createIPAssociation(endpoint, resourcename, cookie, parentpool, vcable): basepath = '/ip/association/' params = None data = {"parentpool": str(parentpool), "vcable": str(vcable)} response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def listVpnEndpoints(endpoint, resourcename, cookie): basepath = '/vpnendpoint/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'GET', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def createStorageVolume(endpoint, resourcename, cookie, size, name, properties=["/oracle/public/storage/default"], bootable=False, imagelist=None, imagelistentry=None, description=None, tags=None, snapshot=None, **kwargs): basepath = '/storage/volume/' params = None data = { "size": size, "properties": properties, "name": name, "bootable": bootable } if imagelist is not None: data['imagelist'] = imagelist if imagelistentry is not None: data['imagelistentry'] = imagelistentry if description is not None: data['description'] = description if tags is not None: data['tags'] = tags if snapshot is not None: data['snapshot'] = snapshot response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def listSecurityIpLists(endpoint, resourcename, cookie): basepath = '/seciplist/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'GET', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def updateOrchestration(endpoint, resourcename, cookie, orchestration): basepath = '/orchestration/' params = None data = orchestration response = callRESTApi(endpoint, basepath, resourcename, data, 'PUT', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def updateSecurityRule(endpoint, resourcename, cookie, name, srclist, dstlist, application, action='PERMIT', description=None, disabled=False, **kwargs): basepath = '/secrule/' params = None data = { "name": name, "src_list": str(srclist), "dst_list": str(dstlist), "application": str(application), "action": str(action) } if description is not None: data['description'] = description if disabled is not None: data['disabled'] = disabled response = callRESTApi(endpoint, basepath, resourcename, data, 'PUT', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def addSshKey(endpoint, resourcename, cookie, name, key, enabled): basepath = '/sshkey/' params = None data = {"name": name, "key": key, "enabled": enabled} response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def listMachnineImages(endpoint, resourcename, cookie): basepath = '/machineimage/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'GET', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def listOrchestrations(endpoint, resourcename, cookie): basepath = '/orchestration/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'GET', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def addLaunchplan(endpoint, resourcename, cookie, launchplan): basepath = '/launchplan/' params = None data = launchplan response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def listStorageProperties(endpoint, resourcename, cookie): basepath = '/property/storage/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'GET', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def updateIPReservation(endpoint, resourcename, cookie, name, parentpool, permanent=True): basepath = '/ip/reservation/' params = None data = {"name": name, "permanent": permanent} if parentpool is not None: data['parentpool'] = str(parentpool) response = callRESTApi(endpoint, basepath, resourcename, data, 'PUT', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def createSecurityAssociation(endpoint, resourcename, cookie, seclist, vcable, name=None): basepath = '/secassociation/' params = None data = {"seclist": str(seclist), "vcable": str(vcable)} if name is not None: data['name'] = name response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def deleteStorageVolumeSnapshot(endpoint, resourcename, cookie): basepath = '/storage/snapshot/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'DELETE', params, cookie) print(response) jsonResponse = {} return jsonResponse
def createSecurityIpList(endpoint, resourcename, cookie, name, secipentries, description=None): basepath = '/seciplist/' params = None data = {"name": name, "secipentries": str(secipentries)} if description is not None: data['description'] = description response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def deleteInstanceSnapshot(endpoint, resourcename, cookie): basepath = '/snapshot/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'DELETE', params, cookie) print(response) # jsonResponse = json.loads(response.text) jsonResponse = {} return jsonResponse
def deleteStorageVolume(endpoint, resourcename, cookie): basepath = '/storage/volume/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'DELETE', params, cookie) print(response) # jsonResponse = json.loads(response.text) jsonResponse = {} return jsonResponse
def deleteSecurityAssociation(endpoint, resourcename, cookie): basepath = '/secassociation/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'DELETE', params, cookie) print(response) # jsonResponse = json.loads(response.text) jsonResponse = {} return jsonResponse
def updateVpnEndpoint(endpoint, resourcename, cookie, name, customervpngateway, psk, reachableroutes, enabled=False): basepath = '/vpnendpoint/' params = None data = {"name": name, "customer_vpn_gateway": str(customervpngateway), "psk": str(psk), "reachable_routes": str(reachableroutes)} if enabled is not None: data['enabled'] = enabled response = callRESTApi(endpoint, basepath, resourcename, data, 'PUT', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def deleteSshKey(endpoint, resourcename, cookie): basepath = '/sshkey/' params = None data = None response = callRESTApi(endpoint, basepath, resourcename, data, 'DELETE', params, cookie) try: jsonResponse = json.loads(response.text) except Exception as e: jsonResponse = {} return jsonResponse
def deleteImageListEntry(endpoint, resourcename, cookie, version): basepath = '/imagelist/' params = None data = None if resourcename is not None and resourcename != '': resourcename = str(resourcename).strip('/') + '/entry/' + str(version) response = callRESTApi(endpoint, basepath, resourcename, data, 'DELETE', params, cookie) print(response) # jsonResponse = json.loads(response.text) jsonResponse = {} return jsonResponse
def authenticate(endpoint, user, password): clearHTTPSession() data = {"password": password, "user": user} basepath = '/authenticate/' resourcename = '' params = None response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params) if response is not None and 'set-cookie' in response.headers: cookie = response.cookies['nimbula'] else: cookie = '' return cookie
def createStorageAttachment(endpoint, resourcename, cookie, instancename, storagevolumename, index): basepath = '/storage/attachment/' params = None data = { "instance_name": instancename, "storage_volume_name": str(storagevolumename), "index": int(index) } response = callRESTApi(endpoint, basepath, resourcename, data, 'POST', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse
def updateImagelist(endpoint, resourcename, cookie, name, description, default): basepath = '/imagelist/' params = None data = { "name": name, "description": str(description), "default": int(default) } response = callRESTApi(endpoint, basepath, resourcename, data, 'PUT', params, cookie) jsonResponse = json.loads(response.text) return jsonResponse