...
Term | Description |
---|---|
View Name | The name of the view. The view name identifies the view to Ambari. |
View Package | This is the JAR package that contains the view definition and all view resources (server-side classes, dependencies and client-side files). See View Package for more information on the contents and structure of the package. |
View Definition | This defines the view name, version, resources and required/optional configuration parameters for a view. The view definition file is included in the view package. See View Definition for more information on the view definition file syntax and features. |
View Instance | An unique instance of a view, that is based on a view definition and specific version that is configured. |
View API |
Anchor | ||||
---|---|---|---|---|
|
...
Code Block |
---|
view.jar | |- view.xml | |- org. | |- WEB-INF | | | |_ lib/*.jar | |- <server packages + classes> | |_ <ui assets> |
Useful Resources
Resource | Link |
---|---|
Views Framework API Docs | https://github.com/apache/ambari/blob/trunk/ambari-views/docs/index.md |
Views Framework Examples | https://github.com/apache/ambari/tree/trunk/ambari-views/examples |
Get List of Views
Gets the list of all available Views
Code Block GET /api/v1/views 200 - OK
Once you have a list of views, you can drill-into a view and see the available versions.
Code Block GET /api/v1/views/FILES 200 - OK
You can go a level deeper and see more information about that specific version for the view, such as the parameters and the archive name, and a list of all instances of the view.
Code Block GET /api/v1/views/FILES/versions/0.1.0 200 - OK
Creating a View Instance
The following example shows creating an instance of the FILES view, version 1.0.0 view called "MyFiles".
...
Create the view instance.
Code Block |
---|
POST /api/v1/views/FILES/versions/1.0.0/instances/MyFiles
201 - CREATED |
...
Set view properties.
Code Block |
---|
PUT /api/v1/views/FILES/versions/1.0.0/instances/MyFiles
[ {
"ViewInstanceInfo" : {
"properties" : {
"dataworker.defaultFs" : "webhdfs://your.namenode.host:50070"
}
}
} ]
200 - OK |
...
Restart Ambari Server to pick-up the view instance and UI resources.
Code Block |
---|
ambari-server restart |
...
Confirm the newly created view instance is available.
Code Block |
---|
GET /api/v1/views/FILES/
{
"href" : "http://127.0.0.1:8080/api/v1/views/FILES/versions/1.0.0",
"ViewInfo" : {
"archive" : "/var/lib/ambari-server/resources/views/files-0.0.1-SNAPSHOT-jar-with-dependencies.jar",
"label" : "Files",
"parameters" : [
{
"name" : "dataworker.defaultFs",
"description" : "FileSystem URI",
"required" : true
}
],
"version" : "1.0.0",
"view_name" : "FILES"
},
"instances" : [
{
"href" : "http://127.0.0.1:8080/api/v1/views/FILES/versions/1.0.0/instances/MyFiles",
"ViewInstanceInfo" : {
"instance_name" : "MyFiles",
"view_name" : "FILES"
}
}
]
} |
Browse to the view instance.
...