
    W`                     T   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Z
d+d	Zd,d
Zd-dZd.dZd/dZd0dZd1dZd Zd2dZd*dZd+dZd,dZd-dZd.dZd/dZd3dZd4dZd Zd Zd Z	 	 d5dZ	 d4dZ d4dZ!d4d Z"d6d!Z#d6d"Z$d# Z%d4d$Z&d4d%Z'd4d&Z(d4d'Z)d4d(Z*y))7z>Shared resource flags for Database Migration Service commands.    )absolute_import)division)unicode_literals)concepts)concept_parsers)presentation_specsc                 0    t        j                  | d      S )Nz)The connection profile of the {resource}.name	help_textr    ResourceParameterAttributeConfigr   s    >lib/googlecloudsdk/api_lib/database_migration/resource_args.py ConnectionProfileAttributeConfigr          		2	2F
H H    c                 0    t        j                  | d      S )Nz$The migration job of the {resource}.r
   r   r   s    r   MigrationJobAttributeConfigr      s    		2	2A
C Cr   c                 0    t        j                  | d      S )Nz)The private connection of the {resource}.r
   r   r   s    r    PrivateConnectionAttributeConfigr   $   r   r   c                 0    t        j                  | d      S )Nz)The service attachment of the {resource}.r
   r   r   s    r    ServiceAttachmentAttributeConfigr   )   s    		2	2F
 r   c                 0    t        j                  | d      S )Nz+The conversion workspace of the {resource}.r
   r   r   s    r   "ConversionWorkspaceAttributeConfigr   /   s    		2	2H
 r   c                 .    t        j                  |       S )Nr   r   r   s    r   CmekKeyAttributeConfigr   5   s    		2	2	==r   c                 0    t        j                  | d      S )Nz&The CMEK keyring id of the {resource}.r
   r   r   s    r   CmekKeyringAttributeConfigr   :   s    		2	2C
 r   c                 0    t        j                  | d      S )Nz(The Cloud project id for the {resource}.r
   r   r   s    r   CmekProjectAttributeConfigr!   @   s    		2	2E
 r   c                  0    t        j                  dd      S )Nregionz$The Cloud region for the {resource}.r
   r    r   r   RegionAttributeConfigr%   F   s    		2	2E
G Gr   c                 b    t        j                  d| t               t         j                  d      S )Nz datamigration.projects.locationsF)resource_namelocationsId
projectsIddisable_auto_completers)r   ResourceSpecr%    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr'   s    r   GetRegionResourceSpecr.   K   s-    			(!')::#
% %r   c                 x    t        j                  d| t        |       t               t         j                  d      S )Nz3datamigration.projects.locations.connectionProfilesr   F)r'   connectionProfilesIdr(   r)   r*   )r   r+   r   r%   r,   r-   s    r    GetConnectionProfileResourceSpecr1   T   s5    			;!;O')::#
% %r   c                 x    t        j                  d| t        |       t               t         j                  d      S )Nz.datamigration.projects.locations.migrationJobsr   F)r'   migrationJobsIdr(   r)   r*   )r   r+   r   r%   r,   r-   s    r   GetMigrationJobResourceSpecr4   ^   s5    			6!1}E')::#
 r   c           	      z    t        j                  d| dt        |       t               t         j                  d      S )Nz3datamigration.projects.locations.privateConnectionsv1r   F)r'   api_versionprivateConnectionsIdr(   r)   r*   )r   r+   r   r%   r,   r-   s    r    GetPrivateConnectionResourceSpecr9   i   s8    			;!;O')::#
% %r   c                 d    t        j                  d| t        |       t         j                        S )Nzcompute.serviceAttachmentsr   )r'   serviceAttachmentproject)r   r+   r   r,   r-   s    r    GetServiceAttachmentResourceSpecr=   t   s,    			"!8mL77	
9 9r   c           	      z    t        j                  d| dt        |       t               t         j                  d      S )Nz5datamigration.projects.locations.conversionWorkspacesr6   r   F)r'   r7   conversionWorkspacesIdr(   r)   r*   )r   r+   r   r%   r,   r-   s    r   "GetConversionWorkspaceResourceSpecr@   |   s;    			=!?')::#
% %r   c           
      |    t        j                  d| dt               t               t	               t               d      S )N/cloudkms.projects.locations.keyRings.cryptoKeysr6   Fr'   r7   cryptoKeysId
keyRingsIdr(   r)   r*   r   r+   r   r   r%   r!   r-   s    r   GetCmekKeyResourceSpecrG      s9    			7!)++-')+-#	
 	r   c                     t        j                  d| dt        d      t        d      t	               t        d      d      S )NrB   r6   kms-keyzkms-keyringzkms-projectFrC   rF   r-   s    r   GetKMSKeyResourceSpecrJ      s?    			7!))4+M:')+M:#	
 	r   c                     |rd}nd}t         j                  j                  |t               dj	                  |      d      j                  |        y)a   Add a resource argument for a database migration connection profile.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
  connection_profile--connection-profileThe connection profile {}.TrequiredN)r   ConceptParserForResourcer1   formatAddToParserparserverb
positionalr   s       r   AddConnectionProfileResourceArgrY      sP     D!D++
&("))$/	 ,  ![(r   c           	          t        j                  dt               dj                  |      d      t        j                  dt               ddddi	      g}t	        j
                  |d
dgi      j                  |        y)zAdd resource arguments for a database migration CloudSQL connection profile.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
  rL   rN   TrO   z--source-idz8Database Migration Service source connection profile ID.r#    rP   flag_name_overridesz--source-id.region--regioncommand_level_fallthroughsN)r   ResourcePresentationSpecr1   rS   r   rQ   rT   rV   rW   resource_specss      r   (AddCloudSqlConnectionProfileResourceArgsrd      s     11

*
,
&
-
-d
3	
 11

*
,
D'n.. 
"	 
V	r   c                     t        j                  dt               dj                  |      d      t        j                  dt	               dddi	      g}t        j                  |d
dgi      j                  |        y)zAdd resource arguments for a database migration AlloyDB connection profile.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
  rL   rN   TrO   z	--kms-keyzName of the CMEK (customer-managed encryption key) used for this AlloyDB cluster. For example, projects/myProject/locations/us-central1/keyRings/myKeyRing/cryptoKeys/myKey.r#   r[   r]   z--kms-key.regionr^   r_   N)r   ra   r1   rS   rJ   r   rQ   rT   rb   s      r   'AddAlloyDBConnectionProfileResourceArgsrg      s     11

*
,
&
-
-d
3	 11


!_  (n	.$ "4zl!C Kr   c                 |    t         j                  j                  dt               dddi      j	                  |        y)zjAdd a resource argument for a connection profile cmek.

  Args:
    parser: the parser for the command.
  
--cmek-keyzName of the CMEK (customer-managed encryption key) used for the connection profile. For example, projects/myProject/locations/us-central1/keyRings/myKeyRing/cryptoKeys/myKey.r#   r[   rf   N)r   rQ   rR   rG   rT   )rV   s    r   AddCmekResourceArgsrj      sA     ++W $R. ,  Kr   c                 b   |rd}nd}| j                  d      }|j                  ddd       |j                         }|j                  d	d
|       |j                  dd|       |j                  ddd       |j                  |d      }|j                  dd       |j                  dd       t        j                  |t	               dj                  |      d      t        j                  dt               dddi|      g}t        j                  |dd gi!      j                  |        y")#aS  Add a resource argument for a database migration oracle cp.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
    required: bool, if True, means that a flag is required.
  rL   rM   Tmutex--static-ip-connectivity
store_trueuse static ip connectivityactionhelp--forward-ssh-hostnameHostname for the SSH tunnel.rs   rP   --forward-ssh-usernameUsername for the SSH tunnel.--forward-ssh-port3Port for the SSH tunnel, default value is 22.         rs   defaultrP   rm   --forward-ssh-password"          SSH password.
          rs   --forward-ssh-private-keySSH private key..rN   rO   --private-connection&Resource ID of the private connection.r#   r[   r]   group--private-connection.regionr^   r_   N
	add_groupadd_argumentr   ra   r1   rS   r9   r   rQ   rT   )	rV   rW   rX   rP   r   connectivity_parserforward_ssh_parserpassword_grouprc   s	            r   %AddOracleConnectionProfileResourceArgr      s{    D!D((t(4"" + # -
 +446!!- "  !!- "  !!
	 " 
 &///N. &   !(;  = 11

*
,
&
-
-d
3	
 11
 
*
,
2'n#%. 
'*"	 
V	r   c                 b   |rd}nd}| j                  d      }|j                  ddd       |j                         }|j                  d	d
d       |j                  ddd       |j                  ddd       |j                  dd      }|j                  dd       |j                  dd       t        j                  |t	               dj                  |      d      t        j                  dt               dddi|      g}t        j                  |dd gi!      j                  |        y")#a  Add a resource argument for a database migration sqlserver cp.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
  rL   rM   Trl   rn   ro   rp   rq   rt   ru   rv   rw   rx   ry   rz   r{   r|   r~   r   r   r   r   r   rN   rO   r   r   r#   r[   r   r   r^   r_   Nr   )rV   rW   rX   r   r   r   r   rc   s           r   (AddSqlServerConnectionProfileResourceArgr   B  s{    D!D((t(4"" + # -
 +446!!- "  !!- "  !!
	 " 
 &//T/J. &   !(;  = 11

*
,
&
-
-d
3	
 11
 
*
,
2'n#%. 
'*"	 
V	r   c                 X   |rd}nd}| j                  d      }|j                  ddd       t        j                  |t	               d	j                  |      d
      t        j                  dt               dddi|      g}t        j                  |ddgi      j                  |        y)a  Add a resource argument for a database migration postgresql cp.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
  rL   rM   Trl   rn   ro   rp   rq   rN   rO   z--psc-service-attachmentz&Resource ID of the service attachment.r#   r[   r   z--psc-service-attachment.regionr^   r_   N)
r   r   r   ra   r1   rS   r=   r   rQ   rT   )rV   rW   rX   r   r   rc   s         r   )AddPostgresqlConnectionProfileResourceArgr     s     D!D((t(4"" + #  11

*
,
&
-
-d
3	 11
$
*
,
2'n#. 
+j\"
 Kr   c                     |rd}nd}t        j                  |t               dj                  |      d      g}t	        j
                  |      j                  |        y)a7  Add resource arguments for actions on an mj except create/update.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    verb: str, the verb to describe the resource, such as 'to promote'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
  migration_jobz--migration-jobThe migration job {}.TrO   N)r   ra   r4   rS   r   rQ   rT   rV   rW   rX   r   rc   s        r   AddOnlyMigrationJobResourceArgsr     s_     DD 11

%
'
!
(
(
.	. Kr   c           
      H   t        j                  dt               dj                  |      d      t        j                  dt	               d|ddi	      t        j                  d
t	               d|ddi	      g}t        j                  |dgdgd      j                  |        y)a!  Add resource arguments for creating/updating a database migration job.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    required: boolean, whether source/dest resource args are required.
  r   r   TrO   --sourceFID of the source connection profile, representing the source database.r#   r[   r\   --destinationPID of the destination connection profile, representing the destination database.r^   )--source.region--destination.regionr_   N)r   ra   r4   rS   r1   r   rQ   rT   rV   rW   rP   rc   s       r   AddMigrationJobResourceArgsr     s     11

%
'
!
(
(
.	 11

*
, 'n	 11

*
,& 'n	#.8 (\#-," Kr   c                    t        j                  dt               dj                  |      d      t        j                  dt	               d|ddi	      t        j                  d
t	               d|ddi	      t        j                  dt               dddi      t        j                  dt               dddi      g}t        j                  |dgdgdgdgd      j                  |        y)a$  Add resource arguments for creating/updating a heterogeneous database mj.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    required: boolean, whether source/dest resource args are required.
  r   r   TrO   r   r   r#   r[   r\   r   r   --conversion-workspacezBName of the conversion workspaces to be used for the migration jobrf   ri   zMName of the CMEK (customer-managed encryption key) used for the migration jobr^   )r   r   z--conversion-workspace.regionz--cmek-key.regionr_   N)
r   ra   r4   rS   r1   r@   rG   r   rQ   rT   r   s       r   (AddHeterogeneousMigrationJobResourceArgsr     s    11

%
'
!
(
(
.	 11

*
, 'n	 11

*
,& 'n	 11
"
,
.
N'n	 11

 
"#  (nC*.V (\#-,,6< *|	" Kr   c                  `    d } t        j                  dd |        t         j                        S )z:Constructs and returns the Resource specification for VPC.c                  0    t        j                  dd      S )Nvpcz@fully qualified name of the VPC database migration will peer to.r
   r   r$   r   r   VpcAttributeConfigz.GetVpcResourceSpec.<locals>.VpcAttributeConfig7  s    44N r   zcompute.networksr   )r'   networkr<   )r   r+   r,   )r   s    r   GetVpcResourceSpecr   4  s1     
		 "77	
9 9r   c                     |rd}nd}t        j                  |t               dj                  |      d      g}t	        j
                  |      j                  |        ya   Add a resource argument for a database migration private connection.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
  private_connectionr   zThe private connection {}.TrO   Nr   ra   r9   rS   r   rQ   rT   r   s        r   AddPrivateConnectionResourceArgr   F  ]     D!D 11

*
,
&
-
-d
3	. /;;FCr   c                     |rd}nd}t        j                  |t               dj                  |      d      g}t	        j
                  |      j                  |        yr   r   r   s        r   %AddPrivateConnectionDeleteResourceArgr   _  r   r   c                     |rd}nd}t         j                  j                  |t               dj	                  |      d      j                  |        y)a"  Add a resource argument for a database migration conversion workspace.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to update'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
  conversion_workspacer   The conversion workspace {}.TrO   N)r   rQ   rR   r@   rS   rT   rU   s       r   !AddConversionWorkspaceResourceArgr   x  sP     !D#D++
(*$++D1	 , 
 Kr   c           	         |rd}nd}| j                  dd      }t        j                  |t               dj	                  |      d      t        j                  dt               dj	                  |      d	d
i|      t        j                  dt               dj	                  |      d	d
i|      g}t        j                  |dgdgd      j                  |        y)a  Add a resource argument for seeding a database migration cw.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to seed'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
  r   r   T)rm   rP   r   rO   z--source-connection-profilezThe connection profile {} from.r#   r[   r    --destination-connection-profiler^   )z"--source-connection-profile.region'--destination-connection-profile.regionr_   N)	r   r   ra   r@   rS   r1   r   rQ   rT   )rV   rW   rX   r   rL   rc   s         r   %AddConversionWorkspaceSeedResourceArgr     s     !D#D''dT'B 11

,
.
(
/
/
5	 11
'
*
,
+
2
24
8'n" 11
,
*
,
+
2
24
8'n"., 1;6@\"	
 
V	r   c                 *   |rd}nd}t        j                  |t               dj                  |      d      t        j                  dt	               dj                  |      dd	id
      g}t        j                  |ddgi      j                  |        y)a  Add a resource argument for applying a database migration cw.

  Args:
    parser: the parser for the command.
    verb: str, the verb to describe the resource, such as 'to apply'.
    positional: bool, if True, means that the resource is a positional rather
      than a flag.
  r   r   r   TrO   r   zThe connection profile {} to.r#   r[   )r]   rP   r   r^   r_   N)r   ra   r@   rS   r1   r   rQ   rT   r   s        r   &AddConversionWorkspaceApplyResourceArgr     s     !D#D 11

,
.
(
/
/
5	 11
,
*
,
)
0
0
6'n. 
3j\"	 
V	r   N)rL   )r   )r   )service_attachment)r   )zcmek-key)zcmek-keyring)zcmek-project)r#   )rI   )T)TT)F)+__doc__
__future__r   r   r    googlecloudsdk.calliope.conceptsr   (googlecloudsdk.command_lib.util.conceptsr   r   r   r   r   r   r   r   r   r!   r%   r.   r1   r4   r9   r=   r@   rG   rJ   rY   rd   rg   rj   r   r   r   r   r   r   r   r   r   r   r   r   r$   r   r   <module>r      s    E &  ' 5 D GH
C
H
>
G
%%%9	%

)(6>$ 6:37?H 9==@)X6*Z;|9$D2D2*+\!r   