Examples of PlatformLayerClient


Examples of org.platformlayer.PlatformLayerClient

    super("open", "item");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey key = path.resolve(getContext());

    UntypedItem untypedItem = client.getItemUntyped(key, getFormat());
    List<EndpointInfo> endpointList = EndpointInfo.getEndpoints(untypedItem.getTags());

    Set<EndpointInfo> endpoints = Sets.newHashSet(endpointList);

    EndpointInfo bestEndpoint = null;
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

    super("put", "link");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey resolved = path.resolve(getContext());

    UntypedItemXml item = (UntypedItemXml) client.getItemUntyped(resolved, Format.XML);

    Links links = item.getLinks();

    Link link = new Link();
    link.name = name;
    link.target = target.resolve(getContext());

    Link existing = links.findLink(name);
    List<Link> linkList = links.getLinks();
    if (existing != null) {
      linkList.remove(existing);
    }
    linkList.add(link);

    item.setLinks(links);

    String xml = item.serialize();

    UntypedItemXml updated = (UntypedItemXml) client.putItem(resolved, xml, Format.XML);

    return updated.getLinks().getLinks();
  }
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

    super("set", "property");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException, IOException {
    PlatformLayerClient client = getPlatformLayerClient();

    if (stdin) {
      if (value != null) {
        throw new CliException("You cannot specify a value when using -stdin");
      }
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

    super("list", "items");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey key = pathToKey(client, path);

    return client.listItemsUntyped(key);
  }
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

    super("delete", "item");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey key = path.resolve(getContext());

    JobData jobData = client.deleteItem(key);
    return jobData;
  }
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

    super("list", "tags");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey key = path.resolve(getContext());
    UntypedItem ret = client.getItemUntyped(key, getFormat());

    return ret.getTags();
  }
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

  public ItemMutatorCommand(String verb, String noun) {
    super(verb, noun);
  }

  protected UntypedItemXml runCommand(ItemPath path) throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey resolved = path.resolve(getContext());

    UntypedItemXml item = (UntypedItemXml) client.getItemUntyped(resolved, Format.XML);

    changeItem(item);

    String xml = item.serialize();

    UntypedItemXml updated = (UntypedItemXml) client.putItem(resolved, xml, Format.XML);

    return updated;
  }
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

    super("list", "roots");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    return client.listRoots();
  }
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

    super("get", "metric");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    MetricQuery query = new MetricQuery();
    query.item = getContext().pathToItem(getProject(), path);
    if (filters != null) {
      query.filters.addAll(filters);
    }

    if (projections != null) {
      query.projections.addAll(projections);
    }

    query.setFlatten(flatten);

    MetricDataStream dataStream = client.getMetric(query);

    return dataStream;
  }
View Full Code Here

Examples of org.platformlayer.PlatformLayerClient

    super("ssh", "item");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    PlatformLayerKey key = path.resolve(getContext());

    UntypedItem untypedItem = client.getItemUntyped(key, Format.XML);

    InetAddress sshAddress = findSshAddress(client, untypedItem);

    ClientAction action = null;
    if (sshAddress != null) {
      String user = "root";

      ProjectId project = key.getProject();
      if (project == null) {
        project = client.getProject();
      }
      if (project == null) {
        throw new CliException("Cannot determine project");
      }
      String projectKey = project.getKey();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.