
                            S 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
SS.r\	R                  " \	R                  R                   5      \	R"                   " S S\	R$                  5      5       5       r\	R                  " \	R                  R(                  5      \	R"                   " S S\	R$                  5      5       5       rg)z)Command to import IaC for an Application.    )absolute_import)division)unicode_literals)applications)base)flags)utilszDImport Infrastructure as Code (IaC) for a Design Center Application.a           To import IaC from a Google Cloud Storage URI into the application `my-app` in space `dev-space` and location `us-central1`, run:

          $ {command} my-app --location=us-central1 --space=dev-space --gcs-uri=gs://my-bucket/iac

        To import IaC from a local YAML file named `iac_module.yaml` into the application `my-app` in space `dev-space` and location `us-central1`, run:

          $ {command} my-app --location=us-central1 --space=dev-space --iac-module-from-file=iac_module.yaml

        To import IaC from a Google Cloud Storage URI into the application `my-app`, allowing partial imports of valid edits, run:

          $ {command} my-app --location=us-central1 --space=dev-space --gcs-uri=gs://my-bucket/iac --allow-partial-import

        To import IaC from a local YAML file into the application `my-app`, allowing partial imports of valid edits, run:

          $ {command} my-app --location=us-central1 --space=dev-space --iac-module-from-file=iac_module.yaml --allow-partial-import

        To validate IaC from a Google Cloud Storage URI for the application `my-app` without importing, run:

          $ {command} my-app --location=us-central1 --space=dev-space --gcs-uri=gs://my-bucket/iac --validate-iac

        To validate IaC from a local YAML file for the application `my-app` without importing, run:

          $ {command} my-app --location=us-central1 --space=dev-space --iac-module-from-file=iac_module.yaml --validate-iac

        To validate IaC from a Google Cloud Storage URI for the application `my-app` and indicate that a future import should allow partial success, run:

          $ {command} my-app --location=us-central1 --space=dev-space --gcs-uri=gs://my-bucket/iac --validate-iac --allow-partial-import

        To validate IaC from a local YAML file for the application `my-app` and indicate that a future import should allow partial success, run:

          $ {command} my-app --location=us-central1 --space=dev-space --iac-module-from-file=iac_module.yaml --validate-iac --allow-partial-import
        z         This command uses the designcenter/v1alpha API. The full documentation for
        this API can be found at:
        http://cloud.google.com/application-design-center/docs
        )DESCRIPTIONEXAMPLESzAPI REFERENCEc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)	ImportIacF   7Import Infrastructure as Code (IaC) for an Application.c                 Z    [         R                  " U SS9  [         R                  " U 5        g Nzto import IaC into)verbr   AddApplicationResourceArgAddImportIacFlagsparsers    ;lib/surface/design_center/spaces/applications/import_iac.pyArgsImportIac.ArgsM   !    	##F1EF	F#    c                 (   [         R                  " U R                  5       5      nUR                  R                  R                  5       nS nUR                  (       a7  [        R                  " UR                  5      n [        R                  " X%5      nUR                  UR!                  5       UR"                  UUR$                  UR&                  S9nU$ ! [         a3  n[        R                  R                  SR                  U5      5      eS nAff = fNz-Invalid format for --iac-module-from-file: {})namegcs_uri
iac_moduleallow_partial_importvalidate_iacapisApplicationsClientReleaseTrackCONCEPTSapplicationParseiac_module_from_filer   ParseIacModuleFiler	   ParseIaCModuleData
ValueErrorarg_parsersArgumentTypeErrorformatr   RelativeNamer    r"   r#   selfargsclientapp_refiac_module_msgiac_module_dataeresponses           r   RunImportIac.RunR       $$T%6%6%89Fmm''--/GN  001J1JKoG11&J
 !!#!!66&&   (H O  G11;BB1EG 	GG   =C 
D.DD N__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpstaticmethodr   r<   __static_attributes__r@   r   r   r   r   F   $     @ -$ $r   r   c                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)ImportIacGah   r   c                 Z    [         R                  " U SS9  [         R                  " U 5        g r   r   r   s    r   r   ImportIacGa.Argso   r   r   c                 (   [         R                  " U R                  5       5      nUR                  R                  R                  5       nS nUR                  (       a7  [        R                  " UR                  5      n [        R                  " X%5      nUR                  UR!                  5       UR"                  UUR$                  UR&                  S9nU$ ! [         a3  n[        R                  R                  SR                  U5      5      eS nAff = fr   r$   r3   s           r   r<   ImportIacGa.Runt   r>   r?   r@   NrA   r@   r   r   rM   rM   h   rK   r   rM   N)rF   
__future__r   r   r   $googlecloudsdk.api_lib.design_centerr   r%   googlecloudsdk.callioper   (googlecloudsdk.command_lib.design_centerr   r	   rG   ReleaseTracksr'   ALPHAUniverseCompatibleCommandr   GArM   r@   r   r   <module>r\      s    0 &  ' E ( : 6 Z BG(X D%%++,   -@ D%%(()$,,   *r   