Skip to content

Allow creating and modifying allocations #52

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

QuanMPhm
Copy link
Contributor

Closes #47. After digging around DRF's documentation on serialization, it turned out the code changes would be a bit more complicated than I expected. I will submit a draft for now to demonstrate my current direction.

My draft allows creating new allocations through api/allocations by posting a json payload like this:

{
    'allocationattribute_set': [
        {'allocation_attribute_type': 'OpenShift Limit on CPU Quota',
        'value': '4'},
        {'allocation_attribute_type': 'OpenShift Limit on RAM Quota (MiB)',
        'value': '4096'},
    ],
    'project_id': 3,
    'resources_id': [1]
}

The output from the allocations API has been changed slightly. It now outputs this:

{
    "id": 31025,
    "project": {
        "id": 3,
        "title": "NERC-TESTING-1",
        "pi": "[[email protected]](mailto:[email protected])",
        "description": "khkjhkl\r\njjhhjk",
        "field_of_science": "Polar Ocean and Climate Systems",
        "status": "New"
    },
    "description": "",
    "resource": {
        "name": "microshift",
        "resource_type": "OpenShift"
    },
    "status": 1,
    "allocationattribute_set": [
        {
            "allocation_attribute_type": "Allocated Project Name",
            "value": "nerc-testing-1-dc43c5"
        },
        {
            "allocation_attribute_type": "Allocated Project ID",
            "value": "nerc-testing-1-dc43c5"
        },
        ....
    ]
}

I will implement the "update" feature once given the green light on this approach.

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.

Allow creating and modifying allocations through the API
1 participant