
    t                     d   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r\S-   r\R(                  " \R*                  R,                  \R*                  R.                  \R*                  R0                  5       " S S\R2                  5      5       rS rg)z:services vpc-peerings enable-vpc-service-controls command.    )absolute_import)division)unicode_literals)projects_api)peering)services_util)base)util)log)
propertiesz(gcloud services vpc-peerings operations zwait {0}c                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
EnableVpcServiceControls!   z7Enable VPC Service Controls for the peering connection.aN            This command configures IPv4 routes and DNS zones applicable to a
          service producer VPC network (for example, servicenetworking). The
          route and DNS configuration match those recommended for using the
          restricted.googleapis.com VIP:

          When enabled, Google Cloud makes the following route configuration
          changes in the service producer VPC network: Google Cloud removes the
          IPv4 default route (destination 0.0.0.0/0, next hop default internet
          gateway). Google Cloud then creates an IPv4 route for destination
          199.36.153.4/30 using the default internet gateway next hop.

          When enabled, Google Cloud also creates Cloud DNS managed private
          zones and authorizes those zones for the service producer VPC network.
          The zones include googleapis.com, pkg.dev, gcr.io, and other necessary
          domains or host names for Google APIs and services that are compatible
          with VPC Service Controls. Record data in the zones resolves all host
          names to 199.36.153.4, 199.36.153.5, 199.36.153.6, and 199.36.153.7.

          When disabled, Google Cloud makes the following route configuration
          changes in the service producer VPC network: Google Cloud restores a
          default route (destination 0.0.0.0/0, next hop default internet
          gateway). Google Cloud also deletes the Cloud DNS managed private
          zones that provided the host name overrides.

          While enabled, the service producer VPC network can still import
          static and dynamic routes from the peered customer network if you
          enable custom route export. These custom routes can include a default
          route. For this reason, this command is not to be used solely as a
          means for preventing access to the internet.
          a            To enable VPC Service Controls for a connection peering a network
          called `my-network` on the current project to a service called
          `your-service`, run:

            $ {command} --network=my-network --service=your-service

          To run the same command asynchronously (non-blocking), run:

            $ {command} --network=my-network --service=your-service --async
          )DESCRIPTIONEXAMPLESc                     U R                  SSSSS9  U R                  SSSS	S
9  [        R                  R                  U 5        g)zArgs is called by calliope to gather arguments for this command.

Args:
  parser: An argparse parser that can be used to add arguments that go on
    the command line after this command. Positional arguments are allowed.
z	--networkNETWORKTzCThe network in the current project that is peered with the service.)metavarrequiredhelpz	--serviceSERVICEz servicenetworking.googleapis.comz/The service to enable VPC service controls for.)r   defaultr   N)add_argumentr	   
ASYNC_FLAGAddToParser)parsers    @lib/surface/services/vpc_peerings/enable_vpc_service_controls.pyArgsEnableVpcServiceControls.ArgsX   sY     R	   2>	  @
 	OO'    c                    [         R                  R                  R                  R	                  SS9n[        U5      n[        R                  " X1R                  UR                  5      nUR                  (       aN  [        R                  UR                  5      n[        R                  R!                  SR                  U5      5        g["        R$                  " UR                  [        R&                  5      n["        R(                  " U5        g)zRun 'services vpc-peerings enable-vpc-service-controls'.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
    with.
T)r   zcAsynchronous operation is in progress... Use the following command to wait for its completion:
 {0}N)r   VALUEScoreprojectGet_GetProjectNumberr   r   servicenetworkasync_OP_WAIT_CMDformatnamer   statusPrintr   WaitOperationGetOperationPrintOperation)selfargsr$   project_numberopcmds         r   RunEnableVpcServiceControls.Runm   s     $$,,00$0?G&w/N		)	).,,*.,,
8B{{rww'c	jj ++16#;8 		$	$RWWg.B.B	CB  $r     N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r7   __static_attributes__r9   r    r   r   r   !   s5     @@
E--^ ( ((%r    r   c                 j    [         R                  " [        R                  " U 5      5      R                  $ )N)r   r%   projects_utilParseProjectprojectNumber)
project_ids    r   r&   r&      s$    			-44Z@	A	O	OOr    N)r>   
__future__r   r   r   +googlecloudsdk.api_lib.cloudresourcemanagerr   googlecloudsdk.api_lib.servicesr   r   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.projectsr
   rC   googlecloudsdk.corer   r   OP_BASE_CMDr*   ReleaseTracksReleaseTrackALPHABETAGASilentCommandr   r&   r9   r    r   <module>rT      s    A &  ' D 3 9 ( E # *8J& 
Y%t11 Y%
Y%xPr    