storj/satellite/admin
Moby von Briesen c334fd090e satellite/payments: Convert coupon duration to be nullable
* Add a nullable billing_periods column in the coupons table
* Add nullable billing_periods column to the currently unused
coupon_codes table
* Drop the duration column from the coupon_codes table
* Replace duration config type so that the default promotional coupon
can be configured to never expire

Zero downtime migration plan:
* Add billing_periods column to coupons and coupon_codes tables (this change)
* After one release, remove all references to the old duration column,
replacing with references to billing_periods. At this point, we can also
change the defult promotional coupon to never expire and migrate over
values from the old duration column.
* After another release, drop the duration column.

Change-Id: I374e8dc9fab9f81b4a5bc681771955662d4c007a
2021-04-01 16:28:23 +02:00
..
apikeys_test.go satellite/admin: add apikey endpoints 2020-10-20 11:26:56 +00:00
apikeys.go satellite/admin: add apikey endpoints 2020-10-20 11:26:56 +00:00
common.go satellite/admin: change returned data to be json encoded 2020-08-05 15:33:39 +02:00
coupon_test.go satellite/payments: Convert coupon duration to be nullable 2021-04-01 16:28:23 +02:00
coupon.go satellite/payments: Convert coupon duration to be nullable 2021-04-01 16:28:23 +02:00
project_test.go satellite/console: change default project and usage limits 2021-03-24 14:24:27 +00:00
project.go satellite/console: change default project and usage limits 2021-03-24 14:24:27 +00:00
README.md satellite/admin: add apikey endpoints 2020-10-20 11:26:56 +00:00
server_test.go satellite/admin: add check project usage endpoint and fix some leftover http.Error handling 2020-08-13 13:48:34 +00:00
server.go satellite/admin: add apikey endpoints 2020-10-20 11:26:56 +00:00
user_test.go satellite/{admin, console}: add test for projectLimit increase and update README 2020-10-05 11:54:37 +00:00
user.go satellite/admin: allow more than just "paid" invoice status during user deletion 2020-12-23 16:40:44 +01:00

satellite/admin

Satellite Admin package provides API endpoints for administrative tasks.

Requires setting Authorization header for requests.

User Management

POST /api/user

Adds a new user.

An example of a required request body:

{
    "email": "alice@mail.test",
    "fullName": "Alice Test",
    "password": "password"
}

A successful response body:

{
    "id":           "12345678-1234-1234-1234-123456789abc",
    "email":        "alice@mail.test",
    "fullName":     "Alice Test",
    "shortName":    "",
    "passwordHash": ""
}

PUT /api/user/{user-email}

Updates the details of existing user found by its email.

Some example request bodies:

{
    "email": "alice+2@mail.test"
}
{
    "email": "alice+2@mail.test",
    "shortName": "myNickName"
}
{
    "projectLimit": 200
}

GET /api/user/{user-email}

This endpoint returns information about user and their projects.

A successful response body:

{
    "user":{
        "id": "12345678-1234-1234-1234-123456789abc",
        "fullName": "Alice Bob",
        "email":"alice@example.test",
        "projectLimit": 10
    },
    "projects":[
        {
            "id": "abcabcab-1234-abcd-abcd-abecdefedcab",
            "name": "Project",
            "description": "Project to store data.",
            "ownerId": "12345678-1234-1234-1234-123456789abc"
        }
    ],
    "coupons": [
        {
            "id":          "2fcdbb8f-8d4d-4e6d-b6a7-8aaa1eba4c89",
            "userId":      "12345678-1234-1234-1234-123456789abc",
            "duration":    2,
            "amount":      3000,
            "description": "promotional coupon (valid for 2 billing cycles)",
            "type":        0,
            "status":      0,
            "created":     "2020-05-19T00:34:13.265761+02:00"
        }
    ]
}

DELETE /api/user/{user-email}

Deletes the user.

Coupon Management

POST /api/coupon

Adds a coupon for specific user.

An example of a required request body:

{
    "userId":      "12345678-1234-1234-1234-123456789abc",
    "duration":    2,
    "amount":      3000,
    "description": "promotional coupon (valid for 2 billing cycles)"
}

A successful response body:

{
    "id": "2fcdbb8f-8d4d-4e6d-b6a7-8aaa1eba4c89"
}

GET /api/coupon/{coupon-id}

Gets a coupon with the specified id.

A successful response body:

{
    "id":          "2fcdbb8f-8d4d-4e6d-b6a7-8aaa1eba4c89",
    "userId":      "12345678-1234-1234-1234-123456789abc",
    "duration":    2,
    "amount":      3000,
    "description": "promotional coupon (valid for 2 billing cycles)",
    "type":        0,
    "status":      0,
    "created":     "2020-05-19T00:34:13.265761+02:00"
}

DELETE /api/coupon/{coupon-id}

Deletes the specified coupon.

Project Management

POST /api/project

Adds a project for specific user.

An example of a required request body:

{
    "ownerId": "ca7aa0fb-442a-4d4e-aa36-a49abddae837",
    "projectName": "My Second Project"
}

A successful response body:

{
    "projectId": "ca7aa0fb-442a-4d4e-aa36-a49abddae646"
}

GET /api/project/{project-id}/usage

This endpoint returns whether the project has outstanding usage or not.

A project with not usage returns status code 200 and {"result":"no project usage exist"}.

GET /api/project/{project-id}/limit

This endpoint returns information about project limits.

A successful response body:

{
  "usage": {
    "amount": "1.0 TB",
    "bytes": 1000000000000
  },
  "bandwidth": {
    "amount": "1.0 TB",
    "bytes": 1000000000000
  },
  "rate": {
    "rps": 0
  }
}

POST /api/project/{project-id}/limit?usage={value}

Updates usage limit for a project.

POST /api/project/{project-id}/limit?bandwidth={value}

Updates bandwidth limit for a project.

POST /api/project/{project-id}/limit?rate={value}

Updates rate limit for a project.

POST /api/project/{project-id}/limit?buckets={value}

Updates bucket limit for a project.

GET /api/project/{project-id}

Gets the common information about a project.

PUT /api/project/{project-id}

Updates project name or description.

{
    "projectName": "My new Project Name",
    "description": "My new awesome description!"
}

DELETE /api/project/{project-id}

Deletes the project.

POST /api/project/{project}/apikey

Adds an apikey for specific project.

An example of a required request body:

{
    "name": "My first API Key"
}

Note: Additionally you can specify partnerId to associate it with the given apikey. If you specify it, it has to be a valid uuid and not an empty string.

A successful response body:

{
    "apikey": "13YqdMKxAVBamFsS6Mj3sCQ35HySoA254xmXCCQGJqffLnqrBaQDoTcCiCfbkaFPNewHT79rrFC5XRm4Z2PENtRSBDVNz8zcjS28W5v"
}

DELETE /api/project/{project}/apikey/{name}

Deletes the given apikey by its name.

APIKey Management

DELETE /api/apikey/{apikey}

Deletes the given apikey.