Ejemplo n.º 1
0
    def Args(parser, version=base.ReleaseTrack.GA):
        """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
      version: The version this tool is running as. base.ReleaseTrack.GA
          is the default.
    """
        flags.AddDeploymentNameFlag(parser)
        flags.AddPropertiesFlag(parser)
        flags.AddAsyncFlag(parser)

        parser.add_argument('--description',
                            help='The new description of the deployment.',
                            dest='description')

        group = parser.add_mutually_exclusive_group()
        flags.AddConfigFlags(group)

        if version in [base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA]:
            group.add_argument('--manifest-id',
                               help='Manifest Id of a previous deployment. '
                               'This flag cannot be used with --config.',
                               dest='manifest_id')

        labels_util.AddUpdateLabelsFlags(parser)

        parser.add_argument(
            '--preview',
            help='Preview the requested update without making any changes to the'
            'underlying resources. (default=False)',
            dest='preview',
            default=False,
            action='store_true')

        parser.add_argument(
            '--create-policy',
            help='Create policy for resources that have changed in the update.',
            default='CREATE_OR_ACQUIRE',
            choices=(sorted(dm_v2_base.GetMessages(
            ).DeploymentmanagerDeploymentsUpdateRequest.
                            CreatePolicyValueValuesEnum.to_dict().keys())))

        flags.AddDeletePolicyFlag(
            parser,
            dm_v2_base.GetMessages().DeploymentmanagerDeploymentsUpdateRequest)
        flags.AddFingerprintFlag(parser)

        parser.display_info.AddFormat(flags.RESOURCES_AND_OUTPUTS_FORMAT)
Ejemplo n.º 2
0
  def Args(parser, version=base.ReleaseTrack.GA):
    """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
      version: The version this tool is running as. base.ReleaseTrack.GA
          is the default.
    """
    flags.AddDeploymentNameFlag(parser)
    flags.AddPropertiesFlag(parser)
    flags.AddAsyncFlag(parser)

    parser.add_argument(
        '--description',
        help='The new description of the deployment.',
        dest='description'
    )

    group = parser.add_mutually_exclusive_group()
    flags.AddConfigFlags(group)

    if version in [base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA]:
      group.add_argument(
          '--manifest-id',
          help='Manifest Id of a previous deployment. '
          'This flag cannot be used with --config.',
          dest='manifest_id')

    labels_util.AddUpdateLabelsFlags(parser, enable_clear=False)

    parser.add_argument(
        '--preview',
        help='Preview the requested update without making any changes to the'
        'underlying resources. (default=False)',
        dest='preview',
        default=False,
        action='store_true')

    if version in [base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA]:
      Update._create_policy_v2beta_flag_map.choice_arg.AddToParser(parser)
    else:
      Update._create_policy_flag_map.choice_arg.AddToParser(parser)

    Update._delete_policy_flag_map.choice_arg.AddToParser(parser)
    flags.AddFingerprintFlag(parser)

    parser.display_info.AddFormat(flags.RESOURCES_AND_OUTPUTS_FORMAT)
Ejemplo n.º 3
0
    def Args(parser, version=base.ReleaseTrack.GA):
        """Args is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
      version: The version this tool is running as. base.ReleaseTrack.GA
          is the default.
    """
        group = parser.add_mutually_exclusive_group()

        config_group = parser.add_mutually_exclusive_group(required=True)

        flags.AddConfigFlags(config_group)
        flags.AddAsyncFlag(group)
        flags.AddDeploymentNameFlag(parser)
        flags.AddPropertiesFlag(parser)
        labels_util.AddCreateLabelsFlags(parser)

        group.add_argument(
            '--automatic-rollback-on-error',
            help='If the create request results in a deployment with resource '
            'errors, delete that deployment immediately after creation. '
            '(default=False)',
            dest='automatic_rollback',
            default=False,
            action='store_true')

        parser.add_argument(
            '--description',
            help='Optional description of the deployment to insert.',
            dest='description')

        parser.add_argument(
            '--preview',
            help=
            'Preview the requested create without actually instantiating the '
            'underlying resources. (default=False)',
            dest='preview',
            default=False,
            action='store_true')

        parser.display_info.AddFormat(flags.RESOURCES_AND_OUTPUTS_FORMAT)