Implement a report service with support for the following:
PUT report
Include the report's environment as a query parameter
Serialize request body as JSON with Content-Type: application/json
Use puppet/v3 prefix
Accept response content as application/json, application/x-msgpack, text/pson
If we fail to send the report, the server version is < 5 and the current serialization format is not pson, then emit an error that preferred_serialization_format should be set to pson.
Implement a report service with support for the following:
{noformat} PUT /puppet/v3/ report/<certname> {noformat}
* Include the report's environment as a query parameter * Serialize request body as JSON with {{Content-Type: application/json}} * Use {{puppet/v3}} prefix * Accept response content as {{application/json, application/x-msgpack, text/pson}} * If we fail to send the report, the server version is < 5 and the current serialization format is not pson, then emit an error that {{preferred_serialization_format}} should be set to {{pson}}.
* Submit the report to {{ /puppet/v3/report/<certnamename> {noformat}}
* Include the report's {{ environment as a}}
query parameter * Serialize request body as JSON with report via {{report.render}}, and pass {{Content-Type: application/json}} * Use as {{puppet/v3report.mime}} prefix * Accept response content as {{application/json, application/x-msgpack, text/pson}}. See {{Puppet::Indirector::Rest#headers}} for how this list is generated for each model (Report, Catalog, etc).
* If we fail to send the report, the server version is < 5 and the current serialization format is not pson, then emit an error that {{preferred_serialization_format}} should be set to {{pson}}.
* Submit the report to {{/puppet/v3/report/<name>}} * Include Require the {{environment}} argument and send it as an HTTP query parameter * Serialize report via Use {{Puppet[:preferred_serialization_format]}} to select the formatter:
* Set the request body to the serializedreport: {{formatter.render(report)}}, and pass * Set the {{Content-Length}} to the number of bytes in the serialized report * Set the {{Content-Type}} as header to {{reportformatter.mime}} * Set the {{ Accept}} header to to the mime types that we support for the Report * Accept response content as {{application/json, application/x-msgpack, text/pson}}. See For example:
{{code:ruby} model =Puppet::IndirectorTransaction::Rest#headersReport model.supported_formats.reject { |f| f == :yaml}} for how this list is generated for each.map { |f| model.get_format (Report, Catalog, etcf).mime } {code}
* If we fail to send the report, the server version is < 5 and the current serialization format is not pson, then emit an error that {{preferred_serialization_format}} should be set to {{pson}}.