Package org.platformlayer.client.cli

Examples of org.platformlayer.client.cli.PlatformLayerCliContext


import com.fathomdb.cli.autocomplete.SimpleArgumentAutoCompleter;
import com.google.common.collect.Lists;

public abstract class PlatformLayerSimpleAutoCompleter extends SimpleArgumentAutoCompleter {
  protected PlatformLayerClient getPlatformLayerClient(CliContext context) {
    PlatformLayerCliContext plContext = (PlatformLayerCliContext) context;
    return plContext.getPlatformLayerClient();
  }
View Full Code Here


    return toPython(ret);
  }

  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);
View Full Code Here

    JSONObject retvalJsonObject = new JSONObject(retvalJsonString);
    return toPython(retvalJsonObject);
  }

  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);
  }
View Full Code Here

    JSONObject retvalJsonObject = new JSONObject(retvalJsonString);
    return toPython(retvalJsonObject);
  }

  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);
  }
View Full Code Here

    String key = client.getSshPublicKey(serviceType);
    return toPython(key);
  }

  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;
  }
View Full Code Here

  // }

  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, pythonObjects, true);
View Full Code Here

    super(UntypedItem.class);
  }

  @Override
  public void visit(CliContext contextGeneric, UntypedItem o, OutputSink sink) throws IOException {
    PlatformLayerCliContext context = (PlatformLayerCliContext) contextGeneric;

    LinkedHashMap<String, Object> values = Maps.newLinkedHashMap();

    UntypedItemXml item = (UntypedItemXml) o;
View Full Code Here

TOP

Related Classes of org.platformlayer.client.cli.PlatformLayerCliContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.