
    K                     ^    d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ d Zd Z	d	 Z
d
 Zd Zy)z8Deployment utilities for `gcloud gsuiteaddons` commands.    )absolute_import)division)unicode_literalsN)filesc                 V    t        j                  |       }t        j                  |      S N)r   ReadFileContentsjsonloads)deployment_filefs     8lib/googlecloudsdk/command_lib/workspace_add_ons/util.pyParseJsonFileToDeploymentr      s     _-!	A    c                 ,    t        j                  |       S r   )r
   r   )
deployments    r   LoadJsonStringr      s    	J	r   c                 2    ~ ~|j                   dz   |_         |S )aS  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                     ~dj                  | j                         j                         | j                  j	                  dd            |_        |S )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                     ~dj                  | j                         j                         | j                  j	                  dd            |_        |S )av  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   