
    ;3                         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	 rS
 rS rS rSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrS rSS jrS rg)z7Flags and helpers for the config-manager command group.    )absolute_import)division)unicode_literals)util)configmanager_util)arg_parsers)basec                 N    U R                  SS[        R                  " 5       US9  g)zAdd --labels flag.z--labels	KEY=VALUEmetavartypehelpNadd_argumentr   ArgDictparser	help_texts     5lib/googlecloudsdk/command_lib/infra_manager/flags.pyAddLabelsFlagr      s*     	      c                 N    U R                  SS[        R                  " 5       US9  g)zAdd --annotations flag.z--annotationsr   r   Nr   r   s     r   AddAnnotationsFlagr   %   s*     	  r   c                 B    [         R                  R                  U 5        g)zAdd --async flag.N)r	   
ASYNC_FLAGAddToParser)r   s    r   AddAsyncFlagr   /   s    //f%r   c                 (   SnSnSnSnSnSnSnSnU R                  S	S
9n	U	R                  5       n
U
R                  SS[        R                  " 5       US9  U
R                  SUS9  U	R                  5       nUR                  SUS9  UR                  S	S
9nUR                  SUS9  UR                  SUS9  UR                  SUS9  UR                  S	S
9nUR                  SUS9  UR                  SSS9  UR                  SUS[
        R                  S9  g)z%Add TerraformBlueprint related flags.a6  Input variable values for the Terraform blueprint. It only
      accepts (key, value) pairs where value is a scalar value.

Examples:

Pass input values on command line:

  $ {command} projects/p1/location/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --input-values=projects=p1,region=r
a9  A .tfvars file containing terraform variable values. --inputs-file flag is supported for python version 3.6 and above.

Examples:

Pass input values on the command line:

  $ {command} projects/p1/location/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --inputs-file=path-to-tfvar-file.tfvar
zURI of an object in Google Cloud Storage.
      e.g. `gs://{bucket}/{object}`

Examples:

Create a deployment from a storage my-bucket:

  $ {command} projects/p1/location/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket"
a  Repository URL.
Example: 'https://github.com/examples/repository.git'

Use in conjunction with `--git-source-directory` and `--git-source_ref`

Examples:

Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:

  $ {command} projects/p1/location/us-central1/deployments/my-deployment --git-source-repo="https://github.com/examples/repository.git"
    --git-source-directory="staging/compute" --git-source-ref="mainline"
a  Subdirectory inside the repository.
Example: 'staging/my-package'

Use in conjunction with `--git-source-repo` and `--git-source-ref`

Examples:

Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:

  $ {command} projects/p1/location/us-central1/deployments/my-deployment --git-source-repo="https://github.com/examples/repository.git"
    --git-source-directory="staging/compute" --git-source-ref="mainline"
a  Subdirectory inside the repository.
Example: 'staging/my-package'

Use in conjunction with `--git-source-repo` and `--git-source-directory`

Examples:

Create a deployment from the "https://github.com/examples/repository.git" repo, "staging/compute" folder, "mainline" branch:

  $ {command} projects/p1/location/us-central1/deployments/my-deployment --git-source-repo="https://github.com/examples/repository.git"
    --git-source-directory="staging/compute" --git-source-ref="mainline"
ax  Local storage path where config files are stored. When using this option, Terraform config file references outside this storage path is not supported.
      e.g. `./path/to/blueprint`

Examples:

Create a deployment from a local storage path `./path/to/blueprint`:

  $ {command} projects/p1/location/us-central1/deployments/my-deployment --local-source="./path/to/blueprint"
a  Use in conjunction with `--local-source` to specify a destination storage bucket for
uploading local files.

If unspecified, the bucket defaults to `gs://PROJECT_NAME_blueprints`. Uploaded
content will appear in the `source` object under a name comprised of the
timestamp and a UUID. The final output destination looks like this:
`gs://_BUCKET_/source/1615850562.234312-044e784992744951b0cd71c0b011edce/`

Examples:

Create a deployment from a local storage path `./path/to/blueprint` and stage-bucket `gs://my-bucket`:

  $ {command} projects/p1/location/us-central1/deployments/my-deployment --local-source="./path/to/blueprint" --stage-bucket="gs://my-bucket"
F)mutexz--input-valuesr   r   z--inputs-file)r   z--gcs-sourcez--git-source-repoz--git-source-directoryz--git-source-refz--local-sourcez--ignore-filez{Override the `.gcloudignore` file and use the specified file instead. See `gcloud topic gcloudignore` for more information.z--stage-bucketT)r   hiddenr   N)	add_groupadd_mutually_exclusive_groupr   r   r   functions_api_util%ValidateAndStandarizeBucketUriOrRaise)r   input_values_help_textinputs_file_help_textgcs_source_help_textgit_source_repo_helpgit_source_directory_helpgit_source_ref_helplocal_source_helpstage_bucket_helpsource_groupinput_valuessource_detailsgit_source_grouplocal_source_groups                 r   AddTerraformBlueprintFlagr3   4   s   			  !!!.,::<, !	      
  <<>.  
 $--E-:   
 $   
    
 &//e/<!! " 
 !!K "  !! CC " r   c                 &    U R                  SUSS9  g)zAdd --service-account flag.z--service-accountzUser-specified Service Account (SA) to be used as credential to manage resources. Format: `projects/{projectID}/serviceAccounts/{serviceAccount}`r!   r   Nr   r   r!   s     r   AddServiceAccountFlagr8      s!    E	  r   c                 (    U R                  SUSSS9  g)z%Add --import-existing-resources flag.z--import-existing-resources
store_trueaG  By default, Infrastructure Manager will return a failure when Terraform encounters a 409 code (resource conflict error) during actuation. If this flag is set to true, Infrastructure Manager will instead attempt to automatically import the resource into the Terraform state (for supported resource types) and continue actuation.)r!   actionr   Nr6   r7   s     r   AddImportExistingResourcesFlagr<      s#    #  r   c                 &    U R                  SUSS9  g)zAdd --worker-pool flag.z--worker-poolzUser-specified Worker Pool resource in which the Cloud Build job will execute. Format: projects/{project}/locations/{location}/workerPools/{workerPoolId}r5   Nr6   r7   s     r   AddWorkerPoolFlagr>      s!    O	  r   c                 &    U R                  SUSS9  g)z Add --artifacts-gcs-bucket flag.z--artifacts-gcs-bucketzuser-defined location of Cloud Build logs, artifacts, and Terraform state files in Google Cloud Storage. Format: `gs://{bucket}/{folder}` A default bucket will be bootstrapped if the field is not set or emptyr5   Nr6   r7   s     r   AddArtifactsGCSBucketFlagr@   	  s     +	  	r   c                 (    U R                  SUSSS9  g)zAdd --draft flag.z--draftzWIf this flag is set to true, the exported deployment state file will be the draft stater:   )r!   r   r;   Nr6   r7   s     r   AddDraftFlagrB     s%        r   c                 (    U R                  SSUSS9  g)zAdd --lock-id flag.z	--lock-idTz>Lock ID of the lock file to verify person importing owns lock.)requiredr!   r   Nr6   r7   s     r   AddLockFlagrE   $  s!    K	  r   c                 &    U R                  SUSS9  g)zAdd --deployment flag.z--deploymentz!Deployment reference for preview.r5   Nr6   r7   s     r   AddDeploymentFlagrG   .  s    .  r   c                 &    U R                  SUSS9  g)zAdd --preview-mode flag.z--preview-modez3Preview mode to set it to either default or delete.r5   Nr6   r7   s     r   AddPreviewModeFlagrI   7  s    @  r   c                 &    U R                  SUUS9  g)zAdd --file flag.z--filer5   Nr6   )r   r   r!   s      r   AddFileFlagrK   @  s      r   c                 &    U R                  SUSS9  g)z!Add --tf-version-constraint flag.z--tf-version-constraintzCUser-specified Terraform version constraint, for example "=1.3.10".r5   Nr6   r7   s     r   AddTFVersionConstraintFlagrM   I  s    
O	  r   c                 0    U R                  SUS[        S9  g)zAdd --quota-validation flag.z--quota-validationzInput to control quota checks for resources in terraform configuration files. There are limited resources on which quota validation applies. Supported values are QUOTA_VALIDATION_UNSPECIFIED, ENABLED, ENFORCEDr!   r   r   N)r   QuotaValidationEnumr7   s     r   AddQuotaValidationFlagrQ   T  s'     	=
   
r   c                 d   [         R                  " 5       nUR                  R                  R                  UR                  R                  R
                  UR                  R                  R                  S.nU c  gX;  a/  [        R                  " SR                  U [        U5      5      5      eX    $ )zChecks if a quota validation provided by user is valid and returns corresponding enum type.

Args:
  quota_validation: value for quota validation.

Returns:
  quota validation enum
Raises:
  ArgumentTypeError: If the value provided by user is not valid.
)QUOTA_VALIDATION_UNSPECIFIEDENABLEDENFORCEDNzCquota validation does not support: '{0}', supported values are: {1})r   GetMessagesModule
DeploymentQuotaValidationValueValuesEnumrS   rT   rU   r   ArgumentTypeErrorformatlist)quota_validationmessagesquota_validation_enum_dicts      r   rP   rP   d  s      113( 


<
<
Y
Y$$CCKK%%DDMM  
7

'
'M	 $'A"B	C  
$	55r   c                 0    U R                  SUS[        S9  g)zAdd --provider-source flag.z--provider-sourcezsInput to control from where to fetch providers. Supported values arePROVIDER_SOURCE_UNSPECIFIED, SERVICE_MAINTAINEDrO   N)r   ProviderSourceEnumr7   s     r   AddProviderSourceFlagra     s%    <   r   c                 &   [         R                  " 5       nUR                  R                  R                  UR                  R                  R
                  S.nU c  gX;  a/  [        R                  " SR                  U [        U5      5      5      eX    $ )zChecks if a provider config provided by user is valid and returns corresponding enum type.

Args:
  provider_source: value for provider source.

Returns:
  provider source enum

Raises:
  ArgumentTypeError: If the value provided by user is not valid.
)PROVIDER_SOURCE_UNSPECIFIEDSERVICE_MAINTAINEDNzBprovider config does not support: '{0}', supported values are: {1})
r   rV   ProviderConfigSourceTypeValueValuesEnumrc   rd   r   rY   rZ   r[   )provider_sourcer]   provider_source_enum_dicts      r   r`   r`     s      113( 
!
!
;
;
W
W 
!
!
;
;
N
N 
5

'
'L	&?!@	A  
#	33r   N)F)T)__doc__
__future__r   r   r   #googlecloudsdk.api_lib.functions.v1r   r$   $googlecloudsdk.api_lib.infra_managerr   googlecloudsdk.callioper   r	   r   r   r   r3   r8   r<   r>   r@   rB   rE   rG   rI   rK   rM   rQ   rP   ra   r`    r   r   <module>ro      s|    > &  ' J C / (&
gT
"

 6@
4r   