Examples of Tags


Examples of org.platformlayer.core.model.Tags

  @Override
  public List<CloudImage> findImages(List<Tag> tags) throws OpsException {
    List<CloudImage> images = Lists.newArrayList();
    for (String imageId : fileStore.find(tags)) {
      Properties properties = fileStore.readProperties(imageId);
      Tags imageTags = fileStore.asTags(properties);
      images.add(new DirectCloudImage(this, imageId, imageTags));
    }
    return images;
  }
View Full Code Here

Examples of org.platformlayer.core.model.Tags

    request.cloud = model.cloud;
    request.hostname = model.dnsName;

    request.hostPolicy = model.hostPolicy;

    Tags tags = new Tags();

    tags.addAll(Tag.HOST_POLICY.filter(tags));

    request.tags = tags;
    if (model.securityGroup != null) {
      request.securityGroups = Lists.newArrayList();
      request.securityGroups.add(model.securityGroup);
View Full Code Here

Examples of org.platformlayer.core.model.Tags

public class PlatformLayerHelpers extends TypedPlatformLayerClient {
  @Inject
  ServiceProviderHelpers serviceProviderHelpers;

  public UUID getOrCreateUuid(ItemBase model) throws PlatformLayerClientException {
    Tags tags = model.getTags();
    UUID uuid = Tag.UUID.findUnique(tags);
    if (uuid != null) {
      return uuid;
    }

    uuid = UUID.randomUUID();
    Tag uuidTag = Tag.UUID.build(uuid);
    tags.add(uuidTag);
    this.addTag(model.getKey(), uuidTag);
    return uuid;
  }
View Full Code Here

Examples of org.platformlayer.core.model.Tags

  public void setUniqueTags(PlatformLayerKey key, Tag... uniqueTags) throws OpsException {
    setUniqueTags(key, Arrays.asList(uniqueTags));
  }

  public void setUniqueTags(PlatformLayerKey key, Iterable<Tag> uniqueTags) throws OpsException {
    Tags tags = getItemTags(key);

    TagChanges tagChanges = new TagChanges();
    for (Tag setTag : uniqueTags) {
      String tagKey = setTag.getKey();

      List<String> existing = tags.findAll(tagKey);
      if (existing == null || existing.isEmpty()) {
        tagChanges.addTags.add(setTag);
      } else if (existing.size() == 1) {
        String existingValue = existing.get(0);
        if (!Objects.equal(existingValue, setTag.value)) {
View Full Code Here

Examples of org.platformlayer.core.model.Tags

  public void setCollectionValues(PlatformLayerKey key, String tagKey, Collection<String> newTagValues)
      throws OpsException {
    Set<String> newTagValuesSet = Sets.newHashSet(newTagValues);

    Tags existingTags = getItemTags(key);

    TagChanges tagChanges = new TagChanges();

    Set<String> foundValues = Sets.newHashSet();
View Full Code Here

Examples of org.platformlayer.core.model.Tags

  @Inject
  GoogleComputeClientFactory googleComputeClientFactory;

  @Handler
  public void doOperation() throws OpsException, IOException {
    Tags instanceTags = instance.getTags();

    GoogleCloud cloud = findCloud();
    if (cloud == null) {
      throw new OpsException("Could not find cloud");
    }
    GoogleComputeClient computeClient = googleComputeClientFactory.getComputeClient(cloud);

    getRecursionState().pushChildScope(cloud);

    List<String> assignedInstanceIds = instanceTags.findAll(Tag.ASSIGNED);
    if (assignedInstanceIds.isEmpty()) {
      if (createInstance && !OpsContext.isDelete()) {
        MachineCreationRequest request = buildMachineCreationRequest();

        PlatformLayerKey instanceKey = instance.getKey();
View Full Code Here

Examples of org.platformlayer.core.model.Tags

    // request.securityGroups;
    request.hostPolicy = instance.hostPolicy;
    request.hostname = instance.hostname;
    request.publicPorts = instance.publicPorts;

    Tags tags = new Tags();
    request.tags = tags;
    return request;
  }
View Full Code Here

Examples of org.platformlayer.core.model.Tags

  }

  @Deprecated
  /* @Deprecated - Pass tags */
  public static InstanceBuilder build(String dnsName, Object controller) throws OpsException {
    Tags tags = null;
    return build(dnsName, controller, tags);
  }
View Full Code Here

Examples of org.platformlayer.core.model.Tags

    return matches;
  }

  public Tags asTags(Properties properties) {
    Tags tags = new Tags();
    for (Object keyObject : properties.keySet()) {
      String key = (String) keyObject;
      // if (key.startsWith(PROPERTY_PREFIX_TAG)) {
      // String tagName = key.substring(PROPERTY_PREFIX_TAG.length());
      String tagName = key;
      Tag tag = Tag.build(tagName, properties.getProperty(key));
      tags.add(tag);
      // }
    }
    return tags;
  }
View Full Code Here

Examples of org.platformlayer.core.model.Tags

      if (tagChanges != null) {
        log.info("Setting tags on " + platformLayerKey);

        if (OpsContext.isDelete()) {
          // Swap the tags for a removal
          Tags x = tagChanges.addTags;
          tagChanges.addTags = tagChanges.removeTags;
          tagChanges.removeTags = x;
        }

        platformLayer.changeTags(platformLayerKey, tagChanges, null);
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.