'Update a Client Key
Update a client key.  This can be used to rename a key.
: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.
:pparam string key_id: the ID of the key to update.
:param string name: the new name for the client key.
:auth: required'

def put(self, request, project, key_id):

    try:
        key = ProjectKey.objects.get(project=project, public_key=key_id, roles=ProjectKey.roles.store)
    except ProjectKey.DoesNotExist:
        raise ResourceDoesNotExist
    serializer = KeySerializer(data=request.DATA, partial=True)
    if serializer.is_valid():
        result = serializer.object
        if result.get('name'):
            key.label = result['name']
        if (result.get('isActive') is True):
            key.status = ProjectKeyStatus.ACTIVE
        elif (result.get('isActive') is False):
            key.status = ProjectKeyStatus.INACTIVE
        if features.has('projects:rate-limits', project):
            if (result.get('rateLimit', (-1)) is None):
                key.rate_limit_count = None
                key.rate_limit_window = None
            elif result.get('rateLimit'):
                key.rate_limit_count = result['rateLimit']['count']
                key.rate_limit_window = result['rateLimit']['window']
        key.save()
        self.create_audit_entry(request=request, organization=project.organization, target_object=key.id, event=AuditLogEntryEvent.PROJECTKEY_EDIT, data=key.get_audit_log_data())
        return Response(serialize(key, request.user), status=200)
    return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
