320 likes | 408 Views
Automate Administration with KURL Shayne Koestler. Introduction. KURL. Kinetic Uniform Request Language KURL is a domain-specific language (DSL) written in Ruby DSL? A language designed to solve a specific set of problems =MIN(A2:A7)
E N D
KURL • Kinetic Uniform Request Language • KURL is a domain-specific language (DSL) written in Ruby • DSL? • A language designed to solve a specific set of problems • =MIN(A2:A7) • KURL creates catalogs and service items in Kinetic Request • Hides complexity of forms and relationships
KURL History • Previous Names • Shayne-alyzer, Template Generator, Accelerator, etc. • Ruby source to JAR file • Klink to ars models to Remedy Pure Java API • More and more comprehensive
KURL Components • KURL Code • Ruby code containing functions made available in KURL • service_item, page, event, etc. • KURL Jar • Commands executed in command prompt with the kurl.jar • build_catalog, retrieve_service_item, etc
KURL Components Execute Ruby Request Server Ruby (.rb) file kurl.jar API Calls Print Ruby
Uses for KURL • Import/Export format • Human readable • Suitable for version control • Automate service item development • Generate KURL code from other sources (csv, database, etc.) • Generate KURL code from a service item • Catalog provisioning (service providers)
Uses for KURL • Alternative method of service item development • Text editing rather than point-and-click • Reduced duplication • Leverage Ruby features to aid development • Version control • https://github.com/kineticdata/demo-acme
Hello World • Ruby file • Command prompt
About Ruby • Object oriented • Dynamic typing • Clean syntax • Powerful features • Designed for developer happiness • JRuby • Runs on Java platform
Ruby • http://www.ruby-lang.org/
JRuby • http://jruby.org/
Development with KURL • Goals • Adaptable and maintainable • Simplicity • More efficient development • Track development
Development with KURL • Generate a template service item • Look and feel • Common elements • Export template to KURL code • Break into reusable functions • Store reused values as ruby variables
KURL Templates • A piece of KURL code wrapped in a function • Reducing duplication of common behavior • Further abstraction of KURL functions • Created 3 reusable code templates • Standard header – configuration items of service item • Standard content page – standard content at top of request • Standard footer – confirmation page
KURL Templates Templates • DSL on top of a DSL • The domain is your service items KURLCode Remedy API
Ruby Variables • Store commonly used values as variables • Refer to variables throughout KURL code • Examples • Company name • Web server URL
Ruby Variables • Added variables to our templates file
More Ruby • Looping over KURL code • Generate data for portal development • Conditionals to generate dynamic content • Conditionally include templates
Resources • KURL on Kinetic Community • http://community.kineticdata.com/10_Kinetic_Request/KURL • Get Started – downloads and setup • KURL Functions – documents the Ruby code functions in KURL • JAR Commands – documents the commands of the KURL jar file • Demo Catalog • https://github.com/kineticdata/demo-acme