Class CreateNodesWithGroupEncodedIntoNameThenAddToSet

    • Method Detail

      • createNodeInGroupWithNameAndTemplate

        protected com.google.common.util.concurrent.ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate​(String group,
                                                                                                                                         String name,
                                                                                                                                         Template template)
        This calls logic necessary to create a node and convert it from its provider-specific object to the jclouds NodeMetadata object. This call directly precedes customization, such as executing scripts.

        The outcome of this operation does not imply the node is running. If you want to insert logic after the node is created, yet before an attempt to customize the node, then append your behaviour to this method. ex. to attach an ip address post-creation
         @Override
         protected ListenableFuture<AtomicReference<NodeMetadata>> createNodeInGroupWithNameAndTemplate(String group, String name,
                  Template template) {
         
            ListenableFuture<AtomicReference<NodeMetadata>> future = super.addNodeIntoGroupWithNameAndTemplate(group, name, template);
            return Futures.compose(future, new Function<AtomicReference<NodeMetadata>, AtomicReference<NodeMetadata>>() {
         
               @Override
               public AtomicReference<NodeMetadata> apply(AtomicReference<NodeMetadata> input) {
                  NodeMetadata node = input.get();
                  // allocate and attach an ip
                  input.set(NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of(ip.getIp())).build());
                  return input;
               }
         
            }, executor);
         }
         
        Parameters:
        group - group the node belongs to
        name - generated name of the node
        template - user-specified template
        Returns:
        node that is created, yet not necessarily in Status#RUNNING
      • getNextNames

        protected Set<String> getNextNames​(String group,
                                           Template template,
                                           int count)
        Find the next node names that can be used. If the nodeNames template option is not specified or is empty, these will be derived from the group and the template. We will pre-allocate a specified quantity, and attempt to verify that there is no name conflict with the current service. If the nodeNames option is specified, names from that will be used instead, without any check for name conflicts. If there are insufficient names in nodeNames, subsequent names will be generated in the default format.
        Parameters:
        group -
        count -
        template -
        Returns: