@@ -4,6 +4,9 @@ module Network.Azure.ServiceManagement
4 HostedService(..)
4 HostedService(..)
6 , Endpoint(..)
6 , Endpoint(..)
7 -- * Setup
10 -- * Setup
8 , AzureSetup(..)
11 , AzureSetup(..)
9 , azureSetup
12 , azureSetup
@@ -58,11 +61,10 @@ instance Show HostedService where
58 show = hostedServiceName
61 show = hostedServiceName
60data Role = Role {
63data Role = Role {
61− roleName :: String
64+ roleName :: String
65+ , roleInputEndpoints :: [Endpoint]
64−instance Show Role where
67data Endpoint = Endpoint {
69data Endpoint = Endpoint {
68 endpointName :: String
70 endpointName :: String
@@ -71,6 +73,23 @@ data Endpoint = Endpoint {
72 deriving Show
74 deriving Show
76+data VirtualMachine = VirtualMachine {
77+ vmService :: HostedService
82+--------------------------------------------------------------------------------
84+--------------------------------------------------------------------------------
86+vmSshEndpoints :: VirtualMachine -> [Endpoint]
89+ | ep <- concatMap roleInputEndpoints (vmRoles vm)
90+ , endpointName ep == "SSH"
74--------------------------------------------------------------------------------
93--------------------------------------------------------------------------------
75-- Setup --
94-- Setup --
76--------------------------------------------------------------------------------
95--------------------------------------------------------------------------------
@@ -103,7 +122,7 @@ azureSetup sid certPath pkeyPath = do
103--------------------------------------------------------------------------------
122--------------------------------------------------------------------------------
105-- | Get a list of virtual machines
124-- | Get a list of virtual machines
106−virtualMachines :: AzureSetup -> IO [(HostedService, [(Role, [Endpoint])])]
125+virtualMachines :: AzureSetup -> IO [VirtualMachine]
107virtualMachines setup = azureExecute setup $ \exec -> do
126virtualMachines setup = azureExecute setup $ \exec -> do
108 services <- exec hostedServicesRequest
127 services <- exec hostedServicesRequest
109 forM services $ \service -> do
128 forM services $ \service -> do
@@ -115,9 +134,9 @@ virtualMachines setup = azureExecute setup $ \exec -> do
115 role <- getXPathTrees "//Role[@type='PersistentVMRole']" -< xml
134 role <- getXPathTrees "//Role[@type='PersistentVMRole']" -< xml
116 name <- getText . getXPathTrees "/Role/RoleName/text()" -< role
135 name <- getText . getXPathTrees "/Role/RoleName/text()" -< role
117 endpoints <- listA (parseEndpoint . getXPathTrees "//InputEndpoint") -< role
136 endpoints <- listA (parseEndpoint . getXPathTrees "//InputEndpoint") -< role
118− id -< (Role name, endpoints)
137+ id -< Role name endpoints
120− return (service, roles)
139+ return $ VirtualMachine service roles
122-- | Get list of available hosted services
141-- | Get list of available hosted services
123hostedServices :: AzureSetup -> IO [HostedService]
142hostedServices :: AzureSetup -> IO [HostedService]