
    =#                        S r SSKJr  SSKJr  SSKJr  SSK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,                  " SSS9r\R,                  " SSS9r\R,                  " SSSSSS9r\R,                  " SSSSSS9r\R,                  " SSS9r\R,                  " S S!S9r\R,                  " S"S#SS$\R:                  S%9r\R,                  " S&S'S\R>                  S(\R@                  " S)S*9S+9r!\R,                  " S,SSS-9r"\R,                  " S.S/S0SS19r#\R,                  " S2S3S4SS19r$SAS5 jr%S6 r&S7 r'S8 r(S9 r)S: r*\R,                  " S;SS\*S<9r+/ S=Qr,S> r-\R\                  " \R^                  S?5      r0S@ r1g)Bz?This module holds common flags used by the gcloud app commands.    )absolute_import)division)unicode_literalsN)	logs_util)storage_util)appinfo)arg_parsers)base)
exceptions)log)	constants)dockerdomainzYA valid domain which may begin with a wildcard, such as: `example.com` or `*.example.com`helpidzThe id of the certificate. This identifier is printed upon creation of a new certificate. Run `{parent_command} list` to view existing certificates.z--launch-browser
store_trueTlaunch_browserzCLaunch a browser if possible. When disabled, only displays the URL.)actiondefaultdestr   z--ignore-bad-certsFzTHIS ARGUMENT NEEDS HELP TEXT.)r   r   hiddenr   z--ignore-filezCOverride the .gcloudignore file and use the specified file instead.priorityzAn integer between 1 and 2^32-1 which indicates the evaluation order of rules. Lowest priority rules are evaluated first. The handle `default` may also be used to refer to the final rule at priority 2^32-1 which is always present in a set of rules.z--levelzCFilter entries with severity equal to or higher than a given level.any)r   requiredr   choicesz--logsz}Filter entries from a particular set of logs. Must be a comma-separated list of log names (request_log, stdout, stderr, etc).APP_LOG   )
min_length)r   r   r   metavartypez--server)r   r   	--service-szLimit to specific service.)r   r   	--version-vzLimit to specific version.c                     U R                   " S/U(       a  S/O/ Q7SSS.6  U R                   " S/U(       a  S/O/ Q7SSS.6  g	)
zAdd arguments to a parser for selecting service and version.

Args:
  parser: An argparse.ArgumentParser.
  short_flags: bool, whether to add short flags `-s` and `-v` for service
    and version respectively.
r"   r#   FzThe service ID.r   r   r$   r%   zThe version ID.Nadd_argument)parsershort_flagss     +lib/googlecloudsdk/command_lib/app/flags.pyAddServiceVersionSelectArgsr-   _   sZ     	)TFr 	)TFr    c                     [         R                  " SSS9nU(       a3  U R                  5       nUR                  U5        UR	                  SSSS9  gUR                  U 5        g)	z;Add the --certificate-id flag to a domain-mappings command.z--certificate-idzA certificate id to use for this domain. May not be used on a domain mapping with automatically managed certificates. Use the `gcloud app ssl-certificates list` to see available certificates for this app.r   z--no-certificate-idr   z2Do not associate any certificate with this domain.)r   r   N)r
   Argumentadd_mutually_exclusive_groupAddToParserr)   )r*   include_no_certcertificate_idgroups       r,   AddCertificateIdFlagr6   r   sh     ==. //1Eu%	A  C
 v&r.   c                 V    [         R                  " SSS/SS9nUR                  U 5        g)z/Adds common flags to a domain-mappings command.z--certificate-management	automaticmanualzType of certificate management. 'automatic' will provision an SSL certificate automatically while 'manual' requires the user to provide a certificate id to provision.)r   help_strN)r
   ChoiceArgumentr2   )r*   certificate_arguments     r,   AddCertificateManagementFlagr=      s5    ,, H%EG ""6*r.   c                 n    U R                  SUSS9  U R                  SUSSS9  U R                  SUSS	S9  g
)z4Add the common flags to an ssl-certificates command.z--display-namez$A display name for this certificate.r'   z--certificateLOCAL_FILE_PATHz      The file path for the new certificate to upload. Must be in PEM
      x.509 format including the header and footer.
      )r   r    r   z--private-keyz      The file path to a local RSA private key file. The private key must be
      PEM encoded with header and footer and must be 2048 bits
      or fewer.
        Nr(   r*   r   s     r,   AddSslCertificateFlagsrA      sf     	1  3 	
	   		  r.   c                 r    U R                  SUSS9  U R                  SUSS/S SS	9  U R                  S
SS9  g)z1Add the common flags to a firewall-rules command.z--source-rangezUAn IP address or range in CIDR notation or the ```*``` wildcard to match all traffic.r'   z--actionALLOWDENYc                 "    U R                  5       $ )N)upper)xs    r,   <lambda>'AddFirewallRulesFlags.<locals>.<lambda>   s
    QWWYr.   zAllow or deny matched traffic.)r   r   r!   r   z--descriptionzA text description of the rule.r   Nr(   r@   s     r,   AddFirewallRulesFlagsrJ      sg     	&'J  L 	j'&/.;	  =
 	=  ?r.   c                 .    [         R                  " S5      e)Na  The --docker-build flag no longer exists.

Docker images are now built remotely using Google Container Builder. To run a
Docker build on your own host, you can run:
  docker build -t gcr.io/<project>/<service.version> .
  gcloud docker push gcr.io/<project>/<service.version>
  gcloud app deploy --image-url=gcr.io/<project>/<service.version>
If you don't already have a Dockerfile, you must run:
  gcloud beta app gen-config
first to get one.
  )argparseArgumentTypeError)unused_values    r,   ValidateDockerBuildFlagrO      s    "" $ 	 r.   z--docker-build)r   r   r!   )debuginfowarningerrorcriticalc                     [         R                  " S5        U R                  (       d  [        R                  " U5      e[
        R                  R                  U R                  5      $ )zGets a bucket reference for a Cloud Build.

Args:
  app: App resource for this project
  project: str, The name of the current project.

Returns:
  storage_util.BucketReference, The bucket to use.
z/No bucket specified, retrieving default bucket.)r   rP   
codeBucketr   DefaultBucketAccessErrorr   BucketReferenceFromUrl)appprojects     r,   GetCodeBucketr\      sD     ))=>	

-
-g
66		%	%	-	-cnn	==r.   zMay only contain lowercase letters, digits, and hyphens. Must begin and end with a letter or digit. Must not exceed 63 characters.c                     U c  g[        U5      S:w  a  [        R                  " 5       e[        R                   H  nU R                  U5      (       d  M    g   [        R                  " U 5      e)a  Check the user-provided image URL.

Ensures that:
- it is consistent with the services being deployed (there must be exactly
  one)
- it is an image in a supported Docker registry

Args:
  image_url: str, the URL of the image to deploy provided by the user
  services: list, the services to deploy

Raises:
  MultiDeployError: if image_url is provided and more than one service is
    being deployed
  docker.UnsupportedRegistryError: if image_url is provided and does not point
    to one of the supported registries
Nr   )lenr   MultiDeployErrorr   ALL_SUPPORTED_REGISTRIES
startswithr   UnsupportedRegistryError)	image_urlservicesregistrys      r,   ValidateImageUrlrf      s_    ( 
]a

%
%
''44hH%% 5 	''	22r.   )F)2__doc__
__future__r   r   r   rL   googlecloudsdk.api_lib.appr   googlecloudsdk.api_lib.storager   googlecloudsdk.appengine.apir   googlecloudsdk.callioper	   r
   googlecloudsdk.command_lib.appr   googlecloudsdk.corer   googlecloudsdk.core.dockerr   r   r0   DOMAIN_FLAGCERTIFICATE_ID_FLAGLAUNCH_BROWSERIGNORE_CERTS_FLAGIGNORE_FILE_FLAGFIREWALL_PRIORITY_FLAG
LOG_LEVELSLEVELDEFAULT_LOGSArgListLOGSSERVER_FLAGSERVICEVERSIONr-   r6   r=   rA   rJ   rO   DOCKER_BUILD_FLAGLOG_SEVERITIESr\   RegexpValidatorMODULE_VERSION_ID_RE_STRINGVERSION_TYPErf    r.   r,   <module>r      s    F &  '  0 7 0 / ( 5 # 0 -mm-/
 mm24  ,<	NP
 MM	)+  ==	NP  ?A  		N  	" }} ""				*, mmt"BD --85J --85J&'*+4?  MM	)	 	"  C>" **''PQ3r.   