Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
More renaming missed in the first pass
  • Loading branch information
jlmwise committed Jun 9, 2020
commit ea61701a51a99ef35f44db51a158f4f02b99a550
26 changes: 13 additions & 13 deletions dlp/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -339,26 +339,26 @@ To run this sample:
.. code-block:: bash

$ python deid.py
usage: deid.py [-h] {deid_mask,deid_fpe,reid_fpe,deid_date_shift,replace} ...
usage: deid.py [-h] {deid_mask,deid_fpe,reid_fpe,deid_date_shift,replace_with_infotype} ...

Uses of the Data Loss Prevention API for deidentifying sensitive data.

positional arguments:
{deid_mask,deid_fpe,reid_fpe,deid_date_shift,redact}
Select how to submit content to the API.
deid_mask Deidentify sensitive data in a string by masking it
with a character.
deid_fpe Deidentify sensitive data in a string using Format
Preserving Encryption (FPE).
reid_fpe Reidentify sensitive data in a string using Format
Preserving Encryption (FPE).
deid_date_shift Deidentify dates in a CSV file by pseudorandomly
shifting them.
redact Deidentify sensitive data in a string by replacing it with
the info type of the data.
Select how to submit content to the API.
deid_mask Deidentify sensitive data in a string by masking it
with a character.
deid_fpe Deidentify sensitive data in a string using Format
Preserving Encryption (FPE).
reid_fpe Reidentify sensitive data in a string using Format
Preserving Encryption (FPE).
deid_date_shift Deidentify dates in a CSV file by pseudorandomly
shifting them.
replace_with_infotype Deidentify sensitive data in a string by replacing it with
the info type of the data.

optional arguments:
-h, --help show this help message and exit
-h, --help show this help message and exit



Expand Down
16 changes: 8 additions & 8 deletions dlp/deid.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def write_data(data):
# [END dlp_deidentify_date_shift]


# [START dlp_deidentify_replace]
# [START dlp_deidentify_replace_infotype]
def deidentify_with_replace_infotype(project, item, info_types):
"""Uses the Data Loss Prevention API to deidentify sensitive data in a
string by replacing it with the info type.
Expand Down Expand Up @@ -487,7 +487,7 @@ def deidentify_with_replace_infotype(project, item, info_types):
print(response.item.value)


# [END dlp_deidentify_replace]
# [END dlp_deidentify_replace_infotype]


if __name__ == "__main__":
Expand Down Expand Up @@ -681,12 +681,12 @@ def deidentify_with_replace_infotype(project, item, info_types):
"key_name.",
)

replace_parser = subparsers.add_parser(
"replace",
replace_with_infotype_parser = subparsers.add_parser(
"replace_with_infotype",
help="Deidentify sensitive data in a string by replacing it with the "
"info type of the data."
)
replace_parser.add_argument(
replace_with_infotype_parser.add_argument(
"--info_types",
action="append",
help="Strings representing info types to look for. A full list of "
Expand All @@ -695,11 +695,11 @@ def deidentify_with_replace_infotype(project, item, info_types):
"If unspecified, the three above examples will be used.",
default=["FIRST_NAME", "LAST_NAME", "EMAIL_ADDRESS"],
)
replace_parser.add_argument(
replace_with_infotype_parser.add_argument(
"project",
help="The Google Cloud project id to use as a parent resource.",
)
replace_parser.add_argument(
replace_with_infotype_parser.add_argument(
"item",
help="The string to deidentify."
"Example: 'My credit card is 4242 4242 4242 4242'",
Expand Down Expand Up @@ -746,7 +746,7 @@ def deidentify_with_replace_infotype(project, item, info_types):
wrapped_key=args.wrapped_key,
key_name=args.key_name,
)
elif args.content == "replace":
elif args.content == "replace_with_infotype":
deidentify_with_replace_infotype(
args.project,
item=args.item,
Expand Down