Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLP: pick up fixes in GAPIC generator. #6495

Merged
merged 1 commit into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions dlp/google/cloud/dlp_v2/gapic/dlp_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=dlp_service_client_config.config,
client_config=None,
client_info=None):
"""Constructor.

Expand Down Expand Up @@ -210,13 +210,20 @@ def __init__(self,
your own client library.
"""
# Raise deprecation warnings for things we want to go away.
if client_config:
warnings.warn('The `client_config` argument is deprecated.',
PendingDeprecationWarning)
if client_config is not None:
warnings.warn(
'The `client_config` argument is deprecated.',
PendingDeprecationWarning,
stacklevel=2)
else:
client_config = dlp_service_client_config.config

if channel:
warnings.warn(
'The `channel` argument is deprecated; use '
'`transport` instead.', PendingDeprecationWarning)
'`transport` instead.',
PendingDeprecationWarning,
stacklevel=2)

# Instantiate the transport.
# The transport is responsible for handling serialization and
Expand Down
186 changes: 81 additions & 105 deletions dlp/google/cloud/dlp_v2/gapic/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,70 +18,6 @@
import enum


class Likelihood(enum.IntEnum):
"""
Categorization of results based on how likely they are to represent a match,
based on the number of elements they contain which imply a match.

Attributes:
LIKELIHOOD_UNSPECIFIED (int): Default value; same as POSSIBLE.
VERY_UNLIKELY (int): Few matching elements.
UNLIKELY (int)
POSSIBLE (int): Some matching elements.
LIKELY (int)
VERY_LIKELY (int): Many matching elements.
"""
LIKELIHOOD_UNSPECIFIED = 0
VERY_UNLIKELY = 1
UNLIKELY = 2
POSSIBLE = 3
LIKELY = 4
VERY_LIKELY = 5


class FileType(enum.IntEnum):
"""
Definitions of file type groups to scan.

Attributes:
FILE_TYPE_UNSPECIFIED (int): Includes all files.
BINARY_FILE (int): Includes all file extensions not covered by text file types.
TEXT_FILE (int): Included file extensions:
asc, brf, c, cc, cpp, csv, cxx, c++, cs, css, dart, eml, go, h, hh, hpp,
hxx, h++, hs, html, htm, shtml, shtm, xhtml, lhs, ini, java, js, json,
ocaml, md, mkd, markdown, m, ml, mli, pl, pm, php, phtml, pht, py, pyw,
rb, rbw, rs, rc, scala, sh, sql, tex, txt, text, tsv, vcard, vcs, wml,
xml, xsl, xsd, yml, yaml.
"""
FILE_TYPE_UNSPECIFIED = 0
BINARY_FILE = 1
TEXT_FILE = 2


class DayOfWeek(enum.IntEnum):
"""
Represents a day of week.

Attributes:
DAY_OF_WEEK_UNSPECIFIED (int): The unspecified day-of-week.
MONDAY (int): The day-of-week of Monday.
TUESDAY (int): The day-of-week of Tuesday.
WEDNESDAY (int): The day-of-week of Wednesday.
THURSDAY (int): The day-of-week of Thursday.
FRIDAY (int): The day-of-week of Friday.
SATURDAY (int): The day-of-week of Saturday.
SUNDAY (int): The day-of-week of Sunday.
"""
DAY_OF_WEEK_UNSPECIFIED = 0
MONDAY = 1
TUESDAY = 2
WEDNESDAY = 3
THURSDAY = 4
FRIDAY = 5
SATURDAY = 6
SUNDAY = 7


class ContentOption(enum.IntEnum):
"""
Options describing which parts of the provided content should be scanned.
Expand Down Expand Up @@ -199,51 +135,44 @@ class StoredInfoTypeState(enum.IntEnum):
INVALID = 4


class CustomInfoType(object):
class ExclusionType(enum.IntEnum):
"""
Attributes:
EXCLUSION_TYPE_UNSPECIFIED (int): A finding of this custom info type will not be excluded from results.
EXCLUSION_TYPE_EXCLUDE (int): A finding of this custom info type will be excluded from final results,
but can still affect rule execution.
"""
EXCLUSION_TYPE_UNSPECIFIED = 0
EXCLUSION_TYPE_EXCLUDE = 1


class CloudStorageOptions(object):
class SampleMethod(enum.IntEnum):
"""
How to sample bytes if not all bytes are scanned. Meaningful only when
used in conjunction with bytes\_limit\_per\_file. If not specified,
scanning would start from the top.
class Likelihood(enum.IntEnum):
"""
Categorization of results based on how likely they are to represent a match,
based on the number of elements they contain which imply a match.

Attributes:
SAMPLE_METHOD_UNSPECIFIED (int)
TOP (int): Scan from the top (default).
RANDOM_START (int): For each file larger than bytes\_limit\_per\_file, randomly pick the
offset to start scanning. The scanned bytes are contiguous.
"""
SAMPLE_METHOD_UNSPECIFIED = 0
TOP = 1
RANDOM_START = 2
Attributes:
LIKELIHOOD_UNSPECIFIED (int): Default value; same as POSSIBLE.
VERY_UNLIKELY (int): Few matching elements.
UNLIKELY (int)
POSSIBLE (int): Some matching elements.
LIKELY (int)
VERY_LIKELY (int): Many matching elements.
"""
LIKELIHOOD_UNSPECIFIED = 0
VERY_UNLIKELY = 1
UNLIKELY = 2
POSSIBLE = 3
LIKELY = 4
VERY_LIKELY = 5


class BigQueryOptions(object):
class SampleMethod(enum.IntEnum):
"""
How to sample rows if not all rows are scanned. Meaningful only when
used in conjunction with rows\_limit. If not specified, scanning would
start from the top.
class FileType(enum.IntEnum):
"""
Definitions of file type groups to scan.

Attributes:
SAMPLE_METHOD_UNSPECIFIED (int)
TOP (int): Scan from the top (default).
RANDOM_START (int): Randomly pick the row to start scanning. The scanned rows are contiguous.
"""
SAMPLE_METHOD_UNSPECIFIED = 0
TOP = 1
RANDOM_START = 2
Attributes:
FILE_TYPE_UNSPECIFIED (int): Includes all files.
BINARY_FILE (int): Includes all file extensions not covered by text file types.
TEXT_FILE (int): Included file extensions:
asc, brf, c, cc, cpp, csv, cxx, c++, cs, css, dart, eml, go, h, hh, hpp,
hxx, h++, hs, html, htm, shtml, shtm, xhtml, lhs, ini, java, js, json,
ocaml, md, mkd, markdown, m, ml, mli, pl, pm, php, phtml, pht, py, pyw,
rb, rbw, rs, rc, scala, sh, sql, tex, txt, text, tsv, vcard, vcs, wml,
xml, xsl, xsd, yml, yaml.
"""
FILE_TYPE_UNSPECIFIED = 0
BINARY_FILE = 1
TEXT_FILE = 2


class ByteContentItem(object):
Expand Down Expand Up @@ -414,3 +343,50 @@ class JobState(enum.IntEnum):
DONE = 3
CANCELED = 4
FAILED = 5


class CustomInfoType(object):
class ExclusionType(enum.IntEnum):
"""
Attributes:
EXCLUSION_TYPE_UNSPECIFIED (int): A finding of this custom info type will not be excluded from results.
EXCLUSION_TYPE_EXCLUDE (int): A finding of this custom info type will be excluded from final results,
but can still affect rule execution.
"""
EXCLUSION_TYPE_UNSPECIFIED = 0
EXCLUSION_TYPE_EXCLUDE = 1


class CloudStorageOptions(object):
class SampleMethod(enum.IntEnum):
"""
How to sample bytes if not all bytes are scanned. Meaningful only when
used in conjunction with bytes\_limit\_per\_file. If not specified,
scanning would start from the top.

Attributes:
SAMPLE_METHOD_UNSPECIFIED (int)
TOP (int): Scan from the top (default).
RANDOM_START (int): For each file larger than bytes\_limit\_per\_file, randomly pick the
offset to start scanning. The scanned bytes are contiguous.
"""
SAMPLE_METHOD_UNSPECIFIED = 0
TOP = 1
RANDOM_START = 2


class BigQueryOptions(object):
class SampleMethod(enum.IntEnum):
"""
How to sample rows if not all rows are scanned. Meaningful only when
used in conjunction with rows\_limit. If not specified, scanning would
start from the top.

Attributes:
SAMPLE_METHOD_UNSPECIFIED (int)
TOP (int): Scan from the top (default).
RANDOM_START (int): Randomly pick the row to start scanning. The scanned rows are contiguous.
"""
SAMPLE_METHOD_UNSPECIFIED = 0
TOP = 1
RANDOM_START = 2
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def __init__(self,
credentials=credentials,
)

self._channel = channel

# gRPC uses objects called "stubs" that are bound to the
# channel and provide a basic method for each RPC.
self._stubs = {
Expand Down Expand Up @@ -90,6 +92,15 @@ def create_channel(cls, address='dlp.googleapis.com:443',
scopes=cls._OAUTH_SCOPES,
)

@property
def channel(self):
"""The gRPC channel used by the transport.

Returns:
grpc.Channel: A gRPC channel object.
"""
return self._channel

@property
def inspect_content(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Loading