
    K                     ^    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 rS r	S	 r
S
 rS rg)z8Deployment utilities for `gcloud gsuiteaddons` commands.    )absolute_import)division)unicode_literalsN)filesc                 Z    [         R                  " U 5      n[        R                  " U5      $ N)r   ReadFileContentsjsonloads)deployment_filefs     8lib/googlecloudsdk/command_lib/workspace_add_ons/util.pyParseJsonFileToDeploymentr      s     _-!	A    c                 .    [         R                  " U 5      $ r   )r
   r   )
deployments    r   LoadJsonStringr      s    	J	r   c                 2    A AUR                   S-   Ul         U$ )aA  Sets the request path in name attribute for authorization request.

Appends /authorization at the end of the request path for the singleton
authorization request.

Args:
  unused_ref: reference to the project object.
  unused_args: command line arguments.
  request: API request to be issued

Returns:
  modified request
z/authorization)name)
unused_refunused_argsrequests      r   SetAuthorizationNamePathr   #   s     + 00',	.r   c                     ASR                  U R                  5       R                  5       U R                  R	                  SS5      5      Ul        U$ )a|  Sets the request path in the name attribute for install status request.

Replaces the '/' within the deployment name by '%2F' and appends
/installStatus at the end of the request path for the install
status request.

Args:
  deployment_ref: reference to the deployment object
  unused_args: command line arguments.
  request: API request to be issued

Returns:
  modified request
z{}/deployments/{}/installStatus/%2FformatParentRelativeNamedeploymentsIdreplacer   deployment_refr   r   s      r   SetInstallStatusNamePathr%   6   sK     299**,""**368', 
.r   c                     ASR                  U R                  5       R                  5       U R                  R	                  SS5      5      Ul        U$ )ab  Sets the request path in the name attribute for various add on commands.

Replaces the '/' within the deployment name by '%2F' in the install,
uninstall,
delete, replace, describe commands.

Args:
  deployment_ref: reference to the deployment object
  unused_args: command line arguments.
  request: API request to be issued

Returns:
  modified request
z{}/deployments/{}r   r   r   r#   s      r   HandleEscapingInNamePathr'   L   sK     $++**,""**368', 
.r   )__doc__
__future__r   r   r   r
   googlecloudsdk.core.utilr   r   r   r   r%   r'    r   r   <module>r,      s2    ? &  '  *
 &,r   