{       
    "id" : "transportControllerEndpoint.json",
    "title" : "API to access the list of controller endoints. The transport controller is a logicial entity that refers to a set of endpoints, ",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "$ref" : "#/definitions/transportControllerGroupList",
    "links" : [
	{
	    "title" : "get all transport controllers in group",
	    "href" : "/",
	    "method" : "GET",
	    "rel" : "instances",
	    "schema" : {"$ref" : "#/definitions/transportControllerGroupList"}
	},
	{
	    "title" : "retrieve the list of endpoints in a transportControllerGroup",
	    "href" : "/{name}",
	    "method" : "GET",
	    "rel" : "instances",
	    "schema" : {"$ref" : "#/definitions/transportControllerGroup"}
	},
	{
	    "title" : "create a new transportControllerGroup",
	    "description" : "create a new transportControllerGroup.",
	    "href" : "/",
	    "method" : "POST",
	    "rel" : "create",
            "schema" : {"$ref" : "#/definitions/transportControllerGroupDescription"},
	    "targetSchema" : {
                "type" : "object",
                "required" : ["name"],
                "properties" : {"name" : {"type" : "string","description" : "The group name, free text"},
                                "success" : {"type" :"boolean" , "description" : "In addition to the HTTP return code, the result of the request is duplicated here."}
                               }
	    }
	},
        {
	    "title" : "create a set of new endpoints",
	    "description" : "Create new endpoints",
	    "href" : "/{name}",
	    "method" : "POST",
	    "rel" : "create",
            "schema" : {"$ref" : "#/definitions/transportControllerGroup"},
            "targetSchema" : {
                "type" : "object",
                "properties" : {
                    "success" : {"type" :"boolean" , "description" : "In addition to the HTTP return code, the result of the request is duplicated here."}
                }
	    }
	},
	{
	    "title" : "replace a set of endpoints",
	    "description" : "Update (replace) endpoints",
	    "href" : "/{name}",
	    "method" : "PUT",
	    "rel" : "create",
            "schema" : {
                "$ref" : "#/definitions/transportControllerGroup",
                "required" : ["id"]
            },
            "targetSchema" : {
                "type" : "object",
                "properties" : {
                    "success" : {"type" :"boolean" , "description" : "In addition to the HTTP return code, the result of the request is duplicated here."}
                }
	    }
	},
	{
	    "title" : "delete ",
	    "href" : "/{name}",	    
	    "method" : "DELETE",
            "schema" : {
                "$ref" : "#/definitions/transportControllerGroup",
                "required" : ["id"]
            },
            "targetSchema" : {
                "type" : "object",
                "properties" : {
                    "success" : {"type" :"boolean" , "description" : "In addition to the HTTP return code, the result of the request is duplicated here."}
                }
	    }
	},
        {
	    "title" : "delete ",
	    "href" : "/",	    
	    "method" : "DELETE",
            "description" : "delete a group specified by name",
            "schema" : {"$ref" : "#/definitions/transportControllerGroupDescription"}
	}        
    ],
    "definitions" : {
        "transportControllerGroupList" : {
            "type" : "array",
            "items" : {"$ref" : "#/definitions/transportControllerGroupDescription"}
        },
        "transportControllerGroupDescription" : {
            "type" : "object",
            "required" : ["name"],
            "properties" : {"name" : {"type" : "string","description" : "group name, in free text"}}
        },
        "transportControllerGroup" : {
            "type" : "array",
            "items" : {"$ref" : "#/definitions/transportControllerEndpoint"}
        },
        "transportControllerEndpoint" : {
            "description" : "One endpoint",
            "type" : "object",
	    "additionalProperties" : false,
            "properties" : {
                "id"          : {"type" :"string" , "description" : "uuid."}, 
                "accessMethod": {"type" :"string" , "description" : "Protocol used to connect to that instance.", "enum" : ["HTTP","HTTPS"]},
                "authMethod"  : {"type" :"string" , "description" : "The authentification method used for the protocol.", "enum" : ["BASIC","NOAUTH", "BEARER"]},
                "hostName"    : {"type" :"string" , "description" : "Optional host name for display."},
                "httpPort"    : {"oneOf" : [
                    {"type" :"integer", "description" : "For access using HTTP or HTTPS, use this port to connect.", "minimum" : 1, "maximum" :65535},
                    {"type" :"string", "description" : "For access using HTTP or HTTPS, use this port to connect. Backward compatibility for UI", "pattern" : "^[0-9]+$"}
                ]},
                "ipAddr"      : {"type" :"string" , "description" : "The Ip address or hostname to which to connect."},
                "login"       : {"type" :"string" , "description" : "The login used for the authentication."},
                "passwd"      : {"type" :"string" , "description" : "The encrypted password used for authentication."},
                "retry"       : {"type" :"integer", "description" : "For future use, global reconnection parameters are specified in the transportController."},
                "timeout"     : {"type" :"integer", "description" : "For future use, global reconnection parameters are specified in the transportController." },
                "authUrl"    : {"type" :"string" , "description" : "The authentication URL if the authentication method is BEARER."},
		"tokenExpiryTime" :{"type" :"integer", "description" : "The authentication token expiration time if the authentication method is BEARER.", "default" : "3600"},
                "newIpAddr"  : {"type" :"string" , "description" : "The Ip address or hostname to which to connect, it will replace the ipAddr field?."}
            },
	    "oneOf":[
		{
		    "properties":{
			"authMethod":{"enum":["BEARER"]},
			"authUrl": {"type" : "string", "minLength" : 1}
		    },
		    "required":["authUrl"]
		},
		{
		    "properties":{
			"authMethod":{"enum":["BASIC", "NOAUTH"]}
		    }
		}
	    ]
	    
        }
    }
}
