MCPcopy Create free account
hub / github.com/StackStorm/st2 / delete

Method delete

st2api/st2api/controllers/v1/auth.py:225–247  ·  view source on GitHub ↗

Delete the key value pair. Handles requests: DELETE /apikeys/1

(self, api_key_id_or_key, requester_user)

Source from the content-addressed store, hash-verified

223 return api_key_api
224
225 def delete(self, api_key_id_or_key, requester_user):
226 """
227 Delete the key value pair.
228
229 Handles requests:
230 DELETE /apikeys/1
231 """
232 api_key_db = ApiKey.get_by_key_or_id(api_key_id_or_key)
233
234 permission_type = PermissionType.API_KEY_DELETE
235 rbac_utils = get_rbac_backend().get_utils_class()
236 rbac_utils.assert_user_has_resource_db_permission(
237 user_db=requester_user,
238 resource_db=api_key_db,
239 permission_type=permission_type,
240 )
241
242 ApiKey.delete(api_key_db)
243
244 extra = {"api_key_db": api_key_db}
245 LOG.audit("ApiKey deleted. ApiKey.id=%s" % (api_key_db.id), extra=extra)
246
247 return Response(status=http_client.NO_CONTENT)
248
249
250api_key_controller = ApiKeyController()

Callers

nothing calls this directly

Calls 5

get_rbac_backendFunction · 0.90
ResponseClass · 0.90
get_by_key_or_idMethod · 0.80
get_utils_classMethod · 0.45

Tested by

no test coverage detected