Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 1 | module xos-core-service { |
| 2 | namespace "urn:xos:core:service"; |
| 3 | prefix xos-cs; |
| 4 | |
| 5 | import complex-types { prefix ct; } |
| 6 | |
| 7 | revision 2015-10-01 { |
| 8 | description "Initial revision."; |
| 9 | } |
| 10 | |
| 11 | grouping service-attribute { |
| 12 | leaf name { type string { length 128; } } |
| 13 | leaf value { type string { length 1024; } } |
| 14 | leaf service { |
| 15 | type instance-identifier { ct:instance-type Service; require-instance true; } |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | grouping service-role { |
| 20 | leaf role { |
| 21 | type enumeration { |
| 22 | enum "admin"; |
| 23 | //enum "Admin"; |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | grouping common-model-attr { |
| 29 | leaf kind { |
| 30 | type string { length 30; } |
| 31 | default "generic"; |
| 32 | } |
| 33 | leaf name { type string { length 255; } } |
| 34 | } |
| 35 | |
| 36 | ct:complex-type ServiceElement { |
| 37 | ct:abstract true; |
| 38 | leaf enabled { type boolean; default true; } |
| 39 | } |
| 40 | |
| 41 | ct:complex-type Service { |
| 42 | ct:extends ServiceElement; |
| 43 | |
| 44 | leaf description { |
| 45 | type string { length 255; } |
| 46 | description "Description of Service"; |
| 47 | } |
| 48 | leaf published { type boolean; default true; } |
| 49 | |
| 50 | uses common-model-attr { |
| 51 | refine kind { |
| 52 | description "Kind of Service"; |
| 53 | } |
| 54 | refine name { |
| 55 | description "Service Name"; |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | ct:complex-type User { |
| 61 | ct:extends ServiceElement; |
| 62 | // TBD - should go to a separate xos-core-user module or such |
| 63 | } |
| 64 | |
| 65 | ct:complex-type ServicePrivilege { |
| 66 | key "user-service-role"; |
| 67 | |
| 68 | leaf user { |
| 69 | type instance-identifier { ct:instance-type User; require-instance true; } |
| 70 | } |
| 71 | leaf service { |
| 72 | type instance-identifier { ct:instance-type Service; } |
| 73 | } |
| 74 | uses service-role; |
| 75 | } |
| 76 | |
| 77 | ct:complex-type TenantRoot { |
| 78 | ct:extends ServiceElement; |
| 79 | |
| 80 | description |
| 81 | "A tenantRoot is one of the things that can sit at the root of a chain |
| 82 | of tenancy. This object represents a node."; |
| 83 | uses common-model-attr; |
| 84 | } |
| 85 | |
| 86 | ct:complex-type ContainerImage { |
| 87 | // TBD |
| 88 | } |
| 89 | |
| 90 | ct:complex-type Tenancy { |
| 91 | ct:extends ServiceElement; |
| 92 | |
| 93 | description |
| 94 | "A Tenancy describes relationship between a subscriber and a provider"; |
| 95 | |
| 96 | uses common-model-attr; |
| 97 | |
| 98 | leaf provider { type instance-identifer { ct:instance-type Service; } } |
| 99 | leaf subscriber { |
| 100 | type instance-identifier { |
| 101 | ct:instance-type ServiceElement; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | // adding stuff from TenantWithContainer here... |
| 106 | leaf creator { type instance-identifier { ct:instance-type User; } } |
| 107 | leaf image { type instance-identifier { ct:instance-type ContainerImage; } } |
| 108 | } |
| 109 | |
| 110 | ct:complex-type Subscriber { |
| 111 | ct:extends TenantRoot; |
| 112 | refine kind { default "Subscriber"; } |
| 113 | } |
| 114 | |
| 115 | ct:complex-type Provider { |
| 116 | ct:extends TenantRoot; |
| 117 | refine kind { default "Provider"; } |
| 118 | } |
| 119 | |
| 120 | } |