Skip to content

Instantly share code, notes, and snippets.

@hemikak
Last active March 29, 2019 10:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Ballerina service to get quotes from Game of Thrones(with annotations and trimmed)
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