
    [                        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 ej                   ej                   ej"                  j$                         G d dej&                                      Zy)z&Create- and update-deployment command.    )absolute_import)division)unicode_literals)configmanager_util)base)deploy_util)flags)resource_args)concept_parsersc                   .    e Zd ZdZddiZed        Zd Zy)CreatezCreate or update a deployment.

  This command updates a deployment when it already exists, otherwise the
  deployment will be created.
  EXAMPLESa  
        Create a deployment named `my-deployment` from a storage `my-bucket`:

          $ {command} projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --input-values="project=p1,region=us-central1"

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

          $ {command} projects/p1/locations/us-central1/deployments/my-deployment --git-source-repo="https://github.com/examples/repository.git"
            --git-source-directory="staging/compute" --git-source-ref="mainline"

        Update a deployment's labels:

          $ {command} projects/p1/locations/us-central1/deployments/my-deployment --git-source-repo="https://github.com/examples/repository.git"
            --git-source-directory="staging/compute" --git-source-ref="mainline" --labels="env=prod,team=finance"
      c                 N   d}d}t        j                  | |       t        j                  | |       t        j                  |        t        j                  |        t        j
                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  t        j                  d      g      j!                  |        y )Na  Labels to apply to the deployment. Existing values are overwritten. To retain
the existing labels on a deployment, do not specify this flag.

Examples:

Update labels for an existing deployment:

  $ {command} projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --labels="env=prod,team=finance"

Clear labels for an existing deployment:

  $ {command} projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --labels=""

Add a label to an existing deployment:

  First, fetch the current labels using the `describe` command, then follow the
  preceding example for updating labels.
a  Annotations to apply to the deployment. Existing values are overwritten. To retain
the existing annotations on a deployment, do not specify this flag.

Examples:

Update annotations for an existing deployment:

  $ {command} projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --annotations="env=prod,team=finance"

Clear annotations for an existing deployment:

  $ {command} projects/p1/locations/us-central1/deployments/my-deployment --gcs-source="gs://my-bucket" --annotations=""

Add an annotation to an existing deployment:

  First, fetch the current annotations using the `describe` command, then follow the
  preceding example for updating annotations.
z#the deployment to create or update.)r	   AddLabelsFlagAddAnnotationsFlagAddAsyncFlagAddTerraformBlueprintFlagAddServiceAccountFlagAddWorkerPoolFlagAddImportExistingResourcesFlagAddArtifactsGCSBucketFlagAddTFVersionConstraintFlagAddQuotaValidationFlagAddProviderSourceFlagr   ConceptParserr
   GetDeploymentResourceArgSpecAddToParser)parserlabels_help_textannotations_help_texts      .lib/surface/infra_manager/deployments/apply.pyArgszCreate.Args8   s    && 
 01	V%:;	v	##F+	'	F#	((0	##F+	$$V,	  (	'!!665	
 k&    c                 `   t        j                         }|j                  j                  j	                         }|j                         }t        j                  ||j                  ||j                  |j                  |j                  |j                  |j                  |j                  |j                  |j                   |j"                  |j$                  |j&                  |j(                  |j*                  |j,                  |j.                  |j0                  |j2                  |j4                        S )a7  This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      The resulting Deployment resource or, in the case that args.async_ is
        True, a long-running operation.
    )r   GetMessagesModuleCONCEPTS
deploymentParseRelativeNamer   Applyasync_service_accounttf_version_constraintlocal_sourcestage_bucketignore_fileimport_existing_resourcesartifacts_gcs_bucketworker_pool
gcs_sourcegit_source_repogit_source_directorygit_source_refinput_valuesinputs_filelabelsquota_validationannotationsprovider_source)selfargsmessagesdeployment_refdeployment_full_names        r!   Runz
Create.Runt   s     "335H]]--335N)668""&&!!!!+ r#   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr"   rC    r#   r!   r   r      s2       
 -" 9 9v%r#   r   N)rG   
__future__r   r   r   $googlecloudsdk.api_lib.infra_managerr   googlecloudsdk.callioper   (googlecloudsdk.command_lib.infra_managerr   r	   r
   (googlecloudsdk.command_lib.util.conceptsr   DefaultUniverseOnlyReleaseTracksReleaseTrackGACreateCommandr   rJ   r#   r!   <module>rU      sp    - &  ' C ( @ : B D D%%(()zT z * zr#   