Update resource
We will try to update a resource information in this example exercise. Let's say we want to add owner's information to the playground
dataset.
To update the resource metadata we will need it's id which is generated when the Provider registered it on the Guardian. First we need to check the resource_id
of that playground
dataset.
To get the list of all the resources use any of the following methods:
Getting the resource_id
for the resource:
- Using
guardian resource list
CLI command - Calling to
GET /api/v1beta1/resources
API
- CLI
- HTTP
$ guardian resource list --output=yaml
$ curl --request GET '{{HOST}}/api/v1beta1/resources'
You can use resource_id
to get the resource details by any of the following commands:
- Using
guardian resource view
CLI command - Calling to
GET /api/v1beta1/resources/:id
API
- CLI
- HTTP
$ guardian resource view {{resource_id}}
$ curl --request GET '{{HOST}}/api/v1beta1/resources/{{resource_id}}'
To update the resource metadata with this information add this to the resource file or request body
details:
owner: owner.guy@company.com
Use any of these commands to update the owner details:
- Using
guardian resource set
CLI command - Calling to
PUT /api/v1beta1/resources/:id
API
- CLI
- HTTP
$ guardian resource set <resource_id> -f resource.yaml
$ curl --request PUT '{{HOST}}/api/v1beta1/resources/{{resource_id}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"details": {
"owner": "owner.guy@company.com"
}
}'