
    	                         d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
  ej                  ej                  j                         G d	 d
ej                               Zy)zZPrint an Artifact Registry IAM policy for Container Registry to Artifact Registry upgrade.    )absolute_import)division)unicode_literals)base)flags)upgrade_util)utilc                   0    e Zd ZdZdddZed        Zd Zy)PrintIamPolicya  Print an Artifact Registry IAM policy for Container Registry to Artifact Registry upgrade.

  Print an Artifact Registry IAM policy that is equivalent to the IAM policy
  applied to the storage bucket for the specified Container Registry hostname.
  Apply the returned policy to the Artifact Registry repository that will
  replace the specified host. If the project has an organization, this command
  analyzes IAM policies at the organization level. Otherwise, this command
  analyzes IAM policies at the project level. See required permissions at
  https://cloud.google.com/policy-intelligence/docs/analyze-iam-policies#required-permissions.
  z{description}z  To print an equivalent Artifact Registry IAM policy for 'gcr.io/my-project':

      $ {command} upgrade print-iam-policy gcr.io --project=my-project
  )DESCRIPTIONEXAMPLESc                 J    t        j                         j                  |        y )N)r   GetGCRDomainArgAddToParser)parsers    8lib/surface/artifacts/docker/upgrade/print_iam_policy.pyArgszPrintIamPolicy.Args0   s    	''/    c                 p    |j                   }t        j                  |      }t        j                  ||      S )zRuns the command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      An iam.Policy.
    )DOMAINr	   
GetProjectr   
iam_policy)selfargsdomainprojects       r   RunzPrintIamPolicy.Run4   s.     [[Food#G""6733r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r    r   r   r   r      s1    	 %- 0 04r   r   N)r!   
__future__r   r   r   googlecloudsdk.callioper   $googlecloudsdk.command_lib.artifactsr   r   r	   ReleaseTracksReleaseTrackBETACommandr   r$   r   r   <module>r,      sX    a &  ' ( 6 = 5 D%%**+%4T\\ %4 ,%4r   