Answer
$f(x)=\left\{\begin{array}{ll}
-x & x\ \leq 0\\
-x+2 & 0\lt x\leq 2
\end{array}\right.$
(Other answers are also possible.)
Work Step by Step
We see that both pieces of the graph correspond to lines with slope $-\frac{1}{1}=-1$. The left line has a $y$ intercept of $0$, while the right line has a $y$ intercept of $2$. Thus the equation is:
$f(x)=\left\{\begin{array}{ll}
-x & x\ \leq 0\\
-x+2 & 0\lt x\leq 2
\end{array}\right.$