# policies#move_policy

Move an inline policy's configuration to remote (Git)

Endpoint: POST /pm/api/v1/policies/move-policy/{identifier}
Version: 1.0
Security: 

## Query parameters:

  - `accountIdentifier` (string)
    Harness account ID
    Example: "eBqAoNchMLKigC_qZ5EdC"

  - `orgIdentifier` (string)
    Harness organization ID
    Example: "test-org"

  - `projectIdentifier` (string)
    Harness project ID
    Example: "test-project"

## Path parameters:

  - `identifier` (string, required)
    Identifier of the policy to move
    Example: "policy-1"

## Header parameters:

  - `x-api-key` (string)
    Harness PAT key used to perform authorization
    Example: "Magni quas odio."

## Request fields (application/json):

  - `git_base_branch` (string)
    If committing to a new branch, git_base_branch tells the api which branch to base the new branch from
    Example: "main"

  - `git_branch` (string, required)
    The git branch to commit the policy to
    Example: "main"

  - `git_commit_msg` (string, required)
    The commit message used in git when moving the policy
    Example: "Move policy to remote"

  - `git_connector_ref` (string)
    The harness connector used for authenticating on the git provider
    Example: "github_connector"

  - `git_is_new_branch` (boolean)
    A flag to determine if the api should try and commit to a new branch

  - `git_path` (string, required)
    The path to the file in the git repo
    Example: ".harness/policy.rego"

  - `git_repo` (string, required)
    The git repo to store the policy in
    Example: "github.com/org/repo"

## Response 200 fields (application/json):

  - `account_id` (string, required)
    Harness account ID associated with this policy
    Example: "eBqAoNchMLKigC_qZ5EdC"

  - `cache_response` (object)
    Cache metadata from GitX getFile RPC
    Example: {"cache_state":"STALE_CACHE","is_sync_enabled":true,"last_updated_at":1773917288158,"ttl_left":258234442}

  - `cache_response.cache_state` (string)
    Cache state (UNKNOWN_STATE, VALID_CACHE, STALE_CACHE)
    Example: "STALE_CACHE"

  - `cache_response.is_sync_enabled` (boolean)
    Whether sync is enabled for this resource
    Example: true

  - `cache_response.last_updated_at` (integer)
    Timestamp (millis) when cache was last updated
    Example: 1773917288158

  - `cache_response.ttl_left` (integer)
    Remaining time-to-live in milliseconds
    Example: 258234442

  - `created` (integer, required)
    Time the policy was created
    Example: 1636669297674

  - `git_commit_sha` (string)
    The commit sha of the commit that last effected the file
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `git_connector_ref` (string)
    The harness connector used for authenticating on the git provider
    Example: "."

  - `git_default_branch` (string)
    The default branch, the service pulls in changes from this branch for policy evaluation
    Example: "main"

  - `git_default_branch_commit_sha` (string)
    The commit sha of the commit that last effected the file in the default branch
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `git_default_branch_file_id` (string)
    The file id of the file in the default branch, may be empty for bitbucket files
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `git_default_branch_file_url` (string)
    The url of the file in the default branch

  - `git_default_branch_update_error` (object)
    Example: {"explanation":"File with given filepath [file.rego] already exists in Github, thus couldn't create a new file","hint":"Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main].","message":"Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."}

  - `git_default_branch_update_error.explanation` (string, required)
    the explanation of the error
    Example: "File with given filepath [file.rego] already exists in Github, thus couldn't create a new file"

  - `git_default_branch_update_error.hint` (string, required)
    the hint on how to resolve the error
    Example: "Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."

  - `git_default_branch_update_error.message` (string, required)
    the message is a human-readable explanation specific to this occurrence of the problem
    Example: "Please check if there's already a file [file.rego] in Github repository [rego-demo] for the given filepath and branch [main]."

  - `git_default_branch_updated` (integer)
    The last time the service successfully pulled in changes from the default branch
    Example: 1636669297674

  - `git_file_id` (string)
    The file id of the file, may be empty for bitbucket files
    Example: "1369b45c20fc685113adcfd1a08a914180ff3c0d"

  - `git_file_url` (string)
    The url of the file on the fit provider

  - `git_path` (string)
    The path to the file in the git repo
    Example: ".harness/policy.rego"

  - `git_repo` (string)
    The git repo the policy resides in
    Example: "github.com/org/repo,omitempty"

  - `identifier` (string, required)
    identifier of the policy
    Example: "policy-1"

  - `name` (string, required)
    Name of the policy
    Example: "Pipeline Approval"

  - `org_id` (string, required)
    Harness organization ID associated with this policy
    Example: "test-org"

  - `parent_unique_id` (string)
    Parent unique identifier for the policy
    Example: "Assumenda deserunt ea libero."

  - `polciy_size_in_bytes` (integer)
    Size of the policy in bytes
    Example: 8522027886266974000

  - `policy_package_name` (string)
    Package name of the policy
    Example: "Veniam provident dolorem reiciendis ut ipsam."

  - `policy_set_count` (integer)
    Count of policy sets associated with this policy
    Example: 3

  - `project_id` (string, required)
    Harness project ID associated with this policy
    Example: "test-project"

  - `rego` (string, required)
    Rego that defines the policy

  - `unique_id` (string)
    Unique identifier for the policy
    Example: "Et eius explicabo laborum aut aut qui."

  - `updated` (integer, required)
    Time the policy was last updated
    Example: 1636669297674

## Response 400 fields (application/json):

  - `fault` (boolean, required)
    Is the error a server-side fault?
    Example: true

  - `id` (string, required)
    ID is a unique identifier for this particular occurrence of the problem.
    Example: "123abc"

  - `message` (string, required)
    Message is a human-readable explanation specific to this occurrence of the problem.
    Example: "parameter 'p' must be an integer"

  - `name` (string, required)
    Name is the name of this class of errors.
    Example: "bad_request"

  - `temporary` (boolean, required)
    Is the error temporary?
    Example: true

  - `timeout` (boolean, required)
    Is the error a timeout?
    Example: true

## Response 409 fields (application/json):

  - `message` (string, required)
    Human-readable warning message
    Example: "Et blanditiis autem tempore."

  - `referenced_by` (array, required)
    Policy sets that reference this policy
    Example: [{"account_id":"Blanditiis est at.","identifier":"Impedit quia quas eum vitae deleniti.","name":"Quisquam voluptas voluptas.","org_id":"Quam accusantium numquam ipsum molestias exercitationem.","project_id":"Itaque necessitatibus aut dolor tempora ullam esse."},{"account_id":"Blanditiis est at.","identifier":"Impedit quia quas eum vitae deleniti.","name":"Quisquam voluptas voluptas.","org_id":"Quam accusantium numquam ipsum molestias exercitationem.","project_id":"Itaque necessitatibus aut dolor tempora ullam esse."},{"account_id":"Blanditiis est at.","identifier":"Impedit quia quas eum vitae deleniti.","name":"Quisquam voluptas voluptas.","org_id":"Quam accusantium numquam ipsum molestias exercitationem.","project_id":"Itaque necessitatibus aut dolor tempora ullam esse."},{"account_id":"Blanditiis est at.","identifier":"Impedit quia quas eum vitae deleniti.","name":"Quisquam voluptas voluptas.","org_id":"Quam accusantium numquam ipsum molestias exercitationem.","project_id":"Itaque necessitatibus aut dolor tempora ullam esse."}]

  - `referenced_by.account_id` (string, required)
    Harness account ID
    Example: "Qui fugit."

  - `referenced_by.identifier` (string, required)
    Identifier of the referencing policy set
    Example: "Nihil ab dolore aliquid."

  - `referenced_by.name` (string, required)
    Name of the referencing policy set
    Example: "Dolor culpa quae dolor ut qui tempora."

  - `referenced_by.org_id` (string)
    Harness organization ID
    Example: "Qui quo sunt et id."

  - `referenced_by.project_id` (string)
    Harness project ID
    Example: "Est laboriosam temporibus error voluptatum."


