[ 
https://issues.apache.org/jira/browse/AMBARI-14750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ajit Kumar updated AMBARI-14750:
--------------------------------
    Description: 
Introduce a new API for *admin-settings*
{code}
api/v1/admin-settings
{code}

There can be several class of system wide admin settings - motd  etc. These are 
like configurations - basically named property bags. It doesn't need version 
support.

*CRUD*
* create a new entry
{code}
curl -u admin:admin -H "X-Requested-By: ambari" -X POST  
http://localhost:8080/api/v1/admin-settings -d '{
   "AdminSettings" : {
    "content" : "{test_content1 : test_value1}",
    "name" : "motd1",
    "setting_type" : "ambari-server",
  }
}' 
Response:
{
  "resources" : [
    {
      "href" : "http://localhost:8080/api/v1/admin-settings/motd1";,
      "AdminSettings" : {
        "name" : "motd1"
      }
    }
  ]
}
{code}
* read any entry
{code}
curl -u test:test  -H 'X-Requested-By: ambari' -X GET  
http://localhost:8080/api/v1/admin-settings
Response:
{
  "href" : "http://localhost:8080/api/v1/admin-settings";,
  "items" : [
    {
      "href" : "http://localhost:8080/api/v1/admin-settings/motd1";,
      "AdminSettings" : {
        "name" : "motd1"
      }
    }
  ]
}
curl -u test:test -H "X-Requested-By: ambari" -X GET  
http://localhost:8080/api/v1/admin-settings/motd1
Response:
{
  "href" : "http://localhost:8080/api/v1/admin-settings/motd1";,
  "AdminSettings" : {
    "content" : "{test_content1 : test_value1}",
    "name" : "motd1",
    "setting_type" : "ambari-server",
    "update_timestamp" : 1453315409437,
    "updated_by" : "admin"
  }
}
{code}
* update - update an entry
{code}
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT  
http://localhost:8080/api/v1/admin-settings/motd -d '{
   "AdminSettings" : {
    "content" : "{test_content1 : test_value1}",
    "setting_type" : "ambari-server",
  }
}' 
{code}
* delete an entry
{code}
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE  
http://localhost:8080/api/v1/admin-settings/motd
{code}

  was:
Introduce a new API for *admin-settings*
{code}
api/v1/admin-settings
{code}

There can be several class of system wide admin settings - motd  etc. These are 
like configurations - basically named property bags. It doesn't need version 
support.

*CRUD*
* create a new entry
{code}
curl -u admin:admin -H "X-Requested-By: ambari" -X POST  
http://localhost:8080/api/v1/admin-settings -d '{
   "AdminSettings" : {
    "content" : "{test_content1 : test_value1}",
    "name" : "motd1",
    "setting_type" : "ambari-server",
    "updated_by" : "admin"
  }
}' 
{code}
* read any entry
{code}
curl -u test:test  -H 'X-Requested-By: ambari' -X GET  
http://localhost:8080/api/v1/admin-settings
Response:
{
  "href" : "http://c6401.ambari.apache.org:8080/api/v1/admin-settings";,
  "items" : [
    {
      "href" : 
"http://c6401.ambari.apache.org:8080/api/v1/admin-settings/motd1";,
      "AdminSettings" : {
        "name" : "motd1"
      }
    }
  ]
}

curl -u test:test -H "X-Requested-By: ambari" -X GET  
http://localhost:8080/api/v1/admin-settings/motd1
Response:
{
  "href" : "http://localhost:8080/api/v1/admin-settings/motd1";,
  "AdminSettings" : {
    "content" : "{test_content1 : test_value1}",
    "name" : "motd1",
    "setting_type" : "ambari-server",
    "update_timestamp" : 1453315409437,
    "updated_by" : "admin"
  }
}
{code}
* update - update an entry
{code}
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT  
http://localhost:8080/api/v1/admin-settings/motd -d '{
   "AdminSettings" : {
    "content" : "{test_content1 : test_value1}",
    "setting_type" : "ambari-server",
    "updated_by" : "admin"
  }
}' 
{code}
* delete an entry
{code}
curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE  
http://localhost:8080/api/v1/admin-settings/motd
{code}


> Provide CRUD API support for settings
> -------------------------------------
>
>                 Key: AMBARI-14750
>                 URL: https://issues.apache.org/jira/browse/AMBARI-14750
>             Project: Ambari
>          Issue Type: Task
>          Components: ambari-server
>    Affects Versions: 2.4.0
>            Reporter: Ajit Kumar
>            Assignee: Ajit Kumar
>             Fix For: 2.4.0
>
>         Attachments: rb42339.patch
>
>
> Introduce a new API for *admin-settings*
> {code}
> api/v1/admin-settings
> {code}
> There can be several class of system wide admin settings - motd  etc. These 
> are like configurations - basically named property bags. It doesn't need 
> version support.
> *CRUD*
> * create a new entry
> {code}
> curl -u admin:admin -H "X-Requested-By: ambari" -X POST  
> http://localhost:8080/api/v1/admin-settings -d '{
>    "AdminSettings" : {
>     "content" : "{test_content1 : test_value1}",
>     "name" : "motd1",
>     "setting_type" : "ambari-server",
>   }
> }' 
> Response:
> {
>   "resources" : [
>     {
>       "href" : "http://localhost:8080/api/v1/admin-settings/motd1";,
>       "AdminSettings" : {
>         "name" : "motd1"
>       }
>     }
>   ]
> }
> {code}
> * read any entry
> {code}
> curl -u test:test  -H 'X-Requested-By: ambari' -X GET  
> http://localhost:8080/api/v1/admin-settings
> Response:
> {
>   "href" : "http://localhost:8080/api/v1/admin-settings";,
>   "items" : [
>     {
>       "href" : "http://localhost:8080/api/v1/admin-settings/motd1";,
>       "AdminSettings" : {
>         "name" : "motd1"
>       }
>     }
>   ]
> }
> curl -u test:test -H "X-Requested-By: ambari" -X GET  
> http://localhost:8080/api/v1/admin-settings/motd1
> Response:
> {
>   "href" : "http://localhost:8080/api/v1/admin-settings/motd1";,
>   "AdminSettings" : {
>     "content" : "{test_content1 : test_value1}",
>     "name" : "motd1",
>     "setting_type" : "ambari-server",
>     "update_timestamp" : 1453315409437,
>     "updated_by" : "admin"
>   }
> }
> {code}
> * update - update an entry
> {code}
> curl -u admin:admin -H "X-Requested-By: ambari" -X PUT  
> http://localhost:8080/api/v1/admin-settings/motd -d '{
>    "AdminSettings" : {
>     "content" : "{test_content1 : test_value1}",
>     "setting_type" : "ambari-server",
>   }
> }' 
> {code}
> * delete an entry
> {code}
> curl -u admin:admin -H "X-Requested-By: ambari" -X DELETE  
> http://localhost:8080/api/v1/admin-settings/motd
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to