Last active
March 29, 2019 10:47
-
-
Save hemikak/75f7c01c3f7e2231049a47ff3d9dd475 to your computer and use it in GitHub Desktop.
Ballerina service to get quotes from Game of Thrones(with annotations and trimmed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/http; | |
import ballerina/log; | |
import ballerinax/kubernetes; | |
import ballerinax/openshift; | |
@openshift:Route { | |
host: "www.got-quote.com" | |
} | |
@kubernetes:Service {} | |
listener http:Listener gotServiceEP = new(9090); // ballerina service endpoint | |
http:Client gotQuoteAPI = new("https://got-quotes.herokuapp.com/quotes"); // game of thrones API endpoint | |
@kubernetes:Deployment { | |
namespace: "got-quote-proj", | |
registry: "172.30.1.1:5000", | |
buildImage: false, | |
buildExtension: "openshift" | |
} | |
@http:ServiceConfig { | |
basePath: "/got" // basepath for my service | |
} | |
service gotService on gotServiceEP { | |
... | |
} | |
# Validates character. | |
# | |
# + character - Game of Thrones character. | |
# + return - Untainted character or error if invalid character. | |
function validateCharacter(string character) returns string|error { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment