
    S                        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  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  S rS r\R$                  " \R&                  R(                  5       " S S\R*                  5      5       r\R$                  " \R&                  R.                  \R&                  R0                  5       " S S\R*                  5      5       rg)zSet the IAM policy for a model.    )absolute_import)division)unicode_literals)models)base)iam_util)endpoint_util)flags)models_util)region_utilc                     [         R                  " SSSS9R                  U 5        [         R                  " SS9R                  U 5        [        R
                  " U 5        g )NTzto set IAM policy for)
positionalrequiredverb)include_global)r
   GetModelResourceArgAddToParserGetRegionArgr   AddArgForPolicyFileparsers    0lib/surface/ai_platform/models/set_iam_policy.py_AddSetIamPolicyArgsr      sI    "$$/K$7D)55f=
v&    c                 
   [         R                  " U 5      n[        R                  " US9   [        R
                  " [        R                  " 5       U R                  U R                  5      sS S S 5        $ ! , (       d  f       g = f)N)region)
r   	GetRegionr	   MlEndpointOverridesr   SetIamPolicyr   ModelsClientmodelpolicy_file)argsr   s     r   _Runr$   &   sT      &&((7##F$7$7$94::$($4$46 877s   ?A44
Bc                   .    \ rS rSrSr\S 5       rS rSrg)SetIamPolicyGA-     Set the IAM policy for a model.

Sets the IAM policy for the given model as defined in a JSON or YAML file.

See https://cloud.google.com/iam/docs/managing-policies for details of
the policy file format and contents.

## EXAMPLES
The following command will read am IAM policy defined in a JSON file
'policy.json' and set it for the model `my_model`:

  $ {command} my_model policy.json
c                     [        U 5        g Nr   r   s    r   ArgsSetIamPolicyGA.Args=   
     r   c                     [        U5      $ r*   r$   selfr#   s     r   RunSetIamPolicyGA.RunA       :r    N	__name__
__module____qualname____firstlineno____doc__staticmethodr,   r3   __static_attributes__r6   r   r   r&   r&   -         ! !r   r&   c                   .    \ rS rSrSr\S 5       rS rSrg)SetIamPolicyBetaE   r(   c                     [        U 5        g r*   r+   r   s    r   r,   SetIamPolicyBeta.ArgsU   r.   r   c                     [        U5      $ r*   r0   r1   s     r   r3   SetIamPolicyBeta.RunY   r5   r   r6   Nr7   r6   r   r   rA   rA   E   r?   r   rA   N)r<   
__future__r   r   r    googlecloudsdk.api_lib.ml_enginer   googlecloudsdk.callioper   googlecloudsdk.command_lib.iamr   $googlecloudsdk.command_lib.ml_enginer	   r
   r   r   r   r$   ReleaseTracksReleaseTrackGACommandr&   ALPHABETArA   r6   r   r   <module>rR      s    & &  ' 3 ( 3 > 6 < <'6 D%%(()T\\  *. D%%++T->->-C-CDt||  Er   