
                            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SKJr  SS jr\R(                  " \R*                  R,                  5       " S S\R.                  5      5       r\R(                  " \R*                  R2                  \R*                  R4                  5       " S S\5      5       rg)z(Cloud Pub/Sub subscriptions ack command.    )absolute_import)division)unicode_literals)
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   K   @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.Args[   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"((Mr;    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr9   r>   __static_attributes__r@   r;   r+   r   r   K   s/    H 

- / /r;   r   c                   .    \ rS rSrSr\S 5       rS rSrg)AckBetah   r/   c                 ^    [         R                  " U S5        [        R                  " U SSS9  g )Nr2   r3   T)add_deprecatedr4   r7   s    r+   r9   AckBeta.Argsl   s%    ,,V5JK	v~dCr;   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.Runq   sU    ##D)G%%,,::BBDM*.M+K'F"((Mr;   r@   N)	rA   rB   rC   rD   rE   rG   r9   r>   rH   r@   r;   r+   rJ   rJ   h   s    HD Dr;   rJ   N)FF)rE   
__future__r   r   r   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ALPHArJ   r@   r;   r+   <module>ra      s    / &  ' 1 7 ( 3 ; 2 # *(-V D%%(()$,,  *8 D%%**D,=,=,C,CDc  Er;   