Class CloudStorageRegexFileSet.Builder (3.47.0)

public static final class CloudStorageRegexFileSet.Builder extends GeneratedMessageV3.Builder<CloudStorageRegexFileSet.Builder> implements CloudStorageRegexFileSetOrBuilder

Message representing a set of files in a Cloud Storage bucket. Regular expressions are used to allow fine-grained control over which files in the bucket to include.

Included files are those that match at least one item in include_regex and do not match any items in exclude_regex. Note that a file that matches items from both lists will not be included. For a match to occur, the entire file path (i.e., everything in the url after the bucket name) must match the regular expression.

For example, given the input {bucket_name: "mybucket", include_regex: ["directory1/."], exclude_regex: ["directory1/excluded."]}:

  • gs://mybucket/directory1/myfile will be included
  • gs://mybucket/directory1/directory2/myfile will be included (.* matches across /)
  • gs://mybucket/directory0/directory1/myfile will not be included (the full path doesn't match any items in include_regex)
  • gs://mybucket/directory1/excludedfile will not be included (the path matches an item in exclude_regex)

    If include_regex is left empty, it will match all files by default (this is equivalent to setting include_regex: [".*"]).

    Some other common use cases:

  • {bucket_name: "mybucket", exclude_regex: [".*\.pdf"]} will include all files in mybucket except for .pdf files

  • {bucket_name: "mybucket", include_regex: ["directory/[^/]+"]} will include all files directly under gs://mybucket/directory/, without matching across /

Protobuf type google.privacy.dlp.v2.CloudStorageRegexFileSet

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addAllExcludeRegex(Iterable<String> values)

public CloudStorageRegexFileSet.Builder addAllExcludeRegex(Iterable<String> values)

A list of regular expressions matching file paths to exclude. All files in the bucket that match at least one of these regular expressions will be excluded from the scan.

Regular expressions use RE2 syntax; a guide can be found under the google/re2 repository on GitHub.

repeated string exclude_regex = 3;

Parameter
Name Description
values Iterable<String>

The excludeRegex to add.

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

addAllIncludeRegex(Iterable<String> values)

public CloudStorageRegexFileSet.Builder addAllIncludeRegex(Iterable<String> values)

A list of regular expressions matching file paths to include. All files in the bucket that match at least one of these regular expressions will be included in the set of files, except for those that also match an item in exclude_regex. Leaving this field empty will match all files by default (this is equivalent to including .* in the list).

Regular expressions use RE2 syntax; a guide can be found under the google/re2 repository on GitHub.

repeated string include_regex = 2;

Parameter
Name Description
values Iterable<String>

The includeRegex to add.

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

addExcludeRegex(String value)

public CloudStorageRegexFileSet.Builder addExcludeRegex(String value)

A list of regular expressions matching file paths to exclude. All files in the bucket that match at least one of these regular expressions will be excluded from the scan.

Regular expressions use RE2 syntax; a guide can be found under the google/re2 repository on GitHub.

repeated string exclude_regex = 3;

Parameter
Name Description
value String

The excludeRegex to add.

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

addExcludeRegexBytes(ByteString value)

public CloudStorageRegexFileSet.Builder addExcludeRegexBytes(ByteString value)

A list of regular expressions matching file paths to exclude. All files in the bucket that match at least one of these regular expressions will be excluded from the scan.

Regular expressions use RE2 syntax; a guide can be found under the google/re2 repository on GitHub.

repeated string exclude_regex = 3;

Parameter
Name Description
value ByteString

The bytes of the excludeRegex to add.

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

addIncludeRegex(String value)

public CloudStorageRegexFileSet.Builder addIncludeRegex(String value)

A list of regular expressions matching file paths to include. All files in the bucket that match at least one of these regular expressions will be included in the set of files, except for those that also match an item in exclude_regex. Leaving this field empty will match all files by default (this is equivalent to including .* in the list).

Regular expressions use RE2 syntax; a guide can be found under the google/re2 repository on GitHub.

repeated string include_regex = 2;

Parameter
Name Description
value String

The includeRegex to add.

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

addIncludeRegexBytes(ByteString value)

public CloudStorageRegexFileSet.Builder addIncludeRegexBytes(ByteString value)

A list of regular expressions matching file paths to include. All files in the bucket that match at least one of these regular expressions will be included in the set of files, except for those that also match an item in exclude_regex. Leaving this field empty will match all files by default (this is equivalent to including .* in the list).

Regular expressions use RE2 syntax; a guide can be found under the google/re2 repository on GitHub.

repeated string include_regex = 2;

Parameter
Name Description
value ByteString

The bytes of the includeRegex to add.

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public CloudStorageRegexFileSet.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
CloudStorageRegexFileSet.Builder
Overrides

build()

public CloudStorageRegexFileSet build()
Returns
Type Description
CloudStorageRegexFileSet

buildPartial()

public CloudStorageRegexFileSet buildPartial()
Returns
Type Description
CloudStorageRegexFileSet

clear()

public CloudStorageRegexFileSet.Builder clear()
Returns
Type Description
CloudStorageRegexFileSet.Builder
Overrides

clearBucketName()

public CloudStorageRegexFileSet.Builder clearBucketName()

The name of a Cloud Storage bucket. Required.

string bucket_name = 1;

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

clearExcludeRegex()

public CloudStorageRegexFileSet.Builder clearExcludeRegex()

A list of regular expressions matching file paths to exclude. All files in the bucket that match at least one of these regular expressions will be excluded from the scan.

Regular expressions use RE2 syntax; a guide can be found under the google/re2 repository on GitHub.

repeated string exclude_regex = 3;

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public CloudStorageRegexFileSet.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
CloudStorageRegexFileSet.Builder
Overrides

clearIncludeRegex()

public CloudStorageRegexFileSet.Builder clearIncludeRegex()

A list of regular expressions matching file paths to include. All files in the bucket that match at least one of these regular expressions will be included in the set of files, except for those that also match an item in exclude_regex. Leaving this field empty will match all files by default (this is equivalent to including .* in the list).

Regular expressions use RE2 syntax; a guide can be found under the google/re2 repository on GitHub.

repeated string include_regex = 2;

Returns
Type Description
CloudStorageRegexFileSet.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public CloudStorageRegexFileSet.Builder clearOneof(Descriptors.OneofDescriptor oneof)