k8s_client.views.groups

Module Contents

Functions

get_groups([name])

Get groups list

post_group()

Create a new group

delete_group([id])

Delete a group

update_group([id])

updates a group

k8s_client.views.groups.get_groups(name=None)

Get groups list

Parameters

"name"string (optional)

The name of the group of which showing the details.

Returns

  • [code: 200] JSON containing the full list of groups if _name is None

  • [code: 200] JSON containing the detail of the specified group if name is a <valid value>

  • [code: 404] Error message if name is NOT a <valid value>

Notes

To each returned group will be added the context details

Examples

>>> [
        {
            "contexts": [
                {
                    "cluster_id": 1,
                    "cost": 0,
                    "id": 1,
                    "kubeuser_id": 1,
                    "max_cores_for_single_job": 105,
                    "name": "context.dev.k8s.master.dafni.hydra.org.uk",
                    "namespace": "default"
                }
            ],
            "id": 1,
            "name": "umwrg"
        }
    ]
k8s_client.views.groups.post_group()

Create a new group

Parameters

Request Bodyjson
JSON containing data for the group:
"name"string

The name of the group to create

"contexts"list [dict]

List of dictionaries of the contexts to attach to the group, eventually empty It can contain the name or the id of the contexts. The name has higher priority, meaning if it is defined, the id is ignored If the context is not found, the group will be inserted anyway without contexts

Returns

  • [code: 409] Error message if name is already inside the DB

  • [code: 406] Error message if INPUT is NOT a <valid json>

  • [code: 200] Empty array if INPUT is valid

Examples

>>> Body = {
    "name": "test5",
    "contexts": [{"id":1}]
}
>>> Body = {
    "name": "test15",
    "contexts": [{"name":"context-test"}]
}
k8s_client.views.groups.delete_group(id=None)

Delete a group

Parameters

"id": int

The id of the group to delete

Returns

  • Error message with return code 409 if there is an integrity error

  • Error message with return code 404 if id is NOT a <valid value>

  • JSON containing the deleted group id with return code 200 if INPUT is valid

k8s_client.views.groups.update_group(id=None)

updates a group

Parameters

"id"int

The id of the group to update

Request Bodyjson
JSON containing data for the group:
"name": string

The name of the group to update

"contexts"list [dict]

List of dictionaries of the contexts to attach to the group, eventually empty It can contain the name or the id of the contexts. The name has higher priority, meaning if it is defined, the id is ignored If the context is not found, the group will be inserted anyway without contexts

Returns

  • [code: 404] Error message if id is not inside the DB

  • [code: 406] Error message if INPUT is NOT a <valid json>

  • [code: 409] Error message if there is an integrity error

  • [code: 200] Empty array if INPUT is valid

Examples

>>> Body = {
    "name": "test5",
    "contexts": [{"id":1}]
}
>>> Body = {
    "name": "test15",
    "contexts": [{"name":"context-test"}]
}