
    1                        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ej                   ej                   ej"                  j$                         G d dej&                                      Z ej                   ej"                  j*                         G d de             Z ej                   ej"                  j.                         G d de             Zy)z5Command for modifying the properties of a subnetwork.    )absolute_import)division)unicode_literals)base_classes)subnets_utils)utils)base)flagsc                      ddddS )N<Updates properties of an existing Compute Engine subnetwork.zm          *{command}* is used to update properties of an existing Compute Engine
          subnetwork.
      z        To enable external IPv6 addresses on the subnetwork example-subnet-1 in
        network-1, run

        $ {command} example-subnet-1 --stack-type=IPV4_IPV6 --ipv6-access-type=EXTERNAL --region=REGION
      )briefDESCRIPTIONEXAMPLES r       .lib/surface/compute/networks/subnets/update.py_DetailedHelpr      s     I



 r   c                   \    e Zd ZdZdZdZdZej                  Z	dZ
 e       Zed        Zd Zy)Updater   FTc                 R   t        j                         | _        | j                  j                  |d       t        j                         j                  |d       t        j
                  || j                  | j                  | j                  | j                  | j                         y)zaThe command arguments handler.

    Args:
      parser: An argparse.ArgumentParser instance.
    update)operation_typeN)r
   SubnetworkArgumentSUBNETWORK_ARGAddArgumentIpCollectionArgumentAddUpdateArgs_include_alpha_logging_include_internal_ipv6_prefix"_include_allow_cidr_routes_overlap_api_version_update_purpose_to_private)clsparsers     r   ArgszUpdate.Args=   s     113C""6("C	 ,,VH,M	""))..&&r   c                    t        j                  | j                               }|j                  }| j                  j                  ||j                        }|j                  }|j                  }|j                  }|j                  }|j                  }	| j                  rH|j                  |j                  }|j                  |j                  }|j                  |j                  }d}
|j                   }|j"                  t%        |dd      dk(  }
d}|j&                  t%        |dd      }|j(                  }d}| j*                  r|j,                  }t%        |dd      }t%        |dd      }t%        |dd      }t%        |dd      }t%        |d	d      }d}|j.                  r<t1        j2                         j                  ||j                        j5                         }t7        j8                  ||fi d
|j:                  d|j<                  d|d|j>                  d|j@                  d|d|d|d|d|	d|
d|d|d|d|d|d|d|d	|d|S )z0Issues requests necessary to update Subnetworks.NroleACTIVEpurpose
stack_typeipv6_access_type1add_secondary_ranges_with_reserved_internal_rangeexternal_ipv6_prefixinternal_ipv6_prefixenable_private_ip_google_accessadd_secondary_rangesremove_secondary_rangesenable_flow_logsaggregation_intervalflow_samplingmetadatafilter_exprmetadata_fieldsset_role_activeset_new_purposedrain_timeout_secondsprivate_ipv6_google_access_typeallow_cidr_routes_overlapip_collection)!r   ComputeApiHolderReleaseTrackclientr   ResolveAsResource	resourceslogging_aggregation_intervallogging_flow_samplinglogging_metadatalogging_filter_exprlogging_metadata_fieldsr   r3   r4   r5   drain_timeoutr'   getattrr)   r;   r    r<   r=   r
   r   SelfLinkr   MakeSubnetworkUpdateRequestr/   r0   r1   r2   )selfargsholderr@   
subnet_refr3   r4   r5   r6   r7   r8   r:   r9   r;   r<   r*   r+   reserved_internal_rangesr-   r.   r=   s                        r   Runz
Update.RunR   s   **4+<+<+>?F]]F$$66tV=M=MNJ<<..M$$H**K22O""		"	"	.#88				'**		"==O ..yyfd3x?oO||i6o&*&J&J# $.."&"@"@|T2Jt%7>&A4 I #4)?F"4)?FM002DD
  
  44 )-(L(L "66	
 ;S !% < < .. 2 $    ( ( ( 4  )H!" #<#$ %& *'( 2)* 2+, $- r   N)__name__
__module____qualname____doc__r   r   r    compute_apiCOMPUTE_GA_API_VERSIONr!   r"   r   detailed_helpclassmethodr%   rQ   r   r   r   r   r   1   sJ     E "'',$33,#/- (Ir   r   c                   0    e Zd ZdZdZdZej                  Zy)
UpdateBetar   FTN)	rR   rS   rT   rU   r   r    rV   COMPUTE_BETA_API_VERSIONr!   r   r   r   r[   r[      s    D"''+$55,r   r[   c                   8    e Zd ZdZdZdZdZej                  Z	dZ
y)UpdateAlphar   TN)rR   rS   rT   rU   r   r   r    rV   COMPUTE_ALPHA_API_VERSIONr!   r"   r   r   r   r^   r^      s(    D"&'+$66,#r   r^   N)rU   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r   rV   googlecloudsdk.callioper	   3googlecloudsdk.command_lib.compute.networks.subnetsr
   r   UniverseCompatibleReleaseTracksr?   GAUpdateCommandr   BETAr[   ALPHAr^   r   r   r   <module>rj      s    < &  ' 7 8 ? ( E* D%%(()hT h * hV D%%**+6 6 ,6 D%%++,$* $ -$r   