
    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SKJr  SS	KJr  \R                   \R"                  \R$                  " \R&                  R(                  5       " S
 S\R*                  5      5       5       5       rg)zACommand for adding an empty named set to a Compute Engine router.    )absolute_import)division)unicode_literals)base_classes)base)
exceptions)flags)	arg_utilsc                   >    \ rS rSrSrSr\S 5       rS rS r	S r
Srg)	AddNamedSet   ztAdd an empty named set to a Compute Engine router.

*{command}* adds an empty named set to a Compute Engine router.
Nc                     [         R                  " 5       [        l        [        R                  R	                  USS9  UR                  SSSS9  UR                  S[        R                  SS	S
.SSS9  g )Ninsert)operation_typez
--set-namezName of the named set to add.T)helprequiredz
--set-typez$The Named Set is a Prefix Named Set.z'The Named Set is a Community Named Set.)PREFIX	COMMUNITYzType of the set's elements.)typechoicesr   r   )r	   RouterArgumentr   
ROUTER_ARGAddArgumentadd_argumentr
   ChoiceToEnumName)clsparsers     ,lib/surface/compute/routers/add_named_set.pyArgsAddNamedSet.Args)   s|    "113K&&vh&G
0  
 ''<B
 /  	    c                    [         R                  " U R                  5       5      nUR                  n[        R
                  R                  UUR                  [        R                  " U5      S9nUR                  R                  UR                  UR                  R                  R                  U R                  UR                  5      5      S9nU R!                  X4UR                  5        UR"                  R$                  SUR                  R&                  " S0 UR)                  5       DSU0D64nUR+                  U/5      S   $ )zIssues the requests needed for adding an empty named set to a Router.

Args:
  args: contains arguments passed to the command.

Returns:
  The result of patching the router adding the empty named set.
)scope_lister)namer   UpdateNamedSetnamedSetr    )r   ComputeApiHolderReleaseTrackclientr   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListermessagesNamedSetset_nameTypeValueValuesEnumConvertSetTypeset_typeRequireNamedSetDoesNotExistapitools_clientrouters#ComputeRoutersUpdateNamedSetRequestAsDictMakeRequests)selfargsholderr*   
router_ref	named_setrequests          r   RunAddNamedSet.Run=   s    **4+<+<+>?F]]F''99"88@ : J
 ((]]__%%99.
 ) I 	$$VG&&;; 	
!	
,5	
G y)!,,r!   c                    UR                   R                  SUR                  R                  " S0 UR	                  5       DSU0D64n UR                  U/5        [        R                  " SSR                  U5      5      e! [         a@  nSR                  US9UR                  5       ;   d  SUR                  5       ;   a   S nAg e S nAff = f)	NGetNamedSetr&   z)The named set '{set_name}' was not found.)r1   zACould not fetch resource:
 - Invalid value for field 'namedSet': zset-namez&A named set named '{0}' already existsr'   )r6   r7   r/    ComputeRoutersGetNamedSetRequestr9   r:   	Exceptionformat__str__r   BadArgumentException)r;   r*   r>   r1   r@   	exceptions         r   r5   'AddNamedSet.RequireNamedSetDoesNotExist`   s    &&88 	
!	
,4	
G7)$ 
)
)<CCHM   

5
<
<h
<
O ! R ! 	
s   A? ?
C		5CCC	c                 "    US:X  a  gUS:X  a  gU$ )Nr   NAMED_SET_TYPE_PREFIXr   NAMED_SET_TYPE_COMMUNITYr'   )r;   r4   s     r   r3   AddNamedSet.ConvertSetTypey   s    8$	[	 'or!   r'   )__name__
__module____qualname____firstlineno____doc__r   classmethodr   rA   r5   r3   __static_attributes__r'   r!   r   r   r      s0    
 * &!-F2r!   r   N)rT   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer	   r-   *googlecloudsdk.command_lib.compute.routers$googlecloudsdk.command_lib.util.apisr
   HiddenUniverseCompatibleReleaseTracksr)   ALPHACreateCommandr   r'   r!   r   <module>rb      s{     H &  ' 7 ( . E < : D%%++,^$$$ ^ -  ^r!   