Create a workflow that connects to the Redis plug-in.
Procedure
- Log in to the Automation Orchestrator Client.
- Navigate to Library > Workflows.
- Click New Workflow.
- Enter a name for the new workflow, and click Create.
- Select the Inputs/Outputs tab, and click New.
- Under the Name text box, enter connection.
- Under the Type text box, enter Redis:Connection.
- Save the workflow and click Run.
The Search text box appears.The search string you enter is delegated to the
query
method of theConnectionFinder
. If you leave the text box empty, the plug-in returns all available connections.Note: Thewrap
method exposes theConnection
as a scripting object and theandFind
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 aConnectionFinder
.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 theConnection
object and cannot retrieve objects of this type. The platform can only search for the object by ID. - Under the {plug-in-home}/o11nplugin-redis-core/src/main/java/com/vmware/o11n/plugin/redis folder, create a directory with name relater.
- Use the
ObjectRelated
interface to create aRootHasConnections
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()); } }
TheRootHasConnections
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 thefindChildren
method become irrelevant. - Use the
define
method to define the relation inCustomMapping
.relateRoot().to(Connection.class).using(RootHasConnections.class).as("connections");
- Build the plug-in.
- Install the modified version of the plug-in on the Automation Orchestrator server. See Deploy a Plug-In.
- Log in to the Automation Orchestrator Client.
- 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()
.