Skip to content

REST: Credentials related api

Svyatoslav Reyentenko edited this page Feb 5, 2013 · 8 revisions

List credentials

Path:/rest/projects/(projectId)/credentials

Type: GET

Path parameters

Parameter Type Description
projectId Number id of the project credentials belong to

Example results:

{ 
    "items": [
        {  
            "id":34,
            "projectId":1,
            "cloudProvider":"gdnova",
            "pairName":"genesis-key",
            "identity":"root",
            "fingerPrint":"74:8e:94:5b:52:64:46:eb:ea:92:da:ba:2e:62:c2:a6:1b:4c:6b:c8",
            "links" : [
                {
                    "rel" : "self",
                    "href" : "http://localhost:8081/rest/projects/1/credentials/1",
                    "methods" : [
                        "get",
                        "delete"
                    ],
                    "type" : "application/vnd.griddynamics.genesis.Credentials+json"
                }
            ]
        }
    ],
    "links": [
        {
         "rel" : "self",
         "href" : "http://localhost:8081/rest/projects/1/credentials",
         "methods" : [
            "get",
            "post"
         ],
         "type" : "application/vnd.griddynamics.genesis.Credentials+json"
      }
    ]
}

Add new credentials

Path: /rest/projects/(projectId)/credentials/

Type: POST

Path parameters:

Parameter Type Description
projectId Number id of the project new credentials should belong to

Request body:

consists form a single JSON map contains the following entries:

Entry name Type Mandatory Description
projectId Int Y project id
cloudProvider String Y code of the cloud provider
pairName String Y name of the ([identity:credentials][1]) pair
cloudProvider String Y code of the cloud provider
identity String Y identity associated with credentials
credential String В either password or ssh private key

Example:

Request

{"projectId":0, "cloudProvider":"nova","pairName":"genesis-key","identity":"root","credential":"password"}

Example results:

Error on update (common result object):

{
	"isSuccess": false,
	"isNotFound": false,
	"variablesErrors" : {"fieldName": "Error message"},
	"compoundServiceErrors" : ["Error message 1", "Error message 2"]
}

Successful creation:

{
	    "result":{
               "id":3,
               "projectId":1,
               "cloudProvider":"amazon-aws",
               "pairName":"genesis-key",
               "identity":"root",
               "fingerPrint":"5b:ff:30:a5:ff:9f:d8:38:33:1d:87:3e:25:b5:5d:c7:88:6a:3e:fe"
        },
        "isSuccess":true
}

Delete credentials

Path: /rest/projects/(projectId)/credentials/(**credentialsId**)

Type: DELETE

Path parameters:

Parameter Type Description
projectId Number id of the project new credentials should belong to
credentialsId Number id of the key pair (can be obtain from list request)

Example:

Request

DELETE http://localhost:8080/rest/projects/1/credentials/35

Clone this wiki locally