@Override public void createCustomAPI( UUID subscriptionId, String serviceName, String tableName, CustomAPIPermissions permissions) throws AzureCmdException { String[] cmd; if (permissions == null) cmd = new String[] { "mobile", "api", "create", "-s", subscriptionId.toString(), serviceName, tableName }; else cmd = new String[] { "mobile", "api", "create", "-p", permissions.toString(), "-s", subscriptionId.toString(), serviceName, tableName }; AzureCommandHelper.getInstance().consoleExec(cmd); }
@Override public List<CustomAPI> getAPIList(UUID subscriptionId, String serviceName) throws AzureCmdException { String[] cmd = new String[] { "mobile", "api", "list", "--json", "-s", subscriptionId.toString(), serviceName }; String json = AzureCommandHelper.getInstance().consoleExec(cmd); CustomJsonSlurper slurper = new CustomJsonSlurper(); List<Map<String, String>> tempRes = (List<Map<String, String>>) slurper.parseText(json); List<CustomAPI> res = new ArrayList<CustomAPI>(); for (Map<String, String> item : tempRes) { CustomAPI c = new CustomAPI(); c.setName(item.get("name")); CustomAPIPermissions permissions = new CustomAPIPermissions(); permissions.setPutPermission(PermissionItem.getPermitionType(item.get("put"))); permissions.setPostPermission(PermissionItem.getPermitionType(item.get("post"))); permissions.setGetPermission(PermissionItem.getPermitionType(item.get("get"))); permissions.setDeletePermission(PermissionItem.getPermitionType(item.get("delete"))); permissions.setPatchPermission(PermissionItem.getPermitionType(item.get("patch"))); c.setCustomAPIPermissions(permissions); res.add(c); } return res; }