
                            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$                  5       " S S\
R&                  5      5       5       rg)z1Command to provision an Apigee SaaS organization.    )absolute_import)division)unicode_literals)apigee)waiter)base)
exceptions)log)
propertiesc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
	Provision   z&Provision an Apigee SaaS organization.a0    {description}

  `{command}` creates an Apigee organization and populates it with the
  necessary child resources to be immediately useable.

  This is a long running operation and could take anywhere from 10 minutes to 1
  hour to complete.

  At the moment, only trial organizations are supported.
  a  
          To provision an organization for the active Cloud Platform project,
          attached to a network named ``default'' run:

              $ {command} --authorized-network=default

          To provision an organization asynchronously and print only the name of
          the launched operation, run:

              $ {command} --authorized-network=default --async --format="value(name)"

          To provision an organization for the project named ``my-proj'', with
          analytics and runtimes located in ``us-central1'', run:

              $ {command} --authorized-network=default --project=my-proj --analytics-region=us-central1 --runtime-location=us-central1-a
          )DESCRIPTIONEXAMPLESc                     U R                  SSSS9  U R                  SSS9  U R                  SS	S9  U R                  S
SSSS9  g )Nz--authorized-networkTa    Name of the network to which the provisioned organization should be attached.
  This must be a VPC network peered through Service Networking. To get a list
  of existing networks, run:

      $ gcloud compute networks list

  To check whether a network is peered through Service Networking, run:

      $ gcloud services vpc-peerings list --network=NETWORK_NAME --service=servicenetworking.googleapis.com

  To create a new network suitable for Apigee provisioning, choose a name for
  the network and address range, and run:

      $ gcloud compute networks create NETWORK_NAME --bgp-routing-mode=global --description='network for an Apigee trial'
      $ gcloud compute addresses create ADDRESS_RANGE_NAME --global --prefix-length=16 --description="peering range for an Apigee trial" --network=NETWORK_NAME --purpose=vpc_peering
      $ gcloud services vpc-peerings connect --service=servicenetworking.googleapis.com --network=NETWORK_NAME --ranges=ADDRESS_RANGE_NAME)requiredhelpz--analytics-regionzPrimary Cloud Platform region for analytics data storage. For valid values, see: https://docs.apigee.com/hybrid/latest/precog-provision.

If unspecified, the default is ``us-west1'')r   z--runtime-locationzCloud Platform location for the runtime instance. For trial organizations, this is a compute zone. To get a list of valid zones, run `gcloud compute zones list`. If unspecified, the default is ``us-west1-a''.z--async
store_trueasync_a#  If set, returns immediately and outputs a description of the long running operation that was launched. Else, `{command}` will block until the organization has been provisioned.

To monitor the operation once it's been launched, run `{grandparent_command} operations describe OPERATION_NAME`.)actiondestr   )add_argument)parsers    -lib/surface/apigee/organizations/provision.pyArgsProvision.ArgsA   s    
N  * <  > +  - L	  N    c                    SUR                   0nUR                  (       a  UR                  US'   UR                  (       a  UR                  US'   [        R                  R
                  R                  R                  5       nUc  [        R                  " SS5        Sn[        R                  R                  R                  R                  5       (       a  Sn[        R                  R                  X2U5      n[        R                  R                  U5        UR                   (       a  U$ ["        R$                  " SUS	   5        [&        R(                  " [        R*                  " US
   5      US   SSS9$ )zRun the provision command.authorizedNetworkanalyticsRegionruntimeLocationNz	--projectzBMust provide a GCP project in which to provision the organization.globalz!Started provisioning operation %snameorganizationuuidzProvisioning organizationi6 )max_wait_ms)authorized_networkanalytics_regionruntime_locationr   VALUEScoreprojectGetr	   RequiredArgumentExceptionapi_endpoint_overridesr   ProjectsClientProvisionOrganizationOperationsClient	SplitNamer   r
   infor   WaitFor	LROPoller)selfargsorg_infor,   location	operations         r   RunProvision.Runn   s0   #T%<%<=H$($9$9h !$($9$9h !$$,,002G**

N
 H//66::<<h%%;;8I %%i0{{HH0)F2CD>>>23&#"	$ $r    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r<   __static_attributes__r>   r   r   r   r      s5     /
-@ *N *NX$r   r   N)rC   
__future__r   r   r   googlecloudsdk.api_libr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   r	   googlecloudsdk.corer
   r   UniverseCompatibleReleaseTracksReleaseTrackALPHADescribeCommandr   r>   r   r   <module>rQ      sn    8 &  ' ) . ( . # * D%%++,o$$$ o$ - o$r   