
    Y                         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 rS	 rS
 rS rS rS rS rS rSS jrS r  SS jrS rS rS rg)z9Flags for the `compute network-endpoint-groups` commands.    )absolute_import)division)unicode_literals)arg_parsers)base)flagsc            	      l    [         R                  " SSSS[         R                  [         R                  S9$ )Nznetwork endpoint groupzcompute.networkEndpointGroupsz#compute.globalNetworkEndpointGroupsz#compute.regionNetworkEndpointGroups)resource_namezonal_collectionglobal_collectionregional_collectionzone_explanationregion_explanation)compute_flagsResourceArgumentZONE_PROPERTY_EXPLANATIONREGION_PROPERTY_EXPLANATION     Glib/googlecloudsdk/command_lib/compute/network_endpoint_groups/flags.pyMakeNetworkEndpointGroupsArgr      s3    		'	',6=?$>>&BB
 r   c                     U (       d  g[        U 5      S:X  a  U S   $ [        U 5      S:X  a  U S   S-   U S   -   $ SR                  U SS 5      S	-   U S   -   $ )
zHJoins strings, for example, into a string like 'A or B' or 'A, B, or C'.    r      z or z, Nz, or )lenjoin)stringss    r   _JoinWithOrr    %   se    	
7|q1:
7|q1:++99WSb\"W,wr{::r   c                 d    U(       a)  [         R                  " SSS/SSS9R                  U 5        gg)z;Adds NEG type argument for creating network endpoint group.z
--neg-typeTzload-balancingz-The type of network endpoint group to create.hiddenchoicesdefaulthelp_strNr   ChoiceArgumentAddToParser)parsersupport_neg_types     r   _AddNetworkEndpointGroupTyper,   1   s6    !" @ k& r   c                 ^    / SQnSn[         R                  " SSUSUS9R                  U 5        g)zAAdds endpoint type argument for creating network endpoint groups.)gce-vm-ip-portzinternet-ip-portzinternet-fqdn-portznon-gcp-private-ip-port
serverlessz	gce-vm-ipzprivate-service-connectzgce-vm-ip-portmapa	        Determines the spec of endpoints attached to this group.

      *gce-vm-ip-port*:::
      Endpoint IP address must belong to a VM in Compute Engine
      (either the primary IP or as part of an aliased IP range).
      The `--default-port` must be specified or every network endpoint
      in the network endpoint group must have a port specified.

      *internet-ip-port*:::
      Endpoint IP address must be a publicly routable address. If specified, the
      default port is used. If unspecified, the well-known port for your backend
      protocol is used as the default port (80 for HTTP, 443 for HTTPS).

      *internet-fqdn-port*:::
      Endpoint FQDN must be resolvable to a public IP address via public
      DNS. The default port is used, if specified. If the default
      port is not specified, the well-known port for your backend
      protocol is used as the default port (80 for HTTP, 443 for
      HTTPS).

      After creating a NEG of this type, you can use the `gcloud compute
      network-endpoint-groups update` command with
      the `--add-endpoint` flag. Example:
      `--add-endpoint="fqdn=backend.example.com,port=443"`

      *non-gcp-private-ip-port*:::
      Endpoint IP address must belong to a VM not in Compute
      Engine and must be routable using a Cloud Router over VPN or an
      Interconnect connection. In this case, the NEG must be zonal. The
      `--default-port` must be specified or every network endpoint in
      the network endpoint group must have a port specified.

      *serverless*:::
      The network endpoint is handled by specified serverless
      infrastructure, such as Cloud Run, App Engine, or Cloud Function.
      Default port, network, and subnet are not effective for serverless
      endpoints.

      *private-service-connect*:::
      The network endpoint corresponds to a service outside the VPC, accessed
      via Private Service Connect.

      *gce-vm-ip*:::
      Endpoint must be the IP address of a VM's network interface in
      Compute Engine. Instance reference is required. The IP address is
      optional. If unspecified, the primary NIC address is used.
      A port must not be specified.

      *gce-vm-ip-portmap*:::
      Endpoint IP address must be a primary IP of a VM's network interface in
      Compute Engine.
      The `--default-port` must be specified or every network endpoint
      in the network endpoint group must have a port specified.
  z--network-endpoint-typeFr.   r"   Nr'   )r*   endpoint_type_choices	help_texts      r   _AddNetworkEndpointTyper2   =   s=    	6)p # Kr   c                 j    Sn/ SQnUSR                  [        U5      5      -  nU R                  SUS9  g)z;Adds network argument for creating network endpoint groups.zq      Name of the network in which the NEG is created. `default` project
      network is used if unspecified.
  )`gce-vm-ip-port`z`non-gcp-private-ip-port``gce-vm-ip``private-service-connect`z`internet-ip-port`z`internet-fqdn-port``gce-vm-ip-portmap`aR  
    This is only supported for NEGs with endpoint type {0}.

    For Private Service Connect NEGs, you can optionally specify --network and
    --subnet if --psc-target-service points to a published service. If
    --psc-target-service points to the regional service endpoint of a Google
    API, do not specify --network or --subnet.
  z	--networkhelpNformatr    add_argument)r*   r1   network_applicable_ne_typess      r   _AddNetworkr>      sI    )!   f[4567) 	k	2r   c                 j    Sn/ SQnUSR                  [        U5      5      -  nU R                  SUS9  g)z:Adds subnet argument for creating network endpoint groups.z      Name of the subnet to which all network endpoints belong.

      If not specified, network endpoints may belong to any subnetwork in the
      region where the network endpoint group is created.
  )r4   r5   r6   r7   a[  
      This is only supported for NEGs with endpoint type {0}.
      For Private Service Connect NEGs, you can optionally specify --network and
      --subnet if --psc-target-service points to a published service. If
      --psc-target-service points to the regional service endpoint of a Google
      API, do not specify --network or --subnet.
  z--subnetr8   Nr:   )r*   r1   subnet_applicable_typess      r   
_AddSubnetrA      sI    )   f[0123) 	jy1r   c                 2    SnU R                  S[        US9  g)z@Adds default port argument for creating network endpoint groups.a      The default port to use if the port number is not specified in the network
    endpoint.

    If this flag isn't specified for a NEG with endpoint type `gce-vm-ip-port`,
    `gce-vm-ip-portmap` or `non-gcp-private-ip-port`, then every network endpoint in the network
    endpoint group must have a port specified. For a global NEG with endpoint
    type `internet-ip-port` and `internet-fqdn-port` if the default port is not
    specified, the well-known port for your backend protocol is used (80 for
    HTTP, 443 for HTTPS).

    This flag is not supported for NEGs with endpoint type `serverless`.

    This flag is not supported for NEGs with endpoint type
    `private-service-connect`.
  z--default-porttyper9   Nr<   intr*   r1   s     r   _AddDefaultPortrH      s!    )" 	&SyAr   c                 2    SnU R                  S[        US9  g)zEAdds psc producer port argument for creating network endpoint groups.a      The producer port to use when a consumer PSC NEG connects to a producer's
    internal network load balancer. If this flag isn't specified for a NEG with
    endpoint type `private-service-connect`, the PSC NEG will connect to port
    443 or the first available port in the PSC producer port range, or to port 1
    if the PSC producer's forwarding rule ports flag is set to all-ports.

    This flag is not supported for NEGs with endpoint type other than
    `private-service-connect`.
  z--producer-portrC   NrE   rG   s     r   _AddProducerPortrJ      s!    	) 	'c	Br   c                    SnU R                  USS9nSnUR                  US9nSnUR                  SUS9  SnUR                  S	US9  S
nUR                  SUS9  Sn	UR                  U	S9n
U
R                  S[        R                  SS9  U
R                  SSS9  U
R                  SSS9  SnU
R                  SUS9  SnUR                  US9nSnUR                  SUS9  SnUR                  SUS9  U(       aZ  SnUR                  US9nSnUR                  SUS9  SnUR                  SUS9  S nUR                  S!US9  S"nUR                  S#US9  g$g$)%zCAdds serverless routing info arguments for network endpoint groups.z      The serverless routing configurations are only valid when endpoint type
      of the network endpoint group is `serverless`.
  T)r9   mutexz      Configuration for a Cloud Run network endpoint group. Cloud Run service
      must be provided explicitly or in the URL mask. Cloud Run tag is optional,
      and may be provided explicitly or in the URL mask.
  r8   z      Cloud Run service name to add to the Serverless network endpoint groups
      (NEG). The service must be in the same project and the same region as the
      Serverless NEG.
  z--cloud-run-servicez~      Cloud Run tag represents the "named revision" to provide additional
      fine-grained traffic routing configuration.
  z--cloud-run-tagz      A template to parse service and tag fields from a request URL. URL mask
      allows for routing to multiple Run services without having to create
      multiple network endpoint groups and backend services.
  z--cloud-run-url-maskaY        Configuration for an App Engine network endpoint group. Both App Engine
      service and version are optional, and may be provided explicitly or in the
      URL mask. The `app-engine-app` flag is only used for default routing. The
      App Engine app must be in the same project as the Serverless network
      endpoint groups (NEG).
  z--app-engine-appz$If set, the default routing is used.)actionr9   z--app-engine-servicez6Optional serving service to add to the Serverless NEG.z--app-engine-versionz6Optional serving version to add to the Serverless NEG.z      A template to parse service and version fields from a request URL. URL
      mask allows for routing to multiple App Engine services without having
      to create multiple network endpoint groups and backend services.
  z--app-engine-url-maskz      Configuration for a Cloud Function network endpoint group. Cloud Function
      name must be provided explicitly or in the URL mask.
  z      Cloud Function name to add to the Serverless NEG. The function must be in
      the same project and the same region as the Serverless network endpoint
      groups (NEG).
  z--cloud-function-namez      A template to parse function field from a request URL. URL mask allows
      for routing to multiple Cloud Functions without having to create multiple
      network endpoint groups and backend services.
  z--cloud-function-url-maska          Configuration for a Serverless network endpoint group.
        Serverless NEGs support all serverless backends and are the only way to
        setup a network endpoint group for Cloud API Gateways.

        To create a serverless NEG with a Cloud Run, Cloud Functions or App
        Engine endpoint, you can either use the previously-listed Cloud Run,
        Cloud Functions or App Engine-specific properties, OR, you can use the
        following generic properties that are compatible with all serverless
        platforms, including API Gateway: serverless-deployment-platform,
        serverless-deployment-resource, serverless-deployment-url-mask, and
        serverless-deployment-version.
    a          The platform of the NEG backend target(s). Possible values:

          * API Gateway: apigateway.googleapis.com
          * App Engine: appengine.googleapis.com
          * Cloud Functions: cloudfunctions.googleapis.com
          * Cloud Run: run.googleapis.com
    z --serverless-deployment-platforma          The user-defined name of the workload/instance. This value must be
        provided explicitly or using the --serverless-deployment-url-mask
        option. The resource identified by this value is platform-specific and
        is as follows:

          * API Gateway: The gateway ID
          * App Engine: The service name
          * Cloud Functions: The function name
          * Cloud Run: The service name
    z --serverless-deployment-resourcea          The optional resource version. The version identified by this value is
        platform-specific and is as follows:

          * API Gateway: Unused
          * App Engine: The service version
          * Cloud Functions: Unused
          * Cloud Run: The service tag
    z--serverless-deployment-versiona          A template to parse platform-specific fields from a request URL. URL
        mask allows for routing to multiple resources on the same serverless
        platform without having to create multiple network endpoint groups and
        backend resources. The fields parsed by this template are
        platform-specific and are as follows:

          * API Gateway: The 'gateway' ID
          * App Engine: The 'service' and 'version'
          * Cloud Functions: The 'function' name
          * Cloud Run: The 'service' and 'tag'
    z --serverless-deployment-url-maskN)	add_groupr<   r   StoreTrueFalseAction)r*   support_serverless_deploymentserverless_group_helpserverless_groupcloud_run_group_helpcloud_run_groupcloud_run_service_helpcloud_run_tag_helpcloud_run_url_mask_helpapp_engine_group_helpapp_engine_groupapp_engine_url_mask_helpcloud_function_group_helpcloud_function_groupcloud_function_name_helpcloud_function_url_mask_help serverless_deployment_group_helpserverless_deployment_group#serverless_deployment_platform_help#serverless_deployment_resource_help"serverless_deployment_version_help#serverless_deployment_url_mask_helps                         r   _AddServerlessRoutingInfore      sc    %%+@%M
 %..4H.I/
 "8   07IJ
 #:   &//5J/K--1   
 C    C   
 $<    *33$ 4 
 ##$< $ "
 ##!(D $  #($ #3"<"<- #= #+'  ,,*0 - 
+'  ,,*0 - *&  ,,)/ - +'  ,,*0 - K #r   c                 (    SnU R                  SUS9  g)zBAdds l7psc routing info arguments for PSC network endpoint groups.zk      PSC target service name to add to the private service connect network
      endpoint groups (NEG).
  z--psc-target-servicer8   N)r<   )r*   psc_target_service_helps     r   _AddL7pscRoutingInforh     s!     	,3JKr   c                     [        X5        [        U 5        [        U 5        [        U 5        [	        U 5        [        U 5        [        X5        [        U 5        g)z?Adds flags for creating a network endpoint group to the parser.N)r,   r2   r>   rA   rH   rJ   re   rh   )r*   r+   rP   s      r   AddCreateNegArgsToParserrj     sD     v8&!fV&6FBvr   c                 P    SnU R                  SS[        R                  " US9US9  g)z@Adds add endpoint argument for updating network endpoint groups.a            The network endpoint to add to the network endpoint group. Keys used
          depend on the endpoint type of the NEG.

          `gce-vm-ip-port`

              *instance* - Name of instance in same zone as the network endpoint
              group.

              The VM instance must belong to the network / subnetwork
              associated with the network endpoint group. If the VM instance
              is deleted, then any network endpoint group that has a reference
              to it is updated.

              *ip* - Optional IP address of the network endpoint. The IP address
              must belong to a VM in compute engine (either the primary IP or
              as part of an aliased IP range). If the IP address is not
              specified, then the primary IP address for the VM instance in
              the network that the network endpoint group belongs to is
              used.

              *ipv6* - Optional IPv6 address of the network endpoint. The IPv6
              address must belong to a VM in compute engine (either the internal
              or external IPv6 address).

              *port* - Required endpoint port unless NEG default port is set.

              *client-destination-port* - Required endpoint client destination port only for the port
              mapping NEG.

          `internet-ip-port`

              *ip* - Required IPv4 address of the endpoint to attach. Must be
              publicly routable.

              *port* - Optional port of the endpoint to attach. If unspecified,
              the NEG default port is set. If no default port is set, the
              well-known port for the backend protocol is used instead
              (80 for HTTP, 443 for HTTPS).

          `internet-fqdn-port`

              *fqdn* - Required fully qualified domain name to use to look up an
              external endpoint. Must be resolvable to a public IP address via
              public DNS.

              *port* - Optional port of the endpoint to attach. If unspecified,
              the NEG default port is set. If no default port is set, the
              well-known port for the backend protocol is used instead
              (80 for HTTP, 443 for HTTPS or HTTP2).

              Example: `--add-endpoint="fqdn=backend.example.com,port=443"`

          `non-gcp-private-ip-port`

              *ip* - Required IPv4 address of the network endpoint to attach.
              The IP address must belong to a VM not in Compute Engine and must
              be routable using a Cloud Router over VPN or an Interconnect
              connection.

              *port* - Required port of the network endpoint to attach unless
              the NEG default port is set.

          `gce-vm-ip`

              *instance* - Required instance name in same zone as the network
              endpoint group.

              The VM instance must belong to the network / subnetwork
              associated with the network endpoint group. If the VM instance
              is deleted, then any network endpoint group that has a reference
              to it is updated.

              *ip* - Optional IP address of the network endpoint to attach. The
              IP address must be the VM's network interface address. If not
              specified, the primary NIC address is used.
    z--add-endpointappendspecrM   rD   r9   Nr<   r   ArgDictendpoint_groupendpoint_specr1   s      r   _AddAddEndpointru     s7    L)\ M2	  r   c                 P    SnU R                  SS[        R                  " US9US9  g)zCAdds remove endpoint argument for updating network endpoint groups.a            The network endpoint to detach from the network endpoint group. Keys
          used depend on the endpoint type of the NEG.

          `gce-vm-ip-port`

              *instance* - Required name of instance whose endpoint(s) to
              detach. If the IP address is unset, all endpoints for the
              instance in the NEG are detached.

              *ip* - Optional IPv4 address of the network endpoint to detach.
              If specified port must be provided as well.

              *ipv6* - Optional IPv6 address of the network endpoint to detach.
              If specified port must be provided as well.

              *port* - Optional port of the network endpoint to detach.

              *client-destination-port* - Optional client destination port, only for port mapping NEGs.

          `internet-ip-port`

              *ip* - Required IPv4 address of the network endpoint to detach.

              *port* - Optional port of the network endpoint to detach if the
              endpoint has a port specified.

          `internet-fqdn-port`

              *fqdn* - Required fully qualified domain name of the endpoint to
              detach.

              *port* - Optional port of the network endpoint to detach if the
              endpoint has a port specified.

          `non-gcp-private-ip-port`

              *ip* - Required IPv4 address of the network endpoint to detach.

              *port* - Required port of the network endpoint to detach unless
              NEG default port is set.

          `gce-vm-ip`

              *instance* - Required name of instance with endpoints to
              detach. If the IP address is unset, all endpoints for the
              instance in the NEG are detached.

              *ip* - Optional IP address of the network endpoint to attach. The
              IP address must be the VM's network interface's primary IP
              address. If not specified, the primary NIC address is used.
  z--remove-endpointrl   rm   ro   Nrp   rr   s      r   _AddRemoveEndpointrw     s6    3)j M2	  r   c                     U R                  SSSS9n[        [        [        [        [        [        S.n[        X5        [	        X5        g)z?Adds flags for updating a network endpoint group to the parser.TzMThese flags can be specified multiple times to add/remove multiple endpoints.)rL   requiredr9   )instanceipipv6portfqdnzclient-destination-portN)rN   strrF   ru   rw   )r*   rs   rt   s      r   AddUpdateNegArgsToParserr   >  sO    ## 	 $ . !$- .0^3r   N)F)FF)__doc__
__future__r   r   r   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer   r   r   r    r,   r2   r>   rA   rH   rJ   re   rh   rj   ru   rw   r   r   r   r   <module>r      su    @ &  ' / ( E	;	K\3824B,C bJL "'"Up<~4r   