Environments

Copy Environment Async

Changed on

Copy environment

This endpoint either duplicates an existing environment to a new environment in the same project, or copies from an existing environment to another existing environment.

The scope object controls which objects will be copied to the target environment.

To clone to a new environment, the user must have write permissions to the containing project. To clone into an existing environment, the user must have write permissions to the target environment, and, with delete_target_only_condition_sets, permission to delete its condition sets. In an environment protected by a policy guard, the copy task fails with 403 when it would change or delete an object the guard protects (the error is in the task's result), and the request itself answers 503, enqueueing nothing, when the guard's decision point cannot be reached.

Poll the task's result through this same environment.

Copying environments across projects or organizations is not allowed.

post/v2/projects/{proj_id}/envs/{env_id}/copy/async

Request

  • Base URL
    https://api.permit.io (the document declares no server; this is the origin it was published from)
  • Auth
    HTTP bearer

Path parameters

proj_idstring required

Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").

env_idstring required

Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").

Query parameters

waitnumber

Time in seconds to wait for the task to complete. Default is 0, means no wait. At most 60: a larger value waits that long.

Request body

conflict_strategy'fail' | 'overwrite'

An enumeration.

delete_target_only_condition_setsboolean

Only applies to copying into an existing environment. Delete the target environment's condition sets whose key the source environment does not have and that scope selects (with the same matching as the copy), together with their rules; a resource set is selected only when its resource is copied. Autogenerated condition sets are never deleted, and the copy fails with 409 instead of deleting a condition set that has a descendant which would not itself be deleted. Requires permission to delete condition sets in the target; in a policy-guarded target a guarded condition set is not deleted (the copy fails with 403, or 503 if the guard cannot be reached). Off by default: without it, neither conflict strategy deletes condition sets

Response

Successful Response

task_idstring required

The unique id of the task.

status'processing' | 'success' | 'failure' | 'cancelled' required

An enumeration.

Changes

    • warning

      added the new CONDITION_SET_OVER_DEPTH enum value to the // response property for the response status

    • info

      added the new optional request property

    • info

      added the new optional request property //////

    • info

      added the non-success response with the status

    • info

      added the optional property //// to the response with the status