Пример #1
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', topic_resource_group),
            resource_args.CreateTopicResourcePresentationSpec(
                'remove', topic_resource_group),
            resource_args.CreateTopicResourcePresentationSpec(
                'update', 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)
Пример #2
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')