|
### Scope Node Model |
|
|
|
@baseURL = http://admin:admin@localhost:3000 |
|
|
|
@appKey = app |
|
@myAppOne = slothPictureFactory |
|
@myAppTwo = slothVoteTracker |
|
|
|
@clusterKey = cluster |
|
@myClusterOne = slothClusterNorth |
|
@myClusterTwo = slothClusterSouth |
|
|
|
## Create Some Scopes |
|
|
|
### Make SlothPictureFactory Scope |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "Scope", |
|
"metadata": { |
|
"name": "{{myAppOne}}" |
|
}, |
|
"spec": { |
|
"description": "{{myAppOne}}", |
|
"filters": [ |
|
{ |
|
"key": "{{appKey}}", |
|
"operator": "equals", |
|
"value": "{{myAppOne}}" |
|
} |
|
], |
|
"title": "{{myAppOne}}" |
|
} |
|
} |
|
|
|
### Make slothVoteTracker Scope |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "Scope", |
|
"metadata": { |
|
"name": "{{myAppTwo}}" |
|
}, |
|
"spec": { |
|
"description": "{{myAppTwo}}", |
|
"filters": [ |
|
{ |
|
"key": "{{appKey}}", |
|
"operator": "equals", |
|
"value": "{{myAppTwo}}" |
|
} |
|
], |
|
"title": "{{myAppTwo}}" |
|
} |
|
} |
|
|
|
### Make slothClusterNorth Scope |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "Scope", |
|
"metadata": { |
|
"name": "{{myClusterOne}}" |
|
}, |
|
"spec": { |
|
"description": "{{myClusterOne}}", |
|
"filters": [ |
|
{ |
|
"key": "{{clusterKey}}", |
|
"operator": "equals", |
|
"value": "{{myClusterOne}}" |
|
} |
|
], |
|
"title": "{{myClusterOne}}" |
|
} |
|
} |
|
|
|
### Make slothClusterSouth Scope |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "Scope", |
|
"metadata": { |
|
"name": "{{myClusterTwo}}" |
|
}, |
|
"spec": { |
|
"description": "{{myClusterTwo}}", |
|
"filters": [ |
|
{ |
|
"key": "{{clusterKey}}", |
|
"operator": "equals", |
|
"value": "{{myClusterTwo}}" |
|
} |
|
], |
|
"title": "{{myClusterTwo}}" |
|
} |
|
} |
|
|
|
### Make indexHelperCluster Scope |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "Scope", |
|
"metadata": { |
|
"name": "indexHelperCluster" |
|
}, |
|
"spec": { |
|
"description": "redundant label filter but makes queries faster", |
|
"filters": [ |
|
{ |
|
"key": "indexHelper", |
|
"operator": "equals", |
|
"value": "cluster" |
|
} |
|
], |
|
"title": "Cluster Index Helper" |
|
} |
|
} |
|
|
|
## Build Container Nodes |
|
|
|
### Create Top Container Node for Applications |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "applications" |
|
}, |
|
"spec": { |
|
"description": "Application Scopes", |
|
"title": "Applications", |
|
"nodeType": "container" |
|
} |
|
} |
|
|
|
### Create Container Node Applications/Clusters |
|
# Note: The "name" (id) has no special meaning, nodeA.nodeB is too help author/reader keep track |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "applications.clusters" |
|
}, |
|
"spec": { |
|
"description": "Application/Clusters Scopes", |
|
"title": "Clusters", |
|
"nodeType": "container", |
|
"parentName": "applications", |
|
"linkId": "indexHelperCluster", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
### Create Top Container for Clusters |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "clusters" |
|
}, |
|
"spec": { |
|
"description": "Cluster Scopes", |
|
"title": "Clusters", |
|
"nodeType": "container", |
|
"linkId": "indexHelperCluster", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
### Create Container Node Clusters/Applications |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "clusters.application" |
|
}, |
|
"spec": { |
|
"description": "Clusters/Application Scopes", |
|
"title": "Applications", |
|
"nodeType": "container", |
|
"parentName": "clusters" |
|
} |
|
} |
|
|
|
## Create Leaf Nodes |
|
|
|
### Create Leaf Nodes For Root Applications |
|
|
|
#### Applications: SlothPictureFactory |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "applications-{{myAppOne}}" |
|
}, |
|
"spec": { |
|
"description": "{{myAppOne}}", |
|
"title": "{{myAppOne}}", |
|
"nodeType": "leaf", |
|
"parentName": "applications", |
|
"linkId": "{{myAppOne}}", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
#### Applications: SlothVoteTracker |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "applications-{{myAppTwo}}" |
|
}, |
|
"spec": { |
|
"description": "{{myAppTwo}}", |
|
"title": "{{myAppTwo}}", |
|
"nodeType": "leaf", |
|
"parentName": "applications", |
|
"linkId": "{{myAppTwo}}", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
### Create Leaf Nodes For Applications/Clusters |
|
|
|
#### Applications/Clusters: SlothClusterNorth |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "applications.clusters-{{myClusterOne}}" |
|
}, |
|
"spec": { |
|
"description": "{{myClusterOne}}", |
|
"title": "{{myClusterOne}}", |
|
"nodeType": "leaf", |
|
"parentName": "applications.clusters", |
|
"linkId": "{{myClusterOne}}", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
#### Applications/Clusters: SlothClusterSouth |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "applications.clusters-{{myClusterTwo}}" |
|
}, |
|
"spec": { |
|
"description": "{{myClusterTwo}}", |
|
"title": "{{myClusterTwo}}", |
|
"nodeType": "leaf", |
|
"parentName": "applications.clusters", |
|
"linkId": "{{myClusterTwo}}", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
### Create Leaf Nodes For Root Clusters |
|
|
|
#### Clusters: SlothClusterNorth |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "clusters-{{myClusterOne}}" |
|
}, |
|
"spec": { |
|
"description": "{{myClusterOne}}", |
|
"title": "{{myClusterOne}}", |
|
"nodeType": "leaf", |
|
"parentName": "clusters", |
|
"linkId": "{{myClusterOne}}", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
#### Clusters: SlothClusterSouth |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "clusters-{{myClusterTwo}}" |
|
}, |
|
"spec": { |
|
"description": "{{myClusterTwo}}", |
|
"title": "{{myClusterTwo}}", |
|
"nodeType": "leaf", |
|
"parentName": "clusters", |
|
"linkId": "{{myClusterTwo}}", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
### Create Leaf Nodes For Clusters/Applications |
|
|
|
#### Clusters/Applications: slothPictureFactory |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "clusters.applications-{{myAppOne}}" |
|
}, |
|
"spec": { |
|
"description": "{{myAppOne}}", |
|
"title": "{{myAppOne}}", |
|
"nodeType": "leaf", |
|
"parentName": "clusters.applications", |
|
"linkId": "{{myAppOne}}", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
#### Clusters/Applications: slothVoteTracker |
|
POST {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes |
|
Content-Type: application/json |
|
Accept: application/json |
|
|
|
{ |
|
"apiVersion": "scope.grafana.app/v0alpha1", |
|
"kind": "ScopeNode", |
|
"metadata": { |
|
"name": "slothPictureFactory" |
|
}, |
|
"spec": { |
|
"description": "{{myAppTwo}}", |
|
"title": "{{myAppTwo}}", |
|
"nodeType": "leaf", |
|
"parentName": "clusters.applications", |
|
"linkId": "{{myAppTwo}}", |
|
"linkType": "scope" |
|
} |
|
} |
|
|
|
### Delete Something |
|
#DELETE {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/scopenodes/clusters |
|
|
|
## Getting "Folders" (Container Nodes) |
|
|
|
### Top Level (Forest) |
|
GET {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/find/scope_node_children |
|
Accept: application/json |
|
|
|
|
|
### Top Level Applications |
|
GET {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/find/scope_node_children?parent=applications |
|
Accept: application/json |
|
|
|
### Top Level Applications |
|
GET {{baseURL}}/apis/scope.grafana.app/v0alpha1/namespaces/default/find/scope_node_children?parent= |
|
Accept: application/json |