
                         ,   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	d
Zej                   ej                  ej                  j                   ej                  j"                         G d dej$                                      Zee_        y)zLCommand to set an IAM policy binding on a Colab Enterprise runtime template.    )runtime_templates)util)base)	constants)endpoint_util)flagsz
        Set the IAM policy for a Colab Enterprise runtime template 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.
    z
        To set the IAM policy for a runtime template with id `my-runtime-template` in region `us-central1` to the policy defined in `policy.json`, run:

        $ {command} my-runtime-template policy.json --region=us-central1
    )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)SetIamPolicyzYSet IAM policy for a Colab Enterprise runtime template as defined in a JSON or YAML file.c                 .    t        j                  |        y)z Register flags for this command.N)r   AddSetIamPolicyBindingFlags)parsers    5lib/surface/colab/runtime_templates/set_iam_policy.pyArgszSetIamPolicy.Args,   s     
%%f-    c                    | j                         }t        j                  | j                               }|j                  j                  j                         }|j                         d   }t        j                  t        j                  |      5  t        j                  |      }|j                  }|j                  t        j                  ||            cddd       S # 1 sw Y   yxY w)z9This is what gets called when the user runs this command.locationsId)versionregionN)ReleaseTrackr   GetMessagesCONCEPTSruntime_templateParseAsDictr   AiplatformEndpointOverridesr   BETA_VERSION	GetClient+projects_locations_notebookRuntimeTemplatesr   runtime_templates_util0CreateRuntimeTemplateSetIamPolicyRequestFromFile)selfargsrelease_trackmessagesruntime_template_refr   
api_clientruntime_templates_services           r   RunzSetIamPolicy.Run1   s    %%'M 1 1 34H==99??A!((*=9F		2	2&&v
 >>-0j

@
@   '33
 
Q
QH
 
 
s   AC  C)N)__name__
__module____qualname____doc__staticmethodr   r*    r   r   r   r   '   s     b. .r   r   N)r.   'googlecloudsdk.api_lib.colab_enterpriser   r!   r   googlecloudsdk.callioper   googlecloudsdk.command_lib.air   r   +googlecloudsdk.command_lib.colab_enterpriser   _DETAILED_HELPDefaultUniverseOnlyReleaseTracksr   GABETACommandr   detailed_helpr0   r   r   <module>r<      s    S _ 8 ( 3 7 = D%%(($*;*;*@*@A4<<  B 8 , r   