class AddUserMappingTask extends AckedClusterStateUpdateTask<AcknowledgedResponse> {

    private final CreateUserMappingRequest request;

    AddUserMappingTask(CreateUserMappingRequest request) {
        super(Priority.NORMAL, request);
        this.request = request;
    }

    @Override
    protected AcknowledgedResponse newResponse(boolean acknowledged) {
        return new AcknowledgedResponse(acknowledged);
    }

    @Override
    public ClusterState execute(ClusterState currentState) throws Exception {<FILL_FUNCTION_BODY>}
}

        ServersMetadata serversMetadata = currentState.metadata().custom(ServersMetadata.TYPE);
        if (serversMetadata == null) {
            throw new ResourceNotFoundException(String.format(
                Locale.ENGLISH,
                "Server `%s` not found",
                request.server()
            ));
        }
        var updatedServersMetadata = serversMetadata.addUser(
            request.server(),
            request.ifNotExists(),
            request.userName(),
            request.options()
        );
        if (updatedServersMetadata == serversMetadata) {
            return currentState;
        }
        return ClusterState.builder(currentState)
            .metadata(
                Metadata.builder(currentState.metadata())
                    .putCustom(ServersMetadata.TYPE, updatedServersMetadata)
            )
            .build();
    
<methods>public io.crate.common.unit.TimeValue ackTimeout() ,public CompletableFuture<org.elasticsearch.action.support.master.AcknowledgedResponse> completionFuture() ,public boolean mustAck(org.elasticsearch.cluster.node.DiscoveryNode) ,public void onAckTimeout() ,public void onAllNodesAcked(java.lang.Exception) ,public void onFailure(java.lang.String, java.lang.Exception) ,public io.crate.common.unit.TimeValue timeout() <variables>private final non-sealed CompletableFuture<org.elasticsearch.action.support.master.AcknowledgedResponse> future,private final non-sealed org.elasticsearch.cluster.ack.AckedRequest request