cyverse-de / terrain

DE's main API entry-point service
Other
4 stars 9 forks source link

CORE-1807: added the subscription listing endpoint #254

Closed slr71 closed 1 year ago

slr71 commented 1 year ago

Here's the Swagger documentation for the endpoint:

image

Here's an example usage:

$ curl -sH "$AUTH_HEADER" "http://localhost:8000/terrain/admin/qms/subscriptions?limit=3&search=sarahr&sort-field=end-date&sort-dir=DESC" | jq
{
  "result": {
    "subscriptions": [
      {
        "id": "1c7a9cca-69fe-11ed-8978-62d47aced14b",
        "effective_start_date": "2022-11-21T17:39:23.854474-07:00",
        "effective_end_date": "2023-11-21T17:39:23.854474-07:00",
        "user": {
          "id": "cd7b20f2-03bb-11ed-b868-62d47aced14b",
          "username": "sarahr"
        },
        "plan": {
          "id": "d80b5482-98dc-11ec-bbe3-406c8f3e9cbb",
          "name": "Commercial",
          "description": "Commercial plan",
          "plan_quota_defaults": [
            {
              "id": "1e3804ed-4ed3-4cd9-8e58-1e725fa79c1b",
              "quota_value": 5000,
              "resource_type": {
                "id": "99e3bc7e-950a-11ec-84a4-406c8f3e9cbb",
                "name": "cpu.hours",
                "unit": "cpu hours"
              }
            },
            {
              "id": "de496045-b954-4f41-b068-3c71b32d2287",
              "quota_value": 5497558138880,
              "resource_type": {
                "id": "99e3f91e-950a-11ec-84a4-406c8f3e9cbb",
                "name": "data.size",
                "unit": "bytes"
              }
            }
          ]
        },
        "quotas": [
          {
            "id": "1c8685ee-69fe-11ed-8978-62d47aced14b",
            "quota": 5000,
            "resource_type": {
              "id": "99e3bc7e-950a-11ec-84a4-406c8f3e9cbb",
              "name": "cpu.hours",
              "unit": "cpu hours"
            },
            "last_modified_at": "2022-11-21T17:39:23.418855-07:00"
          },
          {
            "id": "1c8ec74a-69fe-11ed-8978-62d47aced14b",
            "quota": 5497558138880,
            "resource_type": {
              "id": "99e3f91e-950a-11ec-84a4-406c8f3e9cbb",
              "name": "data.size",
              "unit": "bytes"
            },
            "last_modified_at": "2022-11-21T17:39:23.418855-07:00"
          }
        ]
      },
      {
        "id": "ca338eea-4680-11ed-9aa7-62d47aced14b",
        "effective_start_date": "2022-10-07T13:44:08.046687-07:00",
        "effective_end_date": "2023-10-07T13:44:08.046687-07:00",
        "user": {
          "id": "ca2bce8a-4680-11ed-9aa7-62d47aced14b",
          "username": "sarahreed1"
        },
        "plan": {
          "id": "99e47c22-950a-11ec-84a4-406c8f3e9cbb",
          "name": "Basic",
          "description": "Basic plan",
          "plan_quota_defaults": [
            {
              "id": "46febbba-9511-11ec-8844-406c8f3e9cbb",
              "quota_value": 20,
              "resource_type": {
                "id": "99e3bc7e-950a-11ec-84a4-406c8f3e9cbb",
                "name": "cpu.hours",
                "unit": "cpu hours"
              }
            },
            {
              "id": "60b3d5ae-9511-11ec-8844-406c8f3e9cbb",
              "quota_value": 5368709120,
              "resource_type": {
                "id": "99e3f91e-950a-11ec-84a4-406c8f3e9cbb",
                "name": "data.size",
                "unit": "bytes"
              }
            }
          ]
        },
        "quotas": [
          {
            "id": "ca33f5d8-4680-11ed-9aa7-62d47aced14b",
            "quota": 20,
            "resource_type": {
              "id": "99e3bc7e-950a-11ec-84a4-406c8f3e9cbb",
              "name": "cpu.hours",
              "unit": "cpu hours"
            },
            "last_modified_at": "2022-10-07T13:10:12.465227-07:00"
          },
          {
            "id": "ca33fbaa-4680-11ed-9aa7-62d47aced14b",
            "quota": 5368709120,
            "resource_type": {
              "id": "99e3f91e-950a-11ec-84a4-406c8f3e9cbb",
              "name": "data.size",
              "unit": "bytes"
            },
            "last_modified_at": "2022-10-07T13:10:12.465227-07:00"
          }
        ]
      }
    ],
    "total": 2
  },
  "status": "OK"
}
slr71 commented 1 year ago

Thanks for the review!