
                         p   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr	  \R                  " \R                  R                  5      \R                   " S S\R                  5      5       5       r\R                  " \R                  R                   \R                  R"                  5       " S	 S
\5      5       rg)zSet IAM Policy.    )absolute_import)division)unicode_literals)base)utilc                   :    \ rS rSrSrSS0rSr\S 5       rS r	Sr
g	)
SetIamPolicy   =  Set the IAM policy for an IAP IAM resource.

This command replaces the existing IAM policy for an IAP IAM resource, given
a file encoded in JSON or YAML that contains the IAM policy. If the given
policy file specifies an "etag" value, then the replacement will succeed only
if the policy already in place matches that etag. (An etag obtained via
$ {parent_command} get-iam-policy will prevent the replacement if
the policy for the resource has been subsequently updated.) A policy
file that does not contain an etag value will replace any existing policy for
the resource.
EXAMPLESa            To set the IAM policy for the web accesses to the IAP protected
          resources within the active project,
          run:

            $ {command} POLICY_FILE

          To set the IAM policy for the web accesses to the IAP protected
          resources within a project, run:

            $ {command} POLICY_FILE --project=PROJECT_ID

          To set the IAM policy for the web accesses to the IAP protected
          resources within an App Engine application, run:

            $ {command} POLICY_FILE --resource-type=app-engine

          To set the IAM policy for the web accesses to the IAP protected
          resources within an App Engine service, run:

            $ {command} POLICY_FILE --resource-type=app-engine
                --service=SERVICE_ID

          To set the IAM policy for the web accesses to the IAP protected
          resources within an App Engine service version, run:

            $ {command} POLICY_FILE --resource-type=app-engine
                --service=SERVICE_ID --version=VERSION

          To set the IAM policy for the web accesses to the IAP protected
          resources within all backend services, run:

            $ {command} POLICY_FILE --resource-type=backend-services

          To set the IAM policy for the web accesses to the IAP protected
          resources within a backend service, run:

            $ {command} POLICY_FILE --resource-type=backend-services
                --service=SERVICE_ID

          To set the IAM policy for the web accesses to the IAP protected
          resources within a regional backend service, run:

            $ {command} POLICY_FILE --resource-type=backend-services
                --service=SERVICE_ID --region=REGION
  Fc                     [         R                  " UU R                  S9  [         R                  " U5        [        R
                  R                  U5        g)zRegister flags for this command.

Args:
  parser: An argparse.ArgumentParser-like object. It is mocked out in order
      to capture some information, but behaves like an ArgumentParser.
)support_cloud_runN)iap_utilAddIapIamResourceArgs_support_cloud_runAddIAMPolicyFileArgr   URI_FLAGRemoveFromParser)clsparsers     %lib/surface/iap/web/set_iam_policy.pyArgsSetIamPolicy.Args\   s@     ""00   (MM""6*    c                     [         R                  " U R                  5       UU R                  5      nUR	                  UR
                  5      $ )zThis is what gets called when the user runs this command.

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

Returns:
  The specified function with its description and configured filter.
)r   ParseIapIamResourceReleaseTrackr   r	   policy_file)selfargsiap_iam_refs      r   RunSetIamPolicy.Runk   sE     ..K
 ##D$4$455r    N)__name__
__module____qualname____firstlineno____doc__detailed_helpr   classmethodr   r"   __static_attributes__r$   r   r   r	   r	      s8    
 -0-d + +6r   r	   c                       \ rS rSrSrSrSrg)SetIamPolicyAlpha}   r   Tr$   N)r%   r&   r'   r(   r)   r   r,   r$   r   r   r.   r.   }   s    
 r   r.   N)r)   
__future__r   r   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.iapr   r   ReleaseTracksr   GADefaultUniverseOnlyCommandr	   ALPHABETAr.   r$   r   r   <module>r9      s      &  ' ( ; D%%(()^64<< ^6  *^6B D%%++T->->-C-CD  Er   