release_tracks: [ALPHA, GA]
hidden: true

help_text:
  brief: |
    Import a policy.
  description: |
    Import the specified policy.
  examples: |
      To import a policy called `my-policy`, run:

        $ {command} my-policy --source=my-policy.yaml --location=us-central1

arguments:
  resource:
    spec: !REF googlecloudsdk.command_lib.authz_toolkit.resources:policy
    help_text: |
      Name of the policy you want to import.

async:
  collection: authztoolkit.projects.locations.operations

request:
  ALPHA:
    api_version: v1alpha
  GA:
    api_version: v1
  collection: authztoolkit.projects.locations.policies
  modify_request_hooks:
  - googlecloudsdk.command_lib.authz_toolkit.hooks:SetUpdateMask

import:
  abort_if_equivalent: true
  create_if_not_exists: true
  create_request:
    collection: authztoolkit.projects.locations.policies
    ALPHA:
      api_version: v1alpha
    GA:
      api_version: v1
    method: create
