E9.2 Server Manager API - Connectors Setup

aostdiek

aostdiek

Member
We are setting up an orchestration to use Server Manager API's to clear jdbj database caches via a Form Extension button, and have got it to work via configuring a Connectors object (attached to a Connections object), where we hard coded a specific environment instance name within the Body of that Connectors object setup:

1705945531333.png

This works successfully in DV because we designated our DV JAS environment as shown above, but with that configuration, once the solution gets moved to PY or PD, the JAS environment would still reference the DV environment. Is there an efficient way to facilitate this, where the Connectors configuration would clear the cache for the specific environment it is generated from (via the orchestration) by passing the instanceName in through a variable to the Body? I have tried setting up a variable {Body} to be pass in that information, but have not figured out how to make that work.

Should we create 3 different Connectors (one for each environment: DV, PY, and PD) and have a Rule, or another Orchestrator component, evaluate the current environment and then have the orchestration use that to run the Connectors component that is specific to the appropriate environment?

I'm inexperienced with Orchestrations invoking API's like this, but have the Connections setup with soft coding records for each environment, so am thinking this last Connectors riddle is my last hurdle to enabling this in all of our environments, and would greatly appreciate any feedback and/or ideas on how we could accommodate this.

Thanks!
 
It's possible to get current envname via this groovy script (or something similar). Get current env from this script step early in your orch, then map the "getEnvironment" var to an input var of your connector, so that you're not hardcoding anything:

Your Body JSON can add params WITHIN double quotes by using the variable delimiter ${varName}


So it would look like
{"instanceName": "${envName}","jdbjDatabaseCacheName":"ALL"}

When you save that, you should see envName pop up in Transformations as a variable you can map to. map getEnvironment from the scripting step to envName in this step.



JavaScript:
import com.oracle.e1.common.OrchestrationAttributes;
import java.text.SimpleDateFormat;
HashMap<String, Object> main(OrchestrationAttributes orchAttr, HashMap inputMap)
{
  HashMap<String, Object> returnMap = new HashMap<String, Object>();
  // Add logic here
String getOrchestrationName = orchAttr.getOrchestrationName()
String getToken = orchAttr.getToken()
String getLangPref = orchAttr.getLangPref()
String getLocale = orchAttr.getLocale()
String getDateFormat = orchAttr.getDateFormat()
String getDateSeperator = orchAttr.getDateSeperator()
String getSimpleDateFormat = orchAttr.getSimpleDateFormat()
String getDecimalFormat = orchAttr.getDecimalFormat()
String getAddressNumber = orchAttr.getAddressNumber()
String getAlphaName = orchAttr.getAlphaName()
String getAppsRelease = orchAttr.getAppsRelease()
String getCountry = orchAttr.getCountry()
String getUsername = orchAttr.getUsername()
String getEnvironment = orchAttr.getEnvironment()
String getTempDir = orchAttr.getTempDir()
String getMachineKey = orchAttr.getMachineKey()
String getMachineName = orchAttr.getMachineName()
String getLongUserId  = orchAttr.getLongUserId ()
String toString = orchAttr.toString()
String env = orchAttr.getEnvironment();
returnMap.put("getOrchestrationName", getOrchestrationName);
returnMap.put("getToken", getToken);
returnMap.put("getLangPref", getLangPref);
returnMap.put("getLocale", getLocale);
returnMap.put("getDateFormat", getDateFormat);
returnMap.put("getDateSeperator", getDateSeperator);
returnMap.put("getSimpleDateFormat", getSimpleDateFormat);
returnMap.put("getDecimalFormat", getDecimalFormat);
returnMap.put("getAddressNumber", getAddressNumber);
returnMap.put("getAlphaName", getAlphaName);
returnMap.put("getAppsRelease", getAppsRelease);
returnMap.put("getCountry", getCountry);
returnMap.put("getUsername", getUsername);
returnMap.put("getEnvironment", getEnvironment);
returnMap.put("getTempDir", getTempDir);
returnMap.put("getMachineKey", getMachineKey);
returnMap.put("getMachineName", getMachineName);
returnMap.put("getLongUserId", getLongUserId);
returnMap.put("toString", toString);

  return returnMap;
}
 
My apologies for the delayed feedback and a reply of appreciation @DaveWagoner . I had not yet been able to understand or get a groovy script to work for me, and the example provided looks like it will provide the components needed to create the instance name. I also had not figured out how to get parameters to work within a JSON body, so the variable delimiter within the double quotes should help me construct the full instance name with a combination of several of the groovy script variables returned. Thank you for taking the time to provide some assistance as usual!
 
Hi @aostdiek, @DaveWagoner ,
We can do use connectors and add multiple connectors into one ORCH , So when we can call ORCH , all connectors will run.
if you have non prod environments (different Htmls) and prod (3-4 htmls) we can use connectors and use it.
 
Back
Top