Exemplo n.º 1
0
 def Args(parser):
   """Register flags for this command."""
   flags.AddRegionFlag(
       parser,
       help_text='Only show logs generated by functions in the region.',
   )
   base.LIMIT_FLAG.RemoveFromParser(parser)
   parser.add_argument(
       'name', nargs='?',
       help=('Name of the function which logs are to be displayed. If no name '
             'is specified, logs from all functions are displayed.'))
   parser.add_argument(
       '--execution-id',
       help=('Execution ID for which logs are to be displayed.'))
   parser.add_argument(
       '--start-time', required=False, type=arg_parsers.Datetime.Parse,
       help=('Return only log entries which timestamps are not earlier than '
             'the specified time. If *--start-time* is specified, the command '
             'returns *--limit* earliest log entries which appeared after '
             '*--start-time*. See $ gcloud topic datetimes for information '
             'on time formats.'))
   parser.add_argument(
       '--end-time', required=False, type=arg_parsers.Datetime.Parse,
       help=('Return only log entries which timestamps are not later than '
             'the specified time. If *--end-time* is specified but '
             '*--start-time* is not, the command returns *--limit* latest '
             'log entries which appeared before --end-time. See '
             '$ gcloud topic datetimes for information on time formats.'))
   parser.add_argument(
       '--limit', required=False, type=arg_parsers.BoundedInt(1, 1000),
       default=20,
       help=('Number of log entries to be fetched; must not be greater than '
             '1000.'))
   flags.AddMinLogLevelFlag(parser)
   parser.display_info.AddCacheUpdater(None)
Exemplo n.º 2
0
 def Args(parser):
   """Register flags for this command."""
   flags.AddRegionFlag(parser)
   base.LIMIT_FLAG.RemoveFromParser(parser)
   parser.add_argument(
       'name', nargs='?',
       help=('Name of the function which logs are to be displayed. If no name '
             'is specified, logs from all functions are displayed.'))
   parser.add_argument(
       '--execution-id',
       help=('Execution ID for which logs are to be displayed.'))
   parser.add_argument(
       '--start-time', required=False, type=arg_parsers.Datetime.Parse,
       help=('Return only log entries which timestamps are not earlier than '
             'the specified time. The timestamp must be in RFC3339 UTC "Zulu" '
             'format. If --start-time is specified, the command returns '
             '--limit earliest log entries which appeared after '
             '--start-time.'))
   parser.add_argument(
       '--end-time', required=False, type=arg_parsers.Datetime.Parse,
       help=('Return only log entries which timestamps are not later than '
             'the specified time. The timestamp must be in RFC3339 UTC "Zulu" '
             'format. If --end-time is specified but --start-time is not, the '
             'command returns --limit latest log entries which appeared '
             'before --end-time.'))
   parser.add_argument(
       '--limit', required=False, type=arg_parsers.BoundedInt(1, 1000),
       default=20,
       help=('Number of log entries to be fetched; must not be greater than '
             '1000.'))
   flags.AddMinLogLevelFlag(parser)
Exemplo n.º 3
0
    def Args(parser):
        """Register flags for this command."""
        # Add args for function properties
        flags.AddFunctionNameArg(parser)
        flags.AddFunctionMemoryFlag(parser)
        flags.AddFunctionTimeoutFlag(parser)
        flags.AddFunctionRetryFlag(parser)
        args_labels_util.AddUpdateLabelsFlags(
            parser,
            extra_update_message=' ' +
            labels_util.NO_LABELS_STARTING_WITH_DEPLOY_MESSAGE,
            extra_remove_message=' ' +
            labels_util.NO_LABELS_STARTING_WITH_DEPLOY_MESSAGE)

        # Add args for specifying the function source code
        flags.AddSourceFlag(parser)
        flags.AddStageBucketFlag(parser)
        flags.AddEntryPointFlag(parser)

        # Add args for specifying the function trigger
        flags.AddTriggerFlagGroup(parser)

        flags.AddRegionFlag(
            parser,
            help_text='The region in which the function will run.',
        )
Exemplo n.º 4
0
 def Args(parser):
     """Register flags for this command."""
     flags.AddRegionFlag(
         parser,
         help_text='The region of the function to delete.',
     )
     parser.add_argument('name', help='The name of the function to delete.')
     parser.display_info.AddCacheUpdater(None)
Exemplo n.º 5
0
 def Args(parser):
     """Register flags for this command."""
     flags.AddRegionFlag(
         parser,
         help_text='The region of the function to delete.',
     )
     parser.add_argument('name',
                         help='The name of the function to delete.',
                         type=util.ValidateFunctionNameOrRaise)
Exemplo n.º 6
0
 def Args(parser):
     """Register flags for this command."""
     _FunctionArgs(parser)
     _SourceCodeArgs(parser)
     _TriggerArgs(parser)
     flags.AddRegionFlag(
         parser,
         help_text='The region in which the function will run.',
     )
Exemplo n.º 7
0
 def Args(parser):
     """Register flags for this command."""
     flags.AddRegionFlag(parser)
     parser.add_argument('name',
                         help='Name of the function to be called.',
                         type=util.ValidateFunctionNameOrRaise)
     parser.add_argument('--data',
                         default='',
                         help='Data passed to the function (JSON string)')
Exemplo n.º 8
0
 def Args(parser):
     flags.AddRegionFlag(parser)
     parser.display_info.AddFormat('''
     table(provider.label:label="EVENT_PROVIDER":sort=1,
           label:label="EVENT_TYPE":sort=2,
           event_is_optional.yesno('Yes'):label="EVENT_TYPE_DEFAULT",
           resource_type.value.name:label="RESOURCE_TYPE",
           resource_is_optional.yesno('Yes'):label="RESOURCE_OPTIONAL"
     )
  ''')
Exemplo n.º 9
0
 def Args(parser):
     """Register flags for this command."""
     flags.AddRegionFlag(
         parser,
         help_text='The region of the function to execute.',
     )
     parser.add_argument('name',
                         help='Name of the function to execute.',
                         type=util.ValidateFunctionNameOrRaise)
     parser.add_argument(
         '--data',
         help='JSON string with data that will be passed to the function.')
Exemplo n.º 10
0
    def Args(parser, track=base.ReleaseTrack.BETA):
        """Registers flags for this command."""
        parser.display_info.AddFormat("""
      table(
        name,
        stage,
        environments()
      )
    """)
        parser.display_info.AddUriFunc(flags.GetLocationsUri)

        flags.AddRegionFlag(parser,
                            help_text='Only show runtimes within the region.')

        flags.AddGen2Flag(parser, track)
Exemplo n.º 11
0
 def Args(parser):
     """Register flags for this command."""
     _FunctionArgs(parser)
     _SourceCodeArgs(parser)
     _TriggerArgs(parser)
     flags.AddRegionFlag(parser)
Exemplo n.º 12
0
 def Args(parser):
     """Register flags for this command."""
     flags.AddRegionFlag(parser)
     base.LIMIT_FLAG.RemoveFromParser(parser)
     parser.add_argument(
         'name',
         nargs='?',
         help=
         ('Name of the function which logs are to be displayed. If no name '
          'is specified, logs from all functions are displayed.'))
     parser.add_argument(
         '--execution-id',
         help=('Execution ID for which logs are to be displayed.'))
     parser.add_argument(
         '--start-time',
         required=False,
         type=arg_parsers.Datetime.Parse,
         help=
         ('Return only log entries which timestamps are not earlier than '
          'the specified time. The timestamp must be in RFC3339 UTC "Zulu" '
          'format. If --start-time is specified, the command returns '
          '--limit earliest log entries which appeared after '
          '--start-time.'))
     parser.add_argument(
         '--end-time',
         required=False,
         type=arg_parsers.Datetime.Parse,
         help=
         ('Return only log entries which timestamps are not later than '
          'the specified time. The timestamp must be in RFC3339 UTC "Zulu" '
          'format. If --end-time is specified but --start-time is not, the '
          'command returns --limit latest log entries which appeared '
          'before --end-time.'))
     parser.add_argument(
         '--limit',
         required=False,
         type=arg_parsers.BoundedInt(1, 1000),
         default=20,
         help=(
             'Number of log entries to be fetched; must not be greater than '
             '1000.'))
     parser.add_argument('--min-log-level',
                         choices=GetLogs.SEVERITIES,
                         help='Minimum level of logs to be fetched.')
     parser.add_argument('--show-log-levels',
                         action='store_true',
                         default=True,
                         help=('Print a log level of each log entry.'))
     parser.add_argument(
         '--show-function-names',
         action='store_true',
         default=True,
         help=('Print a function name before each log entry.'))
     parser.add_argument(
         '--show-execution-ids',
         action='store_true',
         default=True,
         help=('Print an execution ID before each log entry.'))
     parser.add_argument(
         '--show-timestamps',
         action='store_true',
         default=True,
         help=('Print a UTC timestamp before each log entry.'))
Exemplo n.º 13
0
 def Args(parser):
     flags.AddRegionFlag(parser)
     parser.display_info.AddFormat(
         'table(name.basename(), status, trigger():label=TRIGGER)')