# Corrosion coupon report upload A function that is used for creating corrosion coupon reports. ## Input ### Arguments - `org_id`: as string which should be a valid `uuid` for the organization - `project_id`: the id of the data project where the pipeline data is found - `pipeline_id`: an `array` of `strings` which should be valid UUIDs for pipelines - `coupon_retrieval_point_id`: an `array` of `strings` which should be valid UUIDs for coupon retrieval points on the pipeline - `installation_date`: a `string` formatted as an ISO date representing the date the corrosion coupon was installed in the pipeline. - `retrieval_date`: a `string` formatted as an ISO date representing the date the corrosion coupon was retrieved from the pipeline. - `metal_loss`: a `float` representing the measured metal loss of the token. - `inspector`: a `string` representing the identifier of the inspector - `remarks`: a `string` for any additional remarks about the inspection ## Creating the function on the platform To create this function on the platform using the `cli` set up the port forwarding as shown in README. Then run the following command to create the function. ```bash cargo run functions create \ -f functions/coupon_retrieval_point_id \ -d "Creates new corrosion coupon reports" \ -i org_id=string \ -i project_id=string \ -i pipeline_id=array \ -i coupon_retrieval_point_id=array \ -i installation_date=string \ -i retrieval_date=string \ -i metal_loss=float \ -i inspector=string \ -i remarks=string ``` ## Testing the function locally You can run and test the function locally by running ```bash cargo run ``` Then you can check it work with `curl` as follows ```bash curl localhost:8080 -d $(jq '. | tojson' functions/coupon_retrieval_point_id/example_input.json) ```