Versions Compared

Key

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

...

Projects are new concept that has been introduced in the v2 api. They allow multi-tenancy in the application from a user perspective.

POST

Code Block
languagebash
titlePOST
linenumberstrue
POST
URL: /v2/project
POST BODY:
{
  name: "Name of Project" //must be unique
}

RETURN STATUS: 201
RETURN BODY: 
{
  name: "name of the project"
}

GET, DELETE


Code Block
languagebash
titleGET, DELETE
linenumberstrue
GET
URL: /v2/project/{project-name}

RETURN STATUS: 200
RETURN BODY: 
{
  name: "Name of Project" //must be unique
}

DELETE
URL: /v2/project/{project-name}

RETURN STATUS: 204

...

Resource Bundle Names and Versions are unique within a Project.

POST

Code Block
languagejs
titlePOST
linenumberstrue
URL: /v2/project/{project-name}/rb
POST BODY:
{
    "rb-name": "test-rbdef",
    "rb-version": "v1",
    "description": "testing resource bundle definition api",
}

RETURN STATUS: 201
RETURN BODY: {  "rb-name": "test-rbdef",
  "rb-version": "v1",
  "description": "testing resource bundle definition api",}

GET, DELETE

Code Block
languagejs
titleGET, DELETE
linenumberstrue
GET
URL: /v2/project/{project-name}/rb/{rb-name}

RETURN STATUS: 200
RETURN BODY: 
{  
  "rb-name": "test-rbdef",
  "rb-version": "v1",
  "description": "testing resource bundle definition api"
}

DELETE
URL: /v2/project/{project-name}/rb/{rb-name}

RETURN STATUS: 204

...

There is a main Intent API that allows you to create a Parent Intent and any SUB Intents are forwarded to their respective handlers.

POST

Code Block
languagejs
titlePOST
linenumberstrue
URL: /v2/project/{project-name}/rb/{rb-name}/{version}/intent
POST BODY:
{
    "intent-name": "test-rbdef",
    "description": "testing resource bundle definition api"
}

RETURN STATUS: 201
RETURN BODY: 
{ 
  "intent-name": "test-rbdef",
  "description": "testing resource bundle definition api"
}

GET, DELETE

Code Block
languagejs
titlePOST
linenumberstrue
GET
URL: /v2/project/{project-name}/rb/{rb-name}/{version}/intent/{intent-name}

RETURN STATUS: 200
RETURN BODY: 
{ 
  "intent-name": "test-rbdef",
  "description": "testing resource bundle definition api"
}

DELETE
URL: /v2/project/{project-name}/rb/{rb-name}/{version}/intent/{intent-name}

RETURN STATUS: 204


Sub Intent API

Sub Intents are handled by Adapters that are installed in k8splugin.

POST

Code Block
languagejs
titlePOST
linenumberstrue
URL: /v2/project/{project-name}/rb/{rb-name}/{version}/intent/{intent-name}/{sub-intent}/...The remaining URL is forwarded to the POST Handler of the Sub Intent AdapterPOST BODY:
{
 // Defined by the sub intent and forwarded to and handled by it
}

RETURN STATUS: 201
RETURN BODY: 
{ 
  // Defined by the sub intent and handled by it
}


Code Block
languagec#
titleCode Fragment
linenumberstrue
router.HandleFunc("/{pr-name}/rb/{rb-name}/{rb-version}/intent/{intent-name}/{sub-intent-name}", adapterMgr.GetAdapter(sub-intent-name).HandlePost).Methods("POST")
router.HandleFunc(`/{pr-name}/rb/{rb-name}/{rb-version}/intent/{intent-name}/{sub-intent-name}/{rest:[a-zA-Z0-9=\-\/]+}`, adapterMgr.GetAdapter(sub-intent-name).HandlePost).Methods("POST")

//HandlePost will then figure out if it needs the “rest” or just r.body is enough.
//json.Unmarshal will happen in the HandlePost preventing any map[string]interface{} casts.

GET, DELETE

Code Block
languagejs
titlePOST
linenumberstrue
GET
URL: /v2/project/{project-name}/rb/{rb-name}/{version}/intent/{intent-name}/{sub-intent}/...

RETURN STATUS: 200
RETURN BODY: 
{
  // Defined by the sub intent and handled by it
}

DELETE
URL: /v2/project/{project-name}/rb/{rb-name}/{version}/intent/{intent-name}/{sub-intent}

RETURN STATUS: 204


Adapter Registration