
    L                        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	rS
rSrSrSrSrS r\R&                  \R(                  " \R*                  R,                  5       " S S\R.                  5      5       5       r\R&                  \R(                  " \R*                  R2                  5       " S S\5      5       5       rg)z"Command to delete transfer agents.    )absolute_import)division)unicode_literals)arg_parsers)base)agents_util)resource_printerzTo delete specific agents on your machine, run the following command:

{container_manager} stop {container_ids}

Note: If you encounter a permission error or cannot find the agent, you may need
to add "sudo" before "{container_manager}".
a7  To delete all agents on your machine, run the following command:

{container_manager} stop $({container_manager} container list --quiet --all --filter ancestor=gcr.io/cloud-ingest/tsop-agent)

Note: If you encounter a permission error, you may need to add "sudo" before both instances of "{container_manager}".
a  To delete all agents on your machine and uninstall the machine's agent container image, run the following commands:

{container_manager} stop $({container_manager} container list --quiet --all --filter ancestor=gcr.io/cloud-ingest/tsop-agent)

# May take a moment for containers to shutdown before you can run:
{container_manager} image rm gcr.io/cloud-ingest/tsop-agent

Note: If you encounter a permission error, you may need to add "sudo" before all three instances of "{container_manager}".
zPick which agents to delete. You can include --all to delete all agents on your machine or --ids to specify agent IDs. You can find agent IDs by running:

{container_manager} container list --all --filter ancestor=gcr.io/cloud-ingest/tsop-agent
z2Delete Transfer Service agents from your machine.
zIf you plan to delete specific agents, you can list which agents are running on your machine by running:

  $ {container_managers} container list --all --filter ancestor=gcr.io/cloud-ingest/tsop-agent

Then run:

  $ {{command}} --ids=id1,id2,...
c                     U [         R                  R                  :H  nU(       a  SOSn[        [        R                  US9S.$ )zReturns the detailed help text for the delete command.

Args:
  release_track (base.ReleaseTrack): The release track.

Returns:
  A dict containing keys DESCRIPTION, EXAMPLES that provides detailed help.
zdocker (or podman)docker)container_managers)DESCRIPTIONEXAMPLES)r   ReleaseTrackALPHA _DELETE_COMMAND_DESCRIPTION_TEXT_DELETE_COMMAND_EXAMPLES_TEXTformat)release_trackis_alphar   s      %lib/surface/transfer/agents/delete.py_get_detailed_help_textr   J   sH     d//555(/7+X5/66/ 7 
     c                   l    \ rS rSrSr\" \R                  R                  5      r	\
S 5       rS rS rSrg)Delete]   (Delete Transfer Service transfer agents.c                     U R                  SSS9nUR                  S[        R                  " 5       SSS9  UR                  SS	S
S9  UR                  SS	SS9  g )NTF)mutex	sort_argsz--idsIDSzwThe IDs of the agents you want to delete. Separate multiple agent IDs with commas, with no spaces following the commas.)typemetavarhelpz--all
store_truez*Delete all agents running on your machine.)actionr#   z--uninstallzFully uninstall the agent container image in addition to deleting the agents. Uninstalling the container image will free up space, but you'll need to reinstall it to run agents on this machine in the future.)	add_groupadd_argumentr   ArgList)parsermutually_exclusive_flags_groups     r   ArgsDelete.Argsd   s    %+%5%5e &6 &" #//  "E 0  #//9 0 
 #//	 0 	r   c                 4    A[         R                  " US5        g )Nobject)r	   Print)selfargs	resourcess      r   DisplayDelete.Display   s    9h/r   c                    [         R                  R                  U5      nUR                  (       a7  [        R                  UR                  SR                  UR                  5      S9$ UR                  (       a  [        R                  UR                  S9$ UR                  (       a  [        R                  UR                  S9$ [        R                  UR                  S9$ )N )container_managercontainer_ids)r7   )r   ContainerManager	from_argsids_DELETE_SPECIFIC_AGENTS_MESSAGEr   valuejoinall_DELETE_ALL_AGENTS_MESSAGE	uninstall_UNINSTALL_MESSAGE_LIST_AGENTS_MESSAGE)r0   r1   r7   s      r   Run
Delete.Run   s    #44>>tDxx,33-33* 4   xx'..-33 /   ~~&&-33 '    &&+11 '  r    N)__name__
__module____qualname____firstlineno____doc__r   r   r   GAdetailed_helpstaticmethodr+   r3   rD   __static_attributes__rF   r   r   r   r   ]   s9     1)$*;*;*>*>?- :0r   r   c                   `    \ rS rSrSr\" \R                  R                  5      r	\
S 5       rSrg)DeleteAlpha   r   c           	         [         R                  U 5        U R                  S[        [        R
                   Vs/ s H  oR                  PM     sn5      [        R
                  R                  R                  SS9  g s  snf )Nz--container-managerz0The container manager to use for running agents.)choicesdefaultr#   )r   r+   r'   sortedr   r9   r=   DOCKER)r)   options     r   r+   DeleteAlpha.Args   sh    
KK
(3(D(DE(Df\\(DE
 ,,3399?   Fs   A<rF   N)rG   rH   rI   rJ   rK   r   r   r   r   rM   rN   r+   rO   rF   r   r   rQ   rQ      s/     1)$*;*;*A*AB-
 
r   rQ   N)rK   
__future__r   r   r   googlecloudsdk.callioper   r   #googlecloudsdk.command_lib.transferr   googlecloudsdk.core.resourcer	   r<   r@   rB   rC   r   r   r   UniverseCompatibleReleaseTracksr   rL   Commandr   r   rQ   rF   r   r   <module>ra      s    ) &  ' / ( ; 9#  	  $  ! & D%%(()9T\\ 9 * 9x D%%++,&  - r   