...
Code Block |
---|
GET /namespaces/default/artifacts/myapp/versions/2.0.0/extensions [ "streamreader" ] GET /namespaces/default/artifacts/myapp/versions/2.0.0/extensions/streamreader [ { "name": "default", "type": "reader", "description": "Writes timestamp and body as two columns and expects the row key to come as a header in the stream event.", "className": "co.cask.cdap.examples.myapp.plugins.DefaultStreamReader", "propertiesartifact": { "rowkeyname": { "streamreaders", "nameversion": "rowkey1.0.0", } } "description": "The header that should be used as the row key to write to. Defaults to 'rowkey'.", ] GET /namespaces/default/artifacts/myapp/versions/2.0.0/extensions/streamreader/plugins/default [ { "name": "default", "type": "reader", "description": "Writes timestamp and body as two columns and expects the row key to come as a header in the stream event.", "className": "co.cask.cdap.examples.myapp.plugins.DefaultStreamReader", "properties": { "rowkey": { "name": "rowkey", "description": "The header that should be used as the row key to write to. Defaults to 'rowkey'.", "type": "string", "required": false } } "artifact": { "name": "streamreaders", "version": "1.0.0" } } ] |
2.3 Creating an Application that uses plugins
With this information a user is now able to create an Application that uses a Plugin:
Code Block |
---|
PUT /namespaces/default/apps/userDump -H 'Content-Type: application/json' -d ' { "artifact": { "typename": "stringmyapp", "version": "2.0.0" }, "requiredconfig": false{ "stream": "users", } }"table": "events" "artifactreaderPlugin": {"default", "namereaderPluginProperties": "streamreaders",{ "versionrowkey": "1.0.0user-id" } } ] |
...
}' |
3. System Artifacts
System artifacts are special artifacts that can be accessed in other namespaces. They cannot be deployed through the RESTful API unless a conf setting is set. Instead, they are placed in a directory on the CDAP master host. When CDAP starts up, the directory will be scanned and those artifacts will be added to the system. Example uses for system artifacts are the ETLBatch and ETLRealtime applications that we want to include out of the box.
System artifacts are included in results by default and are indicated with a special flag.
Code Block |
---|
GET /namespaces/default/artifacts?includeSystem=true
[
{
"name": "ETLBatch",
"version": "3.1.0",
"isSystem": true
},
{
"name": "ETLRealtime",
"version": "3.1.0",
"isSystem": true
},
{
"name": "ETLPlugins",
"version": "3.1.0",
"isSystem": true
},
{
"name": "myapp",
"version": "1.0.0",
"isSystem": false
},
{
"name": "myapp",
"version": "1.0.1",
"isSystem": false
}
] |
...
Code Block |
---|
PUT /namespaces/default/apps/somePipeline -d ' { "artifact": { "name":"ETLBatch", "version":"3.1.0", "isSystem": true }, "config": { ... } }' |
...
4. Deleting an Artifact
Non-snapshot artifacts will be immutable. Advanced users can delete an existing artifact, but the assumption will be that they know exactly what they are doing. Deleting an artifact may cause programs that are using it to fail.
...
5. CDAP Upgrade
The programmatic API changes are all backwards compatible, so existing apps will not need to be recompiled. They will, however, need to be added to the artifact repository as part of the upgrade tool (or force people to redeploy their existing apps).
...