Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Add default manifest and API controller for loading it #8

Merged
merged 6 commits into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions app/controllers/api/migration_analytics_manifest_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module Api
class MigrationAnalyticsManifestController < BaseController

def index
manifest_path = Cfme::MigrationAnalytics::Engine.root.join('config', 'default-manifest.json')
manifest = load_manifest(manifest_path)

res = {
:path => manifest_path,
:body => manifest,
}
render_resource :migration_analytics_manifest, res
end

private

def load_manifest(path)
JSON.parse(File.read(path))
rescue JSON::ParserError
nil
end

end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need specs added for the API. so spec/requests/migration_analytics_manifest_spec.rb, maybe look at https://github.com/RedHatCloudForms/cfme-cloud_services/pull/23/files for spec/ files for the api file plus the spec_helper.rb and support/api_request_helpers.rb.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll take a look and try to get these started. I got stuck trying to get the Travis config's Ruby checks to work in this repo though, I may need some help figuring that out (the bin/setup script fails, probably because it was depending on something from https://github.com/martinpovolny/miq_plugin_example that I removed). I have an issue to track that: #2

13 changes: 13 additions & 0 deletions config/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
:collections:
:migration_analytics_manifest:
:description: Migration Analytics Manifest
:options:
- :arbitrary_resource_path
- :collection
:identifier: migration_analytics_manifest
:verbs:
- :get
:collection_actions:
:get:
- :name: read
:identifier: red_hat_cloud_services
349 changes: 349 additions & 0 deletions config/default-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
{
"cfme_version": "5.11",
"manifest": {
"version": "1.0.0",
"core": {
"MiqDatabase": {
"id": null,
"guid": null,
"region_number": null,
"region_description": null
},
"Zone": {
"id": null,
"name": null
}
},
"ManageIQ::Providers::OpenStack::CloudManager": {
"id": null,
"name": null,
"type": null,
"guid": null,
"api_version": null,
"emstype_description": null,
"hostname": null,
"vms": {
"id": null,
"name": null,
"description": null,
"type": null,
"uid_ems": null,
"cpu_cores_per_socket": null,
"cpu_total_cores": null,
"disks_aligned": null,
"ems_ref": null,
"has_rdm_disk": null,
"power_state": null,
"ram_size_in_bytes": null,
"retired": null,
"v_datastore_path": null,
"operating_system": {
"product_type": null,
"product_name": null,
"distribution": null
},
"hardware": {
"id": null,
"guest_os_full_name": null,
"disks": {
"id": null,
"device_name": null,
"device_type": null,
"disk_type": null,
"filename": null,
"free_space": null,
"mode": null,
"size": null,
"size_on_disk": null
},
"nics": {
"id": null,
"device_name": null,
"device_type": null,
"address": null,
"model": null,
"uid_ems": null,
"network": {
"id": null,
"ipaddress": null,
"hostname": null
}
}
},
"files": {
"id": null,
"name": null,
"contents": null
},
"system_services": {
"id": null,
"name": null,
"typename": null
}
}
},
"ManageIQ::Providers::Redhat::InfraManager": {
"id": null,
"name": null,
"type": null,
"guid": null,
"api_version": null,
"emstype_description": null,
"hostname": null,
"vms": {
"id": null,
"name": null,
"description": null,
"type": null,
"uid_ems": null,
"cpu_cores_per_socket": null,
"cpu_total_cores": null,
"disks_aligned": null,
"ems_ref": null,
"has_rdm_disk": null,
"host": {
"ems_ref": null
},
"power_state": null,
"ram_size_in_bytes": null,
"retired": null,
"v_datastore_path": null,
"operating_system": {
"product_type": null,
"product_name": null,
"distribution": null
},
"hardware": {
"id": null,
"guest_os_full_name": null,
"disks": {
"id": null,
"device_name": null,
"device_type": null,
"disk_type": null,
"filename": null,
"free_space": null,
"mode": null,
"size": null,
"size_on_disk": null
},
"nics": {
"id": null,
"device_name": null,
"device_type": null,
"address": null,
"model": null,
"uid_ems": null,
"network": {
"id": null,
"ipaddress": null,
"hostname": null
}
}
},
"files": {
"id": null,
"name": null,
"contents": null
},
"system_services": {
"id": null,
"name": null,
"typename": null
}
},
"ems_clusters": {
"id": null,
"name": null,
"uid_ems": null,
"ems_ref": null,
"ha_enabled": null,
"drs_enabled": null,
"effective_cpu": null,
"effective_memory": null
},
"hosts": {
"id": null,
"name": null,
"type": null,
"hostname": null,
"ipaddress": null,
"power_state": null,
"guid": null,
"uid_ems": null,
"ems_ref": null,
"mac_address": null,
"maintenance": null,
"vmm_vendor": null,
"vmm_version": null,
"vmm_product": null,
"vmm_buildnumber": null,
"archived": null,
"cpu_cores_per_socket": null,
"cpu_total_cores": null,
"ems_cluster": {
"ems_ref": null
},
"hardware": {
"memory_mb": null
}
},
"storages": {
"id": null,
"name": null,
"location": null,
"store_type": null,
"total_space": null,
"free_space": null,
"uncommitted": null,
"storage_domain_type": null,
"host_storages": {
"ems_ref": null,
"host": {
"ems_ref": null
}
}
}
},
"ManageIQ::Providers::Vmware::InfraManager": {
"id": null,
"name": null,
"type": null,
"guid": null,
"api_version": null,
"emstype_description": null,
"hostname": null,
"vms": {
"id": null,
"name": null,
"description": null,
"type": null,
"uid_ems": null,
"cpu_cores_per_socket": null,
"cpu_total_cores": null,
"disks_aligned": null,
"ems_ref": null,
"has_rdm_disk": null,
"host": {
"ems_ref": null
},
"power_state": null,
"ram_size_in_bytes": null,
"retired": null,
"v_datastore_path": null,
"operating_system": {
"product_type": null,
"product_name": null,
"distribution": null
},
"hardware": {
"id": null,
"guest_os_full_name": null,
"disks": {
"id": null,
"device_name": null,
"device_type": null,
"disk_type": null,
"filename": null,
"free_space": null,
"mode": null,
"size": null,
"size_on_disk": null
},
"nics": {
"id": null,
"device_name": null,
"device_type": null,
"address": null,
"model": null,
"uid_ems": null,
"network": {
"id": null,
"ipaddress": null,
"hostname": null
}
}
},
"files": {
"id": null,
"name": null,
"contents": null
},
"system_services": {
"id": null,
"name": null,
"typename": null
}
},
"ems_extensions": {
"id": null,
"ems_ref": null,
"key": null,
"company": null,
"label": null,
"summary": null,
"version": null
},
"ems_licenses": {
"id": null,
"ems_ref": null,
"name": null,
"license_edition": null,
"total_licenses": null,
"used_licenses": null
},
"ems_clusters": {
"id": null,
"name": null,
"uid_ems": null,
"ems_ref": null,
"ha_enabled": null,
"drs_enabled": null,
"effective_cpu": null,
"effective_memory": null
},
"hosts": {
"id": null,
"name": null,
"type": null,
"hostname": null,
"ipaddress": null,
"power_state": null,
"guid": null,
"uid_ems": null,
"ems_ref": null,
"mac_address": null,
"maintenance": null,
"vmm_vendor": null,
"vmm_version": null,
"vmm_product": null,
"vmm_buildnumber": null,
"archived": null,
"cpu_cores_per_socket": null,
"cpu_total_cores": null,
"ems_cluster": {
"ems_ref": null
},
"hardware": {
"memory_mb": null
}
},
"storages": {
"id": null,
"name": null,
"location": null,
"store_type": null,
"total_space": null,
"free_space": null,
"uncommitted": null,
"storage_domain_type": null,
"host_storages": {
"ems_ref": null,
"host": {
"ems_ref": null
}
}
}
}
}
}