def Args(parser):
        id_group = parser.add_group(mutex=True,
                                    required=True,
                                    help='The certificate identifier.')
        serial_num_group = id_group.add_group(
            help='The serial number and certificate authority resource.',
            required=False)
        serial_num_group.add_argument(
            '--serial-number',
            help='The serial number of the certificate.',
            required=True)
        concept_parsers.ConceptParser([
            presentation_specs.ResourcePresentationSpec(
                '--certificate',
                resource_args.CreateCertificateResourceSpec('CERTIFICATE'),
                'The certificate to revoke.',
                required=False,
                prefixes=True,
                group=id_group),
            presentation_specs.ResourcePresentationSpec(
                '--issuer',
                resource_args.CreateCertificateAuthorityResourceSpec(
                    'CERTIFICATE_AUTHORITY', 'issuer', 'issuer-location'),
                'The issuing certificate authority of the certificate to revoke.',
                required=False,
                group=serial_num_group),
        ]).AddToParser(parser)

        flags.AddRevocationReasonFlag(parser)
    def CommonArgs(cls, parser):
        # Flags specific to connecting to a cluster
        cluster_group = flags.GetClusterArgGroup(parser)
        namespace_presentation = presentation_specs.ResourcePresentationSpec(
            '--namespace',
            resource_args.GetNamespaceResourceSpec(),
            'Namespace to list revisions in.',
            required=True,
            prefixes=False)
        concept_parsers.ConceptParser([namespace_presentation
                                       ]).AddToParser(cluster_group)

        # Flags not specific to any platform
        flags.AddServiceFlag(parser)

        parser.display_info.AddFormat(
            'table('
            '{ready_column},'
            'name:label=REVISION,'
            'active.yesno(yes="yes", no=""),'
            'service_name:label=SERVICE:sort=1,'
            'creation_timestamp.date("%Y-%m-%d %H:%M:%S %Z"):'
            'label=DEPLOYED:sort=2:reverse,'
            'author:label="DEPLOYED BY")'.format(
                ready_column=pretty_print.READY_COLUMN))
        parser.display_info.AddUriFunc(cls._GetResourceUri)
Beispiel #3
0
    def CommonArgs(parser):
        # Flags specific to managed CR
        managed_group = flags.GetManagedArgGroup(parser)
        flags.AddAllowUnauthenticatedFlag(managed_group)
        flags.AddServiceAccountFlag(managed_group)
        flags.AddCloudSQLFlags(managed_group)

        # Flags specific to connecting to a cluster
        cluster_group = flags.GetClusterArgGroup(parser)
        flags.AddEndpointVisibilityEnum(cluster_group)
        flags.AddCpuFlag(cluster_group)

        # Flags not specific to any platform
        service_presentation = presentation_specs.ResourcePresentationSpec(
            'SERVICE',
            resource_args.GetServiceResourceSpec(prompt=True),
            'Service to deploy to.',
            required=True,
            prefixes=False)
        flags.AddImageArg(parser)
        flags.AddFunctionArg(parser)
        flags.AddMutexEnvVarsFlags(parser)
        flags.AddMemoryFlag(parser)
        flags.AddConcurrencyFlag(parser)
        flags.AddTimeoutFlag(parser)
        flags.AddAsyncFlag(parser)
        flags.AddLabelsFlags(parser)
        flags.AddMaxInstancesFlag(parser)
        concept_parsers.ConceptParser([service_presentation
                                       ]).AddToParser(parser)
Beispiel #4
0
 def Args(parser):
     """Register flags for this command."""
     concept_parsers.ConceptParser([flags.CreateTaxonomyResourceArg()
                                    ]).AddToParser(parser)
     flags.AddDisplayNameFlag(parser, 'annotation')
     flags.AddDescriptionFlag(parser, 'annotation', required=False)
     flags.AddParentAnnotationFlag(parser)
Beispiel #5
0
 def Args(parser):
     """Register flags for this command."""
     concept_parsers.ConceptParser([
         flags.CreateAssetResourceArg(positional=True),
         flags.CreateAnnotationResourceArg()
     ]).AddToParser(parser)
     flags.AddSubAssetFlag(parser)
Beispiel #6
0
def AddMigrationJobResourceArgs(parser, verb, required=False):
    """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.
  """
    resource_specs = [
        presentation_specs.ResourcePresentationSpec(
            'migration_job',
            GetMigrationJobResourceSpec(),
            'The migration job {}.'.format(verb),
            required=True),
        presentation_specs.ResourcePresentationSpec(
            '--source',
            GetConnectionProfileResourceSpec(),
            'Resource ID of the source connection profile.',
            required=required,
            flag_name_overrides={'region': ''}),
        presentation_specs.ResourcePresentationSpec(
            '--destination',
            GetConnectionProfileResourceSpec(),
            'Resource ID of the destination connection profile.',
            required=required,
            flag_name_overrides={'region': ''})
    ]
    concept_parsers.ConceptParser(resource_specs,
                                  command_level_fallthroughs={
                                      '--source.region': ['--region'],
                                      '--destination.region': ['--region']
                                  }).AddToParser(parser)
  def testCommandFallthroughsNotUsed(self, is_multitype):
    """Tests that command level fallthroughs are prioritized over others."""
    resource_spec = (
        self.resource_spec if not is_multitype else self.two_way_resource)
    resource = self.PresentationSpecType(is_multitype=is_multitype)(
        '--book',
        resource_spec,
        'The book to act upon.',
        flag_name_overrides={'project': '--book-project'})
    concept_parsers.ConceptParser(
        [resource],
        command_level_fallthroughs={'--book.project': ['--other-project']}
    ).AddToParser(self.parser)
    self.parser.add_argument('--other-project', help='h')

    parsed_args = self.parser.parser.parse_args(
        ['--book', 'examplebook',
         '--shelf', 'exampleshelf',
         '--book-project', 'exampleproject',
         '--other-project', 'otherproject'])

    self.AssertParsedResultEquals(
        'projects/exampleproject/shelves/exampleshelf/books/examplebook',
        parsed_args.CONCEPTS.book.Parse(),
        is_multitype=is_multitype)
Beispiel #8
0
    def CommonArgs(parser):
        # Flags specific to managed CR
        managed_group = flags.GetManagedArgGroup(parser)
        flags.AddCloudSQLFlags(managed_group)
        flags.AddRevisionSuffixArg(managed_group)

        # Flags specific to connecting to a cluster
        cluster_group = flags.GetClusterArgGroup(parser)
        flags.AddEndpointVisibilityEnum(cluster_group)
        flags.AddSecretsFlags(cluster_group)
        flags.AddConfigMapsFlags(cluster_group)
        flags.AddHttp2Flag(cluster_group)

        # Flags not specific to any platform
        service_presentation = presentation_specs.ResourcePresentationSpec(
            'SERVICE',
            resource_args.GetServiceResourceSpec(prompt=True),
            'Service to update the configuration of.',
            required=True,
            prefixes=False)
        flags.AddMutexEnvVarsFlags(parser)
        flags.AddMemoryFlag(parser)
        flags.AddConcurrencyFlag(parser)
        flags.AddTimeoutFlag(parser)
        flags.AddAsyncFlag(parser)
        flags.AddLabelsFlags(parser)
        flags.AddMaxInstancesFlag(parser)
        flags.AddCommandFlag(parser)
        flags.AddArgsFlag(parser)
        flags.AddPortFlag(parser)
        flags.AddCpuFlag(parser)
        flags.AddNoTrafficFlag(parser)
        concept_parsers.ConceptParser([service_presentation
                                       ]).AddToParser(parser)
  def testParsePluralAnchorFallthroughMultitypeArgFallthrough(self):
    properties.VALUES.core.project.Set('xyz')
    fallthrough = deps.ArgFallthrough('--other')
    resource_spec = self.SetUpFallthroughSpec(fallthrough=fallthrough,
                                              is_multitype=True)
    # Remove the fallthrough for the organization.
    for attribute in resource_spec.attributes:
      if attribute.name == 'organization':
        attribute.fallthroughs = []
    resource = self.PresentationSpecType(is_multitype=True)(
        '--books',
        resource_spec,
        'Group Help',
        prefixes=False,
        required=False,
        plural=True,
        flag_name_overrides={'project': '--book-project'}
    )
    concept_parser = concept_parsers.ConceptParser([resource])
    concept_parser.AddToParser(self.parser)
    self.parser.add_argument('--other', help='h')

    namespace = self.parser.parser.parse_args(['--other', 'xyz'])
    self.AssertParsedListEquals(
        ['projects/xyz/shelves/xyz/books/xyz'],
        namespace.CONCEPTS.books.Parse(),
        is_multitype=True)
  def testParsePluralAnchorFallthroughMultiple(
      self, is_multitype, fallthrough_value, args, expected):
    """Tests plural resource args parse when there's an anchor fallthrough."""
    spec = copy.deepcopy(
        self.SetUpFallthroughSpec(
            deps.Fallthrough(lambda: ['xyz'], hint='h'),
            is_multitype=is_multitype))
    fallthrough = deps.Fallthrough(lambda: fallthrough_value, hint='h',
                                   active=True)
    for attribute in spec.attributes:
      if attribute.name == 'book':
        attribute.fallthroughs = [fallthrough] + attribute.fallthroughs
    resource = self.PresentationSpecType(is_multitype=is_multitype)(
        '--books',
        spec,
        'Group Help',
        prefixes=False,
        plural=True,
        flag_name_overrides={'project': '--book-project'}
    )
    concept_parser = concept_parsers.ConceptParser([resource])
    concept_parser.AddToParser(self.parser)

    namespace = self.parser.parser.parse_args(args)
    self.AssertParsedListEquals(
        expected,
        namespace.CONCEPTS.books.Parse(),
        is_multitype=is_multitype)
  def testTwoResourceArgs(self, is_multitype, args, first_expected,
                          second_expected):
    """Test a concept parser with two resource args."""
    resource_spec = (
        self.two_way_shelf_case_book if is_multitype else self.resource_spec)
    resource = self.PresentationSpecType(is_multitype=is_multitype)(
        'book',
        resource_spec,
        'The book to act upon.',
        prefixes=True)
    other_resource = self.PresentationSpecType(is_multitype=is_multitype)(
        '--other',
        resource_spec,
        'The second book to act upon.',
        prefixes=True)
    concept_parser = concept_parsers.ConceptParser([resource, other_resource])
    concept_parser.AddToParser(self.parser)

    namespace = self.parser.parser.parse_args(args)
    self.AssertParsedResultEquals(
        first_expected,
        namespace.CONCEPTS.book.Parse(),
        is_multitype=is_multitype)
    self.AssertParsedResultEquals(
        second_expected,
        namespace.CONCEPTS.other.Parse(),
        is_multitype=is_multitype)
  def testAllFallthrough(self):
    """Test a resource where everything has a fallthough."""
    def Fallthrough():
      return '!'
    resource = presentation_specs.ResourcePresentationSpec(
        'book',
        concepts.ResourceSpec(
            'example.projects.shelves.books',
            'project',
            projectsId=concepts.ResourceParameterAttributeConfig(
                name='project', help_text='Auxilio aliis.',
                fallthroughs=[
                    deps.PropertyFallthrough(properties.VALUES.core.project)]),
            shelvesId=concepts.ResourceParameterAttributeConfig(
                name='shelf', help_text='Auxilio aliis.',
                fallthroughs=[deps.Fallthrough(Fallthrough, hint='hint')]),
            booksId=concepts.ResourceParameterAttributeConfig(
                name='book', help_text='Auxilio aliis.',
                fallthroughs=[deps.Fallthrough(Fallthrough, hint='hint')])),
        'Group Help',
        prefixes=False)

    concept_parser = concept_parsers.ConceptParser([resource])
    concept_parser.AddToParser(self.parser)
    properties.VALUES.core.project.Set('foo')
    namespace = self.parser.parser.parse_args([])
    self.assertEqual('projects/foo/shelves/!/books/!',
                     namespace.CONCEPTS.book.Parse().RelativeName())
  def testCommandFallthroughsOtherResource(
      self, is_multitype, args_to_parse, expected):
    """Tests that command level fallthroughs are prioritized over others."""
    resource_spec = (
        self.two_way_shelf_case_book if is_multitype else self.resource_spec)
    concept_parser = concept_parsers.ConceptParser(
        [self.PresentationSpecType(is_multitype=is_multitype)(
            '--book',
            resource_spec,
            'The book to act upon.'),
         self.PresentationSpecType(is_multitype=is_multitype)(
             '--other-book',
             resource_spec,
             'The other book',
             prefixes=True)],
        command_level_fallthroughs={'--other-book.shelf': ['--book.shelf']})
    concept_parser.AddToParser(self.parser)

    parsed_args = self.parser.parser.parse_args(args_to_parse)

    self.AssertParsedResultEquals(
        'projects/{}/shelves/exampleshelf/books/examplebook'.format(
            self.Project()),
        parsed_args.CONCEPTS.book.Parse(),
        is_multitype=is_multitype)
    self.AssertParsedResultEquals(
        'projects/{}/{}'.format(self.Project(), expected),
        parsed_args.CONCEPTS.other_book.Parse(),
        is_multitype=is_multitype)
Beispiel #14
0
 def CommonArgs(parser):
   # Flags specific to managed CR
   managed_group = flags.GetManagedArgGroup(parser)
   flags.AddRegionArg(managed_group)
   # Flags specific to CRoGKE
   gke_group = flags.GetGkeArgGroup(parser)
   concept_parsers.ConceptParser([resource_args.CLUSTER_PRESENTATION
                                 ]).AddToParser(gke_group)
   # Flags not specific to any platform
   service_presentation = presentation_specs.ResourcePresentationSpec(
       'SERVICE',
       resource_args.GetServiceResourceSpec(),
       'Service to delete.',
       required=True,
       prefixes=False)
   concept_parsers.ConceptParser([service_presentation]).AddToParser(parser)
Beispiel #15
0
    def Args(parser):
        id_group = parser.add_group(mutex=True,
                                    required=True,
                                    help='The certificate identifier.')
        base.Argument(
            '--serial-number',
            help='The serial number of the certificate.').AddToParser(id_group)
        concept_parsers.ConceptParser([
            presentation_specs.ResourcePresentationSpec(
                '--certificate',
                resource_args.CreateCertificateResourceSpec('certificate'),
                'The certificate to revoke.',
                flag_name_overrides={
                    'issuer': '',
                    'issuer-location': '',
                    'project': '',
                },
                group=id_group),
            presentation_specs.ResourcePresentationSpec(
                '--issuer',
                resource_args.CreateCertificateAuthorityResourceSpec(
                    'Issuing CA', 'issuer', 'issuer-location'),
                'The issuing certificate authority of the certificate to revoke.',
                required=False),
        ]).AddToParser(parser)

        flags.AddRevocationReasonFlag(parser)
Beispiel #16
0
    def AddToParser(self, parser):
        # Import done here to avoid circular import
        # pylint: disable=g-import-not-at-top
        from googlecloudsdk.command_lib.kuberun import resource_args

        mutex_group = parser.add_mutually_exclusive_group()
        concept_parsers.ConceptParser([resource_args.CLUSTER_PRESENTATION
                                       ]).AddToParser(mutex_group)
        kubeconfig_group = mutex_group.add_group()
        kubeconfig_group.add_argument(
            '--context',
            help='Name of the context in your kubectl config file to use for '
            'connecting. Cannot be specified together with --cluster and '
            '--cluster-location.')
        kubeconfig_group.add_argument(
            '--kubeconfig',
            help=
            'Absolute path to your kubectl config file. Cannot be specified '
            'together with --cluster and --cluster-location.')
        kubeconfig_group.add_argument(
            '--use-kubeconfig',
            default=False,
            action='store_true',
            help='Use the kubectl config to connect to the cluster. If '
            '--kubeconfig is not also provided, the colon- or semicolon-delimited '
            'list of paths specified by $KUBECONFIG will be used. If $KUBECONFIG '
            'is unset, this defaults to ~/.kube/config. Cannot be specified '
            'together with --cluster and --cluster-location.')
Beispiel #17
0
def AddProjectConfigUpdateArgs(parser):
  """Add the arg groups for `source project-configs update` command."""
  update_group = parser.add_group(required=True, mutex=True)
  AddPushblockFlags(update_group)
  topic_group = update_group.add_group(
      'Manage Cloud Pub/Sub topics associated with the Cloud project.')
  topic_resource_group = topic_group.add_argument_group(mutex=True)

  concept_parsers.ConceptParser(
      [
          resource_args.CreateTopicResourcePresentationSpec(
              'add', 'The Cloud Pub/Sub topic to add to the project.',
              topic_resource_group),
          resource_args.CreateTopicResourcePresentationSpec(
              'remove', 'The Cloud Pub/Sub topic to remove from the project.',
              topic_resource_group),
          resource_args.CreateTopicResourcePresentationSpec(
              'update', 'The Cloud Pub/Sub topic to update in the project.',
              topic_resource_group),
      ],
      command_level_fallthroughs={
          '--add-topic.project': ['--topic-project'],
          '--remove-topic.project': ['--topic-project'],
          '--update-topic.project': ['--topic-project'],
      }).AddToParser(parser)
  AddOptionalTopicFlags(topic_group, 'project')
Beispiel #18
0
 def CommonArgs(cls, parser):
   # Flags specific to managed CR
   managed_group = flags.GetManagedArgGroup(parser)
   flags.AddRegionArgWithDefault(managed_group)
   # Flags specific to CRoGKE
   gke_group = flags.GetGkeArgGroup(parser)
   namespace_presentation = presentation_specs.ResourcePresentationSpec(
       '--namespace',
       resource_args.GetNamespaceResourceSpec(),
       'Namespace list configurations in.',
       required=True,
       prefixes=False)
   concept_parsers.ConceptParser(
       [resource_args.CLUSTER_PRESENTATION,
        namespace_presentation]).AddToParser(gke_group)
   # Flags not specific to any platform
   parser.display_info.AddFormat(
       'table('
       '{ready_column},'
       'metadata.name:label=CONFIGURATION,'
       'region:label=REGION,'
       'status.latestCreatedRevisionName:label="LATEST REVISION",'
       'status.latestReadyRevisionName:label="READY REVISION")'.format(
           ready_column=pretty_print.READY_COLUMN))
   parser.display_info.AddUriFunc(cls._GetResourceUri)
Beispiel #19
0
def AddRepoUpdateArgs(parser, verb='to update'):
  """Add the arg groups for `source repos update` command."""
  topic_group = parser.add_group(
      'Manages Cloud Pub/Sub topics associated with the repository.',
      required=True)
  topic_resource_group = topic_group.add_argument_group(
      mutex=True, required=True)

  concept_parsers.ConceptParser(
      [
          resource_args.CreateTopicResourcePresentationSpec(
              'add', 'The Cloud Pub/Sub topic to add to the repository.',
              topic_resource_group),
          resource_args.CreateTopicResourcePresentationSpec(
              'remove',
              'The Cloud Pub/Sub topic to remove from the repository.',
              topic_resource_group),
          resource_args.CreateTopicResourcePresentationSpec(
              'update', 'The Cloud Pub/Sub topic to update in the project.',
              topic_resource_group),
          resource_args.CreateRepoResourcePresentationSpec(verb)
      ],
      command_level_fallthroughs={
          '--add-topic.project': ['--topic-project'],
          '--remove-topic.project': ['--topic-project'],
          '--update-topic.project': ['--topic-project'],
      }).AddToParser(parser)

  AddOptionalTopicFlags(topic_group)
Beispiel #20
0
 def Args(parser):
     """Register flags for this command."""
     concept_parsers.ConceptParser([
         flags.CreateTaxonomyResourceArg(positional=True)
     ]).AddToParser(parser)
     update_group = parser.add_group(required=True)
     flags.AddDescriptionFlag(update_group, 'taxonomy', required=False)
Beispiel #21
0
def AddReimageResourcesToParser(parser):
  """Add TPU resource args to parser for reimage command."""
  custom_help = {
      'tpu': 'The Cloud TPU to reimage.'
  }

  resource_specs = LoadTPUResourceSpecs(custom_help)
  presentation_specs = []
  for arg in (spec for spec in resource_specs if spec.name in custom_help):
    presentation_specs.append(concept_parsers.ResourcePresentationSpec(
        TPU_YAML_SPEC_TEMPLATE[arg.name]['flag_name'],
        arg.GenerateResourceSpec(),
        arg.group_help,
        flag_name_overrides={
            n: '' for n in TPU_YAML_SPEC_TEMPLATE[arg.name]['removed_flags']
        },
        required=True))
  concept_parsers.ConceptParser(presentation_specs).AddToParser(parser)
  # Not using Tensorflow resource arg here due to parsing conflict with zone
  # attribute and its ultimately passed only as string to API
  base.Argument(
      '--version',
      required=True,
      help='The Tensorflow version to Reimage Cloud TPU with.').AddToParser(
          parser)
Beispiel #22
0
  def CommonArgs(parser):
    # Flags not specific to any platform
    service_presentation = presentation_specs.ResourcePresentationSpec(
        'JOB',
        resource_args.GetJobResourceSpec(prompt=True),
        'Job to create.',
        required=True,
        prefixes=False)
    flags.AddImageArg(parser)
    flags.AddLabelsFlag(parser)
    flags.AddParallelismFlag(parser)
    flags.AddCompletionsFlag(parser)
    flags.AddMaxAttemptsFlag(parser)
    flags.AddServiceAccountFlag(parser)
    flags.AddSetEnvVarsFlag(parser)
    flags.AddSetCloudSQLFlag(parser)
    flags.AddVpcConnectorArg(parser)
    flags.AddEgressSettingsFlag(parser)
    flags.AddMemoryFlag(parser)
    flags.AddCpuFlag(parser, managed_only=True)
    flags.AddCommandFlag(parser)
    flags.AddArgsFlag(parser)
    flags.AddClientNameAndVersionFlags(parser)
    flags.AddBinAuthzPolicyFlags(parser, with_clear=False)
    flags.AddBinAuthzBreakglassFlag(parser)

    polling_group = parser.add_mutually_exclusive_group()
    flags.AddAsyncFlag(polling_group)
    flags.AddWaitForCompletionFlag(polling_group)

    concept_parsers.ConceptParser([service_presentation]).AddToParser(parser)
    # No output by default, can be overridden by --format
    parser.display_info.AddFormat('none')
Beispiel #23
0
def AddGatewayApiConfigResourceArgs(parser,
                                    verb,
                                    gateway_required=True,
                                    api_config_required=True):
    """Adds Gateway and API Config resource arguments to parser.

  Args:
    parser: parser to add arg to
    verb: action being taken with the Gateway
    gateway_required: Boolean for if Gateway is required, default is True
    api_config_required: Boolean for if API Config is required, default is True

  Returns: None
  """

    concept_parsers.ConceptParser([
        presentation_specs.ResourcePresentationSpec(
            'gateway',
            GetGatewayResourceSpec(),
            'Name for gateway which will be {}.'.format(verb),
            required=gateway_required),
        presentation_specs.ResourcePresentationSpec(
            '--api-config',
            GetApiConfigResourceSpec(),
            'Resource name for API config the gateway will use.',
            flag_name_overrides={'location': ''},
            required=api_config_required)
    ]).AddToParser(parser)
Beispiel #24
0
    def Args(parser):
        flags.AddLocationFlag(parser, 'certificates', '--issuer-location')
        concept_parsers.ConceptParser([
            presentation_specs.ResourcePresentationSpec(
                '--issuer',
                resource_args.CreateCertificateAuthorityResourceSpec(
                    'CERTIFICATE_AUTHORITY'),
                'The issuing Certificate Authority.',
                required=False,
                flag_name_overrides={'location': ''})
        ],
                                      command_level_fallthroughs={
                                          '--issuer.location':
                                          ['--issuer-location']
                                      }).AddToParser(parser)
        base.PAGE_SIZE_FLAG.SetDefault(parser, 100)

        parser.display_info.AddFormat("""
        table(
          name.basename(),
          name.scope().segment(-3):label=ISSUER,
          name.scope().segment(-5):label=LOCATION,
          revocation_details.revocation_state.yesno(no="ACTIVE"):label=REVOCATION_STATUS,
          certificate_description.subject_description.not_before_time:label=NOT_BEFORE,
          certificate_description.subject_description.not_after_time:label=NOT_AFTER)
        """)
Beispiel #25
0
def AddResourceArgs(parser, resources):
  """Add resource arguments.

  Args:
    parser: the parser for the command.
    resources: a list of resource args to add.
  """
  concept_parsers.ConceptParser(resources).AddToParser(parser)
Beispiel #26
0
def AddInstanceUpdateArgs(parser):
  """Add args for updating an instance."""
  concept_parsers.ConceptParser([flags.GetInstancePresentationSpec(
      'The instance to update.')]).AddToParser(parser)
  AddDescriptionArg(parser)
  AddAsyncFlag(parser, 'update')
  labels_util.AddUpdateLabelsFlags(parser)
  AddFileShareArg(parser, required=False)
Beispiel #27
0
def AddResourceArgs(parser, resources):
  """Add resource arguments for commands that have topic and subscriptions.

  Args:
    parser: the parser for the command.
    resources: a list of resource args to add.
  """
  concept_parsers.ConceptParser(resources).AddToParser(parser)
Beispiel #28
0
 def CommonArgs(parser):
   job_presentation = presentation_specs.ResourcePresentationSpec(
       'JOB',
       resource_args.GetJobResourceSpec(),
       'Job to delete.',
       required=True,
       prefixes=False)
   concept_parsers.ConceptParser([job_presentation]).AddToParser(parser)
Beispiel #29
0
def AddImageResourceArg(parser):
  """Add resource arg of image for 'packages list' command."""
  concept_parsers.ConceptParser(
      [
          resource_args.CreateImageResourcePresentationSpec(
              'Name of the disk image.'),
      ]
  ).AddToParser(parser)
Beispiel #30
0
 def Args(parser):
   """Register flags for this command."""
   flags.AddQueryFilterFlag(parser)
   concept_parsers.ConceptParser(
       [flags.CreateAnnotationResourceArg(required=False,
                                          plural=True)]).AddToParser(parser)
   flags.AddMatchChildAnnotationsFlag(parser)
   flags.AddShowOnlyAnnotatableFlag(parser)