Prefect Cloud

Connect your client's Prefect Cloud with a key they paste, and call its API through Operate As.

Website
prefect.io
Connects by
Pasting a API key
Category
Developer tools
Services
1
Tools
442
ServiceKey
Prefect Cloudprefect-cloud

Connecting

Your client makes a API key in their Prefect Cloud settings and pastes it on their link. Operate As tries it with Prefect Cloud before saving it, and stores it encrypted. See Services connected with an API key.

Check they're connected
curl https://api.operate.as/v1/me/clients \  -H "Authorization: Bearer $OPERATE_AS_API_KEY"
Response
[  {    "id": "6f1c2a7e-...",    "name": "Miller Dental",    "services": [      "prefect-cloud"    ]  }]

Permissions

What the client readsPermission it asks for
Use the Prefect Cloud key you paste, with only the access you gave that keyChosen on the provider's screen

Tools

Install Prefect Cloud's typed package for your language:

pip install operate-as-prefect-cloud
Run prefect-cloud.accept_invitation_api_invitations_id_accept_post
curl -X POST https://api.operate.as/v1/actions/prefect-cloud.accept_invitation_api_invitations_id_accept_post \  -H "Authorization: Bearer $OPERATE_AS_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "clientId": "6f1c2a7e-...",    "input": {      "id": "<id>",      "invite_code": "<invite_code>"    }  }'

Shows the required inputs. Every input, with its JSON Schema: GET /v1/actions/prefect-cloud.accept_invitation_api_invitations_id_accept_post

Response
{  "status": 200,  "data": {    "…": "the service's own response"  },  "encoding": "json"}

Pass-through

Paths continue from https://api.prefect.cloud/api. Your Operate As key goes in Authorization; the client's access is added for you.

See Pass-through requests for the full request and response format.

Call any endpoint
curl "https://api.operate.as/v1/clients/6f1c2a7e-.../prefect-cloud/me/" \  -H "Authorization: Bearer $OPERATE_AS_API_KEY"
Response
{  "status": 200,  "data": {    "…": "the service's own response"  },  "encoding": "json"}

When access ends

A key works until your client deletes it in Prefect Cloud. They can paste a new one on the same link at any time, and your workflows carry on without changes.

See Keeping access alive and Removing access.

Calls answer, once the key is deleted
{  "status": 401,  "data": {    "…": "the service's own error"  },  "encoding": "json"}