'Create a new Client Key
Create a new client key bound to a project.  The key\'s secret and
public key are generated by the server.
:pparam string organization_slug: the slug of the organization the
client keys belong to.
:pparam string project_slug: the slug of the project the client keys
belong to.
:param string name: the name for the new key.'

@attach_scenarios([create_key_scenario])
def post(self, request, project):

    serializer = KeySerializer(data=request.DATA)
    if serializer.is_valid():
        result = serializer.object
        key = ProjectKey.objects.create(project=project, label=result.get('name'), public_key=result.get('public'), secret_key=result.get('secret'))
        self.create_audit_entry(request=request, organization=project.organization, target_object=key.id, event=AuditLogEntryEvent.PROJECTKEY_ADD, data=key.get_audit_log_data())
        return Response(serialize(key, request.user), status=201)
    return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
