Examples of PublicEndpointBase


Examples of org.platformlayer.core.model.PublicEndpointBase

  }

  public PublicEndpointBase createPublicEndpoint(InstanceBase instance, PlatformLayerKey parent) throws OpsException {
    MachineProvider cloudController = getCloud(instance.cloud);

    PublicEndpointBase endpoint = cloudController.buildEndpointTemplate();

    if (parent != null) {
      endpoint.getTags().add(Tag.buildParentTag(parent));
    }

    return endpoint;
    // throw new UnsupportedOperationException();
  }
View Full Code Here

Examples of org.platformlayer.core.model.PublicEndpointBase

  protected PublicEndpointBase buildItemTemplate() throws OpsException {
    InstanceBase instance = OpsContext.get().getInstance(InstanceBase.class);

    PlatformLayerKey instanceKey = instance.getKey();

    PublicEndpointBase publicEndpoint = platformLayerCloudHelpers.createPublicEndpoint(instance, parentItem);
    // publicEndpoint.network = network;
    publicEndpoint.publicPort = publicPort;
    publicEndpoint.publicPortCluster = publicPortCluster;
    publicEndpoint.backendPort = backendPort;
    publicEndpoint.instance = instanceKey;
    publicEndpoint.key = PlatformLayerKey.fromId(instance.getId() + "_" + publicPort);

    if (transport != null) {
      publicEndpoint.transport = transport.toString();
    }
    // publicEndpoint.getTags().add(OpsSystem.get().createParentTag(instance));

    Tag uniqueTag = UniqueTag.build(instance, String.valueOf(publicPort));
    publicEndpoint.getTags().add(uniqueTag);

    return publicEndpoint;
  }
View Full Code Here

Examples of org.platformlayer.core.model.PublicEndpointBase

        @Override
        public TagChanges get() throws OpsException {
          int maxAttempts = 5;
          int attempt = 0;

          PublicEndpointBase item = endpoint.getItem();

          while (true) {
            attempt++;

            if (item == null) {
              if (!OpsContext.isDelete()) {
                throw new OpsException("Endpoint not created");
              } else {
                log.warn("No endpoint => no tagging to be done");
                return null;
              }
            }

            List<EndpointInfo> endpointInfos = EndpointInfo.findEndpoints(item.getTags(), publicPort);
            if (!endpointInfos.isEmpty()) {
              TagChanges tagChanges = new TagChanges();
              for (EndpointInfo endpointInfo : endpointInfos) {
                tagChanges.addTags.add(endpointInfo.toTag());
              }

              return tagChanges;
            }

            if (attempt != maxAttempts) {
              log.info("Endpoint not yet found; sleeping and retrying");
              TimeSpan.FIVE_SECONDS.doSafeSleep();

              item = platformLayerClient.getItem(item.getKey());
              continue;
            } else {
              throw new OpsException("Cannot find endpoint for port: " + publicPort);
            }
          }
View Full Code Here

Examples of org.platformlayer.core.model.PublicEndpointBase

  @Inject
  DnsHelpers dns;

  @Handler
  public void handler() throws OpsException {
    PublicEndpointBase endpoint = endpointProvider.get();

    if (OpsContext.isConfigure()) {
      // Create a DNS record
      Tag parentTag = Tag.buildParentTag(endpoint.getKey());

      List<EndpointInfo> endpoints = EndpointInfo.findEndpoints(endpoint.getTags(), destinationPort);
      if (endpoints.isEmpty()) {
        throw new OpsException("Cannot find endpoint for port: " + destinationPort);
      }

      DnsRecord record = new DnsRecord();
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.