Skip to content

Conversation

@QuanMPhm
Copy link
Contributor

@QuanMPhm QuanMPhm commented Oct 9, 2025

Closes #60. This PR consists of the last commit. Depends on whether #64 or #52 is merged. This is a bare-bones script that allows anyone with admin Coldfront credentials to create allocations through the API. They will need to submit a JSON file that contains a list of JSON payloads.

@knikolla @DanNiESh Let me know your thoughts on the script and if there's anything else I can add.

To create an allocation, a JSON payload can be uploaded to `/api/allocations`:

{
    "attributes": [
        {"attribute_type": "OpenShift Limit on CPU Quota", "value": 8},
        {"attribute_type": "OpenShift Limit on RAM Quota (MiB)", "value": 16},
    ],
    "project": {"id": project.id},
    "resources": [{"id": self.resource.id}],
    "status": "New",
}

Updating allocation status is done via a PATCH request
to `/api/allocations/{id}` with a JSON payload:

{
    "status": "Active"
}

Certain status transitions trigger signals:
- New -> Active: allocation_activate
- Active -> Denied: allocation_deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a script to create allocations in Coldfront

1 participant