This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Add default manifest and API controller for loading it #8
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7e2d7e7
Add hello-world API controller
mturley 4c77dbb
Add initial default manifest file
mturley 2d7550d
/api/migration_analytics_manifest loads tmp if present, or default
mturley 93803de
Clean up controller code
mturley 1c9d3e2
Define collection_actions using the red_hat_cloud_services miq_produc…
mturley 9ed71c3
Remove /tmp manifest upload feature
mturley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
app/controllers/api/migration_analytics_manifest_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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