5.245 Plugin Types

This section describes behavior of the Plugin Type object in Moab Web Services. It contains the URLs, request bodies, and responses delivered to and from MWS.

The Fields: Plugin Types reference section contains the type and description of all fields in the Plugin Type object. It also contains details regarding which fields are valid during PUT and POST actions.

Supported methods

Resource GET PUT POST DELETE
/rest/plugin-types Get All Plugin Types Creating or Updating Plugin Types -- --
/rest/plugin-types/<id> Get Single Plugin Type -- -- --

This topic contains these sections:

5.245.1 Getting Plugin Types

The HTTP GET method is used to retrieve Plugin Type information. Queries for all objects and a single object are available.

Quick reference

GET http://localhost:8080/mws/rest/plugin-types/<id>?api-version=3

5.245.1.A Get All Plugin Types

URLs and parameters

GET http://localhost:8080/mws/rest/plugin-types?api-version=3

See Global URL Parameters for available URL parameters.

Sample response

GET http://localhost:8080/mws/rest/plugin-types?api-version=3&fields=id
------------------------------------

{
  "totalCount": 2,
  "resultCount": 2,
  "results":   [
    {"id": "vCenter"},
    {"id": "Native"}
  ]
}

5.245.1.B Get Single Plugin Type

URLs and parameters

GET http://localhost:8080/mws/rest/plugin-types/<id>?api-version=3
Parameter Required Type Valid values Description
id Yes String -- The unique identifier of the object.

See Global URL Parameters for available URL parameters.

Sample response

JSON response
------------------------------------

{
  "author": "Adaptive Computing Enterprises, Inc.",
  "commonsVersion": "0.9.3 > *",
  "description": "Polls a VMware® vCenter™ Server for information on the hypervisors and virtual machines it manages.",
  "documentationLink": "",
  "email": "",
  "eventComponent": 1,
  "realizedEventComponent": 513,
  "id": "VCenter",
  "initialPlugins": { },
  "instances": [
    {"id":"vcenter"}
  ],
  "issueManagementLink": "",
  "license": "APACHE",
  "mwsVersion": "7.1.2 > *",
  "pollMethod": true,
  "scmLink": "",
  "title": "VCenter",
  "version": "1.0",
  "webServices": [ ],
  "website": "http://www.adaptivecomputing.com"
}

5.245.2 Creating or Updating Plugin Types

The HTTP PUT method is used to create or update Plugin Types. The Content-Type HTTP header is used to determine if the request contains a single class file as plaintext or the binary data of a JAR file. Each request is explained in the following sections.

Quick reference

PUT http://localhost:8080/mws/rest/plugin-types?api-version=3[&reload-plugins=false]

There is a known issue with dynamically updating plugin types with typed field injection. For more information, see Add or Update Plugin Types.

5.245.2.A Update Plugin Type (File)

URLs and parameters

PUT http://localhost:8080/mws/rest/plugin-types?api-version=3[&reload-plugins=false]
Parameter Required Type Valid values Description
reload-plugins No String true or false Reloads all plugins of this type on successful update. Defaults to true.

See Global URL Parameters for available URL parameters.

Request body

This function is idempotent, meaning it will create the Plugin Type if it does not exist or update it if it does. The request body is the actual contents of the class file to upload. This web service is an exception to most as it requires a content type of application/x-groovy or text/plain.

If the application/x-groovy or text/plain content types are not used in the request, it will be interpreted as JSON, resulting in a failure.

Plaintext upload
------------------------------------

package test

import com.adaptc.mws.plugins.*

class UploadPlugin {
	static author = "Adaptive Computing"
	static description = "A sample plugin class"
	String id

	public void configure() throws InvalidPluginConfigurationException {
		def myConfig = config
		def errors = []
		if (!myConfig.arbitraryKey)
			errors << "Missing arbitraryKey!"
		if (errors)
			throw new InvalidPluginConfigurationException(errors)
	}

	public def customService(Map params) {
		return params
	}
}

If using the curl library to perform plugin type uploading, the equivalent of the command-line option --data-binary must be used to send the request body. Otherwise compilation errors may be encountered when uploading the plugin type.

Sample response

The response of this task is the same as the Get All Plugin Types task. The reason that the return of this task is a list is to accommodate the possibility of uploading multiple plugin types in a single JAR file as explained in the next section.

5.245.2.B Update Plugin Type (JAR)

URLs and parameters

PUT http://localhost:8080/mws/rest/plugin-types?api-version=3&jar-filename=<filename.jar>[&reload-plugins=false]
Parameter Required Type Valid values Description
jar-filename Yes String -- The filename of the JAR file that is being uploaded.
reload-plugins No String true or false Reloads all plugins of this type on successful update. Defaults to true.

See Global URL Parameters for available URL parameters.

Request body

This function is idempotent, meaning it will create the Plugin Types if they do not exist or update them if they do. The request body is the binary contents of the JAR file to upload. This web service is an exception to most as it requires a content type of application/x-jar.

If the application/x-jar content type is not used in the request, it will be interpreted as JSON, resulting in a failure.

If using the curl library to perform plugin type uploading, the equivalent of the command-line option --data-binary must be used to send the request body. Otherwise compilation errors may be encountered when uploading the plugin type.

Sample response

The response of this task is the same as the Get All Plugin Types task. Note that when using a JAR file, multiple plugin types may be uploaded in the same request.

Related Topics 

© 2016 Adaptive Computing