Errors are passed via both a non-2xx status code and an HTTPError response body:
HTTPError{
// The Porter custom error code
Code: Number,
// A descriptive error message
Errors: []String,
}
ErrorDataWriteDescription: occurs when a write is attempted against the database and fails.
Status Code: 500
Response Body:
{
"Code": 500,
"Errors": [{
"Could not write to database"
}],
}
ErrorDataReadDescription: occurs when a read is attempted against the database and fails.
Status Code: 500
Response Body:
{
"Code": 500,
"Errors": [{
"Could not read from database"
}],
}
ErrorInternalDescription: occurs with a generic internal server error
Status Code: 500
Response Body:
{
"Code": 500,
"Errors": [{
"Internal server error"
}],
}
/api/usersGET /api/users/{id}Description: Gets a user object matching a specific id.
URL parameters:
id The user's ID.Query parameters: N/A
Request Body: N/A
Successful Response Body:
User{
"id": Number,
"email": String,
"clusters": []ClusterConfig{
"name": String,
"server": String,
"context": String,
"user": String,
},
"rawKubeConfig": String,
}
Errors:
Invalid email (example: {"email": "notanemail"})
422Request Body:
{
"code":601,
"errors":["email validation failed"]
}
Missing field
422Request Body:
{
"code":601,
"errors":["required validation failed"]
}`
Email already taken
422Request Body:
{
"code":601,
"errors":["Email already taken"]
}
GET /api/users/{id}/clustersDescription: Retrieves the clusters that are currently linked to a User account.
URL parameters:
id The user's ID.Query parameters: N/A
Request Body: N/A
Successful Response Body:
{
"clusters": []ClusterConfig{
"name": String,
"server": String,
"context": String,
"user": String,
},
}
Errors: TBD
GET /api/users/{id}/clusters/allDescription: Parses all clusters from the user's kubeconfig and returns a list of viable cluster configs.
URL parameters:
id The user's ID.Query parameters: N/A
Request Body: N/A
Response Body:
{
"clusters": []ClusterConfig{
"name": String,
"server": String,
"context": String,
"user": String,
},
}
Errors: TBD
POST /api/users/{id}POST /api/users/{id}/clustersPUT /api/users/{id}DELETE /api/users/{id}