
    >                        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
 jr\R                   " \R"                  R$                  5       " S S\R&                  5      5       r\R                   " \R"                  R*                  \R"                  R,                  5       " S S\5      5       rg)z(Cloud Pub/Sub subscriptions ack command.    )
exceptions)subscriptions)base)flags)resource_args)util)log)
propertiesc                 d   [         R                  " 5       nU R                  R                  R	                  5       nU(       dn  UR                  X5      n[        R                  R                  SR                  SR                  U5      5      5        U(       a  UR                  5       US.0 4$ U0 4$ Sn0 n UR                  X5      n[        R                   " Xq5      u  p[        R                  R                  SR                  SR                  U
5      5      5        U	(       a=  [        R                  R                  SR                  SR                  U	5      5      5        U(       a  UR                  5       US.nXg4$ ! [        R                   a   n[        R                  " U5      n SnANSnAff = f)zAcks one or more messages.z2Acked the messages with the following ackIds: [{}],)subscriptionIdackIdsNz:Failed to ack the messages with the following ackIds: [{}])r   SubscriptionsClientCONCEPTSsubscriptionParseAckr	   statusPrintformatjoinRelativeNameapi_ex	HttpErrorr   HandleExactlyOnceDeliveryError'ParseExactlyOnceAckIdsAndFailureReasons)argsack_idslegacy_outputcapture_failuresclientsubscription_refresultack_ids_and_failure_reasonserrorfailed_ack_idssuccessfully_processed_ack_idss              'lib/surface/pubsub/subscriptions/ack.py_Runr)      s   ,,.&]]//557	ZZ2FJJ<CCHHW	  ,99; 
 
 RZ& "MZZ2F 483_3_!4,0. **GNN	hh-.0 1JJDKKHH^$	&' *779F 
	,,% 
		 M"&"E"Ee"LMs   4E; ;F/F**F/c                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	r   H   @Acknowledges one or more messages on the specified subscription.DESCRIPTIONa            Acknowledges one or more messages as having been successfully received.
          If a delivered message is not acknowledged within the Subscription's
          ack deadline, Cloud Pub/Sub will attempt to deliver it again.

          To automatically acknowledge messages when pulling from a Subscription,
          you can use the `--auto-ack` flag on `gcloud pubsub subscriptions pull`.
      c                 `    [         R                  " U S5        [        R                  " U S5        g )Nto ACK messages on.acknowledge.r   AddSubscriptionResourceArgr   AddAckIdFlagparsers    r(   ArgsAck.ArgsX   s#    ,,V5JK	v~.    c                 D    [        XR                  SS9u  p#U(       a  U$ U$ )NT)r    )r)   r   )selfr   r#   r$   s       r(   RunAck.Run]   s&    *.llT+3'F"((Mr8    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr6   r;   __static_attributes__r=   r8   r(   r   r   H   s/    H 

- / /r8   r   c                   .    \ rS rSrSr\S 5       rS rSrg)AckBetae   r,   c                 ^    [         R                  " U S5        [        R                  " U SSS9  g )Nr/   r0   T)add_deprecatedr1   r4   s    r(   r6   AckBeta.Argsi   s%    ,,V5JK	v~dCr8   c                     [         R                  " U5      n[        R                  R                  R
                  R                  5       n[        XSUS9u  pEU(       a  U$ U$ )NT)r    r   )r   ParseAckIdsArgsr
   VALUESpubsubr   GetBoolr)   )r:   r   r   r   r#   r$   s         r(   r;   AckBeta.Runn   sU    ##D)G%%,,::BBDM*.M+K'F"((Mr8   r=   N)	r>   r?   r@   rA   rB   rD   r6   r;   rE   r=   r8   r(   rG   rG   e   s    HD Dr8   rG   N)FF)rB   apitools.base.pyr   r   googlecloudsdk.api_lib.pubsubr   googlecloudsdk.callioper   !googlecloudsdk.command_lib.pubsubr   r   r   googlecloudsdk.corer	   r
   r)   ReleaseTracksReleaseTrackGACommandr   BETAALPHArG   r=   r8   r(   <module>r]      s    / 2 7 ( 3 ; 2 # *(-V D%%(()$,,  *8 D%%**D,=,=,C,CDc  Er8   