@@ -28,6 +28,15 @@ import Data.Certificate.X509 (X509)
28import Control.Monad.Trans.Resource (ResourceT)
28import Control.Monad.Trans.Resource (ResourceT)
29import Control.Monad.IO.Class (liftIO)
29import Control.Monad.IO.Class (liftIO)
30import Control.Arrow.ArrowList (listA)
30import Control.Arrow.ArrowList (listA)
31+import Text.PrettyPrint
31import Network.HTTP.Conduit
40import Network.HTTP.Conduit
32 ( parseUrl
41 ( parseUrl
33 , clientCertificates
42 , clientCertificates
@@ -57,26 +66,70 @@ import Text.XML.HXT.XPath (getXPathTrees)
57data HostedService = HostedService {
66data HostedService = HostedService {
58 hostedServiceName :: String
67 hostedServiceName :: String
62data CloudService = CloudService {
70data CloudService = CloudService {
63 cloudServiceName :: String
71 cloudServiceName :: String
64 , cloudServiceVMs :: [VirtualMachine]
72 , cloudServiceVMs :: [VirtualMachine]
68data VirtualMachine = VirtualMachine {
75data VirtualMachine = VirtualMachine {
69 vmName :: String
76 vmName :: String
70 , vmInputEndpoints :: [Endpoint]
77 , vmInputEndpoints :: [Endpoint]
74data Endpoint = Endpoint {
80data Endpoint = Endpoint {
75− endpointName :: String
81+ endpointName :: String
76− , endpointPort :: String
82+ , endpointPort :: String
77− , endpointVip :: String
83+ , endpointVip :: String
86+--------------------------------------------------------------------------------
88+--------------------------------------------------------------------------------
90+instance Show HostedService where
91+ show = show . ppHostedService
93+instance Show CloudService where
94+ show = show . ppCloudService
96+instance Show VirtualMachine where
97+ show = show . ppVirtualMachine
99+instance Show Endpoint where
100+ show = show . ppEndpoint
102+ppHostedService :: HostedService -> Doc
103+ppHostedService = text . hostedServiceName
105+ppCloudService :: CloudService -> Doc
107+ (text "Cloud Service" <+> (doubleQuotes . text . cloudServiceName $ cs))
109+ ( text "VIRTUAL MACHINES"
111+ (vcat . map ppVirtualMachine . cloudServiceVMs $ cs)
114+ppVirtualMachine :: VirtualMachine -> Doc
115+ppVirtualMachine vm =
116+ (text "Virtual Machine" <+> (doubleQuotes . text . vmName $ vm))
118+ ( text "INPUT ENDPOINTS"
120+ (vcat . map ppEndpoint . vmInputEndpoints $ vm)
123+ppEndpoint :: Endpoint -> Doc
125+ (text "Input endpoint" <+> (doubleQuotes . text . endpointName $ ep))
127+ ( text "Port" <+> text (endpointPort ep)
128+ $$ text "IP" <+> text (endpointVip ep)
131+hang2 :: Doc -> Doc -> Doc
132+hang2 d1 d2 = hang d1 2 d2
81--------------------------------------------------------------------------------
134--------------------------------------------------------------------------------
82-- Pure operations --
135-- Pure operations --