Ë
    €Ï[  ã                   ó’   — 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 dd	lmZ d
ZdZdd„Zd„ Zd„ Zdd„Zd„ Zy)z"Cloud Run utility library for GCF.é    )Úabsolute_import)Údivision)Úunicode_literals)Úutil)Úglobal_methods)Úconnection_context)Úserverless_operations)Ú	resourceszrun.namespaces.serviceszrun.projects.locations.servicesc                 ó  — t        | |«      }t        |j                  «      }t        j                  |«      5 }|j                  t        |j                  «       «      ||t        j                  ¬«      cddd«       S # 1 sw Y   yxY w)aË  Add the IAM binding for the invoker role on the function's Cloud Run service.

  Args:
    function: cloudfunctions_v2_messages.Function, a GCF v2 function.
    member: str, The user to bind the Invoker role to.
    add_binding: bool, Whether to add to or remove from the IAM policy.
    is_gen2: bool, Whether the function is a 2nd gen function. If false, the
      function is a 1st gen function undergoing upgrade.

  Returns:
    A google.iam.v1.Policy
  )Úadd_bindingÚmemberÚroleN)	Ú_GetOnePlatformServiceRefÚ _GetRunRegionalConnectionContextÚlocationsIdr	   ÚConnectÚAddOrRemoveIamPolicyBindingÚ_GetK8sServiceRefÚNameÚ ALLOW_UNAUTH_POLICY_BINDING_ROLE)Úfunctionr   r   Úis_gen2Úservice_ref_one_platformÚrun_connection_contextÚ
operationss          ú4lib/googlecloudsdk/command_lib/functions/run_util.pyÚAddOrRemoveInvokerBindingr       sx   € ô 7°xÀÓIÐä;Ø×*Ñ*óÐô ×$Ñ$Ð%;Ô<À
Ø×1Ñ1ÜÐ2×7Ñ7Ó9Ó:ØØÜ"×CÑCð	 2ó ÷ =×<Ò<ús   ·:A;Á;Bc                 óè   — t        | «      }t        |j                  «      }t        j                  |«      5 }|j                  t        |j                  «       «      «      cddd«       S # 1 sw Y   yxY w)z1Get the Cloud Run service for the given function.N)r   r   r   r	   r   Ú
GetServicer   r   )r   r   r   r   s       r   r   r   <   s`   € ä6°xÓ@Ðä;Ø×*Ñ*óÐô ×$Ñ$Ð%;Ô<À
Ø× Ñ ÜÐ2×7Ñ7Ó9Ó:ó÷ =×<Ò<ús   ¶(A(Á(A1c                 óh   — t        j                  | t        j                  t        j                  «      S ©N)r   ÚRegionalConnectionContextr   ÚSERVERLESS_API_NAMEÚSERVERLESS_API_VERSION)Úlocations    r   r   r   J   s*   € Ü	×	5Ñ	5ØÜ×(Ñ(Ü×+Ñ+ó
ð ó    c                 óº   — |r| j                   j                  n| j                  j                   j                  }t        j                  j                  |t        «      S r!   )ÚserviceConfigÚserviceÚupgradeInfor
   ÚREGISTRYÚParseRelativeNameÚ*_CLOUD_RUN_SERVICE_COLLECTION_ONE_PLATFORM)r   r   Úservice_names      r   r   r   R   sS   € ñ 
ð ×Ñ×$Ò$à×Ñ×-Ñ-×5Ñ5ð ô
 
×	Ñ	×	-Ñ	-ØÔ>ó
ð r&   c                 óŽ   — t         j                  j                  dj                  t	        j
                  «       | «      t        «      S )Nznamespaces/{}/services/{})r
   r+   r,   ÚformatÚapi_utilÚ
GetProjectÚ!_CLOUD_RUN_SERVICE_COLLECTION_K8S)r.   s    r   r   r   ]   s7   € Ü	×	Ñ	×	-Ñ	-Ø!×(Ñ(¬×)<Ñ)<Ó)>ÀÓMÜ'ó
ð r&   N)TT)T)Ú__doc__Ú
__future__r   r   r   Ú#googlecloudsdk.api_lib.functions.v2r   r1   Úgooglecloudsdk.api_lib.runr   Úgooglecloudsdk.command_lib.runr   r	   Úgooglecloudsdk.corer
   r3   r-   r   r   r   r   r   © r&   r   Ú<module>r;      sI   ðñ )å &Ý Ý 'å @Ý 5Ý =Ý @Ý )ð %>Ð !Ø-NÐ *óò8òóór&   