Create a workflow that connects to the Redis plug-in.

Procedure

  1. Log in to the Automation Orchestrator Client.
  2. Navigate to Library > Workflows.
  3. Click New Workflow.
  4. Enter a name for the new workflow, and click Create.
  5. Select the Inputs/Outputs tab, and click New.
  6. Under the Name text box, enter connection.
  7. Under the Type text box, enter Redis:Connection.
  8. Save the workflow and click Run.
    The Search text box appears.
    The search string you enter is delegated to the query method of the ConnectionFinder. If you leave the text box empty, the plug-in returns all available connections.
    Note: The wrap method exposes the Connection as a scripting object and the andFind method marks the object as a type. You cannot define an object as a findable type if you do not use a finder class. You can use a ConnectionFinder.
    Although there is a findable object and you can use a query to search for this object, the plug-in inventory tree is empty. If you want to see the available connections in the inventory tree, you must define the relation of the findable object.
    The platform cannot identify the parent object of the Connection object and cannot retrieve objects of this type. The platform can only search for the object by ID.
  9. Under the {plug-in-home}/o11nplugin-redis-core/src/main/java/com/vmware/o11n/plugin/redis folder, create a directory with name relater.
  10. Use the ObjectRelated interface to create a RootHasConnections relater.
    package com.vmware.o11n.plugin.redis.relater; 
    import java.util.ArrayList; 
    import java.util.List; 
    import org.springframework.beans.factory.annotation.Autowired; 
    import com.vmware.o11n.plugin.redis.config.ConnectionRepository; 
    import com.vmware.o11n.plugin.redis.model.Connection; 
    import com.vmware.o11n.sdk.modeldriven.ObjectRelater; 
    import com.vmware.o11n.sdk.modeldriven.PluginContext; 
    import com.vmware.o11n.sdk.modeldriven.Sid; 
      
    public class RootHasConnections implements ObjectRelater<Connection> { 
      
      
        @Autowired 
        private ConnectionRepository connectionRepository; 
      
        @Override 
        public List<Connection> findChildren(PluginContext ctx, String relation, String parentType, Sid parentId) { 
            return new ArrayList<>(connectionRepository.findAll()); 
        } 
    } 
    The RootHasConnections relater creates the relation between the root of the inventory and a list of connections.
    Note: The relater only returns all connection objects. When you relate the root of a tree to an object, the arguments of the findChildren method become irrelevant.
  11. Use the define method to define the relation in CustomMapping.
    relateRoot().to(Connection.class).using(RootHasConnections.class).as("connections"); 
  12. Build the plug-in.
  13. Install the modified version of the plug-in on the Automation Orchestrator server. See Deploy a Plug-In.
  14. Log in to the Automation Orchestrator Client.
  15. Navigate to the Inventory page and expand the Redis plug-in entry.
    The relateRoot() method relates objects to the root of the tree. There is one additional method for adding inventory objects to the tree – relate().