- release_tracks: [ALPHA, BETA, GA]

  help_text:
    brief: Set IAM policy for an access policy.
    description: |
      Sets the IAM policy for a access policy, given access policy ID and a file
      encoded in JSON or YAML that contains the IAM policy.

    examples: |
      The following command reads an IAM policy defined in a JSON file
      `policy.json` and sets it for the access policy with the ID
      `accessPolicies/1234`:

      $ {command} accessPolicies/1234 policy.json

      See https://cloud.google.com/iam/docs/managing-policies for details of the
      policy file format and contents.
  request:
    collection: accesscontextmanager.accessPolicies
    use_relative_name: true
    ALPHA:
      api_version: v1alpha
      method: setIamPolicy
    BETA:
      api_version: v1
      method: setIamPolicy
    GA:
      api_version: v1
      method: setIamPolicy
    modify_request_hooks:
    - googlecloudsdk.command_lib.iam.hooks:UseMaxRequestedPolicyVersion:api_field=setIamPolicyRequest.policy.version
  arguments:
    resource:
      help_text: The access policy to set the IAM policy for.
      spec: !REF googlecloudsdk.command_lib.accesscontextmanager.resources:policy
