Esempio n. 1
0
 def Args(parser):
   """Register flags for this command."""
   parser.add_argument(
       'BUCKET_ID', help='ID of the bucket to undelete.')
   util.AddBucketLocationArg(
       parser, True, 'Location of the bucket.')
   util.AddParentArgs(parser, 'Undelete a bucket')
Esempio n. 2
0
 def Args(parser):
   """Register flags for this command."""
   base.PAGE_SIZE_FLAG.RemoveFromParser(parser)
   base.URI_FLAG.RemoveFromParser(parser)
   util.AddParentArgs(parser, 'List sinks')
   parser.display_info.AddFormat('table(name, destination, filter)')
   parser.display_info.AddCacheUpdater(None)
Esempio n. 3
0
 def Args(parser):
     """Register flags for this command."""
     base.LIMIT_FLAG.AddToParser(parser)
     parser.add_argument(
         'log_filter',
         help=('Filter expression that specifies the '
               'log entries to return. A detailed guide on '
               'basic and advanced filters can be found at: '
               'https://cloud.google.com/logging/docs/view/'
               'overview'),
         nargs='?')
     order_arg = base.ChoiceArgument(
         '--order',
         choices=('desc', 'asc'),
         required=False,
         default='desc',
         help_str=
         'Ordering of returned log entries based on timestamp field.')
     order_arg.AddToParser(parser)
     parser.add_argument(
         '--freshness',
         required=False,
         type=arg_parsers.Duration(),
         help=
         ('Return entries that are not older than this value. '
          'Works only with DESC ordering and filters without a timestamp. '
          'See $ gcloud topic datetimes for information on '
          'duration formats.'),
         default='1d')
     util.AddParentArgs(parser, 'Read log entries')
 def Args(parser):
   """Register flags for this command."""
   parser.add_argument(
       'BUCKET_ID', help='ID of the bucket to delete.')
   util.AddBucketLocationArg(
       parser, True, 'Location of the bucket.')
   util.AddParentArgs(parser, 'Delete a bucket')
   parser.display_info.AddCacheUpdater(None)
Esempio n. 5
0
    def Args(parser):
        """Register flags for this command."""
        parser.add_argument('operation_id', help='The Id of the operation.')
        parser.add_argument('--location',
                            required=True,
                            help='Location of the operation.')

        util.AddParentArgs(parser, 'Describe operation')
 def Args(parser):
   """Register flags for this command."""
   parser.add_argument('VIEW_ID', help='Id of the view to describe.')
   util.AddParentArgs(parser, 'Describe a view')
   util.AddBucketLocationArg(parser, True, 'Location of the bucket.')
   parser.add_argument(
       '--bucket',
       required=True,
       type=arg_parsers.RegexpValidator(r'.+', 'must be non-empty'),
       help='ID of bucket')
Esempio n. 7
0
 def Args(parser):
     """Register flags for this command."""
     util.AddParentArgs(parser, 'List buckets')
     util.AddBucketLocationArg(
         parser, False,
         'Location from which to list buckets. By default, buckets in all '
         'locations will be listed')
     parser.display_info.AddFormat(
         'table(name, display_name, retentionDays, locked, create_time,'
         'update_time, description)')
     parser.display_info.AddCacheUpdater(None)
Esempio n. 8
0
 def Args(parser):
     """Register flags for this command."""
     util.AddParentArgs(parser, 'List buckets')
     util.AddBucketLocationArg(
         parser, False,
         'Location from which to list buckets. By default, buckets in all '
         'locations will be listed')
     parser.display_info.AddFormat(
         'table(name.segment(-3):label=LOCATION, '
         'name.segment(-1):label=BUCKET_ID, retentionDays, lifecycle_state, '
         'locked, create_time, update_time)')
     parser.display_info.AddCacheUpdater(None)
Esempio n. 9
0
    def Args(parser):
        """Register flags for this command."""

        util.AddParentArgs(parser, 'List views')
        util.AddBucketLocationArg(parser, True,
                                  'Location of the specified bucket')
        parser.add_argument('--bucket',
                            required=True,
                            type=arg_parsers.RegexpValidator(
                                r'.+', 'must be non-empty'),
                            help='ID of bucket')
        parser.display_info.AddFormat(
            'table(name.segment(-1):label=VIEW_ID, filter, create_time, '
            'update_time)')
Esempio n. 10
0
 def Args(parser):
     """Register flags for this command."""
     parser.add_argument('VIEW_ID', help='Id of the view to update.')
     parser.add_argument('--description',
                         help='New description for the view.')
     parser.add_argument('--filter', help='New filter for the view.')
     util.AddParentArgs(parser, 'Update view')
     util.AddBucketLocationArg(
         parser, True, 'Location of the bucket that contains the view.')
     parser.add_argument('--bucket',
                         required=True,
                         type=arg_parsers.RegexpValidator(
                             r'.+', 'must be non-empty'),
                         help='ID of the bucket that holds the view')
Esempio n. 11
0
 def Args(parser):
     """Register flags for this command."""
     parser.add_argument('VIEW_ID', help='ID of the view to create.')
     parser.add_argument('--description',
                         help='A textual description for the view.')
     parser.add_argument('--log-filter', help='A filter for the view.')
     util.AddParentArgs(parser, 'Create view')
     util.AddBucketLocationArg(
         parser, True, 'Location of the bucket that will hold the view.')
     parser.add_argument('--bucket',
                         required=True,
                         type=arg_parsers.RegexpValidator(
                             r'.+', 'must be non-empty'),
                         help='ID of the bucket that will hold the view')
  def Args(parser):
    """Register flags for this command."""
    parser.add_argument('bucket_id', help='Id of the bucket to copy.')
    parser.add_argument(
        'destination', help='destination to which to copy logs.')
    parser.add_argument(
        '--location', required=True, help='Location of the bucket.')
    parser.add_argument(
        '--log-filter',
        required=False,
        help=('A filter specifying which log entries to copy. '
              'The filter must be no more than 20k characters. '
              'An empty filter matches all log entries.'))

    util.AddParentArgs(parser, 'Copy log entries')
Esempio n. 13
0
 def Args(parser):
     """Register flags for this command."""
     parser.add_argument('sink_name',
                         help='The name of the sink to update.')
     parser.add_argument(
         'destination',
         nargs='?',
         help=(
             'A new destination for the sink. '
             'If omitted, the sink\'s existing destination is unchanged.'))
     parser.add_argument(
         '--log-filter',
         help=(
             'A new filter expression for the sink. '
             'If omitted, the sink\'s existing filter (if any) is unchanged.'
         ))
     util.AddParentArgs(parser, 'Update a sink')
    def Args(parser):
        """Registers flags for this command."""
        parser.add_argument(
            'log_filter',
            help=
            ('Filter expression that specifies the log entries to return. A '
             'detailed guide on the Logging query language can be found at: '
             'https://cloud.google.com/logging/docs/view/logging-query-language.'
             ),
            nargs='?')
        parser.add_argument(
            '--buffer-window',
            required=False,
            type=arg_parsers.Duration(),
            help=
            ('The duration of time for which entries should be buffered for '
             'ordering before being returned. A longer buffer window helps to '
             'return logs in chronological order, but it also increases the '
             'latency from when entries are received by Cloud Logging to when '
             'they are returned. If unset, Cloud Logging will use 2s by '
             'default.'))

        view_group = parser.add_argument_group(
            help='These arguments are used in conjunction with the parent to '
            'construct a view resource.')
        view_group.add_argument(
            '--location',
            required=True,
            metavar='LOCATION',
            help='Location of the bucket. If this argument is provided, then '
            '`--bucket` and `--view` must also be specified.')
        view_group.add_argument(
            '--bucket',
            required=True,
            help='Id of the bucket. If this argument is provided, then '
            '`--location` and `--view` must also be specified.')
        view_group.add_argument(
            '--view',
            required=True,
            help='Id of the view. If this argument is provided, then '
            '`--location` and `--bucket` must also be specified.')

        util.AddParentArgs(parser, 'Tail log entries')
Esempio n. 15
0
 def Args(parser):
     """Register flags for this command."""
     parser.add_argument('sink_name', help='The name for the sink.')
     parser.add_argument('destination',
                         help='The destination for the sink.')
     parser.add_argument(
         '--log-filter',
         required=False,
         help=('A filter expression for the sink. If present, the filter '
               'specifies which log entries to export.'))
     parser.add_argument(
         '--include-children',
         required=False,
         action='store_true',
         help=(
             'Whether to export logs from all child projects and folders. '
             'Only applies to sinks for organizations and folders.'))
     util.AddParentArgs(parser, 'Create a sink')
     parser.display_info.AddCacheUpdater(None)
Esempio n. 16
0
    def Args(parser):
        """Register flags for this command."""
        parser.add_argument('log_name',
                            help=('Name of the log where the log entry will '
                                  'be written.'))
        parser.add_argument(
            'message',
            help=('Message to put in the log entry. It can be '
                  'JSON if you include `--payload-type=json`.'))
        parser.add_argument('--payload-type',
                            choices=Write.PAYLOAD_TYPE,
                            default='text',
                            help=('Type of the log entry payload.'))
        parser.add_argument('--severity',
                            required=False,
                            choices=Write.SEVERITY_ENUM,
                            default='DEFAULT',
                            help='Severity level of the log entry.')

        util.AddParentArgs(parser, 'Write log entries')
Esempio n. 17
0
 def Args(parser):
     """Register flags for this command."""
     read_logs_lib.LogFilterPositionalArgs(parser)
     read_logs_lib.LoggingReadArgs(parser)
     view_group = parser.add_argument_group(
         help='These arguments are used in conjunction with the parent to '
         'construct a view resource.')
     view_group.add_argument(
         '--location',
         required=True,
         metavar='LOCATION',
         help='Location of the bucket. If this argument is provided then '
         '`--bucket` and `--view` must also be specified.')
     view_group.add_argument(
         '--bucket',
         required=True,
         help='Id of the bucket. If this argument is provided then '
         '`--location` and `--view` must also be specified.')
     view_group.add_argument(
         '--view',
         required=True,
         help='Id of the view. If this argument is provided then '
         '`--location` and `--bucket` must also be specified.')
     util.AddParentArgs(parser, 'Read log entries')
Esempio n. 18
0
    def Args(parser):
        """Register flags for this command."""

        util.AddParentArgs(parser, 'List locations')
        parser.display_info.AddFormat('table(locationId)')
Esempio n. 19
0
    def Args(parser):
        """Register flags for this command."""
        parser.add_argument('sink_name',
                            help='The name of the sink to update.')
        parser.add_argument(
            'destination',
            nargs='?',
            help=(
                'A new destination for the sink. '
                'If omitted, the sink\'s existing destination is unchanged.'))
        parser.add_argument(
            '--log-filter',
            help=(
                'A new filter expression for the sink. '
                'If omitted, the sink\'s existing filter (if any) is unchanged.'
            ))
        util.AddParentArgs(parser, 'Update a sink')

        bigquery_group = parser.add_argument_group(
            help='Settings for sink exporting data to BigQuery.')
        bigquery_group.add_argument(
            '--use-partitioned-tables',
            action='store_true',
            help=
            ('If specified, use BigQuery\'s partitioned tables. By default, '
             'Logging creates dated tables based on the log entries\' '
             'timestamps, e.g. \'syslog_20170523\'. Partitioned tables remove '
             'the suffix and special query syntax '
             '(https://cloud.google.com/bigquery/docs/'
             'querying-partitioned-tables) must be used.'))

        parser.add_argument(
            '--clear-exclusions',
            action='store_true',
            help=('Remove all logging exclusions from the sink.'))
        parser.add_argument(
            '--remove-exclusions',
            type=arg_parsers.ArgList(),
            metavar='EXCLUSION ID',
            help=('Specify the name of the Logging exclusion(s) to delete.'))
        parser.add_argument(
            '--add-exclusion',
            action='append',
            type=arg_parsers.ArgDict(spec={
                'name': str,
                'filter': str,
                'description': str,
                'disabled': bool
            },
                                     required_keys=['name', 'filter']),
            help=
            ('Add an exclusion filter for log entries that are not to be '
             'routed to the sink\' destination. This flag can be repeated.\n\n'
             'The ``name\'\' and ``filter\'\' attributes are required. The '
             'following keys are accepted:\n\n'
             '*name*::: Required. An identifier, such as '
             '``load-balancer-exclusion\'\'. '
             'Identifiers are limited to 100 characters and can include only '
             'letters, digits, underscores, hyphens, and periods.\n\n'
             '*description*::: Optional. A description of this exclusion.\n\n'
             '*filter*::: Required. Entries that match this advanced log '
             'filter will be excluded. Filter cannot be empty.\n\n'
             '*disabled*::: Optional. By default, an exclusion is not '
             'disabled. To disable an exclusion, include this key and specify '
             'any value.\n\n'))

        parser.add_argument(
            '--update-exclusion',
            action='append',
            type=arg_parsers.ArgDict(spec={
                'name': str,
                'filter': str,
                'description': str,
                'disabled': bool
            },
                                     required_keys=['name']),
            help=
            ('Update an exclusion filter for a log entry that is not to be '
             'exported. This flag can be repeated.\n\n'
             'The ``name\'\' attribute is required. The '
             'following keys are accepted:\n\n'
             '*name*::: Required. An identifier, such as '
             '``load-balancer-exclusion\'\'. '
             'Identifiers are limited to 100 characters and can include only '
             'letters, digits, underscores, hyphens, and periods.\n\n'
             '*description*::: Optional. A description of this exclusion.\n\n'
             '*filter*::: Optional. Entries that match this advanced log '
             'filter will be excluded. Filter cannot be empty.\n\n'
             '*disabled*::: Optional. To disable an exclusion, include this '
             'key and specify any value. To enable a disabled exclusion, '
             'include this key, but do not specify any value. Do not include '
             'this key unless you want to change its value.\n\n'))

        parser.add_argument('--description', help='Description of the sink.')

        parser.add_argument(
            '--disabled',
            action='store_true',
            help=
            ('Disable the sink. Disabled sinks do not route logs to the sink '
             'destination. Specify --no-disabled to enable a disabled sink. '
             'If this flag is not specified, the value will not be updated.'))
    def Args(parser):
        """Register flags for this command."""
        parser.add_argument('sink_name', help='The name for the sink.')
        parser.add_argument('destination',
                            help='The destination for the sink.')
        parser.add_argument(
            '--log-filter',
            required=False,
            help=('A filter expression for the sink. If present, the filter '
                  'specifies which log entries to export.'))
        parser.add_argument(
            '--include-children',
            required=False,
            action='store_true',
            help=(
                'Whether to export logs from all child projects and folders. '
                'Only applies to sinks for organizations and folders.'))
        bigquery_group = parser.add_argument_group(
            help='Settings for sink exporting data to BigQuery.')
        bigquery_group.add_argument(
            '--use-partitioned-tables',
            required=False,
            action='store_true',
            help=
            ('If specified, use BigQuery\'s partitioned tables. By default, '
             'Logging creates dated tables based on the log entries\' '
             'timestamps, e.g. \'syslog_20170523\'. Partitioned tables remove '
             'the suffix and special query syntax '
             '(https://cloud.google.com/bigquery/docs/'
             'querying-partitioned-tables) must be used.'))

        parser.add_argument(
            '--exclusion',
            action='append',
            type=arg_parsers.ArgDict(spec={
                'name': str,
                'description': str,
                'filter': str,
                'disabled': bool
            },
                                     required_keys=['name', 'filter']),
            help=
            ('Specify an exclusion filter for a log entry that is not to be '
             'exported. This flag can be repeated.\n\n'
             'The ``name\'\' and ``filter\'\' attributes are required. The '
             'following keys are accepted:\n\n'
             '*name*::: An identifier, such as ``load-balancer-exclusion\'\'. '
             'Identifiers are limited to 100 characters and can include only '
             'letters, digits, underscores, hyphens, and periods.\n\n'
             '*description*::: A description of this exclusion.\n\n'
             '*filter*::: An advanced log filter that matches the log entries '
             'to be excluded.\n\n'
             '*disabled*::: If this exclusion should be disabled and not '
             'exclude the log entries.'))

        parser.add_argument('--description', help='Description of the sink.')

        parser.add_argument(
            '--disabled',
            action='store_true',
            help=('Sink will be disabled. Disabled sinks do not export logs.'))

        util.AddParentArgs(parser, 'Create a sink')
        parser.display_info.AddCacheUpdater(None)
Esempio n. 21
0
 def Args(parser):
     """Register flags for this command."""
     parser.add_argument('sink_name',
                         help='The name of the sink to describe.')
     util.AddParentArgs(parser, 'Describe a sink')
Esempio n. 22
0
 def Args(parser):
   """Register flags for this command."""
   parser.add_argument('sink_name', help='The name of the sink to delete.')
   util.AddParentArgs(parser, 'Delete a sink')
   parser.display_info.AddCacheUpdater(None)
Esempio n. 23
0
 def Args(parser):
   """Register flags for this command."""
   parser.add_argument('BUCKET_ID', help='The id of the bucket to describe.')
   util.AddParentArgs(parser, 'Describe a bucket')
   util.AddBucketLocationArg(parser, True, 'Location of the bucket.')
 def Args(parser):
     """Register flags for this command."""
     util.AddParentArgs(parser, 'Describe CMEK settings')
Esempio n. 25
0
 def Args(parser):
     """Register flags for this command."""
     parser.add_argument('LOCATION_ID',
                         help='Id of the location to describe.')
     util.AddParentArgs(parser, 'Describe a location')