|  | 
| 1 | 1 | ###Pure | 
| 2 |  | -// Define a simple function to be used by our hosted service | 
| 3 | 2 | function model::greet(name: String[1]): String[1] | 
| 4 | 3 | { | 
| 5 |  | -  'Hello, ' + $name + '! Welcome to the hosted service.' | 
|  | 4 | +  'Hello, ' + $name + '!' | 
| 6 | 5 | } | 
| 7 | 6 | 
 | 
| 8 | 7 | function model::processData(data: String[1]): String[1] | 
| 9 | 8 | { | 
| 10 |  | -  'Processed data: ' + $data | 
|  | 9 | +  'Processed: ' + $data | 
| 11 | 10 | } | 
| 12 | 11 | 
 | 
| 13 | 12 | ###HostedService | 
| 14 |  | -// Basic hosted service with UserList ownership | 
| 15 | 13 | HostedService model::BasicHostedService | 
| 16 | 14 | { | 
| 17 | 15 |    pattern : '/api/greet/{name}'; | 
| 18 |  | -   ownership : UserList { users: [ | 
| 19 |  | -      'user1', | 
| 20 |  | -      'user2' | 
| 21 |  | -      ] }; | 
|  | 16 | +   ownership : UserList { users: ['user1', 'user2'] }; | 
| 22 | 17 |    function : model::greet(String[1]):String[1]; | 
| 23 |  | -   documentation : 'A simple hosted service that greets users by name'; | 
|  | 18 | +   documentation : 'A simple hosted service'; | 
| 24 | 19 |    autoActivateUpdates : true; | 
| 25 | 20 | } | 
| 26 | 21 | 
 | 
| 27 |  | -// Hosted service with Deployment ownership and stereotypes | 
| 28 | 22 | HostedService <<meta::pure::profiles::doc.doc>> {doc.doc = 'Example with deployment ownership'} model::DeploymentHostedService | 
| 29 | 23 | { | 
| 30 | 24 |    pattern : '/api/process/{data}'; | 
| 31 | 25 |    ownership : Deployment { identifier: '12345' }; | 
| 32 | 26 |    function : model::processData(String[1]):String[1]; | 
| 33 |  | -   documentation : 'A hosted service that processes data with deployment ownership'; | 
|  | 27 | +   documentation : 'A hosted service with deployment ownership'; | 
| 34 | 28 |    autoActivateUpdates : false; | 
| 35 | 29 | } | 
| 36 | 30 | 
 | 
| 37 |  | -// Hosted service with post-deployment actions | 
| 38 | 31 | HostedService model::AdvancedHostedService | 
| 39 | 32 | { | 
| 40 | 33 |    pattern : '/api/advanced/{param}'; | 
| 41 |  | -   ownership : UserList { users: [ | 
| 42 |  | -      'admin' | 
| 43 |  | - ]    ] }; | 
|  | 34 | +   ownership : UserList { users: ['admin'] }; | 
| 44 | 35 |    function : model::processData(String[1]):String[1]; | 
| 45 |  | -   documentation : 'Advanced hosted service with post-deployment actions'; | 
|  | 36 | +   documentation : 'Advanced hosted service'; | 
| 46 | 37 |    autoActivateUpdates : true; | 
| 47 | 38 | } | 
0 commit comments