Let's look at some basic kubectl output options.
Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).
We can start with:
kubectl get no
| public static void main(final String... args) { | |
| // this is javaslang.collection.Stream | |
| Stream.of(0, 1, 2, 3, 13, 14, null, -1) | |
| .peek(n -> out.print(format("%d -> ", n))) | |
| .map(Match.as(Object.class) // match as function | |
| .when(Objects::isNull).then("!") | |
| .whenIs(0).then(nil()) | |
| .when(is(1)).then("one") | |
| .whenIs(13).then(() -> "unlucky") | |
| .whenIs(14).then(printIt()) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| /** | |
| * Example of using an angular provider to build an api service. | |
| * @author Jeremy Elbourn (@jelbourn) | |
| */ | |
| /** Namespace for the application. */ | |
| var app = {}; | |
| /******************************************************************************/ |
| import org.apache.commons.codec.binary.Base64; | |
| private String encodeFileToBase64Binary(String fileName) | |
| throws IOException { | |
| File file = new File(fileName); | |
| byte[] bytes = loadFile(file); | |
| byte[] encoded = Base64.encodeBase64(bytes); | |
| String encodedString = new String(encoded); |