public static Object getSchema(String serviceType)
     throws PlatformLayerClientException, JSONException {
   PlatformLayerCliContext context = PlatformLayerCliContext.get();
   PlatformLayerClient client = context.getPlatformLayerClient();
   String retval = client.getSchema(serviceType, Format.XML);
   return retval;
 }
 public static Object getSshPublicKey(String serviceType)
     throws PlatformLayerClientException, JSONException {
   PlatformLayerCliContext context = PlatformLayerCliContext.get();
   PlatformLayerClient client = context.getPlatformLayerClient();
   String key = client.getSshPublicKey(serviceType);
   return toPython(key);
 }
  public static Object toPython(Object in) {
    if (in instanceof Iterable) {
      Iterable<?> list = (Iterable<?>) in;
      PlatformLayerCliContext context = PlatformLayerCliContext.get();
      List<Object> pythonObjects = Lists.newArrayList();
      for (Object item : list) {
        pythonObjects.add(toPython(item));
      }
      return FormattedList.build(context.getFormatterRegistry(), pythonObjects, true);
    }

    // if (in instanceof UntypedItemCollection) {
    // UntypedItemCollection list = (UntypedItemCollection) in;
    // List<Object> python = new FormattedList<Object>();
    // for (UntypedItem item : list) {
    // python.add(toPython(item));
    // }
    // return python;
    // }

    if (in == null) {
      return null;
    }

    return in;
  }
 public static Object getActivation(String serviceType)
     throws PlatformLayerClientException, JSONException {
   PlatformLayerCliContext context = PlatformLayerCliContext.get();
   PlatformLayerClient client = context.getPlatformLayerClient();
   String retvalJsonString = client.getActivation(serviceType, Format.JSON);
   JSONObject retvalJsonObject = new JSONObject(retvalJsonString);
   return toPython(retvalJsonObject);
 }
 public static Object activateService(String serviceType, Object properties)
     throws PlatformLayerClientException, JSONException {
   PlatformLayerCliContext context = PlatformLayerCliContext.get();
   PlatformLayerClient client = context.getPlatformLayerClient();
   String json = properties.toString();
   String wrapper = "{ \"data\": \"" + json + "\" }";
   String retvalJsonString = client.activateService(serviceType, wrapper, Format.JSON);
   JSONObject retvalJsonObject = new JSONObject(retvalJsonString);
   return toPython(retvalJsonObject);
 }