
                  	          d Z ddlmZ ddlmZ ddlmZ ddlm	Z	 dZ
dZ G d d	ej                        Zd!dZ ej                  dedd
d
de
      Z ej                  dedd
de
      Z ej                  ddeddd      Z ej                  ddedd      Z ej                  dddeddd      Zd"dZd"dZ	 d!dZd Zd Zd!dZd Zy )#z;Flags and helpers for the compute backend-buckets commands.    )arg_parsers)
completers)flags)	arg_utilszrThe name of the Google Cloud Storage bucket to serve from. The storage
        bucket must be in the same project.zT    table(
      name,
      bucketName:label=GCS_BUCKET_NAME,
      enableCdn
    )c                        e Zd Z fdZ xZS )BackendBucketsCompleterc                 2    t        t        | 
  dddd| y )Ncompute.backendBucketsz"compute backend-buckets list --uri)
collectionlist_command )superr   __init__)selfkwargs	__class__s     ?lib/googlecloudsdk/command_lib/compute/backend_buckets/flags.pyr   z BackendBucketsCompleter.__init__'   s(    	
!41 +9     )__name__
__module____qualname__r   __classcell__)r   s   @r   r   r   %   s     r   r   Fc                 >    t        j                  dd| t        d      S )Nbackend_bucket_namebackend bucketr
   )nameresource_nameplural	completerglobal_collectioncompute_flagsResourceArgumentr   )r   s    r   BackendBucketArgumentr$   /   s$    		'	' $'0
 r   r   z--gcs-bucket-namer
   )r   r   r   r   requiredr    detailed_help)r   r   r   r   r    r&   r   Tcompute.regionBackendBuckets)r   r   r   r   regional_collectionr    )r   r   r   r(   r    backend_bucketzID of the backend bucket or fully qualified identifier for the
          backend bucket.

          To set the backend_bucket attribute:
          + provide the argument backend_bucket on the command line.)r   r   r%   r   r(   r    
short_helpc                 >    t        j                  dd| t        d      S )Nr   --default-backend-bucketr
   )r   r   r%   r   r    r!   r%   s    r   BackendBucketArgumentForUrlMapr.   l   s$    		'	'$%'0
 r   c           	      B    t        j                  dd| t        ddd      S )Nr   r,   r
   r'   z=If not specified it will be set to the region of the URL map.)r   r   r%   r   r    r(   region_explanationr!   r-   s    r   .RegionSupportingBackendBucketArgumentForUrlMapr1   v   s*    		'	'$%'08
I

 
r   c                     |rt         | _        nt               | _        | j                  j                  ||       |j	                  dd       |j	                  dt
        j                  d       y)	aQ  Adds top-level backend bucket arguments that can be updated.

  Args:
    cls: type, Class to add backend bucket argument to.
    parser: The argparse parser.
    operation_type: str, operation_type forwarded to AddArgument(...)
    support_regional_global_flags: bool, whether backend bucket supports
      regional and global flags.
  )operation_typez--descriptionz8An optional, textual description for the backend bucket.)helpz--enable-cdnz      Enable Cloud CDN for the backend bucket. Cloud CDN can cache HTTP
      responses from a backend bucket at the edge of the network, close to
      users.)actionr4   N)"GLOBAL_REGIONAL_BACKEND_BUCKET_ARGBACKEND_BUCKET_ARGr$   AddArgumentadd_argumentr   StoreTrueFalseAction)clsparserr3   support_regional_global_flagss       r   AddUpdatableArgsr>      sr     #?C24C$$VN$KE  
 	--  r   c                     | j                  dt        j                         dd       | j                  dt        j                         dd       y)	zNAdds cache key includeHttpHeader and includeNamedCookie flags to the argparse.z--cache-key-include-http-headerHEADER_FIELD_NAMEz      Specifies a comma-separated list of HTTP headers, by field name, to
      include in cache keys. Only the request URL is included in the cache
      key by default.
      typemetavarr4   z"--cache-key-query-string-whitelistQUERY_STRINGz      Specifies a comma-separated list of query string parameters to include
      in cache keys. Default parameters are always included. '&' and '=' are
      percent encoded and not treated as delimiters.
      N)r9   r   ArgListr<   s    r   AddCacheKeyExtendedCachingArgsrG      sX    ' !
	  	 	* 
	  	r   c                 L    | j                  dddgt        j                  d      S )z(Add support for --compression-mode flag.z--compression-modeDISABLED	AUTOMATICa        Compress text responses using Brotli or gzip compression, based on
      the client's Accept-Encoding header. Two modes are supported:
      AUTOMATIC (recommended) - automatically uses the best compression based
      on the Accept-Encoding header sent by the client. In most cases, this
      will result in Brotli compression being favored.
      DISABLED - disables compression. Existing compressed responses cached
      by Cloud CDN will not be served to clients.
      )choicesrB   r4   r9   r   ChoiceToEnumNamerF   s    r   AddCompressionModerN      s3    			;'%%
	 
 
 r   c                 X    | j                  d|rddgndgt        j                  dd      S )z-Add support for --load-balancing-scheme flag.z--load-balancing-schemeINTERNAL_MANAGEDEXTERNAL_MANAGEDFz      The load balancing scheme of the backend bucket.
      If left blank, the backend bucket will be compatible with Global External
      Application Load Balancer or Classic Application Load Balancer.
      )rK   rB   r%   r4   rL   )r<   enable_external_manageds     r   AddLoadBalancingSchemerS      sB    				  "#56%%
 
 
 r   c                 P    | j                  dt        j                         dd      S )z-Add support for --resource-manager-tags flag.z--resource-manager-tagsz	KEY=VALUEz`      Comma-separated list of Resource Manager tags
      to apply to the backend bucket.
      rA   )r9   r   ArgDictrF   s    r   AddResourceManagerTagsrV      s1    			 
	 
 
 r   N)F)T)__doc__googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   compute_completersr   r"   $googlecloudsdk.command_lib.util.apisr   _GCS_BUCKET_DETAILED_HELPDEFAULT_LIST_FORMATListCommandCompleterr   r$   r#   GCS_BUCKET_ARGREQUIRED_GCS_BUCKET_ARG(GLOBAL_REGIONAL_MULTI_BACKEND_BUCKET_ARGr6   &GLOBAL_REGIONAL_BACKEND_BUCKET_ARG_IAMr.   r1   r>   rG   rN   rS   rV   r   r   r   <module>rc      s7    B 0 O E :/ 	 0EE  0//"%	.+ 9-88"%	.+  ,J=+I+I	"%6., ( &D]%C%C	"%6.& " *H)G)G	"%6.H* & @EB2$"
r   