Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
GET: /v3/namespaces/{namespace-id}/apps/{app-id}/plugins/{plugin-id}
 
{plugin-id} is unique in the app.
this will return JSON of PluginPluginInfo object corresponding to the plugin-id. 
Code Block
public final class Plugin {
  // Existing/**
 * Internal class used by REST API to provide plugin information and the macros used in the plugin.
 */
class PluginInfo {
  Plugin plugin;
  MacroInfo macroInfo;
}
Code Block
// No changes to existing Plugin class in CDAP-API.
public final class Plugin {
  private final ArtifactId artifactId;
  private final PluginClass pluginClass;
  private final PluginProperties properties;
   Plugin(ArtifactId artifactId, PluginClass pluginClass, PluginProperties) {
	...
  }
  ...
}
Code Block
// new field internal class
class MacroInfo {
  
  /* macro macrosproperties used at this plugin 
   * Examples : 
   * for the field value ${hostname}:${port}/${path}, the set would be[hostname, port, path]
   * for the field value ${secure(accessKey)}, the set would be [accessKey]
   * for the field value ${key1:${key2}}, the set would be [key2, key1:${key2}]
   * for the field value \${u-name}, the set would be empty as macro is escaped     
   * for the field value ${key1\${key2}}, the set would be [key1\${key2}] so the user understands key2 is not a macro and will provide value for         the key, "key1${key2}"
   */
   private final Set<String> macros;
   Plugin(ArtifactId artifactId, PluginClass pluginClass, PluginProperties, @Nullable Set<String> macros) {
	...
  }
  ...
}

 

Another Option is instead of returning Set<String> macros, we can return MacroInfo object.

Code Block
class MacroInfo
{
	Set<String> properties; 
	Set<MacroFunction> functions;
}


class MacroFunction {
	String functionName;
	List<String> arguments;
}

 

Notes:

MacroInfo object can be constructed by looking into plugin properties and for the fields which are macro enabled, we can use the parser to get the macros used in those fields.

Though the UI will only be interested in properties, having macro function information will be useful when getting details of a plugin.

Notes:

macros can either be nullable to support backward compatibility
or we need upgrade step to provide empty set for macros when upgrading pipeline.