| 178 | } |
| 179 | |
| 180 | func (cmd *ShowSpace) populatePluginModel(space models.Space) { |
| 181 | cmd.pluginModel.Name = space.Name |
| 182 | cmd.pluginModel.Guid = space.GUID |
| 183 | |
| 184 | cmd.pluginModel.Organization.Name = space.Organization.Name |
| 185 | cmd.pluginModel.Organization.Guid = space.Organization.GUID |
| 186 | |
| 187 | for _, app := range space.Applications { |
| 188 | a := plugin_models.GetSpace_Apps{ |
| 189 | Name: app.Name, |
| 190 | Guid: app.GUID, |
| 191 | } |
| 192 | cmd.pluginModel.Applications = append(cmd.pluginModel.Applications, a) |
| 193 | } |
| 194 | |
| 195 | for _, domain := range space.Domains { |
| 196 | d := plugin_models.GetSpace_Domains{ |
| 197 | Name: domain.Name, |
| 198 | Guid: domain.GUID, |
| 199 | OwningOrganizationGuid: domain.OwningOrganizationGUID, |
| 200 | Shared: domain.Shared, |
| 201 | } |
| 202 | cmd.pluginModel.Domains = append(cmd.pluginModel.Domains, d) |
| 203 | } |
| 204 | |
| 205 | for _, service := range space.ServiceInstances { |
| 206 | si := plugin_models.GetSpace_ServiceInstance{ |
| 207 | Name: service.Name, |
| 208 | Guid: service.GUID, |
| 209 | } |
| 210 | cmd.pluginModel.ServiceInstances = append(cmd.pluginModel.ServiceInstances, si) |
| 211 | } |
| 212 | for _, group := range space.SecurityGroups { |
| 213 | sg := plugin_models.GetSpace_SecurityGroup{ |
| 214 | Name: group.Name, |
| 215 | Guid: group.GUID, |
| 216 | Rules: group.Rules, |
| 217 | } |
| 218 | cmd.pluginModel.SecurityGroups = append(cmd.pluginModel.SecurityGroups, sg) |
| 219 | } |
| 220 | |
| 221 | quota, err := cmd.quotaRepo.FindByGUID(space.SpaceQuotaGUID) |
| 222 | if err == nil { |
| 223 | cmd.pluginModel.SpaceQuota.Name = quota.Name |
| 224 | cmd.pluginModel.SpaceQuota.Guid = quota.GUID |
| 225 | cmd.pluginModel.SpaceQuota.MemoryLimit = quota.MemoryLimit |
| 226 | cmd.pluginModel.SpaceQuota.InstanceMemoryLimit = quota.InstanceMemoryLimit |
| 227 | cmd.pluginModel.SpaceQuota.RoutesLimit = quota.RoutesLimit |
| 228 | cmd.pluginModel.SpaceQuota.ServicesLimit = quota.ServicesLimit |
| 229 | cmd.pluginModel.SpaceQuota.NonBasicServicesAllowed = quota.NonBasicServicesAllowed |
| 230 | } |
| 231 | } |