
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZ dd
lmZ ddZ	 ddee	j$                     dej&                  deej(                     fdZd Zd Zd Zd Zd Zd Zy)z1Code for making shared messages between commands.    )absolute_import)division)print_function)unicode_literals)Optional)types_utils)integration_printer)base)runapps_v1alpha1_messagesc                 (    dj                  | ||      S )zReturns a user message for a successful integration deploy.

  Args:
    integration_type: str, type of the integration
    integration_name: str, name of the integration
    action: str, the action that succeeded
  zQ[{{bold}}{}{{reset}}] integration [{{bold}}{}{{reset}}] has been {} successfully.format)integration_typeintegration_nameactions      @lib/googlecloudsdk/command_lib/run/integrations/messages_util.pyGetSuccessMessager      s    "
F-v67    Nmetadataresourceresource_statusc           
          t        j                  |       }|j                  t        j                  d| d||d            S )a  Print the call to action message for the given integration.

  Args:
    metadata: the type metadata
    resource: the integration resource object
    resource_status: status of the integration

  Returns:
    A formatted string of the call to action message.
  N)namer   regionr   statuslatest_deployment)r	   GetFormatterCallToActionr
   Record)r   r   r   	formatters       r   GetCallToActionr!   ,   sD     "..x8)			! 
 r   c                 $    dj                  |       S )zReturns message when delete command fails.

  Args:
    integration_name: str, name of the integration.

  Returns:
    A formatted string of the error message.
  zODeleting Integration [{}] failed, please rerun the delete command to try again.r   )r   s    r   GetDeleteErrorMessager#   F   s     012r   c                 8    dj                  t        |       |      S )zMessage about check status with describe command.

  Args:
    release_track: Release track of the command being run.
    integration_name: str, name of the integration.

  Returns:
    A formatted string of the message.
  zEYou can check the status with `gcloud {}run integrations describe {}`r   _ReleaseCommandPrefixrelease_trackr   s     r   CheckStatusMessager)   S   s!     Nv#M24DEGr   c                 >    ddj                  t        |       |      z   S )zMessage about retry deployment using update command.

  Args:
    release_track: Release track of the command being run.
    integration_name: str, name of the integration.

  Returns:
    A formatted string of the message.
  z,To retry the deployment, use update command z%`gcloud {}run integrations update {}`r%   r'   s     r   RetryDeploymentMessager+   b   s)     53v#M24DEFGr   c                 ,    | j                   }|r|dz  }|S )zPrefix for release track for printing commands.

  Args:
    release_track: Release track of the command being run.

  Returns:
    A formatted string of the release track prefix
   )prefix)r(   tracks     r   r&   r&   r   s      

%
	SLE	,r   c                 $    dj                  |       S )zGenerates a message when an integration already exists during create.

  Args:
    name: name of the integration.

  Returns:
    A string message.
  z[Integration with name [{}] already exists. Update it with `gcloud run integrations update`.r   r   s    r   IntegrationAlreadyExistsr2      s    =>DfTlKr   c                 $    dj                  |       S )zGenerates a message when an integration is not found.

  Args:
    name: name of the integration.

  Returns:
    A string message.
  zdIntegration [{}] cannot be found. First create an integration with `gcloud run integrations create`.r   r1   s    r   IntegrationNotFoundr4      s    O6$<r   )deployed)N)__doc__
__future__r   r   r   r   typingr   'googlecloudsdk.api_lib.run.integrationsr   +googlecloudsdk.command_lib.run.integrationsr	   6googlecloudsdk.command_lib.run.integrations.formattersr
   6googlecloudsdk.generated_clients.apis.runapps.v1alpha1r   runappsr   TypeMetadataResourceResourceStatusr!   r#   r)   r+   r&   r2   r4    r   r   <module>rB      s    8 &  % '  ? K G g7" 9={//0 g4454
2GG 
Kr   