Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose http operations in a declarative way #4

Closed
AmitKumarDas opened this issue Feb 24, 2020 · 3 comments
Closed

expose http operations in a declarative way #4

AmitKumarDas opened this issue Feb 24, 2020 · 3 comments
Assignees

Comments

@AmitKumarDas
Copy link

AmitKumarDas commented Feb 24, 2020

As a developer I would like to make http API calls declarative. The http API invocation & its result can form the basis of a new Kubernetes custom resource.

Sample http based request & response

curl -u "${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}" \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"clusterId":"1c2", "raidGroupConfig":{"type":"mirror", "groupDeviceCount":2}}' \
'http://34.69.231.86/v3/groups/1a11/recommendations/1r!cstorpool/?action=getcapacityrecommendation'
HTTP/1.1 POST /v3/groups/1a11/recommendations/1r!cstorpool/?action=getcapacityrecommendation
Host: 34.69.231.86
Accept: application/json
Content-Type: application/json
Content-Length: 76

{
"clusterId": "1c2",
"raidGroupConfig": {
"type": "mirror",
"groupDeviceCount": 2
}
}
HTTP/1.1 200
date: Thu, 05 Mar 2020 05:10:55 GMT
x-api-user-id: 1a9
x-api-client-ip: 49.37.204.116
x-api-roles: ProjectOwner
vary: Accept-Encoding
content-type: application/json; charset=utf-8
transfer-encoding: chunked
x-api-account-id: 1a11
x-api-schemas: http://34.69.231.86/v3/groups/1a11/schemas
connection: keep-alive
content-encoding: gzip
expires: Thu, 01 Jan 1970 00:00:00 GMT

{
"type": "collection",
"resourceType": "recommendation",
"links": {
"self": "…/v3/groups/1a11/recommendations/1r!cstorpool/"
},
"createTypes": { },
"actions": { },
"data": [ 2 items
{
"id": null,
"type": "cStorPoolCapacityRecommendationOutput",
"links": { },
"actions": { },
"baseType": "cStorPoolCapacityRecommendationOutput",
"deviceGroupName": "HDD",
"maxCapacity": "536870912k",
"minCapacity": "53687091200"
},
{
"id": null,
"type": "cStorPoolCapacityRecommendationOutput",
"links": { },
"actions": { },
"baseType": "cStorPoolCapacityRecommendationOutput",
"deviceGroupName": "HDD-512",
"maxCapacity": "536870912k",
"minCapacity": "53687091200"
}
],
"sortLinks": { },
"pagination": null,
"sort": null,
"filters": { },
"createDefaults": { }
}
@AmitKumarDas AmitKumarDas changed the title expose http based CRUD operations as a custom resource expose http operations in a declarative way Feb 24, 2020
@AmitKumarDas
Copy link
Author

AmitKumarDas commented Feb 27, 2020

Draft 0

kind: HTTP
spec:
  url:
  verb:
  request:
    body:
status:
  phase:
  httpStatusCode:
  reason:
  response:
    body:

This in turn will enable me to develop higher level declarative APIs e.g. declarative APIs for a particular component. In the following yaml I have considered the case of making Director APIs declarative:

kind: DirectorHTTP
spec:
  includeAPIs:
  - labelnodes
  - nodes
  directorurl:
  groupid:
  clusterid:
  controlPlaneNodes:
  - node1
  dataPlaneNodes:
  - node1
  - node2
status:
  phase:

Above custom resource will in turn result into creation of multiple resources of kind HTTP. Each of these resources will have the latest response in their status.response.body. These http responses which will be json docs, can be used further as part of some workflow, automation tooling, etc.

@AmitKumarDas
Copy link
Author

AmitKumarDas commented Mar 5, 2020

Draft 1

kind: HTTP
metadata:
  name:
request:
  url:
  method:
  headers:
  params:
  body:
response:
  code:
  reason:
  body:

@AmitKumarDas
Copy link
Author

#8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants