http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json new file mode 100644 index 0000000..772b336 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/cartridges.json @@ -0,0 +1,383 @@ +{ + "type": "object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Cartridge Definition", + "name": "Cartridge ", + "options": { + "disable_properties": true, + "disable_collapse": true + }, + "required": ["type", "provider", "host", "displayName", "description", "version", "multiTenant", "portMapping"], + "properties": { + "type": { + "type": "string", + "id": "root/type", + "id": "root/type", + "title": "Type", + "name": "Type", + "default": "php", + "propertyOrder": 1, + "maxItems": 1 + }, + "isPublic": { + "type": "boolean", + "id": "root/isPublic", + "title": "Is Public", + "name": "Is Public", + "default": false, + "propertyOrder": 2, + "maxItems": 1 + }, + "provider": { + "type": "string", + "id": "root/provider", + "title": "Provider", + "name": "Provider", + "default": "apache", + "propertyOrder": 3, + "maxItems": 1 + }, + "host": { + "type": "string", + "id": "root/host", + "title": "Host", + "name": "Host", + "default": "stratos.org", + "propertyOrder": 4, + "maxItems": 1 + }, + "displayName": { + "type": "string", + "id": "root/displayName", + "title": "Display Name", + "name": "Display Name", + "default": "load balancer", + "propertyOrder": 5, + "maxItems": 1 + }, + "description": { + "type": "string", + "id": "root/description", + "title": "Description", + "name": "Description", + "default": "LB Cartridge", + "propertyOrder": 6, + "maxItems": 1 + }, + "version": { + "type": "string", + "id": "root/version", + "title": "Version", + "name": "Version", + "default": "4", + "propertyOrder": 7, + "maxItems": 1 + }, + "multiTenant": { + "type": "boolean", + "id": "root/multiTenant", + "title": "Multi Tenant", + "name": "Multi Tenant", + "default": false, + "maxItems": 1 + }, + "defaultAutoscalingPolicy": { + "type": "string", + "id": "root/defaultAutoscalingPolicy", + "title": "Default Autoscaling Policy", + "name": "Default Autoscaling Policy", + "default": "economyPolicy", + "required": false + }, + "portMapping": { + "type": "array", + "id": "root/portMapping", + "title": "Port Mapping", + "name": "Port Mapping", + "items": [ + { + "type": "object", + "id": "root/portMapping/0", + "required": ["port", "protocol", "proxyPort"], + "format": "grid", + "properties": { + "protocol": { + "type": "string", + "id": "root/portMapping/0/protocol", + "title": "Protocol", + "name": "Protocol", + "default": "http" + }, + "port": { + "type": "number", + "id": "root/portMapping/0/port", + "title": "Port", + "name": "Port", + "default": "8280", + "format": "number" + }, + "proxyPort": { + "type": "number", + "id": "root/portMapping/0/proxyPort", + "title": "Proxy Port", + "name": "Proxy Port", + "default": "8280", + "format": "number" + } + } + }, + { + "type": "object", + "id": "root/portMapping/1", + "required": false, + "format": "grid", + "properties": { + "protocol": { + "type": "string", + "id": "root/portMapping/1/protocol", + "title": "Protocol", + "name": "Protocol", + "default": "https" + }, + "port": { + "type": "number", + "id": "root/portMapping/1/port", + "title": "Port", + "name": "Port", + "default": "8243", + "format": "number" + }, + "proxyPort": { + "type": "number", + "id": "root/portMapping/1/proxyPort", + "title": "Proxy Port", + "name": "Proxy Port", + "default": "8243", + "format": "number" + } + } + } + ] + }, + "iaasProvider": { + "type": "array", + "id": "root/iaasProvider", + "title": "iaas Provider", + "name": "iaas Provider", + "required": false, + "items": { + "type": "object", + "id": "root/iaasProvider/0", + "format": "grid", + "required": ["type", "imageId", "maxInstanceLimit"], + "properties": { + "type": { + "type": "string", + "id": "root/iaasProvider/0/type", + "title": "Type", + "name": "Type", + "default": "ec2" + }, + "imageId": { + "type": "string", + "id": "root/iaasProvider/0/imageId", + "title": "Image ID", + "name": "Image ID", + "default": "ap-southeast-1/amiÂ-70326522" + }, + "maxInstanceLimit": { + "type": "number", + "id": "root/iaasProvider/0/maxInstanceLimit", + "title": "Max Instance Limit", + "name": "Max Instance Limit", + "default": "5", + "format": "number" + }, + "property": { + "type": "array", + "id": "root/iaasProvider/0/property", + "required": false, + "items": [ + { + "type": "object", + "id": "root/iaasProvider/0/property/0", + "format": "grid", + "required": ["name", "value"], + "properties": { + "name": { + "type": "string", + "id": "root/iaasProvider/0/property/0/name", + "default": "instanceType" + }, + "value": { + "type": "string", + "id": "root/iaasProvider/0/property/0/value", + "default": "m1.medium" + } + } + }, + { + "type": "object", + "id": "root/iaasProvider/0/property/1", + "required": false, + "format": "grid", + "properties": { + "name": { + "type": "string", + "id": "root/iaasProvider/0/property/1/name", + "default": "keyPair", + "required": false + }, + "value": { + "type": "string", + "id": "root/iaasProvider/0/property/1/value", + "default": "xxxxxx", + "required": false + } + } + } + ] + }, + "networkInterfaces": { + "type":"array", + "id": "root/iaasProvider/0/networkInterfaces", + "title": "Network Interfaces", + "name": "Network Interfaces", + "required":true, + "items":[ + { + "type":"object", + "id": "root/iaasProvider/0/networkInterfaces/0", + "required":["networkUuid"], + "properties":{ + "networkUuid": { + "type":"string", + "id": "root/iaasProvider/0/networkInterfaces/0/networkUuid", + "title": "Network UUID", + "name": "Network UUID", + "default": "fb9c21f4-0672-48b2-8279-77334bb63a53", + "pattern":"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + } + } + }, + { + "type":"object", + "id": "root/iaasProvider/0/networkInterfaces/1", + "required":["networkUuid"], + "properties":{ + "networkUuid": { + "type":"string", + "id": "root/iaasProvider/0/networkInterfaces/1/networkUuid", + "title": "Network UUID", + "name": "Network UUID", + "default": "1e43f86f-4165-4f2e-8017-dd4cfb5548b0", + "pattern":"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" + } + } + } + ] + }, + } + } + + + }, + "loadBalancer": { + "type": "object", + "id": "root/loadBalancer", + "title": "Load Balancer", + "name": "Load Balancer", + "required": ["type", "property"], + "properties": { + "type": { + "type": "string", + "id": "root/loadBalancer/type", + "title": "Type", + "name": "Type", + "default": "lb" + }, + "property": { + "type": "object", + "id": "root/loadBalancer/property", + "title": "Property", + "name": "Property", + "required": ["name", "value"], + "properties": { + "name": { + "type": "string", + "id": "root/loadBalancer/property/name", + "default": "default.load.balancer" + }, + "value": { + "type": "string", + "id": "root/loadBalancer/property/value", + "default": "true" + } + } + } + + } + }, + "persistence": { + "type": "object", + "id": "root/persistence", + "title": "Persistence", + "name": "Persistence", + "required": ["isRequired", "volume"], + "properties": { + "isRequired": { + "type": "boolean", + "id": "root/persistence/isRequired", + "title": "Is Required", + "name": "Is Required", + "default": "true" + }, + "volume": { + "type": "array", + "id": "root/persistence/volume", + "title": "Volume", + "name": "Volume", + "items": { + "type": "object", + "id": "root/persistence/volume/0", + "required": ["device", "mappingPath", "size", "removeOnTermination"], + "properties": { + "device": { + "type": "string", + "id": "root/persistence/volume/0/device", + "title": "Device", + "name": "Device", + "default": "/dev/sdc" + }, + "mappingPath": { + "type": "string", + "id": "root/persistence/volume/0/mappingPath", + "title": "Mapping Path", + "name": "Mapping Path", + "default": "/home/ubuntu/sdc" + }, + "size": { + "type": "number", + "id": "root/persistence/volume/0/size", + "title": "Size", + "name": "Size", + "default": "11", + "format": "number" + }, + "removeOnTermination": { + "type": "boolean", + "id": "root/persistence/volume/0/removeOnTermination", + "title": "Remove On Termination", + "name": "Remove On Termination", + "default": false + } + } + } + + + } + } + }, + } +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/deployments.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/deployments.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/deployments.json new file mode 100644 index 0000000..c73b81f --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/deployments.json @@ -0,0 +1,103 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Deployment Definition", + "name": "Deployment Policy", + "options": { + "disable_properties": true, + "disable_collapse": true + }, + "required":["id","partitionGroup"], + "properties":{ + "id": { + "type":"string", + "id": "root/id", + "title": "Deployment Policy ID", + "name": "Deployment Policy ID", + "default": "isuruh-ec2", + "maxItems":1 + }, + "description": { + "type":"string", + "id": "root/description", + "title": "Description", + "name": "Description", + "maxItems":1 + }, + "isPublic": { + "type":"boolean", + "id": "root/isPublic", + "title": "Is Public", + "name": "Is Public", + "default": false, + "maxItems":1 + }, + "partitionGroup": { + "type":"object", + "id": "root/partitionGroup", + "title": "Partition Group", + "name": "Partition Group", + "required":["id","partitionAlgo","partition"], + "properties":{ + "id": { + "type":"string", + "id": "root/partitionGroup/id", + "title": "Partition Group ID", + "name": "Partition Group ID", + "default": "ec2", + "maxItems":1 + }, + "partitionAlgo": { + "type":"string", + "id": "root/partitionGroup/partitionAlgo", + "title": "Partition Algorithm", + "name": "Partition Algorithm", + "default": "one-after-another", + "enum": ["round-robin", "one-after-another"], + "maxItems":1 + }, + "partition": { + "type":"array", + "id": "root/partitionGroup/partition", + "title": "Partition", + "name": "Partition", + "minItems":1, + "items": + { + "type":"object", + "id": "root/partitionGroup/partition/0", + "required":["id","partitionMin","partitionMax"], + "format": "grid", + "properties":{ + "id": { + "type":"string", + "id": "root/partitionGroup/partition/0/id", + "default": "P1", + + }, + "partitionMax": { + "type":"string", + "id": "root/partitionGroup/partition/0/partitionMax", + "default": "3", + }, + "partitionMin": { + "type":"string", + "id": "root/partitionGroup/partition/0/partitionMin", + "default": "1", + }, + "description": { + "type": "string", + "id": "root/partitionGroup/partition/0/description", + "default": "description", + + } + } + } + + + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json new file mode 100644 index 0000000..4f2e710 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/docker.json @@ -0,0 +1,302 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Docker Definition", + "name": "Docker", + "properties":{ + "description": { + "type":"string", + "id": "root/description", + "default": "Kubernetes CoreOS cluster on EC2 ", + "required":false + }, + "groupId": { + "type":"string", + "id": "root/groupId", + "default": "KubGrp1", + "required":false + }, + "kubernetesHosts": { + "type":"array", + "id": "root/kubernetesHosts", + "required":false, + "items":[ + { + "type":"object", + "id": "root/kubernetesHosts/0", + "required":false, + "properties":{ + "hostId": { + "type":"string", + "id": "root/kubernetesHosts/0/hostId", + "default": "KubHostSlave1", + "required":false + }, + "hostIpAddress": { + "type":"string", + "id": "root/kubernetesHosts/0/hostIpAddress", + "default": "172.17.8.101", + "required":false + }, + "hostname": { + "type":"string", + "id": "root/kubernetesHosts/0/hostname", + "default": "slave1.dev.kubernetes.example.org", + "required":false + }, + "property": { + "type":"array", + "id": "root/kubernetesHosts/0/property", + "required":false, + "items":[ + { + "type":"object", + "id": "root/kubernetesHosts/0/property/0", + "required":false, + "properties":{ + "name": { + "type":"string", + "id": "root/kubernetesHosts/0/property/0/name", + "default": "prop1", + "required":false + }, + "value": { + "type":"string", + "id": "root/kubernetesHosts/0/property/0/value", + "default": "val1", + "required":false + } + } + }, + { + "type":"object", + "id": "root/kubernetesHosts/0/property/1", + "required":false, + "properties":{ + "name": { + "type":"string", + "id": "root/kubernetesHosts/0/property/1/name", + "default": "prop2", + "required":false + }, + "value": { + "type":"string", + "id": "root/kubernetesHosts/0/property/1/value", + "default": "val2", + "required":false + } + } + } + ] + } + } + }, + { + "type":"object", + "id": "root/kubernetesHosts/1", + "required":false, + "properties":{ + "hostId": { + "type":"string", + "id": "root/kubernetesHosts/1/hostId", + "default": "KubHostSlave2", + "required":false + }, + "hostIpAddress": { + "type":"string", + "id": "root/kubernetesHosts/1/hostIpAddress", + "default": "172.17.8.102", + "required":false + }, + "hostname": { + "type":"string", + "id": "root/kubernetesHosts/1/hostname", + "default": "slave2.dev.kubernetes.example.org", + "required":false + }, + "property": { + "type":"array", + "id": "root/kubernetesHosts/1/property", + "required":false, + "items":[ + { + "type":"object", + "id": "root/kubernetesHosts/1/property/0", + "required":false, + "properties":{ + "name": { + "type":"string", + "id": "root/kubernetesHosts/1/property/0/name", + "default": "prop1", + "required":false + }, + "value": { + "type":"string", + "id": "root/kubernetesHosts/1/property/0/value", + "default": "val1", + "required":false + } + } + }, + { + "type":"object", + "id": "root/kubernetesHosts/1/property/1", + "required":false, + "properties":{ + "name": { + "type":"string", + "id": "root/kubernetesHosts/1/property/1/name", + "default": "prop2", + "required":false + }, + "value": { + "type":"string", + "id": "root/kubernetesHosts/1/property/1/value", + "default": "val2", + "required":false + } + } + } + ] + } + } + } + ] + }, + "kubernetesMaster": { + "type":"object", + "id": "root/kubernetesMaster", + "required":false, + "properties":{ + "hostId": { + "type":"string", + "id": "root/kubernetesMaster/hostId", + "default": "KubHostMaster1", + "required":false + }, + "hostIpAddress": { + "type":"string", + "id": "root/kubernetesMaster/hostIpAddress", + "default": "172.17.8.100", + "required":false + }, + "hostname": { + "type":"string", + "id": "root/kubernetesMaster/hostname", + "default": "master.dev.kubernetes.example.org", + "required":false + }, + "property": { + "type":"array", + "id": "root/kubernetesMaster/property", + "required":false, + "items":[ + { + "type":"object", + "id": "root/kubernetesMaster/property/0", + "required":false, + "properties":{ + "name": { + "type":"string", + "id": "root/kubernetesMaster/property/0/name", + "default": "prop1", + "required":false + }, + "value": { + "type":"string", + "id": "root/kubernetesMaster/property/0/value", + "default": "val1", + "required":false + } + } + }, + { + "type":"object", + "id": "root/kubernetesMaster/property/1", + "required":false, + "properties":{ + "name": { + "type":"string", + "id": "root/kubernetesMaster/property/1/name", + "default": "prop2", + "required":false + }, + "value": { + "type":"string", + "id": "root/kubernetesMaster/property/1/value", + "default": "val2", + "required":false + } + } + } + ] + } + } + }, + "portRange": { + "type":"object", + "id": "root/portRange", + "required":false, + "properties":{ + "lower": { + "type":"string", + "id": "root/portRange/lower", + "default": "4500", + "required":false + }, + "upper": { + "type":"string", + "id": "root/portRange/upper", + "default": "5000", + "required":false + } + } + }, + "property": { + "type":"array", + "id": "root/property", + "required":false, + "items":[ + { + "type":"object", + "id": "root/property/0", + "required":false, + "properties":{ + "name": { + "type":"string", + "id": "root/property/0/name", + "default": "prop1", + "required":false + }, + "value": { + "type":"string", + "id": "root/property/0/value", + "default": "val1", + "required":false + } + } + }, + { + "type":"object", + "id": "root/property/1", + "required":false, + "properties":{ + "name": { + "type":"string", + "id": "root/property/1/name", + "default": "prop2", + "required":false + }, + "value": { + "type":"string", + "id": "root/property/1/value", + "default": "val2", + "required":false + } + } + } + ] + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/loadbalancer.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/loadbalancer.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/loadbalancer.json new file mode 100644 index 0000000..42ba217 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/loadbalancer.json @@ -0,0 +1,263 @@ +{ + "type": "object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Load Balancer Definition", + "name": "Load Balancer", + "options": { + "disable_properties": true, + "disable_collapse": true + }, + "required": ["type", "provider", "host", "displayName", "description", "version", "portMapping"], + "properties": { + "type": { + "type": "string", + "id": "root/type", + "title": "Type", + "name": "Type", + "default": "lb", + "propertyOrder": 1, + "maxItems": 1 + }, + "isPublic": { + "type": "boolean", + "id": "root/isPublic", + "title": "Is Public", + "name": "Is Public", + "default": false, + "propertyOrder": 2, + "maxItems": 1 + }, + "provider": { + "type": "string", + "id": "root/provider", + "title": "Provider", + "name": "Provider", + "default": "lb", + "propertyOrder": 3, + "maxItems": 1 + }, + "host": { + "type": "string", + "id": "root/host", + "title": "Host", + "name": "Host", + "default": "stratos.org", + "propertyOrder": 4, + "maxItems": 1 + }, + "displayName": { + "type": "string", + "id": "root/displayName", + "title": "Display Name", + "name": "Display Name", + "default": "load balancer", + "propertyOrder": 5, + "maxItems": 1 + }, + "description": { + "type": "string", + "id": "root/description", + "title": "Description", + "name": "Description", + "default": "LB Cartridge", + "propertyOrder": 6, + "maxItems": 1 + }, + "version": { + "type": "string", + "id": "root/version", + "title": "Version", + "name": "Version", + "default": "4", + "propertyOrder": 7, + "maxItems": 1 + }, + "defaultAutoscalingPolicy": { + "type": "string", + "id": "root/defaultAutoscalingPolicy", + "title": "Default Autoscaling Policy", + "name": "Default Autoscaling Policy", + "default": "economyPolicy", + "required": false + }, + "portMapping": { + "type": "array", + "id": "root/portMapping", + "title": "Port Mapping", + "name": "Port Mapping", + "items": [ + { + "type": "object", + "id": "root/portMapping/0", + "required": ["port", "protocol", "proxyPort"], + "format": "grid", + "properties": { + "protocol": { + "type": "string", + "id": "root/portMapping/0/protocol", + "title": "Protocol", + "name": "Protocol", + "default": "http" + }, + "port": { + "type": "number", + "id": "root/portMapping/0/port", + "title": "Port", + "name": "Port", + "default": "8280", + "format": "number" + }, + "proxyPort": { + "type": "number", + "id": "root/portMapping/0/proxyPort", + "title": "Proxy Port", + "name": "Proxy Port", + "default": "8280", + "format": "number" + } + } + }, + { + "type": "object", + "id": "root/portMapping/1", + "required": false, + "format": "grid", + "properties": { + "protocol": { + "type": "string", + "id": "root/portMapping/1/protocol", + "title": "Protocol", + "name": "Protocol", + "default": "https" + }, + "port": { + "type": "number", + "id": "root/portMapping/1/port", + "title": "Port", + "name": "Port", + "default": "8243", + "format": "number" + }, + "proxyPort": { + "type": "number", + "id": "root/portMapping/1/proxyPort", + "title": "Proxy Port", + "name": "Proxy Port", + "default": "8243", + "format": "number" + } + } + } + ] + }, + "iaasProvider": { + "type": "array", + "id": "root/iaasProvider", + "title": "iaas Provider", + "name": "iaas Provider", + "required": false, + "items": { + "type": "object", + "id": "root/iaasProvider/0", + "format": "grid", + "required": ["type", "imageId", "maxInstanceLimit"], + "properties": { + "type": { + "type": "string", + "id": "root/iaasProvider/0/type", + "title": "Type", + "name": "Type", + "default": "ec2" + }, + "imageId": { + "type": "string", + "id": "root/iaasProvider/0/imageId", + "title": "Image ID", + "name": "Image ID", + "default": "ap-southeast-1/amiÂ-70326522" + }, + "maxInstanceLimit": { + "type": "number", + "id": "root/iaasProvider/0/maxInstanceLimit", + "title": "Max Instance Limit", + "name": "Max Instance Limit", + "default": "5", + "format": "number" + }, + "property": { + "type": "array", + "id": "root/iaasProvider/0/property", + "required": false, + "items": [ + { + "type": "object", + "id": "root/iaasProvider/0/property/0", + "format": "grid", + "required": ["name", "value"], + "properties": { + "name": { + "type": "string", + "id": "root/iaasProvider/0/property/0/name", + "default": "instanceType" + }, + "value": { + "type": "string", + "id": "root/iaasProvider/0/property/0/value", + "default": "m1.medium" + } + } + }, + { + "type": "object", + "id": "root/iaasProvider/0/property/1", + "required": false, + "format": "grid", + "properties": { + "name": { + "type": "string", + "id": "root/iaasProvider/0/property/1/name", + "default": "keyPair", + "required": false + }, + "value": { + "type": "string", + "id": "root/iaasProvider/0/property/1/value", + "default": "xxxxxx", + "required": false + } + } + } + ] + } + } + } + + + }, + "property": { + "type": "array", + "id": "root/property", + "required": false, + "items": { + "type": "object", + "id": "root/property/0", + "required": false, + "properties": { + "name": { + "type": "string", + "id": "root/property/0/name", + "default": "load.balancer", + "required": false + }, + "value": { + "type": "string", + "id": "root/property/0/value", + "default": "true", + "required": false + } + } + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/multitenant.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/multitenant.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/multitenant.json new file mode 100644 index 0000000..31616e5 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/multitenant.json @@ -0,0 +1,71 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Multi-Tenant Service Definition", + "name": "Service Definition", + "options": { + "disable_properties": true, + "disable_collapse": true + }, + "required":["serviceName","cartridgeType","deploymentPolicyName","autoscalingPolicyName","clusterDomain", + "clusterSubDomain","tenantRange"], + "properties":{ + "serviceName": { + "type":"string", + "id": "root/serviceName", + "title": "Service Name", + "name": "Service Name", + "default": "appserver" + }, + "isPublic": { + "type":"string", + "id": "root/isPublic", + "title": "Is Public", + "name": "Is Public", + "default": "true" + }, + "cartridgeType": { + "type":"string", + "id": "root/cartridgeType", + "title": "Cartridge Type", + "name": "Cartridge Type", + "default": "appserver" + }, + "deploymentPolicyName": { + "type":"string", + "id": "root/deploymentPolicyName", + "title": "Deployment Policy Name", + "name": "Deployment Policy Name", + "default": "D1" + }, + "autoscalingPolicyName": { + "type":"string", + "id": "root/autoscalingPolicyName", + "title": "Autoscaling Policy Name", + "name": "Autoscaling Policy Name", + "default": "AS1" + }, + "clusterDomain": { + "type":"string", + "id": "root/clusterDomain", + "title": "Cluster Domain", + "name": "Cluster Domain", + "default": "appserverdev.dev.domain" + }, + "clusterSubDomain": { + "type":"string", + "id": "root/clusterSubDomain", + "title": "Cluster Sub Domain", + "name": "Cluster Sub Domain", + "default": "subdomain2" + }, + "tenantRange": { + "type":"string", + "title": "Tenant Range", + "name": "Tenant Range", + "id": "root/tenantRange", + "default": "*" + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json new file mode 100644 index 0000000..1209c93 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/configure/partitions.json @@ -0,0 +1,89 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Partition Definition", + "name": "Partition", + "options": { + "disable_properties": true, + "disable_collapse": true + }, + "required" : ["id","provider","property"], + "properties":{ + "id": { + "type":"string", + "title": "Partition ID", + "name": "Partition ID", + "id": "root/id", + "default": "P1", + "maxItems":1 + }, + "description": { + "type":"string", + "id": "root/description", + "title": "Description", + "name": "Description", + "maxItems":1 + }, + "isPublic": { + "type":"boolean", + "id": "root/isPublic", + "title": "Is Public", + "name": "Is Public", + "default": false, + "maxItems":1 + }, + "provider": { + "type":"string", + "id": "root/provider", + "title": "Provider", + "name": "Provider", + "default": "ec2", + "enum": ["ec2", "openstack", "vcloud"], + }, + "property": { + "readonly":true, + "type":"array", + "id": "root/property", + "items":[ + { + "type":"object", + "id": "root/property/0", + "format": "grid", + "required":["name", "value"], + "properties":{ + "name": { + "type":"string", + "id": "root/property/0/name", + "default": "region" + }, + "value": { + "type":"string", + "id": "root/property/0/value", + "default": "ap-southeast-1" + } + } + }, + { + "type":"object", + "id": "root/property/1", + "format": "grid", + "properties":{ + "name": { + "type":"string", + "id": "root/property/1/name", + "default": "zone" + }, + "value": { + "type":"string", + "id": "root/property/1/value", + "default": "ap-southeast-1a" + + } + } + } + ] + + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json new file mode 100644 index 0000000..945c482 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/tenants.json @@ -0,0 +1,52 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Tenant", + "name": "Tenant", + "required":false, + "properties":{ + "active": { + "type":"string", + "id": "root/active", + "default": "true", + "required":false + }, + "adminPassword": { + "type":"string", + "id": "root/adminPassword", + "default": "admin123", + "required":false + }, + "admin": { + "type":"string", + "id": "root/admin", + "default": "admin", + "required":false + }, + "email": { + "type":"string", + "id": "root/email", + "default": "[email protected]", + "required":false + }, + "firstname": { + "type":"string", + "id": "root/firstname", + "default": "Frank", + "required":false + }, + "lastname": { + "type":"string", + "id": "root/lastname", + "default": "Myers", + "required":false + }, + "tenantDomain": { + "type":"string", + "id": "root/tenantDomain", + "default": "frank.com", + "required":false + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json new file mode 100644 index 0000000..8c0218e --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/forms/schema/users/users.json @@ -0,0 +1,68 @@ +{ + "type":"object", + "$schema": "http://json-schema.org/draft-04/schema", + "id": "root", + "title": "Users", + "options": { + "disable_properties": true, + "disable_collapse": true + }, + "required":["userName","credential","role"], + "properties":{ + "userName": { + "type":"string", + "id": "root/userName", + "title": "User Name", + "name": "User Name", + "default": "" + }, + "credential": { + "type":"string", + "id": "root/credential", + "title": "Password", + "name": "Password", + "default": "" + }, + "role": { + "type":"string", + "id": "root/role", + "title": "User Role", + "name": "User Role", + "enum":["admin","Internal/user"], + "default": "Internal/user" + }, + "email": { + "type":"string", + "id": "root/email", + "title": "Email", + "name": "Email", + "format":"email", + "default": "[email protected]", + "required":false + }, + "firstName": { + "type":"string", + "id": "root/firstName", + "title": "First Name", + "name": "First Name", + "default": "", + "required":false + }, + "lastName": { + "type":"string", + "id": "root/lastName", + "title": "Last Name", + "name": "Last Name", + "default": "", + "required":false + }, + "profileName": { + "type":"string", + "id": "root/profileName", + "title": "Profile Name", + "name": "Profile Name", + "default": "", + "required":false + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/log/console.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/log/console.jag b/components/org.apache.stratos.manager.console/console/controllers/log/console.jag new file mode 100644 index 0000000..a90686f --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/log/console.jag @@ -0,0 +1,30 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ + +<% + +function printLog() { + var log = new Log("apacheStratos"); + return stringify(log); +} + +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/login/login.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/login/login.jag b/components/org.apache.stratos.manager.console/console/controllers/login/login.jag new file mode 100644 index 0000000..5700de9 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/login/login.jag @@ -0,0 +1,89 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +var log = new Log("controller.login"), + carbon = require('carbon'), + process = require('process'), + util = require('/controllers/rest/rest_calls.jag'), + server = new carbon.server.Server(), + conf = carbon.server.loadConfig('carbon.xml'), + offset = conf.*::['Ports'].*::['Offset'].text(), + hostName = conf.*::['HostName'].text().toString(); + +if (hostName === null || hostName === '') { + hostName = 'localhost'; +} + +var httpPort = 9763 + parseInt(offset, 10), + httpsPort = 9443 + parseInt(offset, 10); + +process.setProperty('server.host', hostName); +process.setProperty('http.port', httpPort.toString()); +process.setProperty('https.port', httpsPort.toString()); + + +var username = request.getParameter('username').trim(), + password = request.getParameter('password'); + +if (username || password) { + session.put("error", "Enter your username and password."); +} + +try { + var auth = server.authenticate(username, password); + + if (!auth) { + session.put("error", "The username or password you entered is incorrect."); + print({status: 0}); + } else { + var userObject = carbon.server.tenantUser(username); + var um = new carbon.user.UserManager({}, userObject.tenantId); + var user = um.getUser(userObject.username); + var roles = user.getRoles(); + //storing in session + session.put("USER_NAME", username); + session.put("TENANT_DOMAIN", userObject.domain); + session.put("ROLE_ARRAY", roles); + session.put("TENANT_ID", userObject.tenantId); + + try { + //get all user permission + var userPermissions = um.authorizer.getAllowedUIResourcesForUser(userObject.username, '/'); //TODO need to + session.put("PERMISSIONS", userPermissions); + //call the authentication rest-endpoint and get the JSESSION_ID + var result = util.RESTCalls.getSession(username, password); + //save the JSESSION_ID in current console.session. + var jSessionId = result.data.Success.sessionId; + session.put("JSESSIONID", jSessionId); + } catch (e) { + log.warn(e); + } + // require('console').server.current(session,username); + print({status: 1}); + } + +} catch (e) { + session.put("error", e.toString()); + print({status: e.toString()}); +} + + +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/login/logout.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/login/logout.jag b/components/org.apache.stratos.manager.console/console/controllers/login/logout.jag new file mode 100644 index 0000000..4b10a94 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/login/logout.jag @@ -0,0 +1,24 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +session.invalidate(); +response.sendRedirect(request.getContextPath()+'/login/'); +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/login/validator.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/login/validator.jag b/components/org.apache.stratos.manager.console/console/controllers/login/validator.jag new file mode 100644 index 0000000..c618f40 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/login/validator.jag @@ -0,0 +1,33 @@ +<% +if(session.get("USER_NAME")==null || session.get("USER_NAME") === undefined){ + response.sendRedirect(request.getContextPath()+'/login/'); +} + +function pageValidate(pagePermission, rolePermission, error){ + hasPermission = checkPagePermission(pagePermission, rolePermission); + + if(hasPermission.length > 0){ + return true; + }else{ + error.push({"errorMessage": "Sorry You don't have permission to access this content"}); + return error; + } + +} + +function checkPagePermission(x, y) { + x.sort(); + y.sort(); + var i = j = 0; + var ret = []; + while (i < x.length && j < y.length) { + if (x[i] < y[j]) i++; + else if (y[j] < x[i]) j++; + else { + ret.push(i); + i++, j++; + } + } + return ret; +} +%> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json b/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json new file mode 100644 index 0000000..dd4961f --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/menu/menu.json @@ -0,0 +1,165 @@ +{ + "menu": [ + { + "link": "configure/", + "linkexternal": false, + "context": "/", + "title": "Configurations", + "icon": "fa-gears", + "permissionPaths": ["/permission", "/permission/admin"], + "description": "Configure partitions, deployment and scaling policies, cartridges and manage docker groups", + "sub-menu": [ + { + "link": "configure/partitions/", + "linkexternal": false, + "context": "/configure", + "title": "Partitions", + "icon": "fa-th-large", + "permissionPaths": ["/permission", "/permission/admin"], + "description": "Define partitions/partition groups to be used in autoscaling and deployment policies." + }, + { + "link": "configure/deployments/", + "linkexternal": false, + "context": "/configure", + "title": "Deployment Policies", + "icon": "fa-road", + "permissionPaths": ["/permission", "/permission/admin", "/permission/admin/manage/view/deploymentpolicy"], + "description": "Define specific policies for cartridge deployment." + }, + { + "link": "configure/autoscalingpolicies/", + "linkexternal": false, + "context": "/configure", + "title": "Autoscaling Policies", + "icon": "fa-expand", + "permissionPaths": ["/permission", "/permission/admin", "/permission/admin/manage/view/autoscalingpolicy"], + "description": "Define policies which specify inbound requests, memory usage and CPU usage etc." + }, + { + "link": "configure/loadbalancer/", + "linkexternal": false, + "context": "/configure", + "title": "Load Balancers", + "icon": "fa-tasks", + "permissionPaths": ["/permission", "/permission/admin"], + "description": "Define load balancer for cartridges." + }, + { + "link": "configure/cartridges/", + "linkexternal": false, + "context": "/configure", + "title": "Cartridges", + "icon": "fa-inbox", + "permissionPaths": ["/permission", "/permission/admin"], + "description": "Define and manage single/multi tenant cartridges." + }, + { + "link": "configure/docker/", + "linkexternal": false, + "context": "/configure", + "title": "Docker Clusters", + "icon": "fa-sitemap", + "permissionPaths": ["/permission", "/permission/admin"], + "description": "Define and manage multitenant services." + } + /* , + { + "link": "configure/application/", + "linkexternal":false, + "context":"/configure", + "title": "Application Deployment", + "icon": "fa-archive ", + "permissionPaths": ["/permission","/permission/admin"], + "description": "Define and manage multitenant services." + } + */ + ] + }, + { + "link": "users/", + "linkexternal": false, + "context": "/", + "title": "Users", + "icon": "fa-users", + "permissionPaths": ["/permission", "/permission/admin" ], + "description": "Manage Users and Tenants", + "sub-menu": [ + { + "link": "users/users/", + "linkexternal": false, + "context": "/users", + "title": "Manage Users", + "icon": "fa-user", + "permissionPaths": ["/permission", "/permission/admin"], + "description": "Manage users." + }, + { + "link": "users/tenants/", + "linkexternal": false, + "context": "/users", + "title": "Manage Tenants", + "icon": "fa-building", + "permissionPaths": ["/permission"], + "description": "Manage tenants." + } + ] + }, + { + "link": "applications/", + "linkexternal": false, + "context": "/", + "title": "Applications", + "icon": "fa-archive", + "permissionPaths": ["/permission", "/permission/admin/manage/view/cartridge"], + "description": "Subscribe to Application.", + "sub-menu": [ + { + "link": "applications/groups/", + "linkexternal": false, + "context": "/applications", + "title": "Application Groups", + "icon": "fa-briefcase", + "permissionPaths": ["/permission", "/permission/admin", "/permission/admin/manage/view/subscription"], + "description": "Add application groups." + }, + { + "link": "applications/applications/", + "linkexternal": false, + "context": "/applications", + "title": "Applications", + "icon": "fa-archive", + "permissionPaths": ["/permission", "/permission/admin","/permission/admin/manage/view/subscription" ], + "description": "Add applications" + } + ] + }, +// { +// "link": "mycartridges/", +// "linkexternal": false, +// "context": "/", +// "title": "Instances", +// "icon": "fa-inbox", +// "permissionPaths": ["/permission", "/permission/admin/manage/view/subscription"], +// "description": "Your Instances" +// }, + { + "link": "https://issues.apache.org/jira/", + "linkexternal": true, + "context": "/", + "title": "JIRA", + "icon": "fa-bug", + "permissionPaths": ["/permission", "/permission/admin/manage/view/subscription"], + "description": "Report your issues to keep this alive" + }, + { + "link": "https://cwiki.apache.org/confluence/display/STRATOS/Home", + "linkexternal": true, + "context": "/", + "title": "Documentation", + "icon": "fa-life-saver", + "permissionPaths": ["/permission", "/permission/admin/manage/view/subscription"], + "description": "Read Documentation to get more information" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6a485f9/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag b/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag new file mode 100644 index 0000000..e075964 --- /dev/null +++ b/components/org.apache.stratos.manager.console/console/controllers/menu/menu_generator.jag @@ -0,0 +1,125 @@ +<% +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +var log = new Log("controller.menu_generator"); + +/** + * This will use to generate menu with permissions + * @param jsonobject: menu json + * @param permissions: user permissions + * @returns menu html content for partial + */ +function menuGenerator(context, jsonobject, permissions) { + var menupermission, + link='', + menu_html = ''; + + if (permissions instanceof Array) { + for (menupermission in jsonobject) { + var jsonPermission = jsonobject[menupermission], + hasPermission = intersection(jsonPermission.permissionPaths, permissions); + + if (hasPermission.length > 0) { + if(jsonPermission.linkexternal){ + link = jsonPermission.link; + }else{ + link = context + '/' + jsonPermission.link; + } + menu_html += '<li><a href="'+ link + '">' + + '<i class="fa ' + jsonPermission.icon + '"></i>' + + jsonPermission.title + '</a>'; + if (jsonPermission.hasOwnProperty('sub-menu')) { + menu_html += '<i class="fa fa-angle-down"></i>'; + menu_html += '<ul>'; + for (submenupermission in jsonPermission['sub-menu']) { + var jsonSubmenuPermission = jsonPermission['sub-menu'][submenupermission], + hasSubmenuPermission = intersection(jsonSubmenuPermission.permissionPaths, permissions); + + if (hasSubmenuPermission.length > 0) { + menu_html += '<li><a href="' + context + '/' + jsonSubmenuPermission.link + + '"><i class="fa ' + jsonSubmenuPermission.icon + '"></i>' + jsonSubmenuPermission.title + '</a></li>'; + } + } + menu_html += '</ul></li>'; + } else { + menu_html += '</li>'; + } + } + + } + } else { + return 'Need to send permissions as an array'; + } + + return menu_html; + +} + + +function intersection(x, y) { + x.sort(); + y.sort(); + var i = j = 0; + var ret = []; + while (i < x.length && j < y.length) { + if (x[i] < y[j]) i++; + else if (y[j] < x[i]) j++; + else { + ret.push(i); + i++, j++; + } + } + return ret; +} + + +function metroGenerator(context, jsonobject, permissions) { + var metroPermission, + metroJSON = []; + + if (permissions instanceof Array) { + for (metroPermission in jsonobject) { + var jsonPermission = jsonobject[metroPermission], + hasPermission = intersection(jsonPermission.permissionPaths, permissions); + + if (hasPermission.length > 0 && jsonPermission.context == context) { + metroJSON.push(jsonPermission); + } + + if (jsonPermission.hasOwnProperty('sub-menu')) { + for (submenupermission in jsonPermission['sub-menu']) { + var jsonSubmenuPermission = jsonPermission['sub-menu'][submenupermission], + hasSubmenuPermission = intersection(jsonSubmenuPermission.permissionPaths, permissions); + + if (hasSubmenuPermission.length > 0 && jsonSubmenuPermission.context == context) { + metroJSON.push(jsonSubmenuPermission); + } + } + } + + } + } else { + return 'Need to send permissions as an array'; + } + + return metroJSON; +} +%> \ No newline at end of file
